001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.shared.asn1.codec.stateful;
021
022
023 /**
024 * Document me.
025 *
026 * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
027 * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sam, 07 jui 2008) $
028 */
029 public class EncoderMonitorAdapter implements EncoderMonitor
030 {
031 /**
032 * Receive notification of a recoverable error. This callback is used to
033 * denote a failure to handle a unit of data to be encoded or decoded. The
034 * entire [en|de]codable unit is lost but the [en|de]coding operation can
035 * still proceed.
036 *
037 * @param encoder
038 * the encoder that had the error
039 * @param exception
040 * the error information encapsulated in an exception
041 */
042 public void error( StatefulEncoder encoder, Exception exception )
043 {
044 }
045
046
047 /**
048 * Receive notification of a non-recoverable error. The application must
049 * assume that the stream data is unusable after the encoder has invoked
050 * this method, and should continue (if at all) only for the sake of
051 * collecting addition error messages: in fact, encoders are free to stop
052 * reporting any other events once this method has been invoked.
053 *
054 * @param encoder
055 * the encoder that had the failure
056 * @param exception
057 * the warning information encapsulated in an exception
058 */
059 public void fatalError( StatefulEncoder encoder, Exception exception )
060 {
061 }
062
063
064 /**
065 * Receive notification of a warning. The encoder must continue to provide
066 * normal callbacks after invoking this method: it should still be possible
067 * for the application to process the encoded data through to the end.
068 *
069 * @param encoder
070 * the encoder that had the error
071 * @param exception
072 * the warning information encapsulated in an exception
073 */
074 public void warning( StatefulEncoder encoder, Exception exception )
075 {
076 }
077
078
079 /**
080 * Monitors callbacks that deliver a fully decoded object.
081 *
082 * @param encoder
083 * the stateful encoder driving the callback
084 * @param decoded
085 * the object that was decoded
086 */
087 public void callbackOccured( StatefulEncoder encoder, EncoderCallback cb, Object decoded )
088 {
089 }
090
091
092 /**
093 * Monitors changes to the callback.
094 *
095 * @param encoder
096 * the encoder whose callback was set
097 * @param oldcb
098 * the unset old callback, or null if none was set
099 * @param newcb
100 * the newly set callback, or null if callback is cleared
101 */
102 public void callbackSet( StatefulEncoder encoder, EncoderCallback oldcb, EncoderCallback newcb )
103 {
104 }
105 }