コード例 #1
0
ファイル: LightManager.java プロジェクト: BerengereG/contrib
  public Boolean dataSourceExport(DataSourceUI dataSourceUI) throws ServerSideException {
    try {
      RepoxManagerDefault repoxManagerDefault =
          (RepoxManagerDefault) ConfigSingleton.getRepoxContextUtil().getRepoxManager();
      DataSourceContainer dataSourceContainer =
          repoxManagerDefault
              .getDataManager()
              .getDataSourceContainer(dataSourceUI.getDataSourceSet());

      DataSource dataSource = dataSourceContainer.getDataSource();
      dataSource.setExportDir(dataSourceUI.getExportDirectory());

      String recordsPerFile;
      if (dataSourceUI.getRecordsPerFile().equals("All")) recordsPerFile = "-1";
      else recordsPerFile = dataSourceUI.getRecordsPerFile();

      ConfigSingleton.getRepoxContextUtil()
          .getRepoxManager()
          .getDataManager()
          .startExportDataSource(
              dataSourceUI.getDataSourceSet(), recordsPerFile, dataSourceUI.getExportFormat());
    } catch (Exception e) {
      throw new ServerSideException(Util.stackTraceToString(e));
    }
    return true;
  }
コード例 #2
0
 public void run() {
   try {
     working = dataSource.isWorking();
   } catch (Exception e) {
     log.error("Error checking if Data Source " + dataSource.getId() + " is working", e);
     working = false;
   }
 }
コード例 #3
0
  public void addNotListedOldTasks(String dataSetId) {
    try {
      DataSource dataSource =
          ConfigSingleton.getRepoxContextUtil()
              .getRepoxManager()
              .getDataManager()
              .getDataSourceContainer(dataSetId)
              .getDataSource();

      for (String logFileName : dataSource.getLogFilenames()) {
        boolean matchFound = false;
        for (OldTask oldTask : dataSource.getOldTasksList()) {
          if (oldTask.getLogName().equals(logFileName)) {
            matchFound = true;
            break;
          }
        }

        if (!matchFound && dataSource.getStatus() != DataSource.StatusDS.RUNNING) {
          String oldTaskId = dataSetId + "_" + UUID.randomUUID().toString();
          StatusAndRecords statusAndRecords =
              getStatusAndRecordsFromLogFile(dataSetId, logFileName);
          OldTask oldTask =
              new OldTask(
                  dataSource,
                  oldTaskId,
                  logFileName,
                  "incrementalIngest",
                  statusAndRecords.getStatus(),
                  "0",
                  "3",
                  "300",
                  convertDateToString(getLogFileDate(dataSetId, logFileName)),
                  statusAndRecords.getRecords());
          dataSource.getOldTasksList().add(oldTask);
          ConfigSingleton.getRepoxContextUtil()
              .getRepoxManager()
              .getDataManager()
              .saveOldTask(oldTask);
          log.warn("New Old Tasks added from Log Files for the data set: " + dataSetId);
        }
      }

    } catch (DocumentException e) {
      e.printStackTrace(); // To change body of catch statement use File | Settings | File
      // Templates.
    } catch (IOException e) {
      e.printStackTrace(); // To change body of catch statement use File | Settings | File
      // Templates.
    } catch (StringIndexOutOfBoundsException e) {
      // Do nothing
    } catch (ArrayIndexOutOfBoundsException e) {
      // Do nothing
    } catch (Exception e) {
      // Do nothing
    }
  }
コード例 #4
0
  public Resolution delete() throws DocumentException, IOException {
    DataProvider dataProvider =
        context.getRepoxManager().getDataProviderManager().getDataProvider(dataProviderId);
    DataSource dataSource = dataProvider.getDataSource(dataSourceId);

    context.getRepoxManager().getDataProviderManager().deleteDataSource(dataSource.getId());
    dataProvider.getDataSources().remove(dataSource);
    context
        .getRepoxManager()
        .getDataProviderManager()
        .updateDataProvider(dataProvider, dataProvider.getId());
    context.getMessages().add(new LocalizableMessage("dataSource.delete.success", dataSourceId));

    return new RedirectResolution(
        "/dataProvider/ViewDataProvider.action?dataProviderId="
            + URLEncoder.encode(dataProviderId, "UTF-8"));
  }