Examples of AgpConnection


Examples of com.esri.gpt.agp.client.AgpConnection

  protected void addDataPart(MultipartProvider provider,
      AgpSource source, AgpItem sourceItem,
      AgpDestination destination, AgpItem destItem)
    throws Exception {
   
    AgpConnection con = source.getConnection();
    String sId = sourceItem.getProperties().getValue("id");
    String sUrl = con.makeSharingUrl()+"/content/items";
    sUrl += "/"+AgpUtil.encodeURIComponent(sId);
    sUrl += "/data";
   
    // this is probably not necessary, -1 seems to work,
    // search?q= results return size=-1,
    // you need an items/[id] request to get the actual size
    String sDataSize = sourceItem.getProperties().getValue("size");
    long nDataSize = -1;
    try {
      nDataSize = Long.valueOf(sDataSize);
    } catch (NumberFormatException nfe) {
      nDataSize = -1;
      nfe.printStackTrace(System.err);
    }
    //System.err.println("nnnnDataSize="+nDataSize);
    String sFileName = null;
    String sPartName = "text"; // TODO is this correct?
    String sItem = sourceItem.getProperties().get("item").getValue();
    String sItemType = sourceItem.getProperties().getValue("itemType");
    String sType = sourceItem.getProperties().getValue("type");
   
    if ((sItemType != null) && sItemType.equals("file")) {
      sPartName = "file";
      sFileName = sItem; // TODO is this correct?
      provider.add("item",sItem); // TODO is this correct?
      provider.add(new AgpDPart(con,sourceItem,sUrl,sPartName,sFileName,nDataSize));
     
    } else if ((sItemType != null) && sItemType.equals("url")) {
      // Content-Type: text/plain; charset=utf-8
      sPartName = "text";
      sFileName = null
      provider.add("item",sItem); // TODO is this correct?
      provider.add(new AgpDPart(con,sourceItem,sUrl,sPartName,sFileName,nDataSize));
     
    } else if ((sItemType != null) && sItemType.equals("text")) {
      sPartName = "text";
      sFileName = null;
      if (!sType.equals("Web Map")) {
        provider.add("item",sItem); // TODO is this correct?
        provider.add(new AgpDPart(con,sourceItem,sUrl,sPartName,sFileName,nDataSize));
      } else {
       
        provider.add("item",sItem); // TODO is this correct?
       
        String sCType = "application/x-www-form-urlencoded";
        StringBuilder params = new StringBuilder();
        con.appendToken(params);
        AgpProperties hdr = con.makeRequestHeaderProperties();
        AgpClient client = con.ensureClient();
        StringProvider prov = new StringProvider(params.toString(),sCType);
        StringHandler handler = new StringHandler();;
        client.executeRequest(sUrl,hdr,prov,handler);
        String sWebMapJson = handler.getContent();
       
       
        /*
        web map
        "operationalLayers":[
           {
              "url":"http://irwinags/arcgis/rest/services/IRWIN/MapServer",
              "id":"IRWIN_8147",
              "visibility":true,
              "opacity":1,
              "title":"IRWIN",
              "itemId":"0d635c1158a844d4a19c048c854345df"
           },
        */
        AgpConnection con2 = destination.getConnection();
        boolean bMod = false;
        JSONObject jso = new JSONObject(sWebMapJson);
        String sProp = "operationalLayers";
        if (jso.has(sProp) && (!jso.isNull(sProp))) {
          JSONArray jsoLayers = jso.getJSONArray(sProp);
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

   */
  protected void addThumbnailPart(MultipartProvider provider,
      AgpSource source, AgpItem sourceItem,
      AgpDestination destination, AgpItem destItem)
    throws Exception {
    AgpConnection con = source.getConnection();
    String sThumbnail = sourceItem.getProperties().getValue("thumbnail");
    if (sThumbnail != null) {
      int n = sThumbnail.indexOf("thumbnail/");
      if (n == 0) {
        String sFileName = sThumbnail.substring(10);
        if ((sFileName.length() > 0) && (sFileName.indexOf("/") == -1)) {
          String sId = sourceItem.getProperties().getValue("id");
          String sUrl = con.makeSharingUrl()+"/content/items";
          sUrl += "/"+AgpUtil.encodeURIComponent(sId);
          sUrl += "/info/thumbnail/"+sFileName;
          provider.add(new AgpDPart(
              con,sourceItem,sUrl,"thumbnail",sFileName,-1));
        }
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

            parameters.getValue("ags.userPassword"));
   
  }
 
  private AgpDestination getDestination() {
    AgpConnection connection = new AgpConnection();
   
    AgpDestination destination = new AgpDestination();
    destination.setConnection(connection);
   
    HostContextPair hcp = HostContextPair.makeHostContextPair(parameters.getValue("agp.host"));
    connection.setHost(hcp.getHost());
    connection.setWebContext(hcp.getContext());
    AgpTokenCriteria agpTokenCriteria = new AgpTokenCriteria();
    agpTokenCriteria.setCredentials(new AgpCredentials(parameters.getValue("agp.userName"), parameters.getValue("agp.userPassword")));
    agpTokenCriteria.setReferer(getReferrer());
    connection.setTokenCriteria(agpTokenCriteria);
   
    destination.setDestinationOwner(parameters.getValue("agp.owner"));
    destination.setDestinationFolderID(parameters.getValue("agp.folder"));
   
    return destination;
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

    String sSrcId = sourceItem.getProperties().getValue("id");
    String sDestId = destItem.getProperties().getValue("id");
    String sTitle = sourceItem.getProperties().getValue("title");
    LOGGER.finer("Processing metadata for: "+sSrcId+" "+sTitle);
    AgpCommonRequest request = new AgpCommonRequest();
    AgpConnection connection = this.source.getConnection();
    try {
      String sXml = request.readFormalMetadata(connection,sSrcId);
      if ((sXml != null) && (sXml.length() > 0)) {
        if (sXml.indexOf("<xhtml") == -1) {
          this.execPublishMetadata(sDestId,sXml);
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

   */
  public AgpSource getSource() {
    StringAttributeMap attrs = getAttributeMap();

    AgpSource source = new AgpSource();
    AgpConnection con1 = new AgpConnection();
    HostContextPair pair = HostContextPair.makeHostContextPair(getSourceHost());
    con1.setHost(pair.getHost());
    con1.setWebContext(pair.getContext());
    con1.setTokenCriteria(new AgpTokenCriteria());
    con1.getTokenCriteria().setCredentials(new AgpCredentials(
            attrs.getValue("src-u"), attrs.getValue("src-p")));
    con1.getTokenCriteria().setReferer(getReferrer());
    source.setConnection(con1);
    AgpSearchCriteria searchCriteria = new AgpSearchCriteria();
    searchCriteria.setSortField("title");
    searchCriteria.setQ(attrs.getValue("src-q"));
    searchCriteria.setDeepTotal(Long.valueOf(attrs.getValue("src-m")));
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

   */
  public AgpDestination getDestination() {
    StringAttributeMap attrs = getAttributeMap();
   
    AgpDestination destination = new AgpDestination();
    AgpConnection con2 = new AgpConnection();
    HostContextPair pair = HostContextPair.makeHostContextPair(getDestinationHost());
    con2.setHost(pair.getHost());
    con2.setWebContext(pair.getContext());
    con2.setTokenCriteria(new AgpTokenCriteria());
    con2.getTokenCriteria().setCredentials(new AgpCredentials(
            attrs.getValue("dest-u"), attrs.getValue("dest-p")));
    con2.getTokenCriteria().setReferer(getReferrer());
    destination.setConnection(con2);
    destination.setDestinationOwner(attrs.getValue("dest-o"));
    destination.setDestinationFolderID(attrs.getValue("dest-f"));

    return destination;
View Full Code Here

Examples of com.esri.gpt.agp.client.AgpConnection

   */
  public AgpDestination getDestination() {
    StringAttributeMap attrs = getAttributeMap();
   
    AgpDestination destination = new AgpDestination();
    AgpConnection con2 = new AgpConnection();
    HostContextPair pair = HostContextPair.makeHostContextPair(getDestinationHost());
    con2.setHost(pair.getHost());
    con2.setWebContext(pair.getContext());
    con2.setTokenCriteria(new AgpTokenCriteria());
    con2.getTokenCriteria().setCredentials(new AgpCredentials(
            attrs.getValue("ags-dest-u"), attrs.getValue("ags-dest-p")));
    con2.getTokenCriteria().setReferer(getReferrer());
    destination.setConnection(con2);
    destination.setDestinationOwner(attrs.getValue("ags-dest-o"));
    destination.setDestinationFolderID(attrs.getValue("ags-dest-f"));

    return destination;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.