org.fusesource.insight.log.support
Class LogQuerySupport

java.lang.Object
  extended by org.fusesource.insight.log.support.LogQuerySupport
All Implemented Interfaces:
LogQuerySupportMBean

public abstract class LogQuerySupport
extends java.lang.Object
implements LogQuerySupportMBean

Base class for any org.fusesource.insight.log.service.LogQueryMBean implementation


Field Summary
protected  org.codehaus.jackson.map.ObjectMapper mapper
           
 
Constructor Summary
protected LogQuerySupport()
           
 
Method Summary
protected  void addJarEntryToIndex(java.util.jar.JarEntry entry, java.lang.StringBuilder buffer)
           
 LogResults allLogResults()
          Returns all the available recent log events as a LogResults object which is then serialized
static java.lang.String ensureStartsWithSlash(java.lang.String path)
           
 java.lang.String filterLogEvents(java.lang.String jsonFilter)
          Filters the list of log events using the JSON encoding of LogFilter
protected  java.lang.String getArtifactFile(java.lang.String mavenCoords, java.lang.String filePath, java.lang.String classifier)
           
 java.lang.String getHostName()
           
 java.lang.String getJavaDoc(java.lang.String mavenCoordinates, java.lang.String filePath)
          Returns the javadoc file for the given maven coordinates and filePath
 java.lang.String getLogEvents(int maxCount)
          Returns the recent log events as JSON
 javax.management.ObjectName getMbeanName()
           
 javax.management.MBeanServer getMbeanServer()
           
 java.lang.String getSource(java.lang.String mavenCoords, java.lang.String className, java.lang.String filePath)
          Returns the source file for the given maven coordinates so that we can link log messages to source code
protected  boolean isRoot(java.lang.String filePath)
          Returns true if the file path is "/" or empty
protected  java.lang.String jarIndex(java.io.File file)
           
protected  java.lang.String jarIndex(java.util.jar.JarFile jarFile)
           
protected  java.lang.String jarIndex(java.net.URL url)
           
 LogResults jsonQueryLogResults(java.lang.String jsonFilter)
          Allows a JSON filter to be specified then returns the log results as a serialised object
protected  LogFilter jsonToLogFilter(java.lang.String json)
           
protected  java.lang.String loadCoords(java.lang.String coords, java.lang.String filePath, java.lang.String classifier)
           
protected static java.lang.String loadString(java.net.URL url)
           
 LogResults logResultsSince(long time)
          Returns all the available log events since the given timestamp (millis)
 void registerMBeanServer(javax.management.MBeanServer mbeanServer)
           
 void setHostName(java.lang.String hostName)
           
 void setMbeanName(javax.management.ObjectName mbeanName)
           
 void setMbeanServer(javax.management.MBeanServer mbeanServer)
           
 void start()
          Registers the object with JMX
 void stop()
          Unregisters the object with JMX
