Package com.esri.gpt.agp.sync

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


   * @return source
   */
  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")));
    source.setSearchCriteria(searchCriteria);

    return source;
  }
View Full Code Here


  }

  @Override
  public boolean checkConnection(IMessageCollector mb) {
    try {
        AgpSource source = protocol.getSource();

        boolean stop = false;
        if (source.getConnection().getHost().isEmpty()) {
          mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.nohost");
          stop = true;
        }

        if (source.getConnection().getTokenCriteria().getCredentials().getUsername().isEmpty() || source.getConnection().getTokenCriteria().getCredentials().getPassword().isEmpty()) {
          mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.nocredentials");
          stop = true;
        }

        if (source.getSearchCriteria().getQ().isEmpty()) {
          mb.addErrorMessage("catalog.harvest.manage.test.err.agp2agp.src.noquery");
          stop = true;
        }

        if (!stop) {
          source.getConnection().generateToken();
          AgpCountRequest sourceRequest = new AgpCountRequest();
          long count = sourceRequest.count(source.getConnection(), source.getSearchCriteria());
          String srcM = protocol.getAttributeMap().getValue("src-m");
          long max = Val.chkLong(srcM, 0);
          long apx = Math.min(count, max);

          mb.addSuccessMessage("catalog.harvest.manage.test.msg.agp2agp.success", new Object[]{apx});
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
View Full Code Here

TOP

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

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.