Package org.apache.manifoldcf.core.interfaces

Examples of org.apache.manifoldcf.core.interfaces.ConfigurationNode


  {
    Configuration result = performAPIDeleteOperationViaNodes("jobs/"+jobIDString,200);
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
    }

  }
View Full Code Here


    Configuration result = performAPIGetOperationViaNodes("jobstatuses/"+jobIDString,200);
    String status = null;
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
      else if (resultNode.getType().equals("jobstatus"))
      {
        int j = 0;
        while (j < resultNode.getChildCount())
        {
          ConfigurationNode childNode = resultNode.findChild(j++);
          if (childNode.getType().equals("status"))
            status = childNode.getValue();
        }
      }
    }
    return status;
  }
View Full Code Here

    Configuration result = performAPIGetOperationViaNodes("jobstatuses/"+jobIDString,200);
    String documentsProcessed = null;
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
      else if (resultNode.getType().equals("jobstatus"))
      {
        int j = 0;
        while (j < resultNode.getChildCount())
        {
          ConfigurationNode childNode = resultNode.findChild(j++);
          if (childNode.getType().equals("documents_processed"))
            documentsProcessed = childNode.getValue();
        }
      }
    }
    if (documentsProcessed == null)
      throw new Exception("Expected a documents_processed field, didn't find it");
View Full Code Here

    Configuration result = performAPIGetOperationViaNodes("jobstatuses/"+jobIDString,200);
    String status = null;
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
      else if (resultNode.getType().equals("jobstatus"))
      {
        int j = 0;
        while (j < resultNode.getChildCount())
        {
          ConfigurationNode childNode = resultNode.findChild(j++);
          if (childNode.getType().equals("status"))
            status = childNode.getValue();
        }
      }
    }
    return status;
  }
View Full Code Here

    Configuration result = performAPIGetOperationViaNodes("jobstatuses/"+jobIDString,200);
    String documentsProcessed = null;
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
      else if (resultNode.getType().equals("jobstatus"))
      {
        int j = 0;
        while (j < resultNode.getChildCount())
        {
          ConfigurationNode childNode = resultNode.findChild(j++);
          if (childNode.getType().equals("documents_processed"))
            documentsProcessed = childNode.getValue();
        }
      }
    }
    if (documentsProcessed == null)
      throw new Exception("Expected a documents_processed field, didn't find it");
