directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r440764 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
Date Wed, 06 Sep 2006 16:22:56 GMT
Author: elecharny
Date: Wed Sep  6 09:22:54 2006
New Revision: 440764

URL: http://svn.apache.org/viewvc?view=rev&rev=440764
Log:
Added a Message decorator, so we will be able to generate the full LdapMessages

Added:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java

Added: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java?view=auto&rev=440764
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
(added)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
Wed Sep  6 09:22:54 2006
@@ -0,0 +1,96 @@
+/*
+ *  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.directory.shared.ldap.messages;
+
+import java.util.Map;
+
+import javax.naming.ldap.Control;
+
+/**
+ * Root Decorator for all LDAP message type decorators.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class MessageDecorator implements Message {
+    /** A reference to the decorated object */
+    protected Message message;
+    
+    /**
+     * Creates a new instance of MessageDecorator, and set the decorated
+     * message into the inner member
+     *
+     * @param message The decorated message
+     */
+    public MessageDecorator( Message message )
+    {
+        this.message = message;
+    }
+    
+    /**
+     * Gets the controls associated with this message mapped by OID.
+     * 
+     * @return Map of OID strings to Control object instances.
+     * @see Control
+     */
+    public Map<String, Control> getControls()
+    {
+        return message.getControls();
+    }
+
+
+    /**
+     * Adds a control to this Message.
+     * 
+     * @param control the control to add.
+     * @throws MessageException if controls cannot be added to this Message or the control
is
+     *             not known etc.
+     */
+    public void addControl( Control control ) throws MessageException
+    {
+        message.addControl( control );
+    }
+
+
+    /**
+     * Deletes a control removing it from this Message.
+     * 
+     * @param control the control to remove.
+     * @throws MessageException if controls cannot be added to this Message or the control
is
+     *             not known etc.
+     */
+    public void removeControl( Control control ) throws MessageException
+    {
+        message.removeControl( control );
+    }
+
+
+    /**
+     * Gets the session unique message sequence id for this message. Requests
+     * and their responses if any have the same message id. Clients at the
+     * initialization of a session start with the first message's id set to 1
+     * and increment it with each transaction.
+     * 
+     * @return the session unique message id.
+     */
+    public int getMessageId()
+    {
+        return message.getMessageId();
+    }
+}



Mime
View raw message