// Path: inspektr-common/src/main/java/com/github/inspektr/common/spi/PrincipalResolver.java
// public interface PrincipalResolver {
// 
//     /**
//      * Default String that can be used when the user is anonymous.
//      */
//     final String ANONYMOUS_USER = "audit:anonymous";
// 
//     /**
//      * Default String that can be used when the user cannot be determined.
//      */
//     final String UNKNOWN_USER = "audit:unknown";
// 
//     /**
//      * Resolve the principal performing an audit-able action.
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      * 
//      * @param auditTarget the join point where we're auditing.
//      * @param returnValue the returned value
//      * @return	The principal as a String. CANNOT be NULL.
//      */
//     String resolveFrom(JoinPoint auditTarget, Object returnValue);
//     
//     /**
//      * Resolve the principal performing an audit-able action that has incurred
//      * an exception.
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      * 
//      * @param auditTarget the join point where we're auditing.
//      * @param exception	The exception incurred when the join point proceeds.
//      * @return	The principal as a String. CANNOT be NULL.
//      */
//     String resolveFrom(JoinPoint auditTarget, Exception exception);
// 
//     /**
//      * Called when there is no other way to resolve the principal (i.e. an error was captured, auditing was not
//      * called, etc.)
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      *
//      * @return the principal.  CANNOT be NULL.
//      */
//     String resolve();
// }
// 
// Path: inspektr-error/src/main/java/com/github/inspektr/error/ErrorLogManager.java
// public interface ErrorLogManager {
// 	
// 	/**
// 	 * Records the specified error.
// 	 * 
// 	 * @param errorDescription	The error description.
// 	 */
// 	void recordError(String errorDescription);
// 	
// 	/**
// 	 * Records the specified throwable.
// 	 * 
// 	 * @param throwable	The throwable describing the error.
// 	 */
// 	void recordError(Throwable throwable);
// 	
// 	/**
// 	 * Returns the list of {@link ErrorReporter} associated with this manager.
// 	 * 
// 	 * @return list of <code>ErrorReporters</code>.
// 	 */
// 	List<ErrorReporter> getErrorReporters();
// 
// }
// 
// Path: inspektr-error/src/main/java/com/github/inspektr/error/ErrorReporter.java
// public interface ErrorReporter {
// 	
// 	/**
// 	 * Reports the specified error.
// 	 * 
// 	 * @param applicationCode	The application identifier.
// 	 * @param principal			Optional application-specific context information on the
// 	 *      principal incurring the error. 
// 	 * @param errorDescription 	Details on the error.
// 	 */
// 	void reportError(String applicationCode, String principal, String errorDescription);
// 	
// 	/**
// 	 * Reports the specified <code>Throwable</code>.
// 	 * 
// 	 * @param applicationCode	The application identifier.
// 	 * @param principal			Optional application-specific context information on the 
// 	 * 		principal incurring the error.
// 	 * @param throwable			The <code>Throwable</code> to be reported.
// 	 */
// 	void reportError(String applicationCode, String principal, Throwable throwable);
// 
// }


import com.github.inspektr.error.ErrorLogManager;
import com.github.inspektr.error.ErrorReporter;
import java.util.List;
import com.github.inspektr.common.spi.PrincipalResolver;
/**
 * Licensed to Inspektr under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Inspektr licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a
 * copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.github.inspektr.error.support;



/**
 * An <code>ErrorLogManager</code> implementation.
 * 
 * @author lleung
 * @version $Revision: 1.2 $ $Date: 2007/07/11 20:48:47 $
 * @since 1.0
 */
public class DefaultErrorLogManager implements ErrorLogManager {
	
	/**
	 * The application identifier to use when recording errors.
	 */
	private String applicationCode;
	
	/**
	 * The resolver for a description of the principal associated with the error.
	 */
	private PrincipalResolver currentContextPrincipalResolver;
	
