KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log > output > jms > PropertyType


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.log.output.jms;
18
19 /**
20  * A class to hold all constants for PropertyTypes.
21  *
22  * @author <a HREF="mailto:mirceatoma@home.com">Mircea Toma</a>
23  */

24 public class PropertyType
25 {
26     public static final int STATIC = 1;
27     public static final int CATEGORY = 2;
28     public static final int CONTEXT = 3;
29     public static final int MESSAGE = 4;
30     public static final int TIME = 5;
31     public static final int RELATIVE_TIME = 6;
32     public static final int THROWABLE = 7;
33     public static final int PRIORITY = 8;
34
35     /**
36      * The maximum value used for TYPEs. Subclasses can define their own TYPEs
37      * starting at <code>MAX_TYPE + 1</code>.
38      */

39
40     public static final String JavaDoc STATIC_STR = "static";
41     public static final String JavaDoc CATEGORY_STR = "category";
42     public static final String JavaDoc CONTEXT_STR = "context";
43     public static final String JavaDoc MESSAGE_STR = "message";
44     public static final String JavaDoc TIME_STR = "time";
45     public static final String JavaDoc RELATIVE_TIME_STR = "rtime";
46     public static final String JavaDoc THROWABLE_STR = "throwable";
47     public static final String JavaDoc PRIORITY_STR = "priority";
48
49     public static int getTypeIdFor( final String JavaDoc type )
50     {
51         if( type.equalsIgnoreCase( CATEGORY_STR ) )
52             return CATEGORY;
53         else if( type.equalsIgnoreCase( STATIC_STR ) )
54             return STATIC;
55         else if( type.equalsIgnoreCase( CONTEXT_STR ) )
56             return CONTEXT;
57         else if( type.equalsIgnoreCase( MESSAGE_STR ) )
58             return MESSAGE;
59         else if( type.equalsIgnoreCase( PRIORITY_STR ) )
60             return PRIORITY;
61         else if( type.equalsIgnoreCase( TIME_STR ) )
62             return TIME;
63         else if( type.equalsIgnoreCase( RELATIVE_TIME_STR ) )
64             return RELATIVE_TIME;
65         else if( type.equalsIgnoreCase( THROWABLE_STR ) )
66         {
67             return THROWABLE;
68         }
69         else
70         {
71             throw new IllegalArgumentException JavaDoc( "Unknown Type " + type );
72         }
73     }
74 }
75
76
Popular Tags