KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > martiansoftware > nailgun > NGConstants


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

18
19 package com.martiansoftware.nailgun;
20
21 import java.util.Properties JavaDoc;
22
23 /**
24  * Just a simple holder for various NailGun-related contants.
25  *
26  * @author <a HREF="http://www.martiansoftware.com/contact.html">Marty Lamb</a>
27  */

28 public class NGConstants {
29     
30     /**
31      * The default NailGun port (2113)
32      */

33     public static final int DEFAULT_PORT = 2113;
34     
35     /**
36      * The exit code sent to clients if an exception occurred on the server
37      */

38     public static final int EXIT_EXCEPTION = 899;
39     
40     /**
41      * The exit code sent to clients if an invalid command is sent
42      */

43     public static final int EXIT_NOSUCHCOMMAND = 898;
44
45     /**
46      * Chunk type marker for command line arguments
47      */

48     public static final char CHUNKTYPE_ARGUMENT = 'A';
49
50     /**
51      * Chunk type marker for client environment variables
52      */

53     public static final char CHUNKTYPE_ENVIRONMENT = 'E';
54     
55     /**
56      * Chunk type marker for the command (alias or class)
57      */

58     public static final char CHUNKTYPE_COMMAND = 'C';
59     
60     /**
61      * Chunk type marker for client working directory
62      */

63     public static final char CHUNKTYPE_WORKINGDIRECTORY = 'D';
64     
65     /**
66      * Chunk type marker for stdin
67      */

68     public static final char CHUNKTYPE_STDIN = '0';
69
70     /**
71      * Chunk type marker for the end of stdin
72      */

73     public static final char CHUNKTYPE_STDIN_EOF = '.';
74
75     /**
76      * Chunk type marker for stdout
77      */

78     public static final char CHUNKTYPE_STDOUT = '1';
79     
80     /**
81      * Chunk type marker for stderr
82      */

83     public static final char CHUNKTYPE_STDERR = '2';
84     
85     /**
86      * Chunk type marker for client exit chunks
87      */

88     public static final char CHUNKTYPE_EXIT = 'X';
89     
90     /**
91      * Server version number
92      */

93     public static final String JavaDoc VERSION;
94     
95     /**
96      * Loads the version number from a file generated by Ant.
97      */

98     static {
99         Properties JavaDoc props = new Properties JavaDoc();
100         try {
101             props.load(NGConstants.class.getClassLoader().getResourceAsStream("com/martiansoftware/nailgun/nailgun-version.properties"));
102         } catch (java.io.IOException JavaDoc e) {
103             System.err.println("Unable to load nailgun-version.properties.");
104         }
105         VERSION = props.getProperty("version", "UNKNOWN");
106     }
107     
108 }
109
Popular Tags