KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > invocation > InvocationKey


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.invocation;
23
24 import java.io.Serializable JavaDoc;
25 import java.io.ObjectStreamException JavaDoc;
26
27
28 /** Type safe enumeration used for keys in the Invocation object. This relies
29  * on an integer id as the identity for a key. When you add a new key enum
30  * value you must assign it an ordinal value of the current MAX_KEY_ID+1 and
31  * update the MAX_KEY_ID value.
32  *
33  * @author Scott.Stark@jboss.org
34  * @version $Revision: 37459 $
35  */

36 public final class InvocationKey implements Serializable JavaDoc
37 {
38    /** The serial version ID */
39    private static final long serialVersionUID = -5117370636698417671L;
40
41    /** The max ordinal value in use for the InvocationKey enums. When you add a
42     * new key enum value you must assign it an ordinal value of the current
43     * MAX_KEY_ID+1 and update the MAX_KEY_ID value.
44     */

45    private static final int MAX_KEY_ID = 18;
46
47    /** The array of InvocationKey indexed by ordinal value of the key */
48    private static final InvocationKey[] values = new InvocationKey[MAX_KEY_ID+1];
49
50    /**
51     * Transactional information with the invocation.
52     */

53    public static final InvocationKey TRANSACTION =
54          new InvocationKey("TRANSACTION", 0);
55
56    /**
57     * Security principal assocated with this invocation.
58     */

59    public static final InvocationKey PRINCIPAL =
60       new InvocationKey("PRINCIPAL", 1);
61
62    /**
63     * Security credential assocated with this invocation.
64     */

65    public static final InvocationKey CREDENTIAL =
66          new InvocationKey("CREDENTIAL", 2);
67
68    /** Any authenticated Subject associated with the invocation */
69    public static final InvocationKey SUBJECT = new InvocationKey("SUBJECT", 14);
70
71    /**
72     * We can keep a reference to an abstract "container" this invocation
73     * is associated with.
74     */

75    public static final InvocationKey OBJECT_NAME =
76          new InvocationKey("CONTAINER", 3);
77
78    /**
79     * The type can be any qualifier for the invocation, anything (used in EJB).
80     */

81    public static final InvocationKey TYPE = new InvocationKey("TYPE", 4);
82
83    /**
84     * The Cache-ID associates an instance in cache somewhere on the server
85     * with this invocation.
86     */

87    public static final InvocationKey CACHE_ID = new InvocationKey("CACHE_ID", 5);
88
89    /**
90     * The invocation can be a method invocation, we give the method to call.
91     */

92    public static final InvocationKey METHOD = new InvocationKey("METHOD", 6);
93
94    /**
95     * The arguments of the method to call.
96     */

97    public static final InvocationKey ARGUMENTS =
98       new InvocationKey("ARGUMENTS", 7);
99
100    /**
101     * Invocation context
102     */

103    public static final InvocationKey INVOCATION_CONTEXT =
104          new InvocationKey("INVOCATION_CONTEXT", 8);
105
106    /**
107     * Enterprise context
108     */

109    public static final InvocationKey ENTERPRISE_CONTEXT =
110          new InvocationKey("ENTERPRISE_CONTEXT", 9);
111
112    /**
113     * The invoker-proxy binding name
114     */

115    public static final InvocationKey INVOKER_PROXY_BINDING =
116          new InvocationKey("INVOKER_PROXY_BINDING", 10);
117
118    /**
119     * The invoker
120     */

121    public static final InvocationKey INVOKER = new InvocationKey("INVOKER", 11);
122
123    /**
124     * The JNDI name of the EJB.
125     */

126    public static final InvocationKey JNDI_NAME =
127       new InvocationKey("JNDI_NAME", 12);
128
129    /**
130     * The EJB meta-data for the {@link javax.ejb.EJBHome} reference.
131     */

132    public final static InvocationKey EJB_METADATA =
133          new InvocationKey("EJB_METADATA", 13);
134
135    /** The EJB home proxy bound for use by getEJBHome */
136    public final static InvocationKey EJB_HOME =
137          new InvocationKey("EJB_HOME", 14);
138
139    /** The SOAP Message Context that is available to the SLSB during a service endpoint invocation */
140    public final static InvocationKey SOAP_MESSAGE_CONTEXT =
141          new InvocationKey("SOAP_MESSAGE_CONTEXT", 15);
142
143    /** The SOAP Message that is available to the SLSB during a service endpoint invocation */
144    public final static InvocationKey SOAP_MESSAGE =
145          new InvocationKey("SOAP_MESSAGE", 16);
146
147    /** The JAAC context id associated with the invocatio */
148    public final static InvocationKey JACC_CONTEXT_ID =
149          new InvocationKey("JACC_CONTEXT_ID", 17);
150
151    /** The key enum symbolic value */
152    private final transient String JavaDoc name;
153    /** The persistent integer representation of the key enum */
154    private final int ordinal;
155
156    private InvocationKey(String JavaDoc name, int ordinal)
157    {
158       this.name = name;
159       this.ordinal = ordinal;
160       values[ordinal] = this;
161    }
162
163    public String JavaDoc toString()
164    {
165       return name;
166    }
167
168    Object JavaDoc readResolve() throws ObjectStreamException JavaDoc
169    {
170       return values[ordinal];
171    }
172 }
173
Popular Tags