KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > mobilitools > smi > api > Constants


1 /*
2 * MobiliTools: an implementation of the Object Management Group's
3 * Mobile Agent Facility specification.
4 * Copyright (C) 2003 France Telecom R&D
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * MobiliTools $Name: $
21 *
22 * Contact: mobilitools-smi@lists.debian-sf.objectweb.org
23 *
24 * Authors: Bruno Dillenseger
25 */

26
27
28 package org.objectweb.mobilitools.smi.api;
29
30 import org.omg.CfMAF.AgentSystemInfo;
31 import org.omg.CfMAF.LanguageMap;
32 import org.omg.CORBA.Any JavaDoc;
33
34
35 /**
36  * MobiliTools $Name: $, $Id: Constants.java,v 1.1.1.1 2003/03/28 14:48:05 dillense Exp $
37  * <P>
38  * Set of constants for parameterizing SMI.
39  * <UL>
40  * <LI>MAF-related identifiers for SMI agent system
41  * <LI>system properties for agency naming (re. CORBA naming service)
42  * <BLOCKQUOTE>
43  * Any SMI agency is automatically bound to a name in the CORBA naming service.
44  * This name is constructed according to the scheme:
45  * <BR><code>/region prefix/region name/agency prefix/agency name</code>
46  * <BR>Both prefixes have default values which may be overridden by setting
47  * dedicated system properties. (String'fied COSnaming names have the following format:
48  * <BR><code>/naming context1!kind1/.../object!kind</code>)
49  * </BLOCKQUOTE>
50  * </UL>
51 */

52 public abstract class Constants
53 {
54     // identifiers for SMI agent systems
55

56     /** agent system type identifier for SMI = 10 */
57     public static final short TYPE_ID = 10;
58     /** major version of SMI agent system = 1 */
59     public static final short MAJOR_VERSION = 1;
60     /** minor version of SMI agent system = 0 */
61     public static final short MINOR_VERSION = 0;
62     /** textual description of SMI agent system = "Simple MAF Implementation" */
63     public static final String JavaDoc DESCRIPTION = "Simple MAF Implementation";
64
65
66     // identifiers compliant with MAF specifications
67

68     /** MAF-compliant language identifier for SMI agent system = 1 */
69     public static final short LANGUAGE_ID = 1;
70     /** MAF-compliant serialization identifier for SMI agent system = 1 */
71     public static final short SERIALIZATION = 1;
72     /** COS naming URI prefix = "CosNaming:" */
73     public static final String JavaDoc COSNAMINGURI = "CosNaming:";
74
75
76     // properties and default values for the agency's full name in the CORBA Naming Service
77

78     /** property name for region naming prefix = "org.objectweb.mobilitools.smi.regionPrefix" */
79     public static final String JavaDoc regionPrefixProp = "org.objectweb.mobilitools.smi.regionPrefix";
80     /** default value for region naming prefix property = "MAF" */
81     public static final String JavaDoc regionPrefixDefault = "MAF";
82     /** property name for agency naming prefix = "org.objectweb.mobilitools.smi.agencyPrefix" */
83     public static final String JavaDoc agencyPrefixProp = "org.objectweb.mobilitools.smi.agencyPrefix";
84     /** default value for agency naming prefix = "agency" */
85     public static final String JavaDoc agencyPrefixDefault = "agency";
86     /** property name for finder naming prefix = "org.objectweb.mobilitools.smi.finderPrefix" */
87     public static final String JavaDoc finderNameProp = "org.objectweb.mobilitools.smi.finderPrefix";
88     /** default value for finder naming prefix = "finder" */
89     public static final String JavaDoc finderNameDefault = "finder";
90
91
92     // when an agency is remotely terminated, it must wait a while so that the CORBA call
93
// has returned before exiting. (only applies when Agency standalone attribute in true)
94

95     /** property name for setting exit delay when agencies are terminated = "org.objectweb.mobilitools.smi.agencyExitDelay" */
96     public static final String JavaDoc agencyExitDelayProp = "org.objectweb.mobilitools.smi.agencyExitDelay";
97     /** default exit delay in ms when agencies are terminated = "10000" */
98     public static final String JavaDoc agencyExitDelayDefault = "10000";
99
100
101     // properties and default values for classloader factory class
102

103     /** property name for classloader factory = "org.objectweb.mobilitools.smi.classloader" */
104     public static final String JavaDoc classLoaderProp = "org.objectweb.mobilitools.smi.classloader";
105     /** default value for classloader factory = "org.objectweb.mobilitools.smi.lib.SMIClassLoader" */
106     public static final String JavaDoc classLoaderDefault = "org.objectweb.mobilitools.smi.lib.SMIClassLoader";
107     /** method name called on classloader factory is "getClassLoader" */
108     public static final String JavaDoc classLoaderMethod = "getClassLoader";
109
110
111     // exceptions
112

113     /** exception raised by some Agency methods when the agency is shutdown */
114     public static final RuntimeException JavaDoc agencyIsClosed =
115         new RuntimeException JavaDoc("The agency is terminated.");
116
117     /**
118      * @param identity the agent system's identity
119      * @param authority the agent system's authority
120      * @return a MAF agent system information record for an SMI agency
121      */

122     public static final AgentSystemInfo makeAgentSystemInfo(byte[] authority, byte[] identity)
123     {
124         return new AgentSystemInfo(
125             new org.omg.CfMAF.Name(
126                 authority,
127                 identity,
128                 TYPE_ID),
129             TYPE_ID,
130             new LanguageMap[] {
131                 new LanguageMap(
132                     LANGUAGE_ID,
133                     new short[] { SERIALIZATION })
134                     },
135             DESCRIPTION,
136             MAJOR_VERSION,
137             MINOR_VERSION,
138             new Any JavaDoc[0]);
139     }
140
141
142     /**
143      * Displays version information
144      */

145     public static void main(String JavaDoc[] args)
146     {
147         System.out.println("MobiliTools version $Name: $");
148     }
149 };
150
Popular Tags