You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2013/06/06 14:11:00 UTC

git commit: removed ldap

Updated Branches:
  refs/heads/trunk 0d07aadd6 -> f5613e6db


removed ldap


Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/f5613e6d
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/f5613e6d
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/f5613e6d

Branch: refs/heads/trunk
Commit: f5613e6dbf56446d9f4297ff2e18b8d42be00dfa
Parents: 0d07aad
Author: jvermillard <jv...@apache.org>
Authored: Thu Jun 6 14:09:29 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Thu Jun 6 14:09:29 2013 +0200

----------------------------------------------------------------------
 ldap/pom.xml                                       |   91 --------
 .../main/java/org/apache/mina/ldap/LdapCodec.java  |  125 -----------
 .../org/apache/mina/ldap/LdapProtocolDecoder.java  |  173 ---------------
 .../org/apache/mina/ldap/LdapProtocolEncoder.java  |   72 ------
 4 files changed, 0 insertions(+), 461 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/f5613e6d/ldap/pom.xml
----------------------------------------------------------------------
diff --git a/ldap/pom.xml b/ldap/pom.xml
deleted file mode 100644
index b7d4400..0000000
--- a/ldap/pom.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-  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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.mina</groupId>
-    <artifactId>mina-parent</artifactId>
-    <version>3.0.0-M1-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>mina-ldap</artifactId>
-  <name>Apache MINA LDAP ${project.version}</name>
-  <packaging>bundle</packaging>
-  <description>Low level LDAP codec</description>
-
-  <properties>
-    <symbolicName>${project.groupId}.ldap</symbolicName>
-    <exportedPackage>${project.groupId}.ldap.api</exportedPackage>
-    <org.apache.directory.shared.version>1.0.0-M8</org.apache.directory.shared.version>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>mina-core</artifactId>
-      <version>${project.version}</version>
-      <type>bundle</type>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-ldap-codec-core</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-ldap-model</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-asn1-api</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-asn1-ber</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-util</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-ldap-codec-standalone</artifactId>
-      <version>${org.apache.directory.shared.version}</version>
-    </dependency>
-    
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-  </dependencies>
-</project>
-

