You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/11/26 05:14:30 UTC

svn commit: r598118 - in /mina/trunk: ./ integration-jmx/ integration-jmx/src/main/java/org/apache/mina/integration/jmx/ integration-ognl/ integration-ognl/src/ integration-ognl/src/main/ integration-ognl/src/main/java/ integration-ognl/src/main/java/o...

Author: trustin
Date: Sun Nov 25 20:14:29 2007
New Revision: 598118

URL: http://svn.apache.org/viewvc?rev=598118&view=rev
Log:
* Added OGNL integration module which will provide complicated query language for finding sessions managed by a service
* Changed DefaultModelMBean to use integration-ognl


Added:
    mina/trunk/integration-ognl/   (with props)
    mina/trunk/integration-ognl/pom.xml   (with props)
    mina/trunk/integration-ognl/src/
    mina/trunk/integration-ognl/src/main/
    mina/trunk/integration-ognl/src/main/java/
    mina/trunk/integration-ognl/src/main/java/org/
    mina/trunk/integration-ognl/src/main/java/org/apache/
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java   (with props)
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java   (with props)
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java   (with props)
    mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java   (with props)
    mina/trunk/integration-ognl/src/test/
    mina/trunk/integration-ognl/src/test/java/
Modified:
    mina/trunk/integration-jmx/pom.xml
    mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/DefaultModelMBean.java
    mina/trunk/pom.xml

Modified: mina/trunk/integration-jmx/pom.xml
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/pom.xml?rev=598118&r1=598117&r2=598118&view=diff
==============================================================================
--- mina/trunk/integration-jmx/pom.xml (original)
+++ mina/trunk/integration-jmx/pom.xml Sun Nov 25 20:14:29 2007
@@ -22,6 +22,10 @@
       <artifactId>mina-integration-beans</artifactId>
     </dependency>
     <dependency>
+      <groupId>${groupId}</groupId>
+      <artifactId>mina-integration-ognl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-beanutils</groupId>
       <artifactId>commons-beanutils</artifactId>
     </dependency>

Modified: mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/DefaultModelMBean.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/DefaultModelMBean.java?rev=598118&r1=598117&r2=598118&view=diff
==============================================================================
--- mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/DefaultModelMBean.java (original)
+++ mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/DefaultModelMBean.java Sun Nov 25 20:14:29 2007
@@ -58,6 +58,10 @@
 import javax.management.modelmbean.ModelMBeanNotificationInfo;
 import javax.management.modelmbean.ModelMBeanOperationInfo;
 
+import ognl.Ognl;
+import ognl.OgnlException;
+import ognl.OgnlRuntime;
+
 import org.apache.commons.beanutils.MethodUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
@@ -70,6 +74,9 @@
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionDataStructureFactory;
 import org.apache.mina.common.TransportMetadata;
+import org.apache.mina.integration.beans.PropertyEditorFactory;
+import org.apache.mina.integration.ognl.IoServicePropertyAccessor;
+import org.apache.mina.integration.ognl.IoSessionPropertyAccessor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -86,6 +93,9 @@
     private volatile ObjectName name;
 
     public DefaultModelMBean(Object source) {
+        OgnlRuntime.setPropertyAccessor(IoSession.class, new IoSessionPropertyAccessor());
+        OgnlRuntime.setPropertyAccessor(IoSession.class, new IoServicePropertyAccessor());
+        
         if (source == null) {
             throw new NullPointerException("source");
         }
@@ -103,39 +113,45 @@
         this.info = createModelMBeanInfo(source);
     }
     
+    public MBeanInfo getMBeanInfo() {
+        return info;
+    }
+
     public Object getAttribute(String name) throws AttributeNotFoundException,
             MBeanException, ReflectionException {
-        
-        // Handle synthetic attributes first.
-        if (source instanceof IoSession) {
-            IoSession s = (IoSession) source;
-            if (name.equals("attributes")) {
-                Map<Object, Object> result = new HashMap<Object, Object>();
-                for (Object key: s.getAttributeKeys()) {
-                    result.put(key, s.getAttribute(key));
-                }
-                return convertAttributeValue("attributes", result);
-            }
-        }
-        
-        // And then try reflection.
         try {
             return convertAttributeValue(
-                    name, PropertyUtils.getNestedProperty(source, name));
-        } catch (IllegalAccessException e) {
-            throw new ReflectionException(e);
-        } catch (InvocationTargetException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof Exception) {
-                throw new MBeanException((Exception) cause);
-            } else {
-                throw new MBeanException(new Exception(cause));
-            }
-        } catch (NoSuchMethodException e) {
-            throw new AttributeNotFoundException(name);
+                    name, Ognl.getValue(name, source));
+        } catch (OgnlException e) {
+            throwMBeanException(e);
+            throw new InternalError();
         }
     }
     
