FAQ: What major changes are required to upgrade MapObjects-Java 1.x applications to MapObjects-Java 2.x?


What major changes are required to upgrade MapObjects-Java 1.x applications to MapObjects-Java 2.x?


Applications developed with MapObjects—Java 1.x will require some changes to correctly function with MapObjects—Java 2.x JAR files.

The most important step is to change the package names in applications from "mo" to "mo2". The 'RenameMo' utility included under the MOJ20/Utilities folder is provided exactly for this purpose. Reference the "ReadMe.txt" file in the aforementioned directory for instructions on use.

Other major changes are as follows:

Package com.esri.mo2.map.dpy:

· SearchableLayer—This interface has been removed. The com.esri.mo2.map.dpy FeatureLayer should now implement the searchable interface of the com.esri.mo2.data.feat package instead to directly search data.

Package com.esri.mo2.ui.tb:

· BaseToolBar—The getSelectedLayer method has been removed and replaced with a getSelectedLayers method. This method returns an array of com.esri.mo2.dpy.Layer objects instead of a single layer.

Toolbar changes:

· A change related to the fields in com.esri.mo2.ui.tb.ZoomPanToolBar and com.esri.mo2.ui.tb.SelectionToolBar has been introduced at 2.0. At version 1.x, one could directly refer to the individual tools as fields of these classes to customize the toolbars. Now the classes com.esri.mo2.ui.tb.ZoomPanToolBarActions and com.esri.mo2.ui.tb.SelectionToolBarActions exist for this purpose. Refer to the JavaDoc for more details.

Icon changes:

· The structure of the various icons has been slightly changed. Custom tools using the icons from com.esri.mo2.util.Resource may not work using 1.x references. A new utility has been included in the MOJ20/Utilities/IconViewer folder to show the package structure of the icons and usage instructions. Refer to this folder for further details.

LayerSource deprecations and the new Content API

· Several classes were deprecated in relation to the old LayerSource API.

<b>Package com.esri.mo2.client.aims</b>
· FeatureServer and ImageServer

<b>Package com.esri.mo2.client.sde</b>

<b>Package com.esri.mo2.file.shp </b>
· DbfWorkspace and ShapefileFolder

<b>Package com.esri.mo2.map.dpy</b>
· Layerinfo, LayerSource, and WorkSpaceLayerSource
· BaseLayerinfo, BaseLayerSource, and BaseWorkSpaceLayerSource

<b>Package com.esri.mo2.map.img</b>
· ImageLayerSource, BaseImageDirectory, BaseImageLayerSource, and ImageDirectoryFolder

<b>Package com.esri.mo2.map.mem</b>
· MemoryLayerSource

They have been replaced with the new Content API that defines a framework for accessing GIS objects from diverse data sources. These GIS objects include Layer, FeatureClass, ImageClass, Geocoder, and (nonspatial) Table.

The advantage of the Content API is that it uses the same series of steps to get GIS objects, regardless of the connection type (input) or the objects accessed (output). These steps focus on creating and managing connections to the data sources. Refer to the com.esri.mo2.src.sys package description for more details regarding the Content API.

Other important deprecated classes by package:

<b>Package com.esri.mo2.client.io </b>
· AuthHttpURLHandler—Use com.esri.mo2.client.io.Authenticator instead.
· Login.

<b>Package com.esri.mo2.data.feat</b>
· Fields—getNumFields method has been deprecated; use size method instead.

<b>Package com.esri.mo2.map.draw</b>
· SimpleFillSymbol—Use com.esri.mo2.map.draw.SimplePolygonSymbol instead.
· TextmarkerSymbol—Use com.esri.mo2.map.draw.SimpleTextSymbol instead.

<b>Package com.esri.mo2.ui.bean</b>
· Layerhandler—Consult the classes in the com.esri.mo2.ui.cat package.
· ArcIMSLayerChooser—Replaced by com.esri.mo2.ui.src.ContentChooser.
· CustomDatasetEditor—Replaced by com.esri.mo2.ui.src.ContentChooser.