Package com.esri.arcgisws

Examples of com.esri.arcgisws.MapServerInfo


      new MapServerBindingStub(serviceInfo.getSoapUrl()):
      new MapServerBindingStub(serviceInfo.getSoapUrl(), getCredentials().getUsername(), getCredentials().getPassword());
    serviceInfo.getKeywords().add(serviceInfo.getType());
    serviceInfo.addKeywords("liveData,service",",");
   
    MapServerInfo mapInfo = stub.getServerInfo(stub.getDefaultMapName());
   
    //serviceInfo.setName(mapInfo.getName());
    serviceInfo.setDescription(mapInfo.getDescription());
    serviceInfo.setEnvelope(mapInfo.getFullExtent());
    //serviceInfo.setEnvelope(mapInfo.getExtent());
   
    /*
    System.err.println("nm="+mapInfo.getDefaultMapDescription().getName());
    System.err.println("ld="+mapInfo.getDefaultMapDescription().getLayerDescriptions());
    System.err.println("     getDefaultMapName()="+service.getDefaultMapName());
    System.err.println("     getCopyrightText()="+mapinfo.getCopyrightText());
    System.err.println("     getMapLayerInfos()="+mapinfo.getMapLayerInfos());
    System.err.println("     getSpatialReference()="+mapinfo.getSpatialReference());
    System.err.println("     getDefaultMapDescription()="+mapinfo.getDefaultMapDescription());
     */
   
    // thumbnail
    String thumbnailUrl = Val.chkStr(serviceInfo.getRestUrl());
    if (thumbnailUrl.length() > 0) {
      if (!thumbnailUrl.endsWith("/MapServer")) {
        int idx = thumbnailUrl.lastIndexOf("/MapServer/");
        if (idx != -1) {
          thumbnailUrl = thumbnailUrl.substring(0,idx+10);
        }
      }
      if (thumbnailUrl.endsWith("/MapServer")) {
        serviceInfo.setThumbnailUrl(thumbnailUrl+"/export?size=256,256&f=image");
      }
    }
   
   
   
    // MXD properties
    PropertySet docInfo = stub.getDocumentInfo();
    if (docInfo != null) {
      PropertySetProperty[] psps = docInfo.getPropertyArray();
      if (psps != null) {
        for (PropertySetProperty psp: psps) {
          String key = Val.chkStr(psp.getKey());
          String value = "";
          Object oVal = psp.getValue();
          if ((oVal != null) && (oVal instanceof String)) {
            value = Val.chkStr((String)oVal);
          }
          if ((key.length() > 0) && (value.length() > 0)) {
            //System.err.println(key+"=="+value);
           
            if (key.equalsIgnoreCase("Title")) {
              serviceInfo.setName(value);
            } else if (key.equalsIgnoreCase("Author")) {
              serviceInfo.setCreator(value);
            } else if (key.equalsIgnoreCase("Comments")) {
              serviceInfo.addRDFPair("mxd.comments",value);
            } else if (key.equalsIgnoreCase("Subject")) {
              serviceInfo.addRDFPair("mxd.subject",value);
            } else if (key.equalsIgnoreCase("Category")) {
              serviceInfo.addRDFPair("mxd.category",value);
            } else if (key.equalsIgnoreCase("Keywords")) {
              serviceInfo.addKeywords(value,",");
            } else {
            }
            
          }
        }
      }
    }
   
    // layers
    MapLayerInfo[] layers = mapInfo.getMapLayerInfos();
    if (layers != null) {
      for (MapLayerInfo layer: layers) {
        serviceInfo.addRDFPair("service.layername",layer.getName());
        /*
        System.err.println("layerName="+layer.getName());
View Full Code Here


    try {
      MapServerBindingStub stub =
        getCredentials()==null || getCredentials().getUsername().length()==0 || getCredentials().getPassword().length()==0?
        new MapServerBindingStub(serviceInfo.getSoapUrl()):
        new MapServerBindingStub(serviceInfo.getSoapUrl(), getCredentials().getUsername(), getCredentials().getPassword());
      MapServerInfo mapInfo = stub.getServerInfo(stub.getDefaultMapName());
      serviceInfo.setEnvelope(mapInfo.getFullExtent());
     
      MapLayerInfo[] mapLayerInfos = mapInfo.getMapLayerInfos();
      for (MapLayerInfo li: mapLayerInfos) {
        if (!li.isIsFeatureLayer()) continue;
        String name = Integer.toString(li.getLayerID());
        String title = li.getName();
        serviceInfo.getLayersInfo().add(new ServiceInfo.LayerInfo(name, title));
      }
     
      String copyrightText = mapInfo.getCopyrightText();
      serviceInfo.setCopyright(copyrightText);
     
    } catch (ArcGISWebServiceException ex) {
      LOGGER.log(Level.FINE, "Error getting MapServerInfo.", ex);
    }
View Full Code Here

TOP

Related Classes of com.esri.arcgisws.MapServerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.