+    public void setAttribute(Attribute attribute)
+            throws AttributeNotFoundException, MBeanException,
+            ReflectionException {
+        String aname = attribute.getName();
+        Object avalue = attribute.getValue();
+        
+        try {
+            Ognl.setValue(aname, source, convert(
+                    avalue, propertyDescriptors.get(aname).getPropertyType()));
+        } catch (OgnlException e) {
+            throwMBeanException(e);
+            throw new InternalError();
+        }
+    }
+
+    private void throwMBeanException(OgnlException e) throws MBeanException {
+        Throwable reason = e.getReason();
+        if (reason instanceof Exception) {
+            throw new MBeanException((Exception) reason);
+        } else {
+            throw new MBeanException(new Exception("Unexpected exception.", reason));
+        }
+    }
+
     public AttributeList getAttributes(String names[]) {
         AttributeList answer = new AttributeList();
         for (int i = 0; i < names.length; i++) {
@@ -148,8 +164,22 @@
         return answer;
     }
 
-    public MBeanInfo getMBeanInfo() {
-        return info;
+    public AttributeList setAttributes(AttributeList attributes) {
+        // Prepare and return our response, eating all exceptions
+        String names[] = new String[attributes.size()];
+        int n = 0;
+        Iterator<Object> items = attributes.iterator();
+        while (items.hasNext()) {
+            Attribute item = (Attribute) items.next();
+            names[n++] = item.getName();
+            try {
+                setAttribute(item);
+            } catch (Exception e) {
+                ; // Ignore all exceptions
+            }
+        }
+    
+        return getAttributes(names);
     }
 
     public Object invoke(String name, Object params[], String signature[])
@@ -227,52 +257,6 @@
         return Class.forName(signature);
     }
 
-    public void setAttribute(Attribute attribute)
-            throws AttributeNotFoundException, MBeanException,
-            ReflectionException {
-        String aname = attribute.getName();
-        Object avalue = attribute.getValue();
-        
-        // Handle synthetic attributes first.
-        // ...
-        
-        // And then try reflection.
-        try {
-            PropertyUtils.setNestedProperty(
-                    source, aname, convert(
-                            avalue, propertyDescriptors.get(aname).getPropertyType()));
-        } catch (IllegalAccessException e) {
-            throw new ReflectionException(e);
-        } catch (InvocationTargetException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof Exception) {
-                throw new MBeanException((Exception) cause);
-            } else {
-                throw new MBeanException(new Exception(cause));
-            }
-        } catch (NoSuchMethodException e) {
-            throw new AttributeNotFoundException(attribute.getName());
-        }
-    }
-
-    public AttributeList setAttributes(AttributeList attributes) {
-        // Prepare and return our response, eating all exceptions
-        String names[] = new String[attributes.size()];
-        int n = 0;
-        Iterator<Object> items = attributes.iterator();
-        while (items.hasNext()) {
-            Attribute item = (Attribute) items.next();
-            names[n++] = item.getName();
-            try {
-                setAttribute(item);
-            } catch (Exception e) {
-                ; // Ignore all exceptions
-            }
-        }
-
-        return getAttributes(names);
-    }
-
     public void setManagedResource(Object resource, String type)
             throws InstanceNotFoundException, InvalidTargetObjectTypeException,
             MBeanException {
@@ -586,13 +570,7 @@
             propType = transportMetadata.getAddressType();
         }
 