http://git-wip-us.apache.org/repos/asf/mina/blob/f5613e6d/ldap/src/main/java/org/apache/mina/ldap/LdapCodec.java
----------------------------------------------------------------------
diff --git a/ldap/src/main/java/org/apache/mina/ldap/LdapCodec.java b/ldap/src/main/java/org/apache/mina/ldap/LdapCodec.java
deleted file mode 100644
index 3e872d9..0000000
--- a/ldap/src/main/java/org/apache/mina/ldap/LdapCodec.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *  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.ldap;
-
-import static org.apache.mina.session.AttributeKey.createKey;
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.shared.ldap.codec.api.LdapApiService;
-import org.apache.directory.shared.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.api.MessageDecorator;
-import org.apache.directory.shared.ldap.model.message.AddResponse;
-import org.apache.directory.shared.ldap.model.message.BindResponse;
-import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.model.message.DeleteResponse;
-import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
-import org.apache.directory.shared.ldap.model.message.IntermediateResponse;
-import org.apache.directory.shared.ldap.model.message.Message;
-import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
-import org.apache.directory.shared.ldap.model.message.ModifyResponse;
-import org.apache.directory.shared.ldap.model.message.SearchResultDone;
-import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
-import org.apache.directory.shared.ldap.model.message.SearchResultReference;
-import org.apache.mina.api.IdleStatus;
-import org.apache.mina.api.IoSession;
-import org.apache.mina.codec.ProtocolDecoder;
-import org.apache.mina.codec.ProtocolEncoder;
-import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.apache.mina.filterchain.WriteFilterChainController;
-import org.apache.mina.session.AttributeKey;
-import org.apache.mina.session.WriteRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A LDAP message codec.
- * 
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class LdapCodec extends ProtocolCodecFilter {
-    private static final Logger LOG = LoggerFactory.getLogger(LdapCodec.class);
-
-    /** The LDAP decoder instance */
-    private static ProtocolDecoder ldapDecoder = new LdapProtocolDecoder();
-
-    /** The LDAP encoder instance */
-    private static ProtocolEncoder ldapEncoder = new LdapProtocolEncoder();
-
-    /** The codec */
-    private static LdapApiService codec = LdapApiServiceFactory.getSingleton();
-
-    /** The Message Container attribute */
-    public static final AttributeKey<LdapMessageContainer> MESSAGE_CONTAINER_AT = createKey(LdapMessageContainer.class,
-            "internal_messageContainer");
-
-    public LdapCodec() {
-        super(ldapEncoder, ldapDecoder);
-    }
-
-    @Override
-    public void sessionOpened(final IoSession session) {
-        final LdapMessageContainer<MessageDecorator<? extends Message>> container = new LdapMessageContainer<MessageDecorator<? extends Message>>(
-                codec);
-        session.setAttribute(MESSAGE_CONTAINER_AT, container);
-    }
-
-    @Override
-    public void sessionClosed(final IoSession session) {
-        session.removeAttribute(MESSAGE_CONTAINER_AT);
-    }
-
-    @Override
-    public void sessionIdle(final IoSession session, final IdleStatus status) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void messageWriting(IoSession session, WriteRequest writeRequest, WriteFilterChainController controller) {
-        Object message = writeRequest.getOriginalMessage();
-
-        if (message instanceof AddResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof BindResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof DeleteResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof CompareResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof ExtendedResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof IntermediateResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof ModifyResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof ModifyDnResponse) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof SearchResultDone) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof SearchResultEntry) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof SearchResultReference) {
-            ldapEncoder.encode(session, writeRequest, controller);
-        } else if (message instanceof ByteBuffer) {
-            controller.callWriteNextFilter(writeRequest);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/f5613e6d/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolDecoder.java
----------------------------------------------------------------------
diff --git a/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolDecoder.java b/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolDecoder.java
deleted file mode 100644
index 335c384..0000000
--- a/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolDecoder.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *  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.ldap;
-
-import static org.apache.mina.session.AttributeKey.createKey;
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
-import org.apache.directory.shared.ldap.codec.api.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.api.MessageDecorator;
-import org.apache.directory.shared.ldap.codec.api.ResponseCarryingException;
-import org.apache.directory.shared.ldap.model.exception.ResponseCarryingMessageException;
-import org.apache.directory.shared.ldap.model.message.Message;
-import org.apache.directory.shared.util.Strings;
-import org.apache.mina.api.IoSession;
-import org.apache.mina.codec.ProtocolDecoder;
-import org.apache.mina.filterchain.ReadFilterChainController;
-import org.apache.mina.session.AttributeKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A LDAP message decoder. It is based on shared-ldap decoder.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class LdapProtocolDecoder implements ProtocolDecoder {
-    /** The logger */
-    private static Logger LOG = LoggerFactory.getLogger(LdapProtocolDecoder.class);
-
-    /** A speedup for logger */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-    /** The ASN 1 decoder instance */
-    private Asn1Decoder asn1Decoder;
-
-    /** Key for the partial HTTP requests head */
-    private static final AttributeKey<Integer> MAX_PDU_SIZE_AT = createKey(Integer.class, "internal_max_pdu_size");
-
-    /**
-     * Creates a new instance of LdapProtocolEncoder.
-     * 
-     * @param codec The LDAP codec service associated with this encoder.
-     */
-    public LdapProtocolDecoder() {
-        asn1Decoder = new Asn1Decoder();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object decode(IoSession session, ByteBuffer in, ReadFilterChainController controller) {
-        @SuppressWarnings("unchecked")
-        LdapMessageContainer<MessageDecorator<? extends Message>> messageContainer = (LdapMessageContainer<MessageDecorator<? extends Message>>) session
-                .getAttribute(LdapCodec.MESSAGE_CONTAINER_AT, null);
-
-        int maxPDUSize = session.getAttribute(MAX_PDU_SIZE_AT, 0);
-
-        messageContainer.setMaxPDUSize(maxPDUSize);
-
-        try {
-            Object message = null;
-
-            do {
-                message = decode(in, messageContainer);
-
-                controller.callReadNextFilter(message);
-            } while (message != null);
-        } catch (DecoderException lde) {
-            // Do something
-        }
-
-        return null;
-    }
-
-    /**
-     * Decode an incoming buffer into LDAP messages. The result can be 0, 1 or many LDAP messages, which will be stored
-     * into the array the caller has created.
-     * 
-     * @param buffer The incoming byte buffer
-     * @param messageContainer The LdapMessageContainer which will be used to store the message being decoded. If the
-     *        message is not fully decoded, the ucrrent state is stored into this container
-     * @param decodedMessages The list of decoded messages
-     * @throws Exception If the decoding failed
-     */
-    private Object decode(ByteBuffer buffer, LdapMessageContainer<MessageDecorator<? extends Message>> messageContainer)
-            throws DecoderException {
-        while (buffer.hasRemaining()) {
-            try {
-                if (IS_DEBUG) {
-                    LOG.debug("Decoding the PDU : ");
-
-                    int size = buffer.limit();
-                    int position = buffer.position();
-                    int pduLength = size - position;
-
-                    byte[] array = new byte[pduLength];
-
-                    System.arraycopy(buffer.array(), position, array, 0, pduLength);
-
-                    if (array.length == 0) {
-                        LOG.debug("NULL buffer, what the HELL ???");
-                    } else {
-                        LOG.debug(Strings.dumpBytes(array));
-                    }
-                }
-
-                asn1Decoder.decode(buffer, messageContainer);
-
-                if (messageContainer.getState() == TLVStateEnum.PDU_DECODED) {
-                    if (IS_DEBUG) {
-                        LOG.debug("Decoded LdapMessage : " + messageContainer.getMessage());
-                    }
-
-                    Message message = messageContainer.getMessage();
-                    messageContainer.clean();
-
-                    return message;
-                }
-            } catch (DecoderException de) {
-                buffer.clear();
-                messageContainer.clean();
-
-                if (de instanceof ResponseCarryingException) {
-                    // Transform the DecoderException message to a MessageException
-                    ResponseCarryingMessageException rcme = new ResponseCarryingMessageException(de.getMessage());
-                    rcme.setResponse(((ResponseCarryingException) de).getResponse());
-
-                    throw rcme;
-                } else {
-                    // TODO : This is certainly not the way we should handle such an exception !
-                    throw new ResponseCarryingException(de.getMessage());
-                }
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object finishDecode(IoSession session) throws Exception {
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void dispose(IoSession session) throws Exception {
-        // Nothing to do
-    }
-}

http://git-wip-us.apache.org/repos/asf/mina/blob/f5613e6d/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolEncoder.java
----------------------------------------------------------------------
diff --git a/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolEncoder.java b/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolEncoder.java
deleted file mode 100644
index 2a2b01f..0000000
--- a/ldap/src/main/java/org/apache/mina/ldap/LdapProtocolEncoder.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  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.ldap;
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.shared.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.shared.ldap.codec.api.LdapEncoder;
-import org.apache.directory.shared.ldap.model.message.Message;
-import org.apache.mina.api.IoSession;
-import org.apache.mina.codec.ProtocolEncoder;
-import org.apache.mina.filterchain.WriteFilterChainController;
-import org.apache.mina.session.WriteRequest;
-
-/**
- * A LDAP message encoder. It is based on shared-ldap encoder.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class LdapProtocolEncoder implements ProtocolEncoder {
-    /** The stateful encoder */
-    private LdapEncoder encoder;
-
-    /**
-     * Creates a new instance of LdapProtocolEncoder.
-     * 
-     * @param codec The LDAP codec service associated with this encoder.
-     */
-    public LdapProtocolEncoder() {
-        this.encoder = new LdapEncoder(LdapApiServiceFactory.getSingleton());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object encode(IoSession session, WriteRequest writeRequest, WriteFilterChainController controller) {
-        try {
-            ByteBuffer buffer = encoder.encodeMessage((Message) writeRequest.getOriginalMessage());
-            writeRequest.setMessage(buffer);
-
-            controller.callWriteNextFilter(writeRequest);
-        } catch (Exception e) {
-            return null;
-        }
-
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void dispose(IoSession session) throws Exception {
-        // Nothing to do
-    }
-}