[sci-flex commit] r418 - plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper...

3 views
Skip to first unread message

codesite...@google.com

unread,
Jan 24, 2009, 5:30:00 PM1/24/09
to sci-fl...@googlegroups.com
Author: senakafdo
Date: Sat Jan 24 13:34:02 2009
New Revision: 418

Added:
sci-flex/trunk/java/demo/conf/
sci-flex/trunk/java/demo/conf/synapse.xml
Modified:

plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/AxiomMediator.java

plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/SynapseEsperMediator.java

plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/XMLMediator.java

Log:
Adding fixes needed by demo application.


Modified:
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/AxiomMediator.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/AxiomMediator.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/AxiomMediator.java
Sat Jan 24 13:34:02 2009
@@ -129,6 +129,11 @@
private String alias = null;

/**
+ * Whether inactive at start
+ */
+ private boolean inactive = false;
+
+ /**
* Object used to control access to {@link #getProvider}. Please
* note that the {@link #mediate} method is calling getProvider()
* without using this lock, for achieving higher concurrency levels
@@ -348,6 +353,14 @@
}

/**
+ * Sets the mediator as inactive at the beginning.
+ * @param state whether inactive or not.
+ */
+ public void setInactive(boolean state) {
+ inactive = state;
+ }
+
+ /**
* Gets an EPServiceProvider based on Mediator configuration details.
* @return EPServiceProvider instance.
*/
@@ -500,7 +513,12 @@
if (activityMonitor == null) {
log.debug("Enabling Mediator Activity");
activityMonitor = new MediatorActivityMonitor(this);
- activityMonitor.startMediator();
+ if (!inactive) {
+ activityMonitor.startMediator();
+ } else {
+ activityMonitor.startMediator();
+ activityMonitor.stopMediator();
+ }
}
componentStore = new AdminComponentStore(this);

componentStore.addUniquelyIdentifiableChild((UniquelyIdentifiableChild)statMonitor);

Modified:
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/SynapseEsperMediator.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/SynapseEsperMediator.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/SynapseEsperMediator.java
Sat Jan 24 13:34:02 2009
@@ -93,6 +93,12 @@
public void setStatement(OMElement epl);

/**
+ * Sets the mediator as inactive at the beginning.
+ * @param state whether inactive or not.
+ */
+ public void setInactive(boolean state);
+
+ /**
* Sets the EPL Statement.
* @param epl the EPL Statement.
*/

Modified:
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/XMLMediator.java
==============================================================================
---
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/XMLMediator.java
(original)
+++
plugins/synapse/esper/trunk/java/mediators/src/main/java/org/sciflex/plugins/synapse/esper/mediators/XMLMediator.java
Sat Jan 24 13:34:02 2009
@@ -122,6 +122,11 @@
private String alias = null;

/**
+ * Whether inactive at start
+ */
+ private boolean inactive = false;
+
+ /**
* Object used to control access to {@link #getProvider}. Please
* note that the {@link #mediate} method is calling getProvider()
* without using this lock, for achieving higher concurrency levels
@@ -327,6 +332,14 @@
}

/**
+ * Sets the mediator as inactive at the beginning.
+ * @param state whether inactive or not.
+ */
+ public void setInactive(boolean state) {
+ inactive = state;
+ }
+
+ /**
* Gets an EPServiceProvider based on Mediator configuration details.
* @return EPServiceProvider instance.
*/
@@ -462,7 +475,12 @@
if (activityMonitor == null) {
log.debug("Enabling Mediator Activity");
activityMonitor = new MediatorActivityMonitor(this);
- activityMonitor.startMediator();
+ if (!inactive) {
+ activityMonitor.startMediator();
+ } else {
+ activityMonitor.startMediator();
+ activityMonitor.stopMediator();
+ }
}
componentStore = new AdminComponentStore(this);

componentStore.addUniquelyIdentifiableChild((UniquelyIdentifiableChild)statMonitor);

Added: sci-flex/trunk/java/demo/conf/synapse.xml
==============================================================================
--- (empty file)
+++ sci-flex/trunk/java/demo/conf/synapse.xml Sat Jan 24 13:34:02 2009
@@ -0,0 +1,105 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <sequence name="main">
+ <in>
+ <filter source="get-property('To')" regex="/">
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="Configuration">
+ <esper-configuration
xmlns="http://www.espertech.com/schema/esper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+ <event-type alias="packets">
+ <xml-dom root-element-name="packet">
+ <xpath-property property-name="version"
xpath="//packet/version" type="string"/>
+ <xpath-property property-name="protocol"
xpath="//packet/protocol" type="string"/>
+ <xpath-property property-name="length"
xpath="//packet/length" type="string"/>
+ <xpath-property property-name="date"
xpath="//packet/timestamp/@date" type="string"/>
+ <xpath-property property-name="time"
xpath="//packet/timestamp/@time" type="string"/>
+ <xpath-property property-name="fid"
xpath="//packet/fragment/@id" type="string"/>
+ <xpath-property property-name="foffset"
xpath="//packet/fragment/@offset" type="string"/>
+ <xpath-property property-name="flags"
xpath="//packet/fragment/@flags" type="string"/>
+ <xpath-property property-name="sip"
xpath="//packet/source/@ip" type="string"/>
+ <xpath-property property-name="sport"
xpath="//packet/source/@port" type="string"/>
+ <xpath-property property-name="dip"
xpath="//packet/destination/@ip" type="string"/>
+ <xpath-property property-name="dport"
xpath="//packet/destination/@port" type="string"/>
+ <xpath-property property-name="tos"
xpath="//packet/extra/@tos" type="string"/>
+ <xpath-property property-name="ttl"
xpath="//packet/extra/@ttl" type="string"/>
+ <xpath-property property-name="type"
xpath="//packet/@type" type="string"/>
+ <xpath-property property-name="vlan"
xpath="//packet/@vlan" type="string"/>
+ <xpath-property property-name="extra"
xpath="//packet/extra/@information" type="string"/>
+ </xml-dom>
+ </event-type>
+ </esper-configuration>
+ </property>
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select sip from
packets where version = '4' output last every 100 events"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select sip from
packets where sip = '192.248.8.248' and sport = '1316'"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select sip from
packets where fid = '10000' and dport = 'ssh'"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select dip from
packets where time = '22:25:43.189253'"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select * from
packets"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ <property name="Inactive" value="true"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select * from
packets"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ <property name="Inactive" value="true"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select * from
packets"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ <property name="Inactive" value="true"/>
+ </class>
+ <class
name="org.sciflex.plugins.synapse.esper.mediators.XMLMediator">
+ <property name="InstanceURI" value="urn:CEPInstance"/>
+ <property name="Statement" value="select * from
packets"/>
+ <property name="EventToAddress"
value="urn:trafficInformation"/>
+ <property name="Inactive" value="true"/>
+ </class>
+ </filter>
+ </in>
+ <log level="full"/>
+ <out>
+ <property action="set" name="OUT_ONLY" value="true"/>
+ <send>
+ <endpoint>
+ <address
uri="mailto:sci...@gmail.com?subject=SCI-Flex%20Alert"/>
+ </endpoint>
+ </send>
+ </out>
+ </sequence>
+</definitions>

Reply all
Reply to author
Forward
0 new messages