Package com.esri.gpt.agp.sync

Examples of com.esri.gpt.agp.sync.AgpDestination


   
    return true;
  }
 
  private void execPublishItem(AgpItem sourceItem,AgpItem destItem) throws Exception {
    AgpDestination dest = this.destination;
    String sDestId = destItem!=null? destItem.getProperties().getValue("id"): null;
    String sTitle = sourceItem.getProperties().getValue("title");
    LOGGER.finer("Publishing item: "+sTitle);
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(sourceItem.getProperties().toString());
    }
   
    // make the URL
    boolean bInsert = true;
    String sUrl = dest.getConnection().makeSharingUrl();
    sUrl += "/content/users";
    sUrl += "/"+AgpUtil.encodeURIComponent(dest.getDestinationOwner());
    sUrl += "/"+AgpUtil.encodeURIComponent(dest.getDestinationFolderID());
    if (sDestId == null) {
      sUrl += "/addItem";
    } else {
      bInsert = false;
      sUrl += "/items";
      sUrl += "/"+AgpUtil.encodeURIComponent(sDestId);
      sUrl += "/update";
    }
   
    // make the content provider, add thumb-nail and data parts
    MultipartProvider provider = new MultipartProvider();
    provider.add("f","json");
    provider.add("token",destination.getConnection().getToken().getTokenString());
    provider.add("overwrite","true");
    for (AgpProperty destProp: sourceItem.getProperties().values()) {
      provider.add(destProp.getName(),destProp.getValue());
    }
    //this.partHelper.addThumbnailPart(provider,src,sourceItem,dest,destItem);
    //this.partHelper.addDataPart(provider,src,sourceItem,dest,destItem);
       
    // execute
    AgpProperties hdr = dest.getConnection().makeRequestHeaderProperties();
    AgpClient client = dest.getConnection().ensureClient();
    JSONObject jso = client.executeJsonRequest(sUrl,hdr,provider);
   
    if (jso.has("id") && jso.has("success") && jso.getString("success").equals("true")) {
      if (sDestId == null) {
        sDestId = jso.getString("id");
View Full Code Here


  @Override
  public void run() {
    try {
      ArcGISInfo source = getSource();
      AgpDestination destination = getDestination();

      Ags2AgpCopy copy = new Ags2AgpCopy(source, destination);
     
      copy.copy();
    } catch (Exception e) {
View Full Code Here

  }
 
  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

    try {
      Protocol protocol = getExecutionUnit().getRepository().getProtocol();
      if (protocol instanceof HarvestProtocolAgs2Agp) {
        HarvestProtocolAgs2Agp ags2agp = (HarvestProtocolAgs2Agp)protocol;
        ArcGISInfo source = ags2agp.getSource();
        AgpDestination destination = ags2agp.getDestination();
       
        Ags2AgpCopy copy = new Ags2AgpCopy(source, destination){
          private long counter;
         
          @Override
View Full Code Here

   * @return destination
   */
  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

   * @return destination
   */
  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

    try {
      Protocol protocol = getExecutionUnit().getRepository().getProtocol();
      if (protocol instanceof HarvestProtocolAgp2Agp) {
        HarvestProtocolAgp2Agp agp2agp = (HarvestProtocolAgp2Agp)protocol;
        AgpSource source = agp2agp.getSource();
        AgpDestination destination = agp2agp.getDestination();
        AgpPush agpPush = new AgpPush(source, destination) {
          private long counter;
         
          @Override
          protected boolean syncItem(AgpItem sourceItem) throws Exception {
View Full Code Here

TOP

Related Classes of com.esri.gpt.agp.sync.AgpDestination

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.