Select to view content in your preferred language

Fail safe access to packages by using the API?

2973
1
Jump to solution
04-09-2012 02:48 PM
Jan-Tschada
Esri Contributor
We are developing a simple ArcGIS Runtime file explorer application. For this kind of scenario it would be very helpful if the API is offering some "fail safe" method determining whether or not a file is a valid  map/tile/locator- package. Right now, we are just doin a plain string comparison using the file extension (see below). It would be really nice to have the same functionality like IMapDocument.isMapDocument(String) from ArcObjects e.g. PackageUtils.isMapPackage(File), PackageUtils.isTilePackage(File), PackageUtils.isLocatorPackage(File). The method shown below is called by the label provider of the tree viewer whenever a node should be populated. The "fail safe" method should be fast, otherwise the UI could become unresponsive.

File explorer application:
[ATTACH=CONFIG]13357[/ATTACH]

 /**   * Determines whether or not the specified element represents a map package.   *    * @param element   *            the element to validate   * @return <code>true</code> only when this element represents a map package and has the type of {@link File}.   */  public static boolean isMapPackage(Object element) {   if (element instanceof File) {    return ((File) element).getName().endsWith(".mpk");   }   return false;  }


Is there any method providing this kind of "fail safe" access to packages?

Thanks in advance.
Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos
1 Solution

Accepted Solutions
RalfGottschalk
Esri Contributor
Hi Jan,

This is good feedback.  There is no way currently through the API to determine if something is a valid package or not, outside of attempting to load it, and then checking for and handling an error in the start complete event.  We will look into this.

View solution in original post

0 Kudos
1 Reply
RalfGottschalk
Esri Contributor
Hi Jan,

This is good feedback.  There is no way currently through the API to determine if something is a valid package or not, outside of attempting to load it, and then checking for and handling an error in the start complete event.  We will look into this.
0 Kudos