	/**
	 * The ErrorReporters to use to report the errors.
	 */
// Path: inspektr-common/src/main/java/com/github/inspektr/common/spi/PrincipalResolver.java
// public interface PrincipalResolver {
// 
//     /**
//      * Default String that can be used when the user is anonymous.
//      */
//     final String ANONYMOUS_USER = "audit:anonymous";
// 
//     /**
//      * Default String that can be used when the user cannot be determined.
//      */
//     final String UNKNOWN_USER = "audit:unknown";
// 
//     /**
//      * Resolve the principal performing an audit-able action.
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      * 
//      * @param auditTarget the join point where we're auditing.
//      * @param returnValue the returned value
//      * @return	The principal as a String. CANNOT be NULL.
//      */
//     String resolveFrom(JoinPoint auditTarget, Object returnValue);
//     
//     /**
//      * Resolve the principal performing an audit-able action that has incurred
//      * an exception.
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      * 
//      * @param auditTarget the join point where we're auditing.
//      * @param exception	The exception incurred when the join point proceeds.
//      * @return	The principal as a String. CANNOT be NULL.
//      */
//     String resolveFrom(JoinPoint auditTarget, Exception exception);
// 
//     /**
//      * Called when there is no other way to resolve the principal (i.e. an error was captured, auditing was not
//      * called, etc.)
//      * <p>
//      * Note, this method should NEVER throw an exception *unless* the expectation is that a failed resolution causes
//      * the entire transaction to fail.  Otherwise use {@link com.github.inspektr.common.spi.PrincipalResolver#UNKNOWN_USER}.
//      *
//      * @return the principal.  CANNOT be NULL.
//      */
//     String resolve();
// }
// 
// Path: inspektr-error/src/main/java/com/github/inspektr/error/ErrorLogManager.java
// public interface ErrorLogManager {
// 	
// 	/**
// 	 * Records the specified error.
// 	 * 
// 	 * @param errorDescription	The error description.
// 	 */
// 	void recordError(String errorDescription);
// 	
// 	/**
// 	 * Records the specified throwable.
// 	 * 
// 	 * @param throwable	The throwable describing the error.
// 	 */
// 	void recordError(Throwable throwable);
// 	
// 	/**
// 	 * Returns the list of {@link ErrorReporter} associated with this manager.
// 	 * 
// 	 * @return list of <code>ErrorReporters</code>.
// 	 */
// 	List<ErrorReporter> getErrorReporters();
// 
// }
// 
// Path: inspektr-error/src/main/java/com/github/inspektr/error/ErrorReporter.java
// public interface ErrorReporter {
// 	
// 	/**
// 	 * Reports the specified error.
// 	 * 
// 	 * @param applicationCode	The application identifier.
// 	 * @param principal			Optional application-specific context information on the
// 	 *      principal incurring the error. 
// 	 * @param errorDescription 	Details on the error.
// 	 */
// 	void reportError(String applicationCode, String principal, String errorDescription);
// 	
// 	/**
// 	 * Reports the specified <code>Throwable</code>.
// 	 * 
// 	 * @param applicationCode	The application identifier.
// 	 * @param principal			Optional application-specific context information on the 
// 	 * 		principal incurring the error.
// 	 * @param throwable			The <code>Throwable</code> to be reported.
// 	 */
// 	void reportError(String applicationCode, String principal, Throwable throwable);
// 
// }


// Path: inspektr-error/src/main/java/com/github/inspektr/error/support/DefaultErrorLogManager.java
import com.github.inspektr.error.ErrorLogManager;
import com.github.inspektr.error.ErrorReporter;
import java.util.List;
import com.github.inspektr.common.spi.PrincipalResolver;

/**
 * Licensed to Inspektr under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Inspektr licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a
 * copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.github.inspektr.error.support;



/**
 * An <code>ErrorLogManager</code> implementation.
 * 
 * @author lleung
 * @version $Revision: 1.2 $ $Date: 2007/07/11 20:48:47 $
 * @since 1.0
 */
public class DefaultErrorLogManager implements ErrorLogManager {
	
	/**
	 * The application identifier to use when recording errors.
	 */
	private String applicationCode;
	
	/**
	 * The resolver for a description of the principal associated with the error.
	 */
	private PrincipalResolver currentContextPrincipalResolver;
	
	/**
	 * The ErrorReporters to use to report the errors.
	 */
	private List<ErrorReporter> errorReporters;