You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2009/07/27 07:51:08 UTC

svn commit: r798028 - /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java

Author: hiranya
Date: Mon Jul 27 05:51:07 2009
New Revision: 798028

URL: http://svn.apache.org/viewvc?rev=798028&view=rev
Log:
Adding an abstract implementation of the SynapseObserver interface (as per the discussion on the mailing list). This abstract class implements
all the events/methods in the interface. Each event will be simply logged by this abstract class. It is recommended that custom extensions of Synapse always extend this abstarct class rather than trying to dirfectly implement the interface.


Added:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java?rev=798028&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/AbstractSynapseObserver.java Mon Jul 27 05:51:07 2009
@@ -0,0 +1,98 @@
+/*
+ *  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.
+ */
+
+package org.apache.synapse.config;
+
+import org.apache.synapse.Mediator;
+import org.apache.synapse.Startup;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.eventing.SynapseEventSource;
+import org.apache.synapse.core.axis2.ProxyService;
+import org.apache.synapse.endpoints.Endpoint;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class AbstractSynapseObserver implements SynapseObserver {
+
+    protected Log log;
+
+    public AbstractSynapseObserver() {
+        log = LogFactory.getLog(this.getClass()); 
+    }
+
+    public void sequenceAdded(Mediator sequence) {
+        log.info("Sequence : " + ((SequenceMediator) sequence).getName() + " was added " +
+                "to the Synapse configuration successfully" );
+    }
+
+    public void sequenceRemoved(Mediator sequence) {
+        log.info("Sequence : " + ((SequenceMediator) sequence).getName() + " was  removed " +
+                "from the Synapse configuration successfully");
+    }
+
+    public void entryAdded(Entry entry) {
+        log.info("Local entry : " + entry.getKey() + " was added " +
+                "to the Synapse configuration successfully");
+    }
+
+    public void entryRemoved(Entry entry) {
+        log.info("Local entry : " + entry.getKey() + " was removed " +
+                "from the Synapse configuration successfully");
+    }
+
+    public void endpointAdded(Endpoint endpoint) {
+        log.info("Endpoint : " + endpoint.getName() + " was added " +
+                "to the Synapse configuration successfully");
+    }
+
+    public void endpointRemoved(Endpoint endpoint) {
+        log.info("Endpoint : " + endpoint.getName() + " was removed " +
+                "from the Synapse configuration successfully");
+    }
+
+    public void proxyServiceAdded(ProxyService proxy) {
+        log.info("Proxy service : " + proxy.getName() + " was added " +
+                "to the Synapse configuration successfully");
+    }
+
+    public void proxyServiceRemoved(ProxyService proxy) {
+        log.info("Proxy service : " + proxy.getName() + " was removed " +
+                "from the Synapse configuration successfully");
+    }
+
+    public void startupAdded(Startup startup) {
+        log.info("Startup : " + startup.getName() + " was added " +
+                "to the Synapse configuration successfully");
+    }
+
+    public void startupRemoved(Startup startup) {
+        log.info("Startup : " + startup.getName() + " was removed " +
+                "from the Synapse configuration successfully");
+    }
+
+    public void eventSourceAdded(SynapseEventSource eventSource) {
+        log.info("Event source : " + eventSource.getName() + " was added " +
+                "to the Synapse configuration successfully");
+    }
+
+    public void eventSourceRemoved(SynapseEventSource eventSource) {
+        log.info("Event source : " + eventSource.getName() + " was removed " +
+                "from the Synapse configuration successfully");
+    }
+}