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 * A do nothing decoder monitor adapter. At a bare minimum warning, error and
025 * fatal exceptions are reported to the console when using this adapter to
026 * prevent exceptions from being completely ignored.
027 *
028 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029 * @version $Rev: 912399 $
030 */
031 public class DecoderMonitorAdapter implements DecoderMonitor
032 {
033 /*
034 * (non-Javadoc)
035 *
036 * @see org.apache.asn1.codec.stateful.DecoderMonitor#error(
037 * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
038 */
039 public void error( StatefulDecoder decoder, Exception exception )
040 {
041 System.err.println( "ERROR: " + exception.getLocalizedMessage() );
042 }
043
044
045 /*
046 * (non-Javadoc)
047 *
048 * @see org.apache.asn1.codec.stateful.DecoderMonitor#fatalError(
049 * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
050 */
051 public void fatalError( StatefulDecoder decoder, Exception exception )
052 {
053 System.err.println( "FATAL: " + exception.getLocalizedMessage() );
054 }
055
056
057 /*
058 * (non-Javadoc)
059 *
060 * @see org.apache.asn1.codec.stateful.DecoderMonitor#warning(
061 * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
062 */
063 public void warning( StatefulDecoder decoder, Exception exception )
064 {
065 System.err.println( "WARN: " + exception.getLocalizedMessage() );
066 }
067
068
069 /*
070 * (non-Javadoc)
071 *
072 * @see org.apache.asn1.codec.stateful.DecoderMonitor#callbackOccured(
073 * org.apache.asn1.codec.stateful.StatefulDecoder,
074 * org.apache.asn1.codec.stateful.DecoderCallback, java.lang.Object)
075 */
076 public void callbackOccured( StatefulDecoder decoder, DecoderCallback cb, Object decoded )
077 {
078 }
079
080
081 /*
082 * (non-Javadoc)
083 *
084 * @see org.apache.asn1.codec.stateful.DecoderMonitor#callbackSet(
085 * org.apache.asn1.codec.stateful.StatefulDecoder,
086 * org.apache.asn1.codec.stateful.DecoderCallback,
087 * org.apache.asn1.codec.stateful.DecoderCallback)
088 */
089 public void callbackSet( StatefulDecoder decoder, DecoderCallback oldcb, DecoderCallback newcb )
090 {
091 }
092 }