예제 #1
0
 public static Configuration getFoundationDBGraphConfig() {
   BaseConfiguration config = new BaseConfiguration();
   config
       .subset(GraphDatabaseConfiguration.STORAGE_NAMESPACE)
       .addProperty(GraphDatabaseConfiguration.STORAGE_BACKEND_KEY, "foundationdb");
   return config;
 }
 @Override
 public boolean open() {
   BaseConfiguration conf = new BaseConfiguration();
   conf.setProperty("storage.backend", storageBackend);
   conf.setProperty("storage.tablename", storageTableName);
   titanGraph = TitanFactory.open(conf);
   titanGraph.makeKey(vertexUserId).dataType(String.class).indexed(Vertex.class).make();
   titanGraph.makeLabel(edgeMentions).make();
   titanGraph.makeLabel(edgeReTweets).make();
   titanGraph.commit();
   return true;
 }
  public void openFileObjectsIntoOneView(FileObject[] files, Object guiSource) {
    ArrayList<LoadingInfo> list = new ArrayList<>();
    for (final FileObject file : files) {
      try {
        list.add(Utils.openFileObject(file, true));
      } catch (Exception e1) {
        LOGGER.warn(
            String.format(
                "Can't open file %s: %s", file.getName().getFriendlyURI(), e1.getMessage()));
      }
    }

    if (list.size() == 0) {
      JOptionPane.showMessageDialog(
          (Component) guiSource,
          "No files can be opened :(",
          "Open error",
          JOptionPane.ERROR_MESSAGE);
      return;
    }

    LoadingInfo[] loadingInfos = new LoadingInfo[list.size()];
    loadingInfos = list.toArray(loadingInfos);

    Collection<LogImporter> elements =
        AllPluginables.getInstance().getLogImportersContainer().getElements();
    LogImporter[] importers = elements.toArray(new LogImporter[elements.size()]);
    String[] names = new String[elements.size()];
    for (int i = 0; i < names.length; i++) {
      names[i] = importers[i].getName();
    }

    TableColumns[] visibleColumns = {
      TableColumns.ID, //
      TableColumns.TIME, //
      TableColumns.LEVEL, //
      TableColumns.MESSAGE, //
      TableColumns.CLASS, //
      TableColumns.METHOD, //
      TableColumns.THREAD, //
      TableColumns.MARK, //
      TableColumns.NOTE, //
      TableColumns.LOG_SOURCE
    };
    final LogViewPanelWrapper logViewPanelWrapper =
        new LogViewPanelWrapper(
            "Multiple log files " + loadingInfos.length,
            null,
            visibleColumns,
            getOtrosApplication());

    logViewPanelWrapper.goToLiveMode();
    BaseConfiguration configuration = new BaseConfiguration();
    configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true);
    configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true);
    BufferingLogDataCollectorProxy logDataCollector =
        new BufferingLogDataCollectorProxy(
            logViewPanelWrapper.getDataTableModel(), 4000, configuration);

    StringBuilder sb = new StringBuilder();
    sb.append("<html>Multiple files:<br>");
    for (LoadingInfo loadingInfo : loadingInfos) {
      sb.append(loadingInfo.getFriendlyUrl());
      sb.append("<BR>");
    }
    sb.append("</html>");

    getOtrosApplication()
        .addClosableTab(
            String.format("Multiple logs [%d]", loadingInfos.length),
            sb.toString(),
            Icons.ARROW_REPEAT,
            logViewPanelWrapper,
            true);

    LogImporter importer = new DetectOnTheFlyLogImporter(elements);
    try {
      importer.init(new Properties());
    } catch (InitializationException e1) {
      LOGGER.error("Cant initialize DetectOnTheFlyLogImporter: " + e1.getMessage());
      JOptionPane.showMessageDialog(
          (Component) guiSource,
          "Cant initialize DetectOnTheFlyLogImporter: " + e1.getMessage(),
          "Open error",
          JOptionPane.ERROR_MESSAGE);
    }
    for (LoadingInfo loadingInfo : loadingInfos) {
      TailLogActionListener tailLogActionListener =
          new TailLogActionListener(getOtrosApplication(), importer);
      tailLogActionListener.openFileObjectInTailMode(
          logViewPanelWrapper, loadingInfo, logDataCollector);
      ParsingContext parsingContext =
          new ParsingContext(
              loadingInfo.getFileObject().getName().getFriendlyURI(),
              loadingInfo.getFileObject().getName().getBaseName());
      logViewPanelWrapper.addHierarchyListener(
          new ReadingStopperForRemove(
              loadingInfo.getObserableInputStreamImpl(),
              logDataCollector,
              new ParsingContextStopperForClosingTab(parsingContext)));
    }

    SwingUtilities.invokeLater(logViewPanelWrapper::switchToContentView);
  }