Author: thomas.diesler(a)jboss.com
Date: 2008-01-16 16:57:30 -0500 (Wed, 16 Jan 2008)
New Revision: 5482
Modified:
framework/trunk/.classpath
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointRecordProcessorDeploymentAspect.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AndFilter.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/NotFilter.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OrFilter.java
Log:
[JBWS-1956] Parametrize Records Management
Modified: framework/trunk/.classpath
===================================================================
--- framework/trunk/.classpath 2008-01-16 21:57:11 UTC (rev 5481)
+++ framework/trunk/.classpath 2008-01-16 21:57:30 UTC (rev 5482)
@@ -15,6 +15,6 @@
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/jaxb-api.jar"/>
<classpathentry kind="lib"
path="thirdparty/jbossws-common.jar"/>
- <classpathentry kind="lib"
path="thirdparty/jbossws-spi.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jbossws-spi.jar"
sourcepath="thirdparty/jbossws-spi-src.zip"/>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointRecordProcessorDeploymentAspect.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointRecordProcessorDeploymentAspect.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointRecordProcessorDeploymentAspect.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -30,9 +30,7 @@
import javax.management.MBeanServer;
import org.jboss.wsf.common.ObjectNameFactory;
-import org.jboss.wsf.framework.management.recording.LogRecorder;
import org.jboss.wsf.framework.management.recording.ManagedRecordProcessor;
-import org.jboss.wsf.framework.management.recording.MemoryBufferRecorder;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -47,28 +45,36 @@
public class EndpointRecordProcessorDeploymentAspect extends DeploymentAspect
{
private MBeanServer mbeanServer;
+ private List<RecordProcessor> processors;
+ public void setProcessors(List<RecordProcessor> processors)
+ {
+ this.processors = processors;
+ }
+
@Override
public void create(Deployment dep)
{
for (Endpoint ep : dep.getService().getEndpoints())
{
- /** Memory buffer recorder **/
- MemoryBufferRecorder memoryRecorder = new MemoryBufferRecorder();
- memoryRecorder.setName("MemoryBufferRecorder");
- this.registerRecordProcessor(memoryRecorder, ep);
- /** Log recorder **/
- LogRecorder logRecorder = new LogRecorder();
- logRecorder.setName("LogRecorder");
- this.registerRecordProcessor(logRecorder, ep);
-
- List<RecordProcessor> recordProcessorList = new
LinkedList<RecordProcessor>();
- recordProcessorList.add(memoryRecorder);
- recordProcessorList.add(logRecorder);
- ep.setRecordProcessors(recordProcessorList);
+ List<RecordProcessor> processorList = new
LinkedList<RecordProcessor>();
+ for (RecordProcessor pr : processors)
+ {
+ try
+ {
+ RecordProcessor clone = (RecordProcessor)pr.clone();
+ registerRecordProcessor(clone, ep);
+ processorList.add(clone);
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+ ep.setRecordProcessors(processorList);
}
}
-
+
@Override
public void destroy(Deployment dep)
{
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AbstractRecordProcessor.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -39,7 +39,6 @@
*/
public abstract class AbstractRecordProcessor implements RecordProcessor
{
-
protected List<RecordFilter> filters = new Vector<RecordFilter>();
protected boolean processDestinationHost = true;
protected boolean processSourceHost = true;
@@ -50,19 +49,19 @@
protected boolean processDate = true;
protected String name;
protected boolean recording = false;
-
+
public abstract void processRecord(Record record);
-
+
public void setName(String name)
{
this.name = name;
}
-
+
public String getName()
{
return name;
}
-
+
public void addFilter(RecordFilter filter)
{
filters.add(filter);
@@ -147,7 +146,7 @@
{
this.processDate = processDate;
}
-
+
public boolean isRecording()
{
return recording;
@@ -157,27 +156,41 @@
{
this.recording = recording;
}
-
+
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ AbstractRecordProcessor retObj = (AbstractRecordProcessor)super.clone();
+ retObj.filters = new Vector<RecordFilter>();
+ for (RecordFilter fil : this.filters)
+ {
+ RecordFilter clFil = (RecordFilter)fil.clone();
+ retObj.filters.add(clFil);
+ }
+ retObj.processDestinationHost = this.processDestinationHost;
+ retObj.processSourceHost = this.processSourceHost;
+ retObj.processHeaders = this.processHeaders;
+ retObj.processEnvelope = this.processEnvelope;
+ retObj.processMessageType = this.processMessageType;
+ retObj.processOperation = this.processOperation;
+ retObj.processDate = this.processDate;
+ retObj.recording = this.recording;
+ retObj.name = this.name;
+ return retObj;
+ }
+
public String toString()
{
StringBuffer sb = new StringBuffer();
sb.append(super.toString());
- sb.append(" (recording = ");
- sb.append(recording);
- sb.append(", processDestinationHost = ");
- sb.append(processDestinationHost);
- sb.append(", processSourceHost = ");
- sb.append(processSourceHost);
- sb.append(", processHeaders = ");
- sb.append(processHeaders);
- sb.append(", processEnvelope = ");
- sb.append(processEnvelope);
- sb.append(", processMessageType = ");
- sb.append(processMessageType);
- sb.append(", processOperation = ");
- sb.append(processOperation);
- sb.append(", processDate = ");
- sb.append(processDate);
+ sb.append(" (recording = " + recording);
+ sb.append(", processDestinationHost = " + processDestinationHost);
+ sb.append(", processSourceHost = " + processSourceHost);
+ sb.append(", processHeaders = " + processHeaders);
+ sb.append(", processEnvelope = " + processEnvelope);
+ sb.append(", processMessageType = " + processMessageType);
+ sb.append(", processOperation = " + processOperation);
+ sb.append(", processDate = " + processDate);
sb.append(")");
return sb.toString();
}
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AndFilter.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AndFilter.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/AndFilter.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -35,7 +35,6 @@
*/
public class AndFilter implements RecordFilter
{
-
private RecordFilter filter1;
private RecordFilter filter2;
@@ -60,4 +59,12 @@
return filter2;
}
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ AndFilter retObj = (AndFilter)super.clone();
+ retObj.filter1 = (RecordFilter)this.filter1.clone();
+ retObj.filter2 = (RecordFilter)this.filter2.clone();
+ return retObj;
+ }
}
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -75,4 +75,13 @@
{
return source;
}
+
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ HostFilter retObj = (HostFilter)super.clone();
+ retObj.hosts = new LinkedList<String>(this.hosts);
+ retObj.source = this.source;
+ return retObj;
+ }
}
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/LogRecorder.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -39,6 +39,11 @@
public class LogRecorder extends AbstractRecordProcessor
{
private Logger log = Logger.getLogger(this.getClass());
+
+ public LogRecorder()
+ {
+ this.name = "LogRecorder";
+ }
@Override
public void processRecord(Record record)
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/MemoryBufferRecorder.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -47,13 +47,16 @@
*/
public class MemoryBufferRecorder extends AbstractRecordProcessor implements
MemoryBufferRecorderMBean
{
-
private Map<String, List<Record>> recentRecords =
Collections.synchronizedMap(new HashMap<String, List<Record>>());
private ConcurrentLinkedQueue<String> recentRecordGroups = new
ConcurrentLinkedQueue<String>();
private int size = 0;
-
private int maxSize = 50;
+ public MemoryBufferRecorder()
+ {
+ this.name = "MemoryBufferRecorder";
+ }
+
@Override
public void processRecord(Record record)
{
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/NotFilter.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/NotFilter.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/NotFilter.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -35,22 +35,28 @@
*/
public class NotFilter implements RecordFilter
{
+ private RecordFilter filter;
- private RecordFilter filter;
-
public NotFilter(RecordFilter filter)
{
this.filter = filter;
}
-
+
public boolean match(Record record)
{
return !filter.match(record);
}
-
+
public RecordFilter getFilter()
{
return filter;
}
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ NotFilter retObj = (NotFilter)super.clone();
+ retObj.filter = (RecordFilter)this.filter.clone();
+ return retObj;
+ }
}
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -36,7 +36,6 @@
*/
public class OperationFilter implements RecordFilter
{
-
private QName operation;
public OperationFilter(QName operation)
@@ -72,4 +71,11 @@
return operation;
}
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ OperationFilter retObj = (OperationFilter)super.clone();
+ retObj.operation = this.operation;
+ return retObj;
+ }
}
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OrFilter.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OrFilter.java 2008-01-16
21:57:11 UTC (rev 5481)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OrFilter.java 2008-01-16
21:57:30 UTC (rev 5482)
@@ -35,7 +35,6 @@
*/
public class OrFilter implements RecordFilter
{
-
private RecordFilter filter1;
private RecordFilter filter2;
@@ -60,4 +59,12 @@
return filter2;
}
+ @Override
+ public Object clone() throws CloneNotSupportedException
+ {
+ OrFilter retObj = (OrFilter)super.clone();
+ retObj.filter1 = (RecordFilter)this.filter1.clone();
+ retObj.filter2 = (RecordFilter)this.filter2.clone();
+ return retObj;
+ }
}