This section provides a step-by-step guide on creating, building, and deploying a Service Interceptor using a Java IDE, such as IntelliJ IDEA, Eclipse or Maven command, with Maven and the ArcGIS Enterprise SDK. This example demonstrates how to use the provided Maven archetype to generate a boilerplate project, customize it, and deploy it to ArcGIS Server. The service interceptor you create in this walkthrough is also available as a sample named AuditLogInterceptor which can be found under the Samples section.
Create the service interceptor project in Maven
Executing the Maven archetype command against server-services-interceptor-archetype in either interactive mode or non-interactive mode can create a service interceptor project. Interactive mode requires you to type every property one by one in the command line as the input to create the project, whereas in non-interactive mode, you can define those properties all at once when executing the archetype command, and the project is created instantly without command line interaction.
Use the Maven command in interactive mode
You can open the command prompt for Windows or Linux terminal and use the following Maven command to create a Service Interceptor project in interactive mode:
mvn archetype:generate -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=server-services-interceptor-archetype -DarchetypeVersion=12.0.0For other versions of Enterprise SDK, remember to change - to the corresponding version of the SDK, such as - for 11.5 Enterprise SDK and - for 11.4 Enterprise SDK.
You need to specify the same version of the SDK you are using as the - parameter.
After executing the above command, you are prompted to enter values for the following properties:
- interceptorName: Type
Audit.Log Interceptor - groupId: Type
entsdksamples.interceptoras the base package name. - artifactId: Type
Auditas the project's name.Log Interceptor - version: Press enter to skip this property. This uses the default value
1.0-, indicating this project is still in development.SNAPSHOT - package: Press enter to skip this property. This uses the groupId's value as the package name.
- Y: Type
Yto confirm your inputs.
The Service Interceptor project is created successfully with Build Success in the command prompt.
Use the Maven command in non-interactive mode
If you would like to create the Service Interceptor project without interactivity, you can set the interactive property to false (-), or use the - flag (see generate project in batch mode).
The following command will achieve the same result as the project above created in interactive mode:
mvn archetype:generate -B -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=server-services-interceptor-archetype -DarchetypeVersion=12.0.0 -DsoeName=simpleAuditLogging -DgroupId=entsdksamples.interceptor -DartifactId=simpleAuditLogging -Dversion=1.0-SNAPSHOTFor other versions of Enterprise SDK, remember to change - to the corresponding version of the SDK, such as - for 11.5 Enterprise SDK and - for 11.4 Enterprise SDK.
The Service Interceptor project is created successfully with Build Success in the command prompt.
Build the service interceptors project
To cleanly build this project, use the cd command to switch to the project's base directory and execute the mvn clean install command. To learn more about project build phases, see the Project build section.
Deploy the service interceptor in ArcGIS Server
To deploy the service interceptor in ArcGIS Server, first upload the interceptor and then register the interceptor.