Length Calculator Server Object Extension


Purpose
This Server Object Extension calculates lengths of all street (polyline) features in the associated map service and can be accessed by a client application through DCOM.

How to use

See How to use ArcGIS samples for help on running the sample.

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/portland/portland.mxd and <Your ArcGIS Developer Kit Install directory>/Samples/data/portland/portland.gdb.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

How to deploy LengthCalculator SOE to ArcGIS Server?
  1. Copy LengthCalculator_DCOMExt.jar file that holds this SOE, from the $AGSDEVKITJAVA/java/samples/arcobjects/serverobjectextensions/lengthcalculator_dcom/lib folder to $AGSSERVERJAVA/java/lib/ext folder.
  2. Alternatively, if you open this sample's Eclipse project in Eclipse IDE, you can export all .java files in arcgissamples.soe package to a jar file and save the jar file to the $AGSSERVERJAVA/java/lib/ext folder.
  3. Log into ArcGIS Manager. Navigate to "Manager Extensions" page in "GIS Server" section.
  4. Refresh this page. If the jar file containing LengthCalculator SOE does exist in $AGSSERVERJAVA/java/lib/ext folder, then ArcGIS Manager will display a record for this SOE on this page.
  5. Click on "Register" link next to the LengthCalculator SOE.
  6. The LengthCalculator SOE is now registered as extension to all Map Services.

How to enable LengthCalculator SOE with particular instance of Map service?
  1. Publish a map document as map service using ArcGIS Manager or ArcCatalog's "Publish GIS Resource" or "Add New Service" wizards.
  2. Create the map service using the "portland" map document from $AGSDEVKITJAVA/java/samples/data/mxds folder. The LengthCalculator SOE sample is designed to extend a map service that’s based on this portland map document only. We'll call this map service "portland".
  3. On the "Capabilities" page of "Publish GIS Resource" or "Add New Service" wizards, select the capability that matches with LengthCalculator SOE. Ensure that the check box next to the capability is checked. If there is no capability that matches with "LengthCalculator", please check if previous SOE deployment and registration step was executed correctly.
  4. If the SOE has capabilities of its own, please select the appropriate ones.
  5. Complete the publishing process and restart map service if necessary.
  6. Ensure that map service shows LengthCalculator SOE as a capability after it is started, in ArcCatalog or ArcGIS Manager.

Consume SOE in Java console application
  1. Execute the client/LengthCalculatorClient.java application. This application requires server name, user name and password as command line arguments.
  2. Check the output messages of the application. This application connects to the server, creates a Map Serve context, obtains a reference to the SOE and calls the calculateLength() method to calculate length of all streets in map service's layer and prints result of the calculateLength() method.

How to disable LengthCalculator SOE with "portland" Map service?
  1. Use ArcGIS Manager or ArcCatalog to access "portland" map service's properties.
  2. On "Capabilities" page, uncheck the check box next to LengthCalculatorSOE Capability.
  3. Save the map service and restart it if necessary.
  4. The LengthCalculator SOE is now disabled on the "portland" map service.

How to un-deploy LengthCalculator SOE?
  1. Log into ArcGIS Manager. Navigate to "Manager Extensions" page in "GIS Server" section.
  2. Click "UnRegister" link next to LengthCalculatorSOE.
  3. The LengthCalculator SOE is now unregistered from ArcGIS Server.
  4. Remove the SOE's jar file from $AGSSERVERJAVA/java/lib/ext folder.


Download the files for Java
soe/LengthCalculatorSOE.java Java Server Object Extension (SOE)
soe/ICalculateLength.java A custom interface that exposes the calculateLength() method. The above SOE implements this method, which calculates length of all street features in the associated map service's layer
soe/client/LengthCalculatorClient.java A client application that consumes the SOE through local connection.




Development licensing Deployment licensing
Server Server