Author: alessio.soldano(a)jboss.com
Date: 2007-12-11 08:53:37 -0500 (Tue, 11 Dec 2007)
New Revision: 5255
Added:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
Modified:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java
Log:
Filters
Modified:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java
===================================================================
---
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java 2007-12-11
12:37:52 UTC (rev 5254)
+++
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java 2007-12-11
13:53:37 UTC (rev 5255)
@@ -22,6 +22,7 @@
package org.jboss.wsf.framework.deployment;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.Vector;
@@ -37,6 +38,7 @@
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.recording.Record;
+import org.jboss.wsf.spi.management.recording.RecordFilter;
import org.jboss.wsf.spi.management.recording.RecordProcessor;
/**
@@ -276,7 +278,18 @@
{
for (RecordProcessor processor : recordProcessors)
{
- processor.processRecord(record);
+ boolean match = true;
+ if (processor.getFilters() != null)
+ {
+ for (Iterator<RecordFilter> it = processor.getFilters().iterator();
it.hasNext() && match;)
+ {
+ match = it.next().match(record);
+ }
+ }
+ if (match)
+ {
+ processor.processRecord(record);
+ }
}
}
}
Added:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
===================================================================
---
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
(rev 0)
+++
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java 2007-12-11
13:53:37 UTC (rev 5255)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.framework.management.recording;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.wsf.spi.management.recording.Record;
+import org.jboss.wsf.spi.management.recording.RecordFilter;
+
+/**
+ * This filter matches record having the source/destination host equal to
+ * any of the provided hosts.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 11-Dec-2007
+ */
+public class HostFilter implements RecordFilter
+{
+ private List<String> hosts = new LinkedList<String>();
+ private boolean source;
+
+ public HostFilter(String host, boolean source)
+ {
+ this.hosts.add(host);
+ this.source = source;
+ }
+
+ public HostFilter(Collection<String> hosts, boolean source)
+ {
+ this.hosts.addAll(hosts);
+ this.source = source;
+ }
+
+ public boolean match(Record record)
+ {
+ for (String host : hosts)
+ {
+ if ((source && host.equalsIgnoreCase(record.getSourceHost())) ||
(!source && host.equalsIgnoreCase(record.getDestinationHost())))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Property changes on:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/HostFilter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
===================================================================
---
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
(rev 0)
+++
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java 2007-12-11
13:53:37 UTC (rev 5255)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.framework.management.recording;
+
+//$Id$
+
+import javax.xml.namespace.QName;
+
+import org.jboss.wsf.spi.management.recording.Record;
+import org.jboss.wsf.spi.management.recording.RecordFilter;
+
+/**
+ * This filter matches record having a given operation QName value.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 11-Dec-2007
+ */
+public class OperationFilter implements RecordFilter
+{
+
+ private QName operation;
+
+ public OperationFilter(QName operation)
+ {
+ this.operation = operation;
+ }
+
+ public boolean match(Record record)
+ {
+ if (record != null)
+ {
+ if (record.getOperation() == null && operation == null)
+ {
+ return true;
+ }
+ else if (operation != null && operation.equals(record.getOperation()))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+}
Property changes on:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/management/recording/OperationFilter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF