1 package org.e2etrace.trace; 2 3 /* 4 * Copyright 2006 Gunther Popp 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 import org.e2etrace.config.ITraceConfig; 20 21 /** 22 * Manages the trace sessions of the current application. 23 * <p> 24 * 25 * An application should only maintain a single trace session manager. However, 26 * the session manager may be able to administer multiple trace sessions, e.g. 27 * one for every thread of the application. For details, please refer to the 28 * concrete session manager implementations. 29 * <p> 30 * 31 * @author Gunther Popp 32 * 33 */ 34 public interface ITraceSessionManager { 35 36 /** 37 * Returns the current (active) trace session. 38 * <p> 39 * 40 * If no current trace session has been assigned yet using <code>setCurrentSession</code> or 41 * if <code>releaseCurrentSession</code> has been called, a {@link NoopTraceSession} will 42 * be returned. This allows, for example, the execution of unit-tests for classes that 43 * contain <code>enterStep/leaveStep</code> without intializing a trace session first. 44 * 45 * @return trace session 46 */ 47 public ITraceSession getCurrentSession(); 48 49 /** 50 * Sets the current (active) trace session. 51 * <p> 52 * 53 * @param session new current trace session 54 */ 55 public void setCurrentSession(ITraceSession session); 56 57 /** 58 * Release current session.<p> 59 * 60 * This call releases the reference to the current trace session. It should be called in 61 * when all trace data for the current trace session has been collected and the session 62 * is no longer needed.<p> 63 */ 64 public void releaseCurrentSession(); 65 66 /** 67 * Assign a new trace configuration to the session manager. 68 * <p> 69 * 70 * The configuration will be used by the manager itself and all trace sessions 71 * under its control. 72 * <p> 73 * 74 * @param config trace configuration 75 */ 76 public void setConfig(ITraceConfig config); 77 78 /** 79 * Returns the current trace configuration. 80 * 81 * @return trace configuration 82 */ 83 public ITraceConfig getConfig(); 84 85 }