예제 #1
0
 public void processEvent(Event event) {
   String msg = EventFormatter.format(event);
   EventSeverity severity = event.getSeverity();
   if (severity == EventSeverity.INFO) {
     // logger.info(filename + ": " + msg);
   } else if (severity == EventSeverity.WARN) {
     // logger.warn(filename + ": "  + msg);
   } else if (severity == EventSeverity.ERROR) {
     logger.error(filename + ": " + msg);
   } else if (severity == EventSeverity.FATAL) {
     logger.fatalError(filename + ": " + msg);
   } else {
     assert false;
   }
 }
예제 #2
0
  /** This does the actual authentication using the teamspace authentication component. */
  private String authenticateUser(HttpServletRequest request) {

    String authHeader = request.getHeader("Authorization");

    String authenticatedUser = null;
    if ((authHeader != null) && authHeader.toUpperCase().startsWith("BASIC")) {

      String[] authTuple = authTupleFromAuthHeader(authHeader);
      if (authTuple.length == 2) {
        String username = authTuple[0];
        String password = authTuple[1];

        if (lookupAuthentication().authenticate(username, password)) {
          authenticatedUser = username;
        } else {
          log_.info(
              "failed authentication"
                  + " from host: "
                  + request.getRemoteAddr()
                  + " with username: "
                  + username);
        }
      }
    }
    return authenticatedUser;
  }
예제 #3
0
 /* (non-Javadoc)
  * @see org.plj.chanells.febe.msg.MessageFactory#sendMessage(org.pgj.messages.Message, org.plj.chanells.febe.core.PGStream)
  */
 public void sendMessage(Message msg, PGStream stream)
     throws IOException, MappingException, CommunicationException {
   SQL sql = (SQL) msg;
   String clname = msg.getClass().getName();
   AbstractSQLMessageFactory msgf = (AbstractSQLMessageFactory) map.get(clname);
   if (msgf == null) {
     logger.fatalError("sender method not implemented for " + clname);
     throw new CommunicationException("sender method not implemented for " + clname);
   }
   stream.SendInteger(msgf.getSQLType(), 4);
   msgf.sendMessage(msg, stream);
 }
예제 #4
0
  /**
   * Creation of a new HelloComponent instance using a container supplied logging channel and
   * context. The context supplied by the container holds the standard context entries for the home
   * and working directories, component name and partition.
   *
   * @avalon.entry key="urn:avalon:name"
   * @avalon.entry key="urn:avalon:partition"
   * @avalon.entry key="urn:avalon:home" type="java.io.File"
   * @avalon.entry key="urn:avalon:temp" type="java.io.File"
   */
  public HelloComponent(Logger logger, Context context) throws ContextException {
    m_logger = logger;

    m_home = (File) context.get("urn:avalon:home");
    m_temp = (File) context.get("urn:avalon:temp");
    m_name = (String) context.get("urn:avalon:name");
    m_partition = (String) context.get("urn:avalon:partition");

    StringBuffer buffer = new StringBuffer("standard context entries");
    buffer.append("\n  name: " + m_name);
    buffer.append("\n  home: " + m_home);
    buffer.append("\n  temp: " + m_temp);
    buffer.append("\n  partition: " + m_partition);

    m_logger.info(buffer.toString());
  }
예제 #5
0
 public Logger getChildLogger(String message) {
   return realLogger.getChildLogger(message);
 }
예제 #6
0
 public boolean isErrorEnabled() {
   return isThrowingException(ERROR_VALUE) || realLogger.isErrorEnabled();
 }
예제 #7
0
 public boolean isWarnEnabled() {
   return isThrowingException(WARN_VALUE) || realLogger.isWarnEnabled();
 }
예제 #8
0
 public boolean isInfoEnabled() {
   return isThrowingException(INFO_VALUE) || realLogger.isInfoEnabled();
 }
예제 #9
0
 public boolean isDebugEnabled() {
   // Enable level also if it is set to throw an exception, so that
   // logging the message occurs, and then throws it.
   return isThrowingException(DEBUG_VALUE) || realLogger.isDebugEnabled();
 }
예제 #10
0
 public void fatalError(String message, Throwable thr) {
   realLogger.fatalError(message, thr);
   throwException(FATAL_VALUE, message);
 }
예제 #11
0
 public void error(String message, Throwable thr) {
   realLogger.error(message, thr);
   throwException(ERROR_VALUE, message);
 }
예제 #12
0
 public void warn(String message, Throwable thr) {
   realLogger.warn(message, thr);
   throwException(WARN_VALUE, message);
 }
예제 #13
0
 public void info(String message, Throwable thr) {
   realLogger.info(message, thr);
   throwException(INFO_VALUE, message);
 }
예제 #14
0
 public void debug(String message, Throwable thr) {
   realLogger.debug(message, thr);
   throwException(DEBUG_VALUE, message);
 }