Package com.esri.gpt.framework.context

Examples of com.esri.gpt.framework.context.RequestContext


    boolean doInit = false;
    boolean doClear = false;

    if (UuidUtil.isUuid(uuid)) {
      if (!getEditor().getRepository().getUuid().equals(uuid) || reload) {
        RequestContext rc = new FacesContextBroker().extractRequestContext();
        HrSelectRequest request = new HrSelectRequest(rc, uuid);
        request.execute();
        HrRecords records = request.getQueryResult().getRecords();
        if (records.size() == 1) {
          record = records.get(0);
View Full Code Here


*/
public synchronized void span(HrRecord resource, Criteria criteria) {
  OneTimeWorker worker = new OneTimeWorker(dataProcessor, resource, criteria){
      @Override
      protected void onComplete() {
        RequestContext context = RequestContext.extract(null);
        try {
          taskQueue.complete(context, resource.getUuid());
        } finally {
          adHoc.remove(this);
          context.onExecutionPhaseCompleted();
        }
      }
  };
  adHoc.add(worker);
  Thread thread = new Thread(worker, "harvester ad hoc");
View Full Code Here

   * Executes copy action.
   * @throws Exception if anything fails
   */
  public void copy() throws Exception {
    LOGGER.log(Level.INFO, "Starting synchronization from ArcGIS Server "+source.getRestUrl()+" into Portal for ArcGIS "+destination.getConnection().getHost());
    RequestContext requestContext = RequestContext.extract(null);
    try {

      ArcGISQueryBuilder qb = new ArcGISQueryBuilder(new IterationContext() {
        @Override
        public void onIterationException(Exception ex) {
          LOGGER.log(Level.SEVERE, "Error iterating through AGS resources.", ex);
        }
      }, source);
     
      Query newQuery = qb.newQuery(new CommonCriteria());
      Result result = newQuery.execute();

      this.destination.getConnection().generateToken();
     
      Iterable<IServiceInfoProvider> records = new ServiceInfoProviderAdapter(new FlatResourcesAdapter(result.getResources()));
      for (IServiceInfoProvider r: records) {
        if (!doContinue()) {
          break;
        }
        ServiceInfo serviceInfo = r.getServiceInfo();
        AgpItem agpItem = createAgpItem(serviceInfo);
        if (agpItem!=null) {
          syncItem(agpItem);
        }
      }

    } finally {
      requestContext.onExecutionPhaseCompleted();
      LOGGER.log(Level.INFO, "Completed synchronization from ArcGIS Server "+source.getRestUrl()+" into Portal for ArcGIS "+destination.getConnection().getHost());
    }
  }
View Full Code Here

   * @param context the operation context
   * @param id the document id
   * @return the original XML string
   */
  public String provideOriginalXml(OperationContext context, String id) throws Exception {
    RequestContext reqContext = context.getRequestContext();
   
    // if a file-identifier was passed, determine it's associated uuid
    ImsMetadataAdminDao dao = new ImsMetadataAdminDao(reqContext);
    String docUuid = dao.findUuid(id);
    if (docUuid.length() > 0) {
      id = docUuid;
    } else {
      return "";
    }

    // ensure access to the document
    MetadataAcl acl = new MetadataAcl(reqContext);
    boolean bHasAccess = acl.hasReadAccess(reqContext.getUser(),id);
    if (!bHasAccess) {
      throw new NotAuthorizedException("Access denied.");
    }

    // read and return the xml
View Full Code Here

  /**
   * Main unit test method.
   * @param args startup arguments
   */
  public static void main(String[] args) {
    RequestContext rc = null;
    try {
      //rc = RequestContext.extract(null);
     
      System.err.println(".................");
          
      GxeDefinition definition = new GxeDefinition();
      definition.setFileLocation("gpt/gxe/iso/iso19139/iso19139-dataset-editor.xml");
     
      GxeContext context = new GxeContext();
      context.setMessageBroker(new MessageBroker());
      context.getMessageBroker().setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
     
      GxeLoader loader = new GxeLoader();
      loader.loadDefinition(context,definition);
     
      GxeJsonSerializer serializer = new GxeJsonSerializer();
      String json = serializer.asJson(context,definition);
      System.err.println(json);
     
    } catch (Throwable t) {
      t.printStackTrace(System.err);
    } finally {
      if (rc != null) rc.onExecutionPhaseCompleted();
    }
  }
View Full Code Here

   * Completes task.
   *
   * @param uuid repository uuid
   */
  private void complete(String uuid) {
    RequestContext context = RequestContext.extract(null);
    try {
      taskQueue.complete(context, uuid);
    } finally {
      context.onExecutionPhaseCompleted();
    }
  }
View Full Code Here

   *
   * @return execution nextUnit
   * @throws SQLException if accessing database fails
   */
  private ExecutionUnit next() throws SQLException {
    RequestContext context = RequestContext.extract(null);
    try {
      final Task task = taskQueue.next(context);
      if (task == null) {
        return null;
      }
      return newExecutionUnit(task);
    } finally {
      context.onExecutionPhaseCompleted();
    }
  }
View Full Code Here

    LOG.log(Level.WARNING, "Could not get rid during creating rest urls", e);
  }
 
  SearchCriteria criteria = this.getSearchCriteria();
  RequestContext context =  this.getContextBroker().extractRequestContext();
  HttpServletRequest request = this.getContextBroker().extractHttpServletRequest();
 
  // If request is coming from search page then we can parse the url and
  // come up with the url
  String queryString = Val.chkStr(request.getQueryString());
View Full Code Here

    String resourceUrl = serviceInfo.getResourceUrl();
    String resourceXml = serviceInfo.asDublinCore(processor);
    processor.publishMetadata(resourceUrl,resourceXml);
   
    // configuration parameters for data element recursion
    RequestContext rContext = processor.getContext().getRequestContext();
    StringAttributeMap params = rContext.getCatalogConfiguration().getParameters();
    boolean recurse = true;
    if (Val.chkStr(params.getValue("AGSProcessor.GeoDataServer.recurse")).equalsIgnoreCase("false")) {
      recurse = false;
    }
    boolean expandDescendants = false;
View Full Code Here

  /**
   * Main unit test method.
   * @param args startup arguments
   */
  public static void main(String[] args) {
    RequestContext rc = null;
    try {
     
      IntegrationContextFactory self = new IntegrationContextFactory();
      System.out.println("isIntegrationEnabled="+self.isIntegrationEnabled());
      IntegrationContext ictx = self.newIntegrationContext();
      if (ictx == null) {
        System.out.println("newIntegrationContext=null");
      } else {
        System.out.println("sdisuite.securityManagerUrl="+self.getSecurityManagerUrl());
      }
     
    } catch (Throwable t) {
      t.printStackTrace(System.err);
    } finally {
      if (rc != null) rc.onExecutionPhaseCompleted();
    }
  }
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.context.RequestContext

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.