Issue #2937 Separate room logging into a subdirectory to separate room logs from

other logging. Updated abstract_setup.xml to check the javaUtilities baseline directory and the cots directory
for dependency jars so that symbolic links are not needed in order to build.  Fixes for Archive log access
and search.

Change-Id: I7ca111cebb4dae998ce1390f3bb73b0f48eb7174

Former-commit-id: 85911a9d01 [formerly d4659c48a6] [formerly 404faeeca0] [formerly 15e1b7a7f6 [formerly 404faeeca0 [formerly 480c86e5bbe6866b8c4c285006d3d7f7fed2b056]]]
Former-commit-id: 15e1b7a7f6
Former-commit-id: f8fc71ad10a4d9dbd3464113660b2d2d68675fd5 [formerly 2f56fd3c9d]
Former-commit-id: 1c685a9eb6
This commit is contained in:
Brad Gonzales 2014-03-31 11:45:22 -05:00
parent 5ffe5c01f6
commit c12c4cf7e2
5 changed files with 63 additions and 21 deletions

View file

@ -43,8 +43,9 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 5, 2012 bsteffen Initial creation
* Jul 5, 2012 bsteffen Initial creation
* Jan 28, 2014 2698 bclement changed sessionName to sessionId
* Mar 31, 2014 2937 bgonzale Use session name for log retrieval.
*
* </pre>
*
@ -75,7 +76,7 @@ public class ArchiveViewerAction extends Action {
public ArchiveViewerAction(IVenueSession session) {
super("View Log...", IconUtil.getImageDescriptor(Activator.getDefault()
.getBundle(), "log.gif"));
sessionId = session.getVenue().getId();
sessionId = session.getVenue().getName();
}
@Override

View file

@ -52,6 +52,8 @@ import org.eclipse.swt.widgets.Text;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 31, 2012 bgonzale Initial creation
* Mar 31, 2014 2937 bgonzale Fix error where text was continually appended
* during search.
*
* </pre>
*
@ -422,10 +424,7 @@ public class SearchComposite extends Composite {
* the text to set
*/
private void setText(String text) {
if (this.text == null) {
this.text = new StringBuilder();
}
this.text.append(text);
this.text = new StringBuilder(text);
}
/**

View file

@ -76,11 +76,24 @@
-->
<for list="${plugin.dependent.libs}" param="plugin">
<sequential>
<copy todir="${openfire.src.dir}/src/plugins/${plugin.name}/lib">
<fileset dir="${baseline.dir}/@{plugin}">
<include name="**/*.jar" />
</fileset>
</copy>
<!-- Dependencies are found in the base dir or cots -->
<if>
<available file="${baseline.dir}/@{plugin}" type="dir"/>
<then>
<copy todir="${openfire.src.dir}/src/plugins/${plugin.name}/lib">
<fileset dir="${baseline.dir}/@{plugin}">
<include name="**/*.jar" />
</fileset>
</copy>
</then>
<else>
<copy todir="${openfire.src.dir}/src/plugins/${plugin.name}/lib">
<fileset dir="${baseline.dir}/../cots/@{plugin}">
<include name="**/*.jar" />
</fileset>
</copy>
</else>
</if>
</sequential>
</for>
</target>

View file

@ -7,7 +7,7 @@
<property name="includegen.filter" value="raytheon|collaboration.dataserver" />
<property name="basedirectories" value="${workspace}/edexOsgi;${workspace}/javaUtilities;${workspace}/cots" />
<property name="tmp.dir" value="${basedir}/tmp" />
<property name="tmp.dir" value="/tmp/collab-dataserver" />
<property name="includes.directory" value="${tmp.dir}/includes" />
<property name="tmp.src.dir" value="${tmp.dir}/src" />
<property name="tmp.bin.dir" value="${tmp.dir}/bin" />

View file

@ -25,6 +25,7 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -64,7 +65,11 @@ import com.raytheon.openfire.plugin.detailedfeedlog.listener.DetailedFeedLogEven
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 23, 2012 mnash Initial creation
* Jul 23, 2012 mnash Initial creation
* Mar 31, 2014 2937 bgonzale Separate room logging from other logging
* in a 'Rooms' subdirectory so that readLogInfo()
* only parses room logs. Add finally block to close
* the buffered readers.
*
* </pre>
*
@ -110,9 +115,13 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
public static final String SITE_INFO = "Site";
private SimpleDateFormat dateFormat = new SimpleDateFormat(
private static final String ROOM_DIR = "Rooms";
private DateFormat dateFormat = new SimpleDateFormat(
"MM/dd/yyyy h:mm a");
private File ROOM_LOG_DIR;
/*
* (non-Javadoc)
*
@ -127,6 +136,16 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
entries = new HashMap<String, Queue<LogEntry>>();
// log dir for rooms
String logDirName = Log.getLogDirectory() + ROOM_DIR;
File logDir = new File(logDirName);
try {
logDir.mkdir();
} catch (SecurityException e) {
logger.error("Failed to create Room log directory.", e);
}
ROOM_LOG_DIR = logDir;
// read the log in from the file
readLogInfo();
@ -163,15 +182,14 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
}
private void readLogInfo() {
Log.getLogDirectory();
File logDir = new File(Log.getLogDirectory());
File[] files = logDir.listFiles();
File[] files = ROOM_LOG_DIR.listFiles();
for (File file : files) {
BufferedReader bReader = null;
try {
logger.info("Reading " + file.getName());
FileReader reader = new FileReader(file);
BufferedReader bReader = new BufferedReader(reader);
bReader = new BufferedReader(reader);
while (bReader.ready()) {
String line = bReader.readLine();
String[] splitLine = line.split("\\|");
@ -193,6 +211,17 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
logger.error("Unable to parse date", e);
} catch (ArrayIndexOutOfBoundsException e) {
logger.info("Unable to read " + file.getName(), e);
} finally {
if (bReader != null) {
try {
bReader.close();
} catch (IOException e) {
StringBuilder sb = new StringBuilder(
"Failed to close log file: ").append(file
.getAbsolutePath());
logger.error(sb.toString(), e);
}
}
}
}
}
@ -208,7 +237,8 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
user = UserManager.getInstance().getUser(
message.getFrom().getResource());
} catch (UserNotFoundException e) {
logger.error("Unable to get user", e);
logger.error("Unable to get user for Room: " + room
+ " and Message: " + message.toXML(), e);
}
String site = getSiteFromPresence(user);
@ -285,12 +315,11 @@ public class DetailedFeedLogPlugin implements Plugin, PropertyEventListener {
* Write out the current in memory log to a file
*/
private void writeToFile() {
String logDir = Log.getLogDirectory();
try {
// writes out each log file for each room, all active and permanent,
// and for rooms that the purge has not removed all logs yet
for (String room : entries.keySet()) {
File file = new File(logDir + room + ".log");
File file = new File(ROOM_LOG_DIR, room + ".log");
FileWriter writer = new FileWriter(file);
for (LogEntry entry : entries.get(room)) {