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   *     https://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.api;
21  
22  import org.apache.directory.api.asn1.DecoderException;
23  import org.apache.directory.api.asn1.util.Asn1Buffer;
24  import org.apache.directory.api.ldap.model.message.ExtendedRequest;
25  import org.apache.directory.api.ldap.model.message.ExtendedResponse;
26  import org.slf4j.Logger;
27  import org.slf4j.LoggerFactory;
28  
29  /**
30   * A Factory to encode Extended Request and Response messages
31   * 
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   */
34  public abstract class AbstractExtendedOperationFactory implements ExtendedOperationFactory
35  {
36      /** logger for reporting errors that might not be handled properly upstream */
37      protected  static final Logger LOG = LoggerFactory.getLogger( AbstractExtendedOperationFactory.class );
38      
39      /** The LDAP codec responsible for encoding and decoding */
40      protected LdapApiService codec;
41      
42      /** The extended operation OID */
43      protected String oid;
44  
45      /**
46       *
47       * Creates a new instance of AbstractExtendedOperationFactory.
48       *
49       * @param codec The LdapApiService instance
50       * @param oid The extended operation OID
51       */
52      protected AbstractExtendedOperationFactory( LdapApiService codec, String oid )
53      {
54          this.codec = codec;
55          this.oid = oid;
56      }
57      
58      
59      /**
60       * {@inheritDoc}
61       */
62      @Override
63      public String getOid()
64      {
65          return oid;
66      }
67  
68  
69      /**
70       * {@inheritDoc}
71       */
72      @Override
73      public ExtendedRequest newRequest( byte[] value ) throws DecoderException
74      {
75          return null;
76      }
77  
78  
79      /**
80       * {@inheritDoc}
81       */
82      @Override
83      public ExtendedResponse newResponse( byte[] value ) throws DecoderException
84      {
85          return null;
86      }
87  
88  
89      /**
90       * {@inheritDoc}
91       */
92      @Override
93      public void encodeValue( Asn1Buffer buffer, ExtendedRequest extendedRequest )
94      {
95          // Nothing to do by default
96      }
97  
98  
99      /**
100      * {@inheritDoc}
101      */
102     @Override
103     public void decodeValue( ExtendedRequest extendedRequest, byte[] requestValue ) throws DecoderException
104     {
105         // Nothing to do by default
106     }
107 
108 
109     /**
110      * {@inheritDoc}
111      */
112     @Override
113     public void encodeValue( Asn1Buffer buffer, ExtendedResponse extendedResponse )
114     {
115         // Nothing to do by default
116     }
117 
118 
119     /**
120      * {@inheritDoc}
121      */
122     @Override
123     public void decodeValue( ExtendedResponse extendedResponse, byte[] responseValue ) throws DecoderException
124     {
125         // Nothing to do by default
126     }
127 }