/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* it is supposed to get the matching lines from history log files.
* since lucene does not easily give the match context.
*/
public class HistoryContext {
private final LineMatcher[] m;
/**
* Map whose keys tell which fields to look for in the history, and
* whose values tell if the field is case insensitive (true for
* insensitivity, false for sensitivity).
*/
if(m != null) {
}
}
public boolean isEmpty() {
return m == null;
}
throws HistoryException
{
if (m == null) {
return false;
}
}
public boolean getContext(
throws HistoryException
{
}
/**
* Obtain the history for the source file <var>src</var> and write out
* matching History log entries.
*
* @param src the source file represented by <var>path</var>
* (SOURCE_ROOT + path)
* @param path the path of the file (rooted at SOURCE_ROOT)
* @param out write destination
* @param context the servlet context path of the application (the path
* prefix for URLs)
* @return {@code true} if at least one line has been written out.
* @throws HistoryException
*/
throws HistoryException
{
if (m == null) {
return false;
}
}
/**
* Writes matching History log entries from 'in' to 'out' or to 'hits'
* @param in the history to fetch entries from
* @param out to write matched context
* @param path path to the file
* @param hits list of hits
* @param wcontext web context - beginning of url
*/
private boolean getHistoryContext(
// There should be exactly one destination for the output. If
// none or both are specified, it's a bug.
throw new IllegalArgumentException(
"Exactly one of out and hits should be non-null");
}
if (m == null) {
return false;
}
int matchedLines = 0;
try {
if (it.hasNext()) { nhe=it.next(); } //this prefetch mechanism is here because of the diff link generation
// we currently generate the diff to previous revision
int matchState;
int start = -1;
for (int i = 0; i< m.length; i++) {
if (start < 0) {
}
} else {
}
matchedLines++;
break;
if (start < 0) {
}
} else {
start = -1;
}
}
}
}
} catch (Exception e) {
}
return matchedLines > 0;
}
/**
* Write a match to a stream.
*
* @param out the receiving stream
* @param line the matching line
* @param start start position of the match
* @param end position of the first char after the match
* @param flatten should multi-line log entries be flattened to a single
* @param path path to the file
* @param wcontext web context (begin of url)
* @param nrev old revision
* @param rev current revision
* line? If {@code true}, replace newline with space.
*/
throws IOException {
//does below need to be encoded? see bug 16985
out.append("<a href="+wcontext+Constants.diffP+path+"?r2="+path+"@"+rev+"&r1="+path+"@"+nrev+" title=\"diff to previous version\">diff</a> ");
}
}
/**
* Output a string as HTML.
*
* @param out where to write the HTML
* @param str the string to print
* @param flatten should multi-line strings be flattened to a single
* line? If {@code true}, replace newline with space.
*/
throws IOException {
switch (ch) {
case '\n':
break;
case '<':
break;
case '>':
break;
case '&':
break;
default:
}
}
}
}