View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.codec.decorators;
21  
22  
23  import org.apache.directory.api.ldap.codec.api.LdapApiService;
24  import org.apache.directory.api.ldap.model.message.AbandonListener;
25  import org.apache.directory.api.ldap.model.message.AbandonableRequest;
26  import org.apache.directory.api.ldap.model.message.MessageTypeEnum;
27  import org.apache.directory.api.ldap.model.message.SingleReplyRequest;
28  
29  
30  /**
31   * A decorator for the LdapResultResponse message
32   *
33   * @param <M> The request to be decorated
34   * 
35   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
36   */
37  public abstract class SingleReplyRequestDecorator<M extends SingleReplyRequest>
38      extends ResultResponseRequestDecorator<M> implements SingleReplyRequest, AbandonableRequest
39  {
40      /**
41       * Makes Request a MessageDecorator.
42       *
43       * @param codec The LDAP service instance
44       * @param decoratedMessage the decorated message
45       */
46      public SingleReplyRequestDecorator( LdapApiService codec, M decoratedMessage )
47      {
48          super( codec, decoratedMessage );
49      }
50  
51  
52      /**
53       * {@inheritDoc}
54       */
55      @Override
56      public MessageTypeEnum getResponseType()
57      {
58          return getDecorated().getResponseType();
59      }
60  
61  
62      /**
63       * {@inheritDoc}
64       */
65      @Override
66      public void abandon()
67      {
68          ( ( AbandonableRequest ) getDecorated() ).abandon();
69      }
70  
71  
72      /**
73       * {@inheritDoc}
74       */
75      @Override
76      public boolean isAbandoned()
77      {
78          return ( ( AbandonableRequest ) getDecorated() ).isAbandoned();
79      }
80  
81  
82      /**
83       * {@inheritDoc}
84       */
85      @Override
86      public AbandonableRequest addAbandonListener( AbandonListener listener )
87      {
88          ( ( AbandonableRequest ) getDecorated() ).addAbandonListener( listener );
89  
90          return this;
91      }
92  }