protected  java.lang.String toJSON(java.lang.Object answer)
           
 void unregisterMBeanServer(javax.management.MBeanServer mbeanServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.fusesource.insight.log.support.LogQuerySupportMBean
getLogResults, queryLogResults
 

Field Detail

mapper

protected org.codehaus.jackson.map.ObjectMapper mapper
Constructor Detail

LogQuerySupport

protected LogQuerySupport()
Method Detail

loadString

protected static java.lang.String loadString(java.net.URL url)
                                      throws java.io.IOException
Throws:
java.io.IOException

start

public void start()
Registers the object with JMX


stop

public void stop()
Unregisters the object with JMX


allLogResults

public LogResults allLogResults()
                         throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Returns all the available recent log events as a LogResults object which is then serialized

Specified by:
allLogResults in interface LogQuerySupportMBean
Returns:
the log events as a serialized object
Throws:
java.io.IOException

logResultsSince

public LogResults logResultsSince(long time)
                           throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Returns all the available log events since the given timestamp (millis)

Specified by:
logResultsSince in interface LogQuerySupportMBean
Returns:
the log events as a serialized object
Throws:
java.io.IOException

getLogEvents

public java.lang.String getLogEvents(int maxCount)
                              throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Returns the recent log events as JSON

Specified by:
getLogEvents in interface LogQuerySupportMBean
Parameters:
maxCount - maximum number to return o <0 for all of them
Returns:
the log events as a blob of JSON using LogEvent
Throws:
java.io.IOException

filterLogEvents

public java.lang.String filterLogEvents(java.lang.String jsonFilter)
                                 throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Filters the list of log events using the JSON encoding of LogFilter

Specified by:
filterLogEvents in interface LogQuerySupportMBean
Returns:
the log events as a blob of JSON using LogEvent
Throws:
java.io.IOException

jsonQueryLogResults

public LogResults jsonQueryLogResults(java.lang.String jsonFilter)
                               throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Allows a JSON filter to be specified then returns the log results as a serialised object

Specified by:
jsonQueryLogResults in interface LogQuerySupportMBean
Throws:
java.io.IOException

getMbeanName

public javax.management.ObjectName getMbeanName()
                                         throws javax.management.MalformedObjectNameException
Throws:
javax.management.MalformedObjectNameException

setMbeanName

public void setMbeanName(javax.management.ObjectName mbeanName)

getMbeanServer

public javax.management.MBeanServer getMbeanServer()

setMbeanServer

public void setMbeanServer(javax.management.MBeanServer mbeanServer)

getHostName

public java.lang.String getHostName()

setHostName

public void setHostName(java.lang.String hostName)

registerMBeanServer

public void registerMBeanServer(javax.management.MBeanServer mbeanServer)

unregisterMBeanServer

public void unregisterMBeanServer(javax.management.MBeanServer mbeanServer)

toJSON

protected java.lang.String toJSON(java.lang.Object answer)
                           throws java.io.IOException
Throws:
java.io.IOException

jsonToLogFilter

protected LogFilter jsonToLogFilter(java.lang.String json)
                             throws java.io.IOException
Throws:
java.io.IOException

getSource

public java.lang.String getSource(java.lang.String mavenCoords,
                                  java.lang.String className,
                                  java.lang.String filePath)
                           throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Returns the source file for the given maven coordinates so that we can link log messages to source code

Specified by:
getSource in interface LogQuerySupportMBean
Parameters:
mavenCoords - is a string of the form "groupId:artifactId:version". For some uber bundles this can be a space separated list.
Throws:
java.io.IOException

getJavaDoc

public java.lang.String getJavaDoc(java.lang.String mavenCoordinates,
                                   java.lang.String filePath)
                            throws java.io.IOException
Description copied from interface: LogQuerySupportMBean
Returns the javadoc file for the given maven coordinates and filePath

Specified by:
getJavaDoc in interface LogQuerySupportMBean
Parameters:
mavenCoordinates - is a string of the form "groupId:artifactId:version". For some uber bundles this can be a space separated list.
Throws:
java.io.IOException

getArtifactFile

protected java.lang.String getArtifactFile(java.lang.String mavenCoords,
                                           java.lang.String filePath,
                                           java.lang.String classifier)
                                    throws java.io.IOException
Throws:
java.io.IOException

loadCoords

protected java.lang.String loadCoords(java.lang.String coords,
                                      java.lang.String filePath,
                                      java.lang.String classifier)
                               throws java.io.IOException
Throws:
java.io.IOException

jarIndex

protected java.lang.String jarIndex(java.net.URL url)
                             throws java.io.IOException
Throws:
java.io.IOException

jarIndex

protected java.lang.String jarIndex(java.io.File file)
                             throws java.io.IOException
Throws:
java.io.IOException

jarIndex

protected java.lang.String jarIndex(java.util.jar.JarFile jarFile)

addJarEntryToIndex

protected void addJarEntryToIndex(java.util.jar.JarEntry entry,
                                  java.lang.StringBuilder buffer)

isRoot

protected boolean isRoot(java.lang.String filePath)
Returns true if the file path is "/" or empty


ensureStartsWithSlash

public static java.lang.String ensureStartsWithSlash(java.lang.String path)


Copyright © 2013 Red Hat. All Rights Reserved.