View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.asn1.codec.stateful ;
18  
19  
20  
21  
22  /***
23   * A do nothing decoder monitor adapter.  At a bare minimum warning, error and
24   * fatal exceptions are reported to the console when using this adapter to 
25   * prevent exceptions from being completely ignored.
26   *
27   * @author Apache Software Foundation
28   * @version $Rev: 161723 $
29   */
30  public class DecoderMonitorAdapter implements DecoderMonitor
31  {
32      /* (non-Javadoc)
33       * @see org.apache.asn1.codec.stateful.DecoderMonitor#error(
34       * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
35       */
36      public void error( StatefulDecoder decoder, Exception exception )
37      {
38          System.err.println( "ERROR: " + exception.getMessage() ) ;
39      }
40  
41      
42      /* (non-Javadoc)
43       * @see org.apache.asn1.codec.stateful.DecoderMonitor#fatalError(
44       * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
45       */
46      public void fatalError( StatefulDecoder decoder, Exception exception )
47      {
48          System.err.println( "FATAL: " + exception.getMessage() ) ;
49      }
50  
51      
52      /* (non-Javadoc)
53       * @see org.apache.asn1.codec.stateful.DecoderMonitor#warning(
54       * org.apache.asn1.codec.stateful.StatefulDecoder, java.lang.Exception)
55       */
56      public void warning( StatefulDecoder decoder, Exception exception )
57      {
58          System.err.println( "WARN: " + exception.getMessage() ) ;
59      }
60  
61      
62      /* (non-Javadoc)
63       * @see org.apache.asn1.codec.stateful.DecoderMonitor#callbackOccured(
64       * org.apache.asn1.codec.stateful.StatefulDecoder,
65       * org.apache.asn1.codec.stateful.DecoderCallback, java.lang.Object)
66       */
67      public void callbackOccured( StatefulDecoder decoder, DecoderCallback cb,
68  								 Object decoded )
69      {
70      }
71  
72      
73      /* (non-Javadoc)
74       * @see org.apache.asn1.codec.stateful.DecoderMonitor#callbackSet(
75       * org.apache.asn1.codec.stateful.StatefulDecoder,
76       * org.apache.asn1.codec.stateful.DecoderCallback,
77       * org.apache.asn1.codec.stateful.DecoderCallback)
78       */
79      public void callbackSet( StatefulDecoder decoder, DecoderCallback oldcb,
80  							 DecoderCallback newcb )
81      {
82      }
83  }