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/10/09 19:48:15 UTC

svn commit: r823636 - /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java

Author: mturk
Date: Fri Oct  9 17:48:15 2009
New Revision: 823636

URL: http://svn.apache.org/viewvc?rev=823636&view=rev
Log:
Add bunch of windows service enums

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java   (with props)

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java?rev=823636&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java Fri Oct  9 17:48:15 2009
@@ -0,0 +1,90 @@
+/* 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.platform.windows;
+
+import java.util.EnumSet;
+
+/**
+ * ServiceControl types.
+ */
+public enum ServiceControl
+{
+
+    UNKNOWN(       -1),
+    /**
+     * Notifies a service that it should start.
+     */
+    START(          0),
+    /**
+     * Notifies a service that it should stop.<BR/>
+     * After sending the stop request to a service, you should not send
+     * other controls to the service.
+     */
+    STOP(           1),
+    /**
+     * Notifies a service that it should pause.
+     */
+    PAUSE(          2),
+    /**
+     * Notifies a paused service that it should resume.
+     */
+    CONTINUE(       3),
+    /**
+     * Notifies a service that it should report its current status
+     * information to the service control manager.
+     */
+    INTERROGATE(    4),
+    /**
+     * Notifies a service when system shutdown occurs.
+     * <BR/>
+     * Note that ControlService cannot
+     * send this notification; only the system can send it.
+     */
+    SHUTDOWN(       5),
+    /**
+     * Notifies a service that its startup parameters have changed.
+     */
+    PARAMCHANGE(    6),
+    /**
+     * The service defines the action associated with the control code.
+     * Range 128 to 255.
+     */
+    USER(         128);
+
+    private int value;
+    private ServiceControl(int v)
+    {
+        value = v;
+    }
+
+    public int valueOf()
+    {
+        return value;
+    }
+
+    public static ServiceControl valueOf(int value)
+    {
+        for (ServiceControl e : values()) {
+            if (e.value == value)
+                return e;
+        }
+        if (value > USER.value)
+            return USER;
+        else
+            return UNKNOWN;
+    }
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/ServiceControl.java
------------------------------------------------------------------------------
    svn:eol-style = native