KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > iiop > security > SvcContextUtils


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.iiop.security;
25
26 /* Import classes generated from CSIV2 idl files */
27 import com.sun.corba.ee.org.omg.CSI.*;
28 import com.sun.corba.ee.org.omg.GSSUP.*;
29 import java.util.logging.*;
30 import com.sun.logging.*;
31
32 /**
33  * This class contains the utility methods for dealing with
34  * service contexts.
35  *
36  * @author: Sekhar Vajjhala
37  *
38  */

39
40 public class SvcContextUtils {
41
42     private static java.util.logging.Logger JavaDoc _logger=null;
43     static{
44        _logger=LogDomains.getLogger(LogDomains.CORBA_LOGGER);
45         }
46     /**
47      * Define minor codes for errors specified in section 4.5,
48      * "ContextError Values and Exceptions"
49      *
50      * Currently only MessageInContextMinor code is defined since this
51      * is the only used by the security interceptors.
52      */

53
54     public static final int MessageInContextMinor = 4 ;
55
56
57     /**
58      * Hard code the value of 15 for SecurityAttributeService until
59      * it is defined in IOP.idl.
60      * sc.context_id = SecurityAttributeService.value;
61      */

62     private static final int SECURITY_ATTRIBUTE_SERVICE_ID = 15;
63
64     /**
65      * Define mnemonic strings for SAS message types for debugging
66      * purposes.
67      */

68
69     private static final String JavaDoc EstablishContextName = "EstablishContext";
70     private static final String JavaDoc CompleteEstablishName = "CompleteEstablishContext";
71     private static final String JavaDoc MessageInContextName = "MessageInContext";
72     private static final String JavaDoc ContextErrorName = "ContextError";
73
74     /**
75      * returns a mnemonic name for the message type based on the
76      * SASContextBody union discriminant
77      */

78
79     public static String JavaDoc getMsgname(short discr) {
80   
81         String JavaDoc name = null;
82
83         switch (discr) {
84
85         case MTEstablishContext.value:
86             name = EstablishContextName;
87             break;
88
89         case MTContextError.value:
90             name = ContextErrorName;
91             break;
92  
93         case MTCompleteEstablishContext.value:
94             name = CompleteEstablishName;
95             break;
96
97         case MTMessageInContext.value:
98             name = MessageInContextName;
99             break;
100
101         default:
102         _logger.log(Level.SEVERE,"iiop.unknown_msgtype");
103             break;
104     }
105         return name;
106     }
107 }
108         
109
110
111
Popular Tags