Beispiel #1
0
 /** Export channels to Matlab file */
 @Test
 public void matlabExport() throws Exception {
   final Model model = getTestModel();
   final ExportJob export =
       new MatlabScriptExportJob(
           model,
           model.getStartTime(),
           model.getEndTime(),
           Source.RAW_ARCHIVE,
           10,
           "/tmp/matlab.m",
           this);
   export.run(new SysoutProgressMonitor());
 }
Beispiel #2
0
 /**
  * Export channels in a spreadsheet
  *
  * @throws Exception on error
  */
 @Test
 public void speadsheetExport() throws Exception {
   final Model model = getTestModel();
   final ExportJob export =
       new SpreadsheetExportJob(
           model,
           model.getStartTime(),
           model.getEndTime(),
           Source.RAW_ARCHIVE,
           10,
           new ValueWithInfoFormatter(Style.Exponential, 3),
           "/tmp/sheet.dat",
           this);
   export.run(new SysoutProgressMonitor());
 }
Beispiel #3
0
 /**
  * Export channels one-by-one
  *
  * @throws Exception on error
  */
 @Test
 public void plainExport() throws Exception {
   final Model model = getTestModel();
   final ExportJob export =
       new PlainExportJob(
           model,
           model.getStartTime(),
           model.getEndTime(),
           Source.OPTIMIZED_ARCHIVE,
           60,
           new ValueWithInfoFormatter(Style.Exponential, 6),
           "/tmp/plain.dat",
           this);
   export.run(new SysoutProgressMonitor());
 }
 /** {@inheritDoc} */
 @Override
 protected void printExportInfo(final PrintStream out) {
   super.printExportInfo(out);
   out.println(comment);
   out.println(comment + "This file can be loaded into Matlab");
   out.println(comment);
   out.println(comment + "It defines a 'Time Series' object for each channel");
   out.println(comment + "which can be displayed via the 'plot' command.");
   out.println(comment + "Time series can be analyzed further with the Matlab");
   out.println(comment + "Time Series Tools, see Matlab manual.");
   out.println();
 }
  /** {@inheritDoc} */
  @Override()
  public void exportLDIF(LDIFExportConfig exportConfig) throws DirectoryException {
    // If the backend already has the root container open, we must use the same
    // underlying root container
    boolean openRootContainer = rootContainer == null;

    try {
      if (openRootContainer) {
        EnvironmentConfig envConfig = ConfigurableEnvironment.parseConfigEntry(cfg);

        envConfig.setReadOnly(true);
        envConfig.setAllowCreate(false);
        envConfig.setTransactional(false);
        envConfig.setConfigParam("je.env.isLocking", "true");
        envConfig.setConfigParam("je.env.runCheckpointer", "true");

        rootContainer = initializeRootContainer(envConfig);
      }

      ExportJob exportJob = new ExportJob(exportConfig);
      exportJob.exportLDIF(rootContainer);
    } catch (IOException ioe) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ioe);
      }
      Message message = ERR_JEB_EXPORT_IO_ERROR.get(ioe.getMessage());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message);
    } catch (JebException je) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, je);
      }
      throw new DirectoryException(
          DirectoryServer.getServerErrorResultCode(), je.getMessageObject());
    } catch (DatabaseException de) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, de);
      }
      throw createDirectoryException(de);
    } catch (LDIFException e) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
      throw new DirectoryException(
          DirectoryServer.getServerErrorResultCode(), e.getMessageObject());
    } catch (InitializationException ie) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ie);
      }
      throw new DirectoryException(
          DirectoryServer.getServerErrorResultCode(), ie.getMessageObject());
    } catch (ConfigException ce) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, ce);
      }
      throw new DirectoryException(
          DirectoryServer.getServerErrorResultCode(), ce.getMessageObject());
    } finally {
      // If a root container was opened in this method as read only, close it
      // to leave the backend in the same state.
      if (openRootContainer && rootContainer != null) {
        try {
          rootContainer.close();
          rootContainer = null;
        } catch (DatabaseException e) {
          if (debugEnabled()) {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
        }
      }
    }
  }