directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: rev 37349 - in incubator/directory/eve/trunk/frontend/geronimo: . src src/java src/java/org src/java/org/apache src/java/org/apache/eve src/java/org/apache/eve/geronimo src/test src/test-data
Date Thu, 02 Sep 2004 02:32:31 GMT
Author: adc
Date: Wed Sep  1 19:32:30 2004
New Revision: 37349

Added:
   incubator/directory/eve/trunk/frontend/geronimo/
   incubator/directory/eve/trunk/frontend/geronimo/maven.xml
   incubator/directory/eve/trunk/frontend/geronimo/project.xml
   incubator/directory/eve/trunk/frontend/geronimo/src/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveBufferPoolGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveDecoderManagerGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEncoderManagerGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEventRouterGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveInputManagerGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveOutputManagerGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveRequestProcessorGBean.java
   incubator/directory/eve/trunk/frontend/geronimo/src/test/
   incubator/directory/eve/trunk/frontend/geronimo/src/test-data/
   incubator/directory/eve/trunk/frontend/geronimo/src/test-data/ldap-plan.xml
Log:
Transliteration of the Merlin code.  Should probably aggregate the POJOs into a single GBean.

Checked in per AOK's request.

Added: incubator/directory/eve/trunk/frontend/geronimo/maven.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/maven.xml	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> 
+  
+<project 
+  default="buildall" 
+  xmlns:j="jelly:core" 
+  xmlns:u="jelly:util" 
+  xmlns:ant="jelly:ant" 
+  xmlns:maven="jelly:maven" 
+  xmlns:deploy="deploy"
+  >
+
+</project>

