You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/23 20:21:23 UTC
svn commit: r768003 - in
/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime:
CommandType.java ProcessState.java Signal.java SyslogLevel.java
io/DriveType.java io/PipeIoMode.java io/SyslogLevel.java
Author: mturk
Date: Thu Apr 23 18:21:22 2009
New Revision: 768003
URL: http://svn.apache.org/viewvc?rev=768003&view=rev
Log:
Add some enums
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java (with props)
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/SyslogLevel.java (with props)
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/CommandType.java
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/CommandType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/CommandType.java?rev=768003&r1=768002&r2=768003&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/CommandType.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/CommandType.java Thu Apr 23 18:21:22 2009
@@ -18,13 +18,6 @@
/**
* Set what type of command the child process will call.
- * @param cmd The type of command. One of:
- * <PRE>
- * SHELLCMD -- Anything that the shell can handle
- * PROGRAM -- Executable program (default)
- * PROGRAM_ENV -- Executable program, copy environment
- * PROGRAM_PATH -- Executable program on PATH, copy env
- * </PRE>
*/
public enum CommandType
{
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java?rev=768003&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java Thu Apr 23 18:21:22 2009
@@ -0,0 +1,60 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime;
+
+/**
+ * Process state modes enum.
+ */
+public enum ProcessState
+{
+ /** Process state is unknown. */
+ UNKNOWN( 0),
+ /** Process is running. */
+ RUNNING( 1),
+ /** Process is sleeping. */
+ SLEEPING( 2),
+ /** Process is waiting for an I/O operation. */
+ WAITING( 3),
+ ZOMBIE( 4),
+ /** Process has stopped. */
+ STOPPED( 5),
+ PAGING( 6),
+ /** Process is dead. */
+ DEAD( 7);
+
+
+ private int value;
+ private ProcessState(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static ProcessState valueOf(int value)
+ {
+ for (ProcessState e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/ProcessState.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java?rev=768003&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java Thu Apr 23 18:21:22 2009
@@ -0,0 +1,113 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime;
+
+/**
+ * Posix signals enumeration.
+ */
+public enum Signal
+{
+
+ /** Unknown signal */
+ UNKNOWN( 0),
+ /** Hangup (POSIX). */
+ SIGHUP( 1),
+ /** Interrupt (ANSI). */
+ SIGINT( 2),
+ /** Quit (POSIX). */
+ SIGQUIT( 3),
+ /** Illegal instruction (ANSI). */
+ SIGILL( 4),
+ /** Trace trap (POSIX). */
+ SIGTRAP( 5),
+ /** Abort (ANSI). */
+ SIGABRT( 6),
+ /** IOT trap (4.2 BSD). */
+ SIGIOT( 6),
+ /** BUS error (4.2 BSD). */
+ SIGBUS( 7),
+ /** Floating-point exception (ANSI). */
+ SIGFPE( 8),
+ /** Kill, unblockable (POSIX). */
+ SIGKILL( 9),
+ /** User-defined signal 1 (POSIX). */
+ SIGUSR1( 10),
+ /** Segmentation violation (ANSI). */
+ SIGSEGV( 11),
+ /** User-defined signal 2 (POSIX). */
+ SIGUSR2( 12),
+ /** Broken pipe (POSIX). */
+ SIGPIPE( 13),
+ /** Alarm clock (POSIX). */
+ SIGALRM( 14),
+ /** Termination (ANSI). */
+ SIGTERM( 15),
+ /** Stack fault. */
+ SIGSTKFLT( 16),
+ /** Child status has changed (POSIX). */
+ SIGCHLD( 17),
+ /** Continue (POSIX). */
+ SIGCONT( 18),
+ /** Stop, unblockable (POSIX). */
+ SIGSTOP( 19),
+ /** Keyboard stop (POSIX). */
+ SIGTSTP( 20),
+ /** Background read from tty (POSIX). */
+ SIGTTIN( 21),
+ /** Background write to tty (POSIX). */
+ SIGTTOU( 22),
+ /** Urgent condition on socket (4.2 BSD). */
+ SIGURG( 23),
+ /** CPU limit exceeded (4.2 BSD). */
+ SIGXCPU( 24),
+ /** File size limit exceeded (4.2 BSD). */
+ SIGXFSZ( 25),
+ /** Virtual alarm clock (4.2 BSD). */
+ SIGVTALRM( 26),
+ /** Profiling alarm clock (4.2 BSD). */
+ SIGPROF( 27),
+ /** Window size change (4.3 BSD, Sun). */
+ SIGWINCH( 28),
+ /** I/O now possible (4.2 BSD). */
+ SIGIO( 29),
+ /** Power failure restart (System V). */
+ SIGPWR( 30),
+ /** Bad system call. */
+ SIGSYS( 31);
+
+
+ private int value;
+ private Signal(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static Signal valueOf(int value)
+ {
+ for (Signal e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Signal.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java?rev=768003&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java Thu Apr 23 18:21:22 2009
@@ -0,0 +1,51 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime;
+
+/**
+ * System log levels.
+ */
+public enum SyslogLevel
+{
+
+ EMERG( 1),
+ ERROR( 2),
+ NOTICE( 3),
+ WARN( 4),
+ INFO( 5),
+ DEBUG( 6);
+
+ private int value;
+ private SyslogLevel(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static SyslogLevel valueOf(int value)
+ {
+ for (SyslogLevel e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ throw new IllegalArgumentException("Invalid initializer: " + value);
+ }
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SyslogLevel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java?rev=768003&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java Thu Apr 23 18:21:22 2009
@@ -0,0 +1,78 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.io;
+
+/**
+ * Drive type enumeration.
+ * <p>
+ * Determines whether a disk drive is a removable, fixed, CD-ROM,
+ * RAM disk, or network drive.
+ * </p>
+ */
+public enum DriveType
+{
+
+ /** The drive type cannot be determined. */
+ UNKNOWN( -1),
+ /** The drive has no type. */
+ NONE( 0),
+ /**
+ * The root path is invalid, for example,
+ * no volume is mounted at the path.
+ */
+ INVALID( 1),
+ /**
+ * The drive is a type that has removable media, for example,
+ * a floppy drive or removable hard disk.
+ */
+ REMOVABLE( 2),
+ /**
+ * The drive is a type that cannot be removed, for example,
+ * a fixed hard drive.
+ */
+ FIXED( 3),
+ /** The drive is a remote (network) drive. */
+ REMOTE( 4),
+ /** The drive is a CD-ROM drive. */
+ CDROM( 5),
+ /** The drive is a RAM disk. */
+ RAMDISK( 6),
+ /** The drive is SWAP. */
+ SWAP( 7);
+
+
+ private int value;
+ private DriveType(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static DriveType valueOf(int value)
+ {
+ for (DriveType e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ return UNKNOWN;
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/DriveType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java?rev=768003&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java Thu Apr 23 18:21:22 2009
@@ -0,0 +1,57 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.io;
+
+/**
+ * Determine if any of {@code stdin}, {@code stdout}, or {@code stderr}
+ * should be linked to pipes when starting a child process.
+ */
+public enum PipeIoMode
+{
+ /** Do not redirect the specific stream. */
+ NO_PIPE( 0),
+ /** Make read/write blocking. */
+ FULL_BLOCK( 1),
+ /** Make read/write non blocking. */
+ FULL_NONBLOCK( 2),
+ /** Block the parent while accessing the {@code Pipe}. */
+ PARENT_BLOCK( 3),
+ /** Block the child while accessing the {@code Pipe}. */
+ CHILD_BLOCK( 4);
+
+
+ private int value;
+ private PipeIoMode(int v)
+ {
+ value = v;
+ }
+
+ public int valueOf()
+ {
+ return value;
+ }
+
+ public static PipeIoMode valueOf(int value)
+ {
+ for (PipeIoMode e : values()) {
+ if (e.value == value)
+ return e;
+ }
+ throw new IllegalArgumentException("Invalid initializer: " + value);
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/PipeIoMode.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/SyslogLevel.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/SyslogLevel.java?rev=768003&view=auto
==============================================================================
(empty)
Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/SyslogLevel.java
------------------------------------------------------------------------------
svn:eol-style = native