-        try {
-            return (PropertyEditor) getClass().getClassLoader().loadClass(
-                "org.apache.mina.integration.beans." +
-                propType.getSimpleName() + "Editor").newInstance();
-        } catch (Exception e) {
-            return null;
-        }
+        return PropertyEditorFactory.getInstance(propType);
     }
     
     protected Class<?> convertOperationReturnType(Class<?> opReturnType) {

Propchange: mina/trunk/integration-ognl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov 25 20:14:29 2007
@@ -0,0 +1,4 @@
+target
+.settings
+.classpath
+.project

Added: mina/trunk/integration-ognl/pom.xml
URL: http://svn.apache.org/viewvc/mina/trunk/integration-ognl/pom.xml?rev=598118&view=auto
==============================================================================
--- mina/trunk/integration-ognl/pom.xml (added)
+++ mina/trunk/integration-ognl/pom.xml Sun Nov 25 20:14:29 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.mina</groupId>
+    <artifactId>build</artifactId>
+    <version>2.0.0-M1-SNAPSHOT</version>
+  </parent>
+  <artifactId>mina-integration-ognl</artifactId>
+  <name>Apache MINA OGNL Integration</name>
+  <packaging>bundle</packaging>  
+  <properties>
+    <exportedPackage>${groupId}.integration.ognl</exportedPackage>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>${groupId}</groupId>
+      <artifactId>mina-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ognl</groupId>
+      <artifactId>ognl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${groupId}</groupId>
+      <artifactId>mina-integration-beans</artifactId>
+    </dependency>
+  </dependencies>
+</project>

Propchange: mina/trunk/integration-ognl/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/integration-ognl/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: mina/trunk/integration-ognl/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java?rev=598118&view=auto
==============================================================================
--- mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java (added)
+++ mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java Sun Nov 25 20:14:29 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.mina.integration.ognl;
+
+import ognl.MethodAccessor;
+import ognl.ObjectMethodAccessor;
+
+/**
+ * An abstract OGNL {@link MethodAccessor} for MINA constructs.
+ * 
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class AbstractMethodAccessor extends ObjectMethodAccessor {
+
+}

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractMethodAccessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java?rev=598118&view=auto
==============================================================================
--- mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java (added)
+++ mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java Sun Nov 25 20:14:29 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.mina.integration.ognl;
+
+import java.util.Map;
+
+import ognl.ObjectPropertyAccessor;
+import ognl.OgnlContext;
+import ognl.OgnlException;
+import ognl.OgnlRuntime;
+import ognl.PropertyAccessor;
+
+/**
+ * An abstract OGNL {@link PropertyAccessor} for MINA constructs.
+ * 
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+@SuppressWarnings("unchecked")
+public abstract class AbstractPropertyAccessor extends ObjectPropertyAccessor {
+
+    @Override
+    public final boolean hasGetProperty(OgnlContext context, Object target,
+            Object oname) throws OgnlException {
+        if (oname == null) {
+            return false;
+        }
+        
+        if (hasGetProperty0(context, target, oname.toString())) {
+            return true;
+        } else {
+            return super.hasGetProperty(context, target, oname);
+        }
+    }
+
+    @Override
+    public final boolean hasSetProperty(OgnlContext context, Object target,
+            Object oname) throws OgnlException {
+        if (oname == null) {
+            return false;
+        }
+        
+        if (hasSetProperty0(context, target, oname.toString())) {
+            return true;
+        } else {
+            return super.hasSetProperty(context, target, oname);
+        }
+    }
+
+    @Override
+    public final Object getPossibleProperty(Map context, Object target, String name)
+            throws OgnlException {
+        Object answer = getProperty0((OgnlContext) context, target, name);
+        if (answer == OgnlRuntime.NotFound) {
+            answer = super.getPossibleProperty(context, target, name);
+        }
+        return answer;
+    }
+
+    @Override
+    public final Object setPossibleProperty(Map context, Object target, String name,
+            Object value) throws OgnlException {
+        Object answer = setProperty0((OgnlContext) context, target, name, value);
+        if (answer == OgnlRuntime.NotFound) {
+            answer = super.setPossibleProperty(context, target, name, value);
+        }
+        return answer;
+    }
+    
+    protected abstract boolean hasGetProperty0(
+            OgnlContext context, Object target, String name) throws OgnlException;
+
+    protected abstract boolean hasSetProperty0(
+            OgnlContext context, Object target, String name) throws OgnlException;
+
+    protected abstract Object getProperty0(
+            OgnlContext context, Object target, String name) throws OgnlException;
+
+    protected abstract Object setProperty0(
+            OgnlContext context, Object target, String name, Object value) throws OgnlException;
+
+
+    // The following methods uses the four method above, so there's no need
+    // to override them.
+    
+    @Override
+    public final Object getProperty(Map context, Object target, Object oname)
+            throws OgnlException {
+        return super.getProperty(context, target, oname);
+    }
+
+    @Override
+    public final boolean hasGetProperty(Map context, Object target, Object oname)
+            throws OgnlException {
+        return super.hasGetProperty(context, target, oname);
+    }
+
+    @Override
+    public final boolean hasSetProperty(Map context, Object target, Object oname)
+            throws OgnlException {
+        return super.hasSetProperty(context, target, oname);
+    }
+
+    @Override
+    public final void setProperty(Map context, Object target, Object oname,
+            Object value) throws OgnlException {
+        super.setProperty(context, target, oname, value);
+    }
+}

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java?rev=598118&view=auto
==============================================================================
--- mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java (added)
+++ mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java Sun Nov 25 20:14:29 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.mina.integration.ognl;
+
+import ognl.OgnlContext;
+import ognl.OgnlException;
+import ognl.OgnlRuntime;
+import ognl.PropertyAccessor;
+
+import org.apache.mina.common.IoService;
+
+/**
+ * An OGNL {@link PropertyAccessor} for {@link IoService}.
+ * 
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class IoServicePropertyAccessor extends AbstractPropertyAccessor {
+    @Override
+    protected Object getProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        return OgnlRuntime.NotFound;
+    }
+
+    @Override
+    protected boolean hasGetProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        return false;
+    }
+
+    @Override
+    protected boolean hasSetProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        return false;
+    }
+
+    @Override
+    protected Object setProperty0(OgnlContext context, Object target,
+            String name, Object value) throws OgnlException {
+        return OgnlRuntime.NotFound;
+    }
+}

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoServicePropertyAccessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java?rev=598118&view=auto
==============================================================================
--- mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java (added)
+++ mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java Sun Nov 25 20:14:29 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.mina.integration.ognl;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import ognl.OgnlContext;
+import ognl.OgnlException;
+import ognl.OgnlRuntime;
+import ognl.PropertyAccessor;
+
+import org.apache.mina.common.IoSession;
+
+/**
+ * An OGNL {@link PropertyAccessor} for {@link IoSession}.
+ * 
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+@SuppressWarnings("unchecked")
+public class IoSessionPropertyAccessor extends AbstractPropertyAccessor {
+
+    @Override
+    protected Object getProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        if (target instanceof IoSession && "attributes".equals(name)) {
+            Map<String, Object> attributes = new TreeMap<String, Object>();
+            IoSession s = (IoSession) target;
+            for (Object key: s.getAttributeKeys()) {
+                Object value = s.getAttribute(key);
+                if (value == null) {
+                    continue;
+                }
+                attributes.put(String.valueOf(key), value);
+            }
+            return attributes;
+        }
+        
+        return OgnlRuntime.NotFound;
+    }
+
+    @Override
+    protected boolean hasGetProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        return target instanceof IoSession && "attributes".equals(name);
+    }
+
+    @Override
+    protected boolean hasSetProperty0(OgnlContext context, Object target,
+            String name) throws OgnlException {
+        return false;
+    }
+
+    @Override
+    protected Object setProperty0(OgnlContext context, Object target,
+            String name, Object value) throws OgnlException {
+        return OgnlRuntime.NotFound;
+    }
+}

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/integration-ognl/src/main/java/org/apache/mina/integration/ognl/IoSessionPropertyAccessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: mina/trunk/pom.xml
URL: http://svn.apache.org/viewvc/mina/trunk/pom.xml?rev=598118&r1=598117&r2=598118&view=diff
==============================================================================
--- mina/trunk/pom.xml (original)
+++ mina/trunk/pom.xml Sun Nov 25 20:14:29 2007
@@ -110,6 +110,11 @@
       </dependency>
       <dependency>
         <groupId>${groupId}</groupId>
+        <artifactId>mina-integration-ognl</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>${groupId}</groupId>
         <artifactId>mina-integration-jmx</artifactId>
         <version>${pom.version}</version>
       </dependency>
@@ -176,9 +181,24 @@
         </exclusions>
       </dependency>
       <dependency>
+        <groupId>ognl</groupId>
+        <artifactId>ognl</artifactId>
+        <version>2.6.9</version>
+      </dependency> 
+      <dependency>
         <groupId>commons-beanutils</groupId>
         <artifactId>commons-beanutils</artifactId>
         <version>1.7.0</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging-api</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency> 
 
       <!-- State Machine -->
@@ -293,6 +313,7 @@
     <module>protocol-http-server</module>
     -->
     <module>integration-beans</module>
+    <module>integration-ognl</module>
     <module>integration-jmx</module>
     <module>integration-spring</module>
     <module>example</module>