This topic introduces the interfaces, annotations, and development resources used to build Java server object extensions (SOEs) with the ArcGIS Enterprise SDK.
Developing SOEs
A Java SOE implements the com.esri.arcgis.server. interface. ArcGIS Server uses this interface to manage the extension's lifecycle.
This interface is mandatory for SOEs, and includes two methods: init() and shutdown(). This interface is used by the server object to manage the lifetime of the SOE. The server object creates the SOE and calls the init() method, handing it back a reference to the server object via the ServerObjectHelper argument. The ServerObjectHelper implements a weak reference, one that is not protected from the garbage collector, on the server object. The extension can keep a strong reference on the server object helper (for example, in a member variable), but this is not recommended as a strong reference can cause unnecessary objects to remain in memory and hinder performance. An extension should get the server object from the server object helper in order to make any method calls on the server object, then release the reference after making the method calls.
The init() method is called once, when the instance of the SOE is created. Like the init() method, the shutdown() method is called only once and informs the SOE that the server object's context is being shut down and is about to go away. In response, the SOE should release its reference on the server object helper. Any log entries are merely informative and are optional. For information about SOE logging, see the log messages topic.
@ ArcGIS Extension
The @ annotation identifies a class or supported interface as an ArcGIS extension. Add it to the SOE class so ArcGIS Server can discover the extension during registration.
@ Server Object Ext Properties
The @ annotation specifies an SOE's display information, configuration properties, capabilities, service type, and shared-instance support.
| Attribute | Description |
|---|---|
display | Specifies the name displayed to administrators when managing or enabling the SOE. |
description | Provides an administrator-facing description of the SOE. |
properties | Defines configurable name=value properties that administrators can set for the extension. |
all | Defines the capabilities exposed by the SOE. |
default | Specifies the capabilities enabled by default. |
servicetype | Specifies the service type with which the SOE can be enabled: " for a map service or " for an image service. |
supports | Indicates whether the SOE supports services configured to use shared instances. Set this to true only after implementing and validating shared-instance requirements. |
The servicetype value must match the service type targeted by the SOE. A map-service SOE uses "; an image-service SOE uses ".
The following snippet illustrates the extension annotations and lifecycle methods. It is a structural example, not a complete REST or SOAP SOE. To expose operations, implement the appropriate request handler as described in the sections below.
@ArcGISExtension
@ServerObjectExtProperties(
displayName = "Sample Java SOE",
description = "Illustrates SOE annotations and lifecycle methods.",
properties = {"sampleProperty=sampleValue"},
allSOAPCapabilities = "",
defaultSOAPCapabilities = "",
servicetype = "MapService",
supportsSharedInstances = false
)
public class SampleSOE implements IServerObjectExtension {
private IServerObjectHelper serverObjectHelper;
@Override
public void init(IServerObjectHelper helper)
throws IOException, AutomationException {
this.serverObjectHelper = helper;
}
@Override
public void shutdown() throws IOException, AutomationException {
this.serverObjectHelper = null;
}
}The example assumes the appropriate ArcGIS Enterprise SDK and Java imports are available in the project. If the SOE targets an image service, change servicetype to " and implement operations appropriate for that service type. For information about configuration properties, see SOE properties.
Interfaces and classes
In addition to I, an SOE can implement other interfaces to support configuration, object activation, and REST or SOAP operations.
com.esri.arcgis.system.IObjectConstruct
This interface is optional and needs to be implemented only if the SOE requires extra initialization such as initializing properties with values defined by a server administrator in ArcGIS Server Manager. The interface includes a single method called construct(), which is called only once when the SOE is created, after I is called. For SOEs that have properties, construct() hands back the configuration properties for the SOE as a property set.
com.esri.arcgis.system.IObjectActivate
The I interface is optional (that is, its implementation is not required unless your SOE requires special logic to execute before and after servicing a request). It includes two methods:
activate()— Called each time a client makes a request to the SOE, via SOAP or RESTdeactivate()— Called each time a client gets and releases the server object's context.
Any logic you implement in these methods should not be expensive. Keep the logic in these methods lightweight. Do not assume that each activation or deactivation corresponds to a unique incoming HTTP request.
com.esri.arcgis.server.SOAPRequestHandler
If you plan on exposing your Java SOE as a SOAP-based web service, your SOE class must then extend the SOAP base class. Extending this base class is not required if you are creating a REST SOE. This base class defines a handle method that’s exposed by the I interface. This method takes in SOAP requests, invokes the appropriate business method from the SOE class, generates a SOAP response, and returns it to the client application, thus relieving you of the burden of handling SOAP requests and responses and allowing you to focus on your SOE’s business logic development. This is discussed in more detail in the develop SOAP SOEs topic.
com.esri.arcgis.system.IRESTRequestHandler
If you plan on exposing your Java SOE as a RESTful Web Service, you must implement the IREST interface. The interface provides two methods:
handle— Called once for each HTTP request to the SOE.REST Request() get— Called by the ArcGIS REST handler to interrogate the SOE for its resource and operations hierarchy at runtime.Schema()
If you're using the Eclipse SOE creation wizard, these methods are automatically generated, thereby allowing you to focus on your implementation of sub-resource and operation methods. This is discussed in more detail in the develop REST SOEs topic.
Java SOE development resources
The ArcGIS Enterprise SDK is installed separately from ArcGIS Server. For Java development, the SDK provides samples, documentation, Maven archetypes, dependencies, and build tools.
Install the SDK's Maven artifacts into your local Maven repository before creating a project. The following archetypes are available for SOE development:
| Archetype | Purpose |
|---|---|
rest-soe-archetype | Creates a project for a REST SOE. |
soap-soe-archetype | Creates a project for a SOAP SOE. |
rest-soap-soe-archetype | Creates a project supporting both REST and SOAP operations. |
Use the archetype version that matches the installed ArcGIS Enterprise SDK. For details, see Overview of Maven integration and Install the Maven artifacts.