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 * NOOP implementation of a trace session (does nothing). 23 * <p> 24 * 25 * This trace session is internally used if tracing is switched off in the 26 * e2etrace configuration. 27 * 28 * @author Gunther Popp 29 * 30 */ 31 public class NoopTraceSession implements ITraceSession { 32 33 // Faked trace config that always returns false for isTraceEnabled() and 34 // isTraceEnabledForId 35 private static final ITraceConfig _FAKED_TRACE_CONFIG = new ITraceConfig() { 36 37 /** {@inheritDoc} */ 38 public boolean isTraceEnabled() { 39 return false; 40 } 41 42 /** {@inheritDoc} */ 43 public boolean isTraceEnabledForId(ITraceStepId id) { 44 return false; 45 } 46 }; 47 48 /** {@inheritDoc} */ 49 public void enterStep(ITraceStepId id) { 50 // This method is intentionally left blank 51 52 } 53 54 /** {@inheritDoc} */ 55 public void leaveStep(ITraceStepId id) { 56 // This method is intentionally left blank 57 58 } 59 60 /** {@inheritDoc} */ 61 public ITraceStep getRootStep() { 62 // This method is intentionally left blank 63 return null; 64 } 65 66 /** {@inheritDoc} */ 67 public long getDuration() { 68 // This method is intentionally left blank 69 return 0; 70 } 71 72 /** {@inheritDoc} */ 73 public void setConfig(ITraceConfig tc) { 74 // This method is intentionally left blank 75 76 } 77 78 /** {@inheritDoc} */ 79 public ITraceConfig getConfig() { 80 return _FAKED_TRACE_CONFIG; 81 82 } 83 84 /** {@inheritDoc} */ 85 public ITraceStep getCurrentStep() { 86 // This method is intentionally left blank 87 return null; 88 } 89 90 /** {@inheritDoc} */ 91 public void enterStep(Class clazz, String method) { 92 // This method is intentionally left blank 93 94 } 95 96 /** {@inheritDoc} */ 97 public void enterStep(String id) { 98 // This method is intentionally left blank 99 100 } 101 102 /** {@inheritDoc} */ 103 public void leaveStep(Class clazz, String method) { 104 // This method is intentionally left blank 105 } 106 107 /** {@inheritDoc} */ 108 public void leaveStep(String id) { 109 // This method is intentionally left blank 110 111 } 112 113 }