View Full Code Here

        String[] folders = getChildFolderNames(parentFolder);
        int i = 0;
        while (i < folders.length)
        {
          String folder = folders[i++];
          ConfigurationNode node = new ConfigurationNode("folder");
          node.setValue(folder);
          output.addChild(output.getChildCount(),node);
        }
      }
      catch (ManifoldCFException e)
      {
        ManifoldCF.createErrorNode(output,e);
      }
    }
    else if (command.startsWith("folder/"))
    {
      String folder = command.substring("folder/".length());
      try
      {
        String canonicalFolder = validateFolderName(folder);
        if (canonicalFolder != null)
        {
          ConfigurationNode node = new ConfigurationNode("folder");
          node.setValue(canonicalFolder);
          output.addChild(output.getChildCount(),node);
        }
      }
      catch (ManifoldCFException e)
      {
View Full Code Here

    {
     
      int i;

      // Create a basic file system connection, and save it.
      ConfigurationNode connectionObject;
      ConfigurationNode child;
      Configuration requestObject;
      Configuration result;
     
      connectionObject = new ConfigurationNode("repositoryconnection");
     
      child = new ConfigurationNode("name");
      child.setValue("CMIS Connection");
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      child = new ConfigurationNode("class_name");
      child.setValue("org.apache.manifoldcf.crawler.connectors.cmis.CmisRepositoryConnector");
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      child = new ConfigurationNode("description");
      child.setValue("CMIS Connection");
      connectionObject.addChild(connectionObject.getChildCount(),child);

      child = new ConfigurationNode("max_connections");
      child.setValue("10");
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      child = new ConfigurationNode("configuration");
     
      //CMIS Repository Connector parameters
     
      //binding
      ConfigurationNode cmisBindingNode = new ConfigurationNode("_PARAMETER_");
      cmisBindingNode.setAttribute("name", CmisConfig.BINDING_PARAM);
      cmisBindingNode.setValue(CmisConfig.BINDING_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisBindingNode);
     
      //username
      ConfigurationNode cmisUsernameNode = new ConfigurationNode("_PARAMETER_");
      cmisUsernameNode.setAttribute("name", CmisConfig.USERNAME_PARAM);
      cmisUsernameNode.setValue(CmisConfig.USERNAME_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisUsernameNode);
     
      //password
      ConfigurationNode cmisPasswordNode = new ConfigurationNode("_PARAMETER_");
      cmisPasswordNode.setAttribute("name", CmisConfig.PASSWORD_PARAM);
      cmisPasswordNode.setValue(CmisConfig.PASSWORD_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisPasswordNode);
     
      //protocol
      ConfigurationNode cmisProtocolNode = new ConfigurationNode("_PARAMETER_");
      cmisProtocolNode.setAttribute("name", CmisConfig.PROTOCOL_PARAM);
      cmisProtocolNode.setValue(CmisConfig.PROTOCOL_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisProtocolNode);
     
      //server
      ConfigurationNode cmisServerNode = new ConfigurationNode("_PARAMETER_");
      cmisServerNode.setAttribute("name", CmisConfig.SERVER_PARAM);
      cmisServerNode.setValue(CmisConfig.SERVER_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisServerNode);
     
      //port
      ConfigurationNode cmisPortNode = new ConfigurationNode("_PARAMETER_");
      cmisPortNode.setAttribute("name", CmisConfig.PORT_PARAM);
      cmisPortNode.setValue(CmisConfig.PORT_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisPortNode);
     
      //path
      ConfigurationNode cmisPathNode = new ConfigurationNode("_PARAMETER_");
      cmisPathNode.setAttribute("name", CmisConfig.PATH_PARAM);
      cmisPathNode.setValue(CmisConfig.PATH_DEFAULT_VALUE);
      child.addChild(child.getChildCount(), cmisPathNode);
     
      connectionObject.addChild(connectionObject.getChildCount(),child);

      requestObject = new Configuration();
      requestObject.addChild(0,connectionObject);
     
      result = performAPIPutOperationViaNodes("repositoryconnections/CMIS%20Connection",201,requestObject);
     
      i = 0;
      while (i < result.getChildCount())
      {
        ConfigurationNode resultNode = result.findChild(i++);
        if (resultNode.getType().equals("error"))
          throw new Exception(resultNode.getValue());
      }
     
      // Create a basic null output connection, and save it.
      connectionObject = new ConfigurationNode("outputconnection");
     
      child = new ConfigurationNode("name");
      child.setValue("ElasticSearch");
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      child = new ConfigurationNode("class_name");
      child.setValue("org.apache.manifoldcf.agents.output.elasticsearch.ElasticSearchConnector");
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      child = new ConfigurationNode("description");
      child.setValue("ElasticSearch Connection");
      connectionObject.addChild(connectionObject.getChildCount(),child);

      child = new ConfigurationNode("max_connections");
      child.setValue("100");
      connectionObject.addChild(connectionObject.getChildCount(),child);

      child = new ConfigurationNode("configuration");
     
      //ElasticSearch Output Connector parameters
     
      //serverlocation
      ConfigurationNode serverLocation = new ConfigurationNode("_PARAMETER_");
      serverLocation.setAttribute("name", "serverlocation");
      serverLocation.setValue("http://localhost:9200");
      child.addChild(child.getChildCount(), serverLocation);
     
      //indexname
      ConfigurationNode indexName = new ConfigurationNode("_PARAMETER_");
      indexName.setAttribute("name", "indexname");
      indexName.setValue("index");
      child.addChild(child.getChildCount(), indexName);
     
      //indextype
      ConfigurationNode indexType = new ConfigurationNode("_PARAMETER_");
      indexType.setAttribute("name", "indextype");
      indexType.setValue("generictype");
      child.addChild(child.getChildCount(), indexType);
     
      connectionObject.addChild(connectionObject.getChildCount(),child);
     
      requestObject = new Configuration();
      requestObject.addChild(0,connectionObject);
     
      result = performAPIPutOperationViaNodes("outputconnections/ElasticSearch",201,requestObject);
     
      i = 0;
      while (i < result.getChildCount())
      {
        ConfigurationNode resultNode = result.findChild(i++);
        if (resultNode.getType().equals("error"))
          throw new Exception(resultNode.getValue());
      }

      // Create a job.
      ConfigurationNode jobObject = new ConfigurationNode("job");
     
      child = new ConfigurationNode("description");
      child.setValue("Test Job");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("repository_connection");
      child.setValue("CMIS Connection");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("output_connection");
      child.setValue("ElasticSearch");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("run_mode");
      child.setValue("scan once");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("start_mode");
      child.setValue("manual");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("hopcount_mode");
      child.setValue("accurate");
      jobObject.addChild(jobObject.getChildCount(),child);

      child = new ConfigurationNode("document_specification");
     
     
      //Job configuration
      ConfigurationNode sn = new ConfigurationNode("startpoint");
      sn.setAttribute("cmisQuery",CMIS_TEST_QUERY);
     
      child.addChild(child.getChildCount(),sn);
      jobObject.addChild(jobObject.getChildCount(),child);
     
      requestObject = new Configuration();
      requestObject.addChild(0,jobObject);
     
      result = performAPIPostOperationViaNodes("jobs",201,requestObject);
     
      String jobIDString = null;
      i = 0;
      while (i < result.getChildCount())
      {
        ConfigurationNode resultNode = result.findChild(i++);
        if (resultNode.getType().equals("error"))
          throw new Exception(resultNode.getValue());
        else if (resultNode.getType().equals("job_id"))
          jobIDString = resultNode.getValue();
      }
      if (jobIDString == null)
        throw new Exception("Missing job_id from return!");
     
      // Now, start the job, and wait until it completes.
View Full Code Here

   
    Configuration result = performAPIPutOperationViaNodes("start/"+jobIDString,201,requestObject);
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
    }
  }
View Full Code Here

  {
    Configuration result = performAPIDeleteOperationViaNodes("jobs/"+jobIDString,200);
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
    }

  }
View Full Code Here

    Configuration result = performAPIGetOperationViaNodes("jobstatuses/"+jobIDString,200);
    String status = null;
    int i = 0;
    while (i < result.getChildCount())
    {
      ConfigurationNode resultNode = result.findChild(i++);
      if (resultNode.getType().equals("error"))
        throw new Exception(resultNode.getValue());
      else if (resultNode.getType().equals("jobstatus"))
      {
        int j = 0;
        while (j < resultNode.getChildCount())
        {
          ConfigurationNode childNode = resultNode.findChild(j++);
          if (childNode.getType().equals("status"))
            status = childNode.getValue();
        }
      }
    }
    return status;
  }
View Full Code Here

TOP

Related Classes of org.apache.manifoldcf.core.interfaces.ConfigurationNode

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.