Package nz.govt.natlib.meta.log

Examples of nz.govt.natlib.meta.log.LogMessage


      FileLogger logger = new FileLogger(file);
      for (int i = 0; i < viewModel.getRowCount(); i++) {
        logger.logMessage((LogMessage) viewModel.getRow(i));
      }
      logger.close();
      LogMessage msg = new LogMessage(LogMessage.WORTHLESS_CHATTER, null,
          "Saved logfile: " + file, "");
      LogManager.getInstance().logMessage(msg);
    } catch (Exception ex) {
      LogMessage msg = new LogMessage(LogMessage.ERROR, ex,
          "Error saving logfile", "");
      LogManager.getInstance().logMessage(msg);
    }
  }
View Full Code Here


      try {
        LogMessage[] msg = FileLogger.readMessages(file[0]);
        LogModel newModel = new LogModel(msg,
            (LogFilter) priorityFilter.getSelectedItem());
        setViewModel(newModel);
        LogMessage logMsg = new LogMessage(
            LogMessage.WORTHLESS_CHATTER, null, "Opened logfile: "
                + file[0], "");
        LogManager.getInstance().logMessage(logMsg);
        setTitle("Log: " + file[0]);
        titlePanel
            .setDescription("Note: This window currently shows the log messages from the file: "
                + file[0]);
        titlePanel
            .setHelp("You can view the log for the current session by selecting 'View Current Log' from the 'File' menu");
      } catch (Exception ex) {
        LogMessage msg = new LogMessage(LogMessage.ERROR, ex,
            "Error reading logfile", "");
        LogManager.getInstance().logMessage(msg);
      }

    } else {
View Full Code Here

    return value;
  }

  public Object getValueAt(int row, int col) {
    LogMessage message = (LogMessage) filteredMessages.get(row);
    Object value = null;

    switch (col) {
    case 0:
      value = message.getLevel();
      break;
    case 1:
      value = new Long(message.getId());
      break;
    case 2:
      value = message.getDate();
      break;
    case 3:
      value = message.getMessage();
      break;
    case 4:
      value = message.getSource();
      break;
    case 5:
      value = message.getComment();
      break;
    }

    return value;
  }
View Full Code Here

    this.filter = filter;

    // refilter everything
    Iterator it = messages.iterator();
    while (it.hasNext()) {
      LogMessage msg = (LogMessage) it.next();
      if (filter.filter(msg)) {
        if (!filteredMessages.contains(msg))
          filteredMessages.add(msg);
      } else {
        if (filteredMessages.contains(msg))
View Full Code Here

    File configFile = new File(configPath);
    File backup = new File(configFile.getPath() + ".bak");
    // backup - if poss
    boolean backedup = (backup.delete() && configFile.renameTo(backup));
    if (!backedup) {
      LogMessage msg = new LogMessage(LogMessage.INFO, configFile,
          "Config File not backed up",
          "check file system permissions etc");
      LogManager.getInstance().logMessage(msg);
    }
    try {
View Full Code Here

    File configFile = new File(configPath);
    File backup = new File(configFile.getPath() + ".bak");
    System.out.println(backup);

    // backup - if poss
    LogMessage msg = new LogMessage(LogMessage.INFO, configFile,
        "Backing up config: " + configFile.getAbsolutePath(),
        "Backing up to: " + backup.getAbsolutePath());
    LogManager.getInstance().logMessage(msg);
    LogMessage msg2 = new LogMessage(LogMessage.INFO, configFile,
        "Backup deleted: " + backup.delete(), "");
    LogManager.getInstance().logMessage(msg2);
    boolean backedup = FileUtil.copy(configFile.getAbsolutePath(), backup
        .getAbsolutePath());// fconfigFile.renameTo(backup));
    if (!backedup) {
      LogMessage msg3 = new LogMessage(LogMessage.INFO, configFile,
          "Config File not backed up",
          "check file system permissions etc");
      LogManager.getInstance().logMessage(msg3);
    }
View Full Code Here

            setJarForAdapter(adapter, jarName);
          } catch (ClassCastException e) {
            LogManager
                .getInstance()
                .logMessage(
                    new LogMessage(
                        LogMessage.ERROR,
                        e,
                        "Adapter class " + className
                            + " not found",
                        "Invalid adapter entry in config.xml file - check contents using admin tool or filesystem"));
          } catch (Exception e) {
            LogManager
                .getInstance()
                .logMessage(
                    new LogMessage(
                        LogMessage.ERROR,
                        e,
                        "Adapter class " + className
                            + " not found",
                        "Invalid adapter entry in config.xml file - check contents using admin tool or filesystem"));
View Full Code Here

      delPic = new ImageIcon(ImagePanel
          .resolveImage(BUTTON_DELETE_ADAPTER));
      folder = new ImageIcon(ImagePanel.resolveImage(BUTTON_FOLDER));
    } catch (Exception e) {
      LogManager.getInstance().logMessage(
          new LogMessage(LogMessage.ERROR, e, "Image not found",
              "Installation may be corrupt?"));
    }
    Border mapBorder = new TitledBorder(BorderFactory.createEtchedBorder(
        Color.white, new Color(148, 145, 140)), "Add/Remove Mappings");
    addAdapter = new ImageButton("Add", addPic);
View Full Code Here

            fos.write(res);
            fos.close();
          }
        } catch (Exception e) {
          LogManager.getInstance().logMessage(
              new LogMessage(LogMessage.ERROR, e,
                  "File error transferring xml file "
                      + newRes.getAbsolutePath(),
                  "Adapter may be corrupt?"));
        }
      }
      if (!jarFile.getParent().equals(
          Config.getInstance().getJarBaseURL())) {
        File newJarFile = new File(
            Config.getInstance().getJarBaseURL(), jarFile.getName());
        FileUtil.copy(jarFile.getAbsolutePath(), newJarFile
            .getAbsolutePath());
        jarFile = newJarFile;
      }
      Loader.loadJar(jarFile.getAbsolutePath());
      try {
        DataAdapter adapterImpl = (DataAdapter) ClassLoader
            .getSystemClassLoader().loadClass(adapter)
            .newInstance();
        AdapterFactory.getInstance().addAdapter(adapterImpl);
        ArrayList profiles = Config.getInstance()
            .getAvailableProfiles();
        Iterator itp = profiles.iterator();
        while (itp.hasNext()) {
          Profile p = (Profile) itp.next();
          p.setAdapter(adapterImpl.getClass().getName(), true);
        }
        ArrayList editprofiles = Config.getEditInstance()
            .getAvailableProfiles();
        Iterator itp2 = editprofiles.iterator();
        while (itp2.hasNext()) {
          Profile p = (Profile) itp2.next();
          p.setAdapter(adapterImpl.getClass().getName(), true);
        }
        Config.getEditInstance().setJarForAdapter(adapterImpl,
            jarFile.getName());
        Config.getInstance().setJarForAdapter(adapterImpl,
            jarFile.getName());
        refresh();
      } catch (Exception e) {
        LogManager.getInstance().logMessage(
            new LogMessage(LogMessage.ERROR, e,
                "Problem loading adapter class",
                "Adapter may be corrupt?"));
      }
    }
  }
View Full Code Here

                continue;
              } catch (Throwable e) {
                LogManager
                    .getInstance()
                    .logMessage(
                        new LogMessage(
                            LogMessage.INFO,
                            e,
                            "Adapter class failure",
                            "Adapter may be corrupt, attempting to proceede"));
                continue;
View Full Code Here

TOP

Related Classes of nz.govt.natlib.meta.log.LogMessage

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.