Added: incubator/directory/eve/trunk/frontend/geronimo/project.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/project.xml	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <extend>${basedir}/../../project.xml</extend>
+  <groupId>incubator-directory</groupId>
+  <id>eve-frontend-geronimo</id>
+
+  <name>Eve Frontend Geronimo Implementation</name>
+  <package>org.apache.eve</package>
+  <currentVersion>SNAPSHOT</currentVersion>
+  <inceptionYear>2004</inceptionYear>
+      
+  <shortDescription>Eve Frontend Geronimo Implementation</shortDescription>
+
+  <description>
+    Contains the Geronimo GBean wrappers.
+  </description>
+
+  <dependencies>
+
+    <!-- =============================================================== -->
+    <!--               G E R O N I M O   D E N D E N C I E S             -->
+    <!-- =============================================================== -->
+      
+    <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-kernel</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <url>http://geronimo.apache.org/modules/kernel/index.html</url>
+    </dependency>
+
+    <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-core</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <url>http://geronimo.apache.org/modules/core/index.html</url>
+    </dependency>
+
+    <!-- =============================================================== -->
+    <!--               C O M M O N S   D E N D E N C I E S               -->
+    <!-- =============================================================== -->
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.3</version>
+      <url>http://jakarta.apache.org/commons/logging</url>
+    </dependency>
+    
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>SNAPSHOT</version>
+      <url>http://jakarta.apache.org/commons/codec</url>
+    </dependency>
+
+    <!-- =============================================================== -->
+    <!--                  O T H E R   D E N D E N C I E S                -->
+    <!-- =============================================================== -->
+      
+
+    <!-- =============================================================== -->
+    <!--              D I R E C T O R Y   D E N D E N C I E S            -->
+    <!-- =============================================================== -->
+
+    <dependency>
+      <groupId>incubator-directory</groupId>
+      <artifactId>ldap-common</artifactId>
+      <version>SNAPSHOT</version>
+      <url>http://incubator.apache.org/directory/subprojects/ldap/common</url>
+    </dependency>
+
+    <dependency>
+      <groupId>incubator-directory</groupId>
+      <artifactId>eve-frontend-api</artifactId>
+      <version>SNAPSHOT</version>
+      <url>http://incubator.apache.org/directory/subprojects/eve/frontend</url>
+    </dependency>
+
+    <dependency>
+      <groupId>incubator-directory</groupId>
+      <artifactId>eve-frontend-impl</artifactId>
+      <version>SNAPSHOT</version>
+      <url>http://incubator.apache.org/directory/subprojects/eve/frontend</url>
+    </dependency>
+
+    <dependency>
+      <groupId>incubator-directory</groupId>
+      <artifactId>codec-stateful</artifactId>
+      <version>SNAPSHOT</version>
+      <url>http://incubator.apache.org/directory/subprojects/ldap/common</url>
+    </dependency>
+
+    <dependency>
+      <groupId>incubator-directory</groupId>
+      <artifactId>snickers-ber-codec</artifactId>
+      <version>SNAPSHOT</version>
+      <url>
+        http://incubator.apache.org/directory/subprojects/snickers/ber/api
+      </url>
+    </dependency>
+
+  </dependencies>
+      
+</project>
+

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveBufferPoolGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveBufferPoolGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,186 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import java.nio.ByteBuffer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.ResourceException;
+import org.apache.eve.buffer.BufferPool;
+import org.apache.eve.buffer.BufferPoolConfig;
+import org.apache.eve.buffer.DefaultBufferPool;
+import org.apache.eve.buffer.DefaultBufferPoolConfig;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+
+
+/**
+ * A Geronimo Buffer Pool service.
+ *
+ * @version $Revision: $ $Date: $
+ */
+public class EveBufferPoolGBean implements BufferPool, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveBufferPoolGBean.class);
+
+    /**
+     * the name
+     */
+    private String bufferName;
+
+    /**
+     * the growth increment
+     */
+    private int increment = 0;
+
+    /**
+     * the maximum pool size
+     */
+    private int maxSize = 0;
+
+    /**
+     * the initial pool size
+     */
+    private int initialSize = 0;
+
+    /**
+     * the size of the buffers pooled
+     */
+    private int size = 0;
+
+    /**
+     * the buffer pool
+     */
+    private DefaultBufferPool bufferPool = null;
+
+
+    public String getBufferName() {
+        return bufferName;
+    }
+
+    public void setBufferName(String bufferName) {
+        this.bufferName = bufferName;
+    }
+
+    public int getIncrement() {
+        return increment;
+    }
+
+    public void setIncrement(int increment) {
+        this.increment = increment;
+    }
+
+    public int getMaxSize() {
+        return maxSize;
+    }
+
+    public void setMaxSize(int maxSize) {
+        this.maxSize = maxSize;
+    }
+
+    public int getInitialSize() {
+        return initialSize;
+    }
+
+    public void setInitialSize(int initialSize) {
+        this.initialSize = initialSize;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        BufferPoolConfig config = new DefaultBufferPoolConfig(bufferName, increment, maxSize, initialSize, size);
+        bufferPool = new DefaultBufferPool(config);
+        log.info("Started " + bufferName);
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        bufferPool = null;
+        log.info("Stopped " + bufferName);
+    }
+
+    public void doFail() {
+        bufferPool = null;
+        log.info("Failed " + bufferName);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveBufferPoolGBean.class);
+
+        infoFactory.addAttribute("bufferName", String.class, true);
+        infoFactory.addAttribute("increment", int.class, true);
+        infoFactory.addAttribute("maxSize", int.class, true);
+        infoFactory.addAttribute("initialSize", int.class, true);
+        infoFactory.addAttribute("size", int.class, true);
+
+        infoFactory.addInterface(BufferPool.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public ByteBuffer getBuffer(Object party) throws ResourceException {
+        return bufferPool.getBuffer(party);
+    }
+
+    public void claimInterest(ByteBuffer buffer, Object party) {
+        bufferPool.claimInterest(buffer, party);
+    }
+
+    public void releaseClaim(ByteBuffer buffer, Object party) {
+        bufferPool.releaseClaim(buffer, party);
+    }
+
+    public BufferPoolConfig getConfig() {
+        return bufferPool.getConfig();
+    }
+
+    public int getInterestedCount(ByteBuffer buffer) {
+        return bufferPool.getInterestedCount(buffer);
+    }
+
+    public int getFreeCount() {
+        return bufferPool.getFreeCount();
+    }
+
+    public int getInUseCount() {
+        return bufferPool.getInUseCount();
+    }
+
+    public int size() {
+        return bufferPool.size();
+    }
+
+    public String getName() {
+        return bufferPool.getName();
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveDecoderManagerGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveDecoderManagerGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,179 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import java.nio.ByteBuffer;
+import java.util.EventObject;
+
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.DecoderCallback;
+import org.apache.commons.codec.stateful.DecoderMonitor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.decoder.DecodeStageHandler;
+import org.apache.eve.decoder.DecoderManager;
+import org.apache.eve.decoder.DecoderManagerMonitor;
+import org.apache.eve.decoder.DefaultDecoderManager;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.event.Subscriber;
+import org.apache.eve.listener.ClientKey;
+import org.apache.eve.seda.DefaultStageConfig;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.pool.ThreadPool;
+
+
+/**
+ * A Geronimo Decoder Manager service.
+ *
+ * @version $Revision: $ $Date: $
+ */
+public class EveDecoderManagerGBean implements DecoderManager, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveDecoderManagerGBean.class);
+
+    /**
+     * the name of this Stage
+     */
+    private String decoderManagerName;
+
+    /**
+     * the thread pool used for this Stages workers
+     */
+    private ThreadPool threadPool;
+
+    /**
+     * the event eventRouter we depend on to recieve and publish events
+     */
+    private EventRouter eventRouter = null;
+
+    /**
+     * underlying wrapped DecoderManager implementation
+     */
+    private DefaultDecoderManager decoderManager = null;
+
+
+    public String getDecoderManagerName() {
+        return decoderManagerName;
+    }
+
+    public void setDecoderManagerName(String decoderManagerName) {
+        this.decoderManagerName = decoderManagerName;
+    }
+
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    public void setThreadPool(ThreadPool threadPool) {
+        this.threadPool = threadPool;
+    }
+
+    public EventRouter getEventRouter() {
+        return eventRouter;
+    }
+
+    public void setEventRouter(EventRouter eventRouter) {
+        this.eventRouter = eventRouter;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        DefaultStageConfig stageConfig = new DefaultStageConfig(decoderManagerName,
+                new org.apache.eve.thread.ThreadPool() {
+                    public void execute(Runnable command) {
+                        try {
+                            threadPool.execute(command);
+                        } catch (InterruptedException e) {
+                            // DO NOTHING
+                        }
+                    }
+                });
+        decoderManager = new DefaultDecoderManager(eventRouter, stageConfig);
+        DecodeStageHandler handler = new DecodeStageHandler(decoderManager);
+        stageConfig.setHandler(handler);
+        decoderManager.setMonitor(new Monitor());
+        decoderManager.start();
+
+        log.info("Started " + decoderManagerName);
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        decoderManager.stop();
+        decoderManager = null;
+
+        log.info("Stopped " + decoderManagerName);
+    }
+
+    public void doFail() {
+        decoderManager = null;
+        log.info("Failed " + decoderManagerName);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveDecoderManagerGBean.class);
+
+        infoFactory.addAttribute("decoderManagerName", String.class, true);
+
+        infoFactory.addReference("ThreadPool", ThreadPool.class);
+        infoFactory.addReference("EventRouter", EventRouter.class);
+
+        infoFactory.addInterface(DecoderManager.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public void setCallback(ClientKey key, DecoderCallback cb) {
+        decoderManager.setCallback(key, cb);
+    }
+
+    public void setDecoderMonitor(ClientKey key, DecoderMonitor monitor) {
+        decoderManager.setDecoderMonitor(key, monitor);
+    }
+
+    public boolean disable(ClientKey key) {
+        return decoderManager.disable(key);
+    }
+
+    public void decode(ClientKey key, ByteBuffer buffer) throws DecoderException {
+        decoderManager.decode(key, buffer);
+    }
+
+    public Object decode(ByteBuffer buffer) throws DecoderException {
+        return decoderManager.decode(buffer);
+    }
+
+    /**
+     * StageMonitor that uses this module's logger.
+     */
+    class Monitor implements DecoderManagerMonitor {
+
+        public void failedOnInform(Subscriber subscriber, EventObject event, Throwable t) {
+            log.debug("Failed to invoke the appropriate inform method"
+                    + " for event " + event + " on subscriber " + subscriber
+                    + ":\n" + t);
+        }
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEncoderManagerGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEncoderManagerGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,140 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import org.apache.commons.codec.EncoderException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.encoder.EncoderManager;
+import org.apache.eve.encoder.DefaultEncoderManager;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.seda.DefaultStageConfig;
+import org.apache.eve.decoder.DefaultDecoderManager;
+import org.apache.eve.decoder.DecodeStageHandler;
+import org.apache.ldap.common.message.Response;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.pool.ThreadPool;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class EveEncoderManagerGBean implements EncoderManager, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveEncoderManagerGBean.class);
+
+    /**
+     * the name of this Stage
+     */
+    private String encoderManagerName;
+
+    /**
+     * the thread pool used for this Stages workers
+     */
+    private ThreadPool threadPool;
+
+    /**
+     * the event eventRouter we depend on to recieve and publish events
+     */
+    private EventRouter eventRouter = null;
+
+    /**
+     * underlying wrapped EncoderManager implementation
+     */
+    private DefaultEncoderManager encoderManager = null;
+
+
+    public String getEncoderManagerName() {
+        return encoderManagerName;
+    }
+
+    public void setEncoderManagerName(String encoderManagerName) {
+        this.encoderManagerName = encoderManagerName;
+    }
+
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    public void setThreadPool(ThreadPool threadPool) {
+        this.threadPool = threadPool;
+    }
+
+    public EventRouter getEventRouter() {
+        return eventRouter;
+    }
+
+    public void setEventRouter(EventRouter eventRouter) {
+        this.eventRouter = eventRouter;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        DefaultStageConfig stageConfig = new DefaultStageConfig(encoderManagerName,
+                new org.apache.eve.thread.ThreadPool() {
+                    public void execute(Runnable command) {
+                        try {
+                            threadPool.execute(command);
+                        } catch (InterruptedException e) {
+                            // DO NOTHING
+                        }
+                    }
+                });
+        encoderManager = new DefaultEncoderManager(eventRouter, stageConfig);
+        encoderManager.start();
+
+        log.info("Started " + encoderManagerName);
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        encoderManager.stop();
+        encoderManager = null;
+
+        log.info("Stopped " + encoderManagerName);
+    }
+
+    public void doFail() {
+        encoderManager = null;
+        log.info("Failed " + encoderManagerName);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveEncoderManagerGBean.class);
+
+        infoFactory.addAttribute("encoderManagerName", String.class, true);
+
+        infoFactory.addReference("ThreadPool", ThreadPool.class);
+        infoFactory.addReference("EventRouter", EventRouter.class);
+
+        infoFactory.addInterface(EncoderManager.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public byte[] encode(Response response) throws EncoderException {
+        return encoderManager.encode(response);
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEventRouterGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveEventRouterGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,127 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import java.util.EventObject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.event.DefaultEventRouter;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.event.EventRouterMonitor;
+import org.apache.eve.event.Filter;
+import org.apache.eve.event.Subscriber;
+import org.apache.eve.event.Subscription;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class EveEventRouterGBean implements EventRouter, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveEventRouterGBean.class);
+
+    /**
+     * the default EventRouter implementation we wrap
+     */
+    private DefaultEventRouter eventRouter;
+
+    public void doStart() throws WaitingException, Exception {
+        eventRouter = new DefaultEventRouter();
+        eventRouter.setMonitor(new Monitor());
+        log.info("Started");
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        log.info("Stopped");
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveEventRouterGBean.class);
+
+        infoFactory.addInterface(EventRouter.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public void subscribe(Class type, Filter filter, Subscriber subscriber) {
+        eventRouter.subscribe(type, filter, subscriber);
+    }
+
+    public void subscribe(Class type, Subscriber subscriber) {
+        eventRouter.subscribe(type, subscriber);
+    }
+
+    public void unsubscribe(Subscriber subscriber) {
+        eventRouter.unsubscribe(subscriber);
+    }
+
+    public void unsubscribe(Class type, Subscriber subscriber) {
+        eventRouter.unsubscribe(type, subscriber);
+    }
+
+    public void publish(EventObject event) {
+        eventRouter.publish(event);
+    }
+
+    /**
+     * EventRouterMonitor that uses this module's logger.
+     */
+    class Monitor implements EventRouterMonitor {
+
+        /* (non-Javadoc)
+         * @see org.apache.eve.event.EventRouterMonitor#eventPublished(
+         * java.util.EventObject)
+         */
+        public void eventPublished(EventObject event) {
+            log.debug("published event: " + event);
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.apache.eve.event.EventRouterMonitor#addedSubscription(
+         * org.apache.eve.event.Subscription)
+         */
+        public void addedSubscription(Subscription subscription) {
+            log.debug("added subscription: " + subscription);
+        }
+
+
+        /* (non-Javadoc)
+         * @see org.apache.eve.event.EventRouterMonitor#removedSubscription(
+         * org.apache.eve.event.Subscription)
+         */
+        public void removedSubscription(Subscription subscription) {
+            log.debug("removed subscription: " + subscription);
+        }
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveInputManagerGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveInputManagerGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,232 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.ResourceException;
+import org.apache.eve.buffer.BufferPool;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.input.DefaultInputManager;
+import org.apache.eve.input.InputManager;
+import org.apache.eve.input.InputManagerMonitor;
+import org.apache.eve.listener.ClientKey;
+import org.apache.eve.listener.KeyExpiryException;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.pool.ThreadPool;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class EveInputManagerGBean implements InputManager, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveInputManagerGBean.class);
+
+    /**
+     * the thread manager we get thread pools from
+     */
+    private ThreadPool threadPool = null;
+
+    /**
+     * the buffer pool to get buffers from
+     */
+    private BufferPool bufferPool = null;
+
+    /**
+     * event router used to decouple source to sink relationships
+     */
+    private EventRouter eventRouter = null;
+
+    /**
+     * selector used to select a ready socket channel
+     */
+    private Selector selector = null;
+
+    /**
+     * the wrapped input manager implementation
+     */
+    private DefaultInputManager inputManager = null;
+
+    
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    public void setThreadPool(ThreadPool threadPool) {
+        this.threadPool = threadPool;
+    }
+
+    public BufferPool getBufferPool() {
+        return bufferPool;
+    }
+
+    public void setBufferPool(BufferPool bufferPool) {
+        this.bufferPool = bufferPool;
+    }
+
+    public EventRouter getEventRouter() {
+        return eventRouter;
+    }
+
+    public void setEventRouter(EventRouter eventRouter) {
+        this.eventRouter = eventRouter;
+    }
+
+    public Selector getSelector() {
+        return selector;
+    }
+
+    public void setSelector(Selector selector) {
+        this.selector = selector;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        inputManager = new DefaultInputManager(eventRouter, bufferPool);
+        inputManager.setMonitor(new Monitor());
+        log.info("Started");
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        inputManager.stop();
+        log.info("Stopped");
+    }
+
+    public void doFail() {
+        log.info("Failed");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveInputManagerGBean.class);
+
+        infoFactory.addReference("ThreadPool", ThreadPool.class);
+        infoFactory.addReference("BufferPool", BufferPool.class);
+        infoFactory.addReference("EventRouter", EventRouter.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    private class Monitor implements InputManagerMonitor {
+
+        public void bufferUnavailable(BufferPool bp, ResourceException fault) {
+            if (log.isErrorEnabled()) {
+                log.error("Failed to acquire buffer resource from buffer pool " + bp, fault);
+            }
+        }
+
+        public void channelCloseFailure(SocketChannel channel, IOException fault) {
+            if (log.isErrorEnabled()) {
+                log.error("Could not properly close socket channel " + channel, fault);
+            }
+        }
+
+        public void channelRegistrationFailure(Selector selector, SocketChannel channel, int key, IOException fault) {
+            if (log.isErrorEnabled()) {
+                log.error("Could not register socket channel " + channel + " for selector " + selector + " using selection key mode " + key, fault);
+            }
+        }
+
+        public void disconnectedClient(ClientKey key) {
+            if (log.isInfoEnabled()) {
+                log.info("Disconnected client with key: " + key);
+            }
+        }
+
+        public void enteringSelect(Selector selector) {
+            if (log.isDebugEnabled()) {
+                log.debug("About to enter select() on selector " + selector);
+            }
+        }
+
+        public void inputRecieved(ClientKey key) {
+            if (log.isDebugEnabled()) {
+                log.debug("Got some input from " + key);
+            }
+        }
+
+        public void keyExpiryFailure(ClientKey key, KeyExpiryException fault) {
+            if (log.isInfoEnabled()) {
+                log.info("While working with client key " + key + " it was prematurely expired!", fault);
+            }
+        }
+
+        public void readFailed(ClientKey key, IOException fault) {
+            if (log.isErrorEnabled()) {
+                log.error("Encountered failure while reading from " + key, fault);
+            }
+        }
+
+        public void registeredChannel(ClientKey key, Selector selector) {
+            if (log.isDebugEnabled()) {
+                log.debug("Succeeded in registering " + key + " with selector " + selector);
+            }
+        }
+
+        public void selectFailure(Selector selector, IOException fault) {
+            if (log.isErrorEnabled()) {
+                log.error("Failed on select() of selector " + selector, fault);
+            }
+        }
+
+        public void selectorReturned(Selector selector) {
+            if (log.isDebugEnabled()) {
+                log.debug("Select on " + selector + " returned");
+            }
+        }
+
+        public void selectTimedOut(Selector selector) {
+            if (log.isWarnEnabled()) {
+                log.warn("Select on " + selector + " timed out");
+            }
+        }
+
+        public void inputRecieved(ByteBuffer buffer, ClientKey key) {
+            if (log.isDebugEnabled()) {
+                log.debug("Recieved input [" + toHexString(buffer) + "] from client " + key);
+            }
+        }
+
+        public void cleanedStaleKey(SelectionKey key) {
+            if (log.isWarnEnabled()) {
+                log.warn("Cleaning up stale connection key for client: " + key.attachment());
+            }
+        }
+
+        public String toHexString(ByteBuffer buf) {
+            byte[] l_bites = new byte[buf.remaining()];
+            buf.get(l_bites);
+            return new String(l_bites);
+        }
+
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveOutputManagerGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveOutputManagerGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,135 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.listener.ClientKey;
+import org.apache.eve.output.DefaultOutputManager;
+import org.apache.eve.output.OutputManager;
+import org.apache.eve.seda.DefaultStageConfig;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.pool.ThreadPool;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class EveOutputManagerGBean implements OutputManager, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveOutputManagerGBean.class);
+
+    /**
+     * the name
+     */
+    private String stageName;
+
+    /**
+     * the thread manager we get thread pools from
+     */
+    private ThreadPool threadPool = null;
+
+    /**
+     * the event eventRouter we depend on to recieve and publish events
+     */
+    private EventRouter eventRouter = null;
+
+    /**
+     * underlying wrapped OutputManager implementation
+     */
+    private DefaultOutputManager outputManager = null;
+
+
+    public String getStageName() {
+        return stageName;
+    }
+
+    public void setStageName(String stageName) {
+        this.stageName = stageName;
+    }
+
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    public void setThreadPool(ThreadPool threadPool) {
+        this.threadPool = threadPool;
+    }
+
+    public EventRouter getEventRouter() {
+        return eventRouter;
+    }
+
+    public void setEventRouter(EventRouter eventRouter) {
+        this.eventRouter = eventRouter;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        DefaultStageConfig stageConfig = new DefaultStageConfig(stageName,
+                new org.apache.eve.thread.ThreadPool() {
+                    public void execute(Runnable command) {
+                        try {
+                            threadPool.execute(command);
+                        } catch (InterruptedException e) {
+                            // DO NOTHING
+                        }
+                    }
+                });
+        outputManager = new DefaultOutputManager(eventRouter, stageConfig);
+        outputManager.start();
+        log.info("Started " + stageName);
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        outputManager.stop();
+        log.info("Stopped " + stageName);
+    }
+
+    public void doFail() {
+        log.info("Failed " + stageName);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveOutputManagerGBean.class);
+
+        infoFactory.addAttribute("stageName", String.class, true);
+        infoFactory.addReference("ThreadPool", ThreadPool.class);
+        infoFactory.addReference("EventRouter", EventRouter.class);
+
+        infoFactory.addInterface(OutputManager.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public void write(ClientKey key, ByteBuffer buf) throws IOException {
+        outputManager.write(key, buf);
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveRequestProcessorGBean.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/java/org/apache/eve/geronimo/EveRequestProcessorGBean.java	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,130 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.eve.geronimo;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.processor.DefaultHandlerRegistry;
+import org.apache.eve.processor.DefaultRequestProcessor;
+import org.apache.eve.processor.RequestProcessor;
+import org.apache.eve.seda.DefaultStageConfig;
+import org.apache.eve.seda.LoggingStageMonitor;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.pool.ThreadPool;
+
+
+/**
+ * @version $Revision: $ $Date: $
+ */
+public class EveRequestProcessorGBean implements RequestProcessor, GBeanLifecycle {
+
+    private final Log log = LogFactory.getLog(EveRequestProcessorGBean.class);
+
+    /**
+     * the name
+     */
+    private String stageName;
+
+    /**
+     * the thread manager we get thread pools from
+     */
+    private ThreadPool threadPool = null;
+
+    /**
+     * the event eventRouter we depend on to recieve and publish events
+     */
+    private EventRouter eventRouter = null;
+
+    /**
+     * underlying wrapped RequestProcessor implementation
+     */
+    private DefaultRequestProcessor requestProcessor = null;
+
+    
+    public String getStageName() {
+        return stageName;
+    }
+
+    public void setStageName(String stageName) {
+        this.stageName = stageName;
+    }
+
+    public ThreadPool getThreadPool() {
+        return threadPool;
+    }
+
+    public void setThreadPool(ThreadPool threadPool) {
+        this.threadPool = threadPool;
+    }
+
+    public EventRouter getEventRouter() {
+        return eventRouter;
+    }
+
+    public void setEventRouter(EventRouter eventRouter) {
+        this.eventRouter = eventRouter;
+    }
+
+    public void doStart() throws WaitingException, Exception {
+        DefaultStageConfig stageConfig = new DefaultStageConfig(stageName,
+                new org.apache.eve.thread.ThreadPool() {
+                    public void execute(Runnable command) {
+                        try {
+                            threadPool.execute(command);
+                        } catch (InterruptedException e) {
+                            // DO NOTHING
+                        }
+                    }
+                });
+
+        DefaultHandlerRegistry hooks = new DefaultHandlerRegistry();
+        requestProcessor = new DefaultRequestProcessor(eventRouter, stageConfig, hooks);
+        requestProcessor.setMonitor(new LoggingStageMonitor());
+        requestProcessor.start();
+        log.info("Started " + stageName);
+    }
+
+    public void doStop() throws WaitingException, Exception {
+        requestProcessor.stop();
+        log.info("Stopped " + stageName);
+    }
+
+    public void doFail() {
+        log.info("Failed " + stageName);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory(EveRequestProcessorGBean.class);
+
+        infoFactory.addAttribute("stageName", String.class, true);
+        infoFactory.addReference("ThreadPool", ThreadPool.class);
+        infoFactory.addReference("EventRouter", EventRouter.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: incubator/directory/eve/trunk/frontend/geronimo/src/test-data/ldap-plan.xml
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/frontend/geronimo/src/test-data/ldap-plan.xml	Wed Sep  1 19:32:30 2004
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed 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.
+-->
+
+
+<!--
+Configuration for the main ring of a Geronimo server.
+-->
+<configuration
+    xmlns="http://geronimo.apache.org/xml/ns/deployment"
+    configId="org/apache/eve/LDAP"
+    parentId="org/apache/geronimo/Server"
+    >
+
+    <dependency>
+        <uri>incubator-directory/jars/eve-frontend-geronimo-SNAPSHOT.jar</uri>
+    </dependency>
+
+    <gbean name="geronimo.ldap:type=BufferPool,name=EVEBufferPool" class="org.apache.eve.geronimo.EveBufferPoolGBean">
+        <attribute name="bufferName" type="java.lang.String">EVEBufferPool</attribute>
+        <attribute name="increment" type="int">4</attribute>
+        <attribute name="maxSize" type="int">100</attribute>
+        <attribute name="initialSize" type="int">20</attribute>
+    </gbean>
+
+    <gbean name="geronimo.ldap:type=EventRouter,name=EVEEventRouter" class="org.apache.eve.geronimo.EveEventRouterGBean"/>
+
+    <gbean name="geronimo.ldap:type=DecoderManager,name=EVEDecoderManager" class="org.apache.eve.geronimo.EveDecoderManagerGBean">
+        <attribute name="decoderManagerName" type="java.lang.String">EVEDecoderManager</attribute>
+        <reference name="ThreadPool">geronimo.server:type=ThreadPool,name=EVEThreadPool</reference>
+        <reference name="EventRouter">geronimo.ldap:type=EventRouter,name=EVEEventRouter</reference>
+    </gbean>
+
+    <gbean name="geronimo.ldap:type=EncoderManager,name=EVEEncoderManager" class="org.apache.eve.geronimo.EveEncoderManagerGBean">
+        <attribute name="encoderManagerName" type="java.lang.String">EVEEncoderManager</attribute>
+        <reference name="ThreadPool">geronimo.server:type=ThreadPool,name=EVEThreadPool</reference>
+        <reference name="EventRouter">geronimo.ldap:type=EventRouter,name=EVEEventRouter</reference>
+    </gbean>
+
+    <gbean name="geronimo.ldap:type=EncoderManager,name=EVEInputManager" class="org.apache.eve.geronimo.EveInputManagerGBean">
+        <reference name="ThreadPool">geronimo.server:type=ThreadPool,name=EVEThreadPool</reference>
+        <reference name="BufferPool">geronimo.ldap:type=BufferPool,name=EVEBufferPool</reference>
+        <reference name="EventRouter">geronimo.ldap:type=EventRouter,name=EVEEventRouter</reference>
+    </gbean>
+
+    <gbean name="geronimo.ldap:type=OutputManager,name=EVEOutputManager" class="org.apache.eve.geronimo.EveOutputManagerGBean">
+        <attribute name="stageName" type="java.lang.String">EVEOutputManager</attribute>
+        <reference name="ThreadPool">geronimo.server:type=ThreadPool,name=EVEThreadPool</reference>
+        <reference name="EventRouter">geronimo.ldap:type=EventRouter,name=EVEEventRouter</reference>
+    </gbean>
+
+    <gbean name="geronimo.ldap:type=RequestProcessor,name=EVERequestProcessor" class="org.apache.eve.geronimo.EveRequestProcessorGBean">
+        <attribute name="stageName" type="java.lang.String">EVERequestProcessor</attribute>
+        <reference name="ThreadPool">geronimo.server:type=ThreadPool,name=EVEThreadPool</reference>
+        <reference name="EventRouter">geronimo.ldap:type=EventRouter,name=EVEEventRouter</reference>
+    </gbean>
+
+    <gbean name="geronimo.server:type=ThreadPool,name=EVEThreadPool" class="org.apache.geronimo.pool.ThreadPool">
+        <attribute name="keepAliveTime" type="long">5000</attribute>
+        <attribute name="poolSize" type="int">10</attribute>
+        <attribute name="poolName" type="java.lang.String">EVEThreadPool</attribute>
+    </gbean>
+
+</configuration>
\ No newline at end of file

Mime
View raw message