001: /*
002: * Hammurapi
003: * Automated Java code review system.
004: * Copyright (C) 2004 Hammurapi Group
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * URL: http://www.hammurapi.org
021: * e-Mail: support@hammurapi.biz
022: */
023: package org.hammurapi;
024:
025: import org.hammurapi.results.Annotation;
026:
027: import com.pavelvlasov.review.Signed;
028: import com.pavelvlasov.review.SourceMarker;
029: import com.pavelvlasov.util.Attributable;
030: import com.pavelvlasov.util.VisitorStack;
031:
032: /**
033: * @author Pavel Vlasov
034: * @version $Revision: 1.8 $
035: */
036: public interface InspectorContext extends Attributable {
037: InspectorDescriptor getDescriptor();
038:
039: /**
040: * Reports violation with a message from descriptor
041: * @param source
042: */
043: void reportViolation(SourceMarker source);
044:
045: /**
046: * Reports violation with a message from descriptor
047: * @param source
048: */
049: void reportViolationEx(SourceMarker source, String messageKey);
050:
051: /**
052: *
053: * @param source
054: * @param message
055: */
056: void reportViolation(SourceMarker source, String message);
057:
058: void annotate(Annotation annotation);
059:
060: void addMetric(SourceMarker source, String name, double value);
061:
062: /**
063: * Formats message taken from InspectorDescriptor with parameters.
064: * @param source
065: * @param params
066: */
067: void reportViolation(SourceMarker source, Object[] params);
068:
069: /**
070: * Formats message taken from InspectorDescriptor with parameters.
071: * @param source
072: * @param params
073: */
074: void reportViolationEx(SourceMarker source, Object[] params,
075: String messageKey);
076:
077: /**
078: * Report warning
079: * @param source
080: * @param message
081: */
082: void warn(SourceMarker source, String message);
083:
084: /**
085: * Report warning
086: * @param source
087: * @param message
088: */
089: void warn(SourceMarker source, Throwable th);
090:
091: /**
092: * Outputs a message to the log
093: * @param source
094: * @param message
095: */
096: void info(SourceMarker source, String message);
097:
098: /**
099: * Outputs a message to the log
100: * @param source
101: * @param message
102: */
103: void debug(SourceMarker source, String message);
104:
105: /**
106: * Outputs a message to the log
107: * @param source
108: * @param message
109: */
110: void verbose(SourceMarker source, String message);
111:
112: /**
113: * Creates a waiver for inspector with a given key
114: * @param inspectorKey
115: */
116: void waive(Signed signed, final String inspectorKey);
117:
118: /**
119: * Visitor stack of the master visitor
120: * @return
121: */
122: VisitorStack getVisitorStack();
123:
124: Session getSession();
125:
126: /**
127: * Helper method to avoid hard reference to Jsel objects.
128: * @param source
129: * @return
130: */
131: public SourceMarker detach(final SourceMarker source);
132: }
|