OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [gnu/] [classpath/] [debug/] [Component.java] - Blame information for rev 769

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 769 jeremybenn
/* Component.java -- a component log level.
2
   Copyright (C) 2005, 2006  Free Software Foundation, Inc.
3
 
4
This file is a part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or (at
9
your option) any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under terms
30
of your choice, provided that you also meet, for each linked independent
31
module, the terms and conditions of the license of that module.  An
32
independent module is a module which is not derived from or based on
33
this library.  If you modify this library, you may extend this exception
34
to your version of the library, but you are not obligated to do so.  If
35
you do not wish to do so, delete this exception statement from your
36
version.  */
37
 
38
 
39
package gnu.classpath.debug;
40
 
41
import java.lang.reflect.Field;
42
import java.lang.reflect.Modifier;
43
import java.util.logging.Level;
44
 
45
public final class Component extends Level
46
{
47
 
48
  /*
49
   * HOW TO ADD NEW COMPONENTS:
50
   *
51
   * If you want to add a new, simple component, that you will use in
52
   * logging statements, simply create a new class variable that
53
   * instantiates this class, and choose an appropriate string name
54
   * and a integer constant not used by any other component level.
55
   *
56
   * For example, if my component had to do with 'frobbing', I would
57
   * add this entry below:
58
   *
59
   *   private static final Component FROBBING = new Component ("FROBBING", 7);
60
   *
61
   * Then, I would update the component 'EVERYTHING' to have and end
62
   * index ONE GREATER THAN the index of the new component.
63
   *
64
   * ADDING NEW COMPONENT CLASSES:
65
   *
66
   * A "component class" is a run of more than one component, which can
67
   * be enabled all at once. EVERYTHING and SSL are examples of component
68
   * classes. To add a new class, create a new component with a start index
69
   * equal to the index of the first member component, and with an end
70
   * index equal to the index of the last member component plus one.
71
   */
72
 
73
  /**
74
   * Signifies that everything should be logged. This should be used to
75
   * enable or disable levels only; logging code should not use it.
76
   */
77
  public static final Component EVERYTHING = new Component ("*", 0, 11);
78
 
79
  /**
80
   * Signifies that all SSL related messages should be logged. This should
81
   * be used to enable or disable levels only; logging code should not use
82
   * it.
83
   */
84
  public static final Component SSL = new Component ("SSL", 0, 5);
85
 
86
  /**
87
   * Traces the progression of an SSL handshake.
88
   */
89
  public static final Component SSL_HANDSHAKE = new Component ("SSL HANDSHAKE", 0);
90
 
91
  /**
92
   * Traces record layer messages during SSL communications.
93
   */
94
  public static final Component SSL_RECORD_LAYER = new Component ("SSL RECORD LAYER", 1);
95
 
96
  /**
97
   * Trace details about the SSL key exchange.
98
   */
99
  public static final Component SSL_KEY_EXCHANGE = new Component ("SSL KEY EXCHANGE", 2);
100
 
101
  /**
102
   * Trace running of delegated tasks.
103
   */
104
  public static final Component SSL_DELEGATED_TASK = new Component ("SSL DELEGATED TASK", 3);
105
 
106
  /* Index 4 reserved for future use by SSL components. */
107
 
108
  /**
109
   * Trace the operation of cryptographic primitives.
110
   */
111
  public static final Component CRYPTO = new Component ("CRYPTO", 5);
112
 
113
  /**
114
   * Trace the parsing of X.509 certificates and related objects.
115
   */
116
  public static final Component X509 = new Component ("X.509", 6);
117
 
118
  /**
119
   * Trace access control policies, including the parsing of
120
   * java.policy files.
121
   */
122
  public static final Component POLICY = new Component ("POLICY", 7);
123
 
124
  /**
125
   * Trace ipp implementation.
126
   */
127
  public static final Component IPP = new Component ("IPP", 10);
128
 
129
  private final int startIndex;
130
  private final int endIndex;
131
 
132
  private Component (final String name, final int bitIndex)
133
  {
134
    this (name, bitIndex, bitIndex + 1);
135
  }
136
 
137
  private Component (final String name, final int startIndex, final int endIndex)
138
  {
139
    super (name, Level.FINE.intValue ());
140
    this.startIndex = startIndex;
141
    this.endIndex = endIndex;
142
  }
143
 
144
  /**
145
   * Return the component for the given name.
146
   *
147
   * @param name The name of the component to get.
148
   * @return The named component, or null if there is no such component.
149
   */
150
  public static Component forName (final String name)
151
  {
152
    try
153
      {
154
        Field f = Component.class.getField (name.toUpperCase ());
155
        if (!Modifier.isStatic (f.getModifiers ())
156
            || Component.class.isAssignableFrom (f.getClass ()))
157
          return null;
158
        return (Component) f.get (null);
159
      }
160
    catch (Throwable _)
161
      {
162
        return null;
163
      }
164
  }
165
 
166
  public int startIndex ()
167
  {
168
    return startIndex;
169
  }
170
 
171
  public int endIndex ()
172
  {
173
    return endIndex;
174
  }
175
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.