コード例 #1
0
  @Override
  public void doAuthAction(ActionRequest request, ActionResponse response) throws Exception {

    String collectionId = request.getParameter("collectionId");

    JobService jobService = ServiceManager.getInstance().getService(JobService.class);

    MasterCollectionFullIndexingStepApplyJob masterCollectionIndexingJob =
        new MasterCollectionFullIndexingStepApplyJob();
    masterCollectionIndexingJob.setArgs(collectionId);

    ResultFuture jobResult = jobService.offer(masterCollectionIndexingJob);

    Writer writer = response.getWriter();
    ResponseWriter resultWriter = getDefaultResponseWriter(writer);
    resultWriter.object().key("collectionId").value(collectionId);

    if (jobResult != null) {
      resultWriter.key("status").value("0");
    } else {
      resultWriter.key("status").value("1");
    }
    resultWriter.endObject();
    resultWriter.done();
  }
コード例 #2
0
  @Override
  public JobResult doRun() throws FastcatSearchException {

    NodeService nodeService = ServiceManager.getInstance().getService(NodeService.class);
    Node node = nodeService.getNodeById(nodeId);
    if (node != null) {
      if (node.isEnabled()) {
        if (isRequest) {
          // make connection if not exist.
          logger.info("Node {} is set Active!", node);
          node.setActive();
          node.setServicePort(servicePort);

          int myServicePort = environment.settingManager().getIdSettings().getInt("servicePort");
          nodeService.sendRequest(node, new NodeHandshakeJob(nodeId, false, myServicePort));
        } else {
          node.setServicePort(servicePort);
        }

      } else {
        logger.info("Node {} is disabled! Cannot accept node request.", node);
      }
    }

    return new JobResult();
  }
コード例 #3
0
  @Override
  public void doAuthAction(ActionRequest request, ActionResponse response) throws Exception {

    PluginService pluginService = ServiceManager.getInstance().getService(PluginService.class);

    String pluginId = request.getParameter("pluginId");

    Plugin plugin = pluginService.getPlugin(pluginId);

    PluginSetting pluginSetting = plugin.getPluginSetting();

    if (pluginSetting instanceof AnalysisPluginSetting) {

      OutputStream ostream = null;

      try {

        ostream = response.getOutputStream();

        JAXBConfigs.writeRawConfig(ostream, pluginSetting, AnalysisPluginSetting.class);

      } finally {

        if (ostream != null)
          try {
            ostream.close();
          } catch (IOException e) {
          }
      }
    }
  }
コード例 #4
0
    @Override
    public JobResult doRun() throws FastcatSearchException {

      NodeService nodeService = ServiceManager.getInstance().getService(NodeService.class);

      try {
        new IndexFileTransfer(environment).transferFile(file, nodeService, node);
      } catch (TransportException e) {
        logger.error("", e);
        return new JobResult(false);
      }

      return new JobResult(true);
    }