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 27 28 /** 29 * A decorator for the LdapResultResponse message 30 * 31 * @param <M> The Request to decorate 32 * 33 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 34 */ 35 public abstract class AbandonableRequestDecorator<M extends AbandonableResultResponseRequest> 36 extends ResultResponseRequestDecorator<M> 37 implements AbandonableRequest 38 { 39 /** 40 * Makes Request a MessageDecorator. 41 * 42 * @param codec The LDAP service instance 43 * @param decoratedMessage the decorated message 44 */ 45 public AbandonableRequestDecorator( LdapApiService codec, M decoratedMessage ) 46 { 47 super( codec, decoratedMessage ); 48 } 49 50 51 /** 52 * Gets the decorated AbandonableRequest. 53 * 54 * @return The decorated {@link AbandonableRequest} 55 */ 56 public AbandonableRequest getAbandonableRequest() 57 { 58 return getDecorated(); 59 } 60 61 62 /** 63 * {@inheritDoc} 64 */ 65 @Override 66 public void abandon() 67 { 68 getAbandonableRequest().abandon(); 69 } 70 71 72 /** 73 * {@inheritDoc} 74 */ 75 @Override 76 public boolean isAbandoned() 77 { 78 return getAbandonableRequest().isAbandoned(); 79 } 80 81 82 /** 83 * {@inheritDoc} 84 */ 85 @Override 86 public AbandonableRequest addAbandonListener( AbandonListener listener ) 87 { 88 getAbandonableRequest().addAbandonListener( listener ); 89 90 return this; 91 } 92 }