/*********************************************************************** Copyright © 2006 ESRI All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions. You may freely redistribute and use this sample code, with or without modification, provided you include the original copyright notice and use restrictions. Disclaimer: THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESRI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, 92373 USA email: contracts@esri.com ***********************************************************************/ /************************************************************************* This Java sample demonstrates usage of ArcSDE API for Geocoding. It will not execute successfully until the user supplies valid ArcSDE Server details such as server name, port number, database name, user, pwd, and valid data, if required. **************************************************************************/ package com.esri.sde.devhelp.geocoding; import com.esri.sde.sdk.client.*; import com.esri.sde.devhelp.geocoding.locatorUtil; public class DescribeLocatorInputAndOutput { public static void main(String[] args) { System.out.println("Connecting to SDE..."); //**Warning: please modify appropriately to suit your application ** String server = "", dbName = "", user = "", pwd = ""; int portNum = 0; // Connect to SDE try { SeConnection conn = new SeConnection(server, portNum, dbName, user, pwd); //**Warning: please modify appropriately to suit your application ** String ssaName = "locssa"; //**Warning: please modify appropriately to suit your application ** String locName = "RedlandsStreets"; SeLocator locator = new SeLocator(conn, locName); printLocatorInputs(locator); System.out.println(""); printLocatorOutputs(locator); conn.close(); System.out.println("Connection closed."); } catch(SeException e) { SeError err = e.getSeError(); System.out.println("Error # : " + err.getSdeError() + " --> " + err.getErrDesc()); System.out.println("Extended Error # : " + err.getExtError() + " --> " + err.getExtErrMsg()); e.printStackTrace(); } } static void printLocatorInputs(SeLocator loc) throws SeException { System.out.println(locatorUtil.formatStringSize("\nInput fields", 32, '.')); String[] inputFields = loc.getInputFields(); String[] inputFieldAliases = loc.getInputFieldAliases(); boolean[] inputFieldsRequired = loc.getInputFieldRequiredIndicators(); int[] sizes = loc.getInputFieldSizes(); String req = ""; //**Warning: please modify to suit your application ** System.out.println(locatorUtil.formatStringSize("*Name*",20,' ') + locatorUtil.formatStringSize("*Required*",20,' ') + locatorUtil.formatStringSize("*Size*",20,' ') + locatorUtil.formatStringSize("*Alias*",20,' ') ); for (int i = 0; i < inputFields.length; i++) { if (inputFieldsRequired[i]) req = "true"; else req = "false"; //**Warning: please modify appropriately to suit your application ** System.out.println(locatorUtil.formatStringSize(inputFields[i],20,' ') + locatorUtil.formatStringSize(req,20,' ') + locatorUtil.formatStringSize(new Integer(sizes[i]).toString(),20,' ') + locatorUtil.formatStringSize(inputFieldAliases[i],20,' ') ); } } static void printLocatorOutputs(SeLocator loc) throws SeException { //**Warning: please modify appropriately to suit your application ** System.out.println(locatorUtil.formatStringSize("\nOutput fields", 32, '.')); locatorUtil.printSeColumnDefinitionArr(loc.describeOutput()); } }