You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2019/05/28 09:46:55 UTC
svn commit: r1860225 [2/16] - in /tomee/deps/branches/commons-daemon: ./
src/ src/assembly/ src/changes/ src/docs/ src/main/ src/main/java/
src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/commons/ src/main/java/org/apache/commons/...
Added: tomee/deps/branches/commons-daemon/src/docs/daemon.html
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/docs/daemon.html?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/docs/daemon.html (added)
+++ tomee/deps/branches/commons-daemon/src/docs/daemon.html Tue May 28 09:46:53 2019
@@ -0,0 +1,277 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!--
+ 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.
+-->
+<HTML>
+ <HEAD>
+ <TITLE>Apache Daemon Specification - Version 1.0</TITLE>
+ <LINK REL="stylesheet" TYPE="text/css" HREF="daemon.css" TITLE="daemon">
+ <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=ISO-8859-1">
+ </HEAD>
+ <BODY>
+
+ <H1>Apache Daemon Specification</H1>
+ <H4>Version 1.0</H4>
+
+ <P CLASS="note">
+ <strong>Abstract:</strong>
+ This document specifies the behavior and life cycle of an abstract
+ Java™ daemon, in relation to its native container. In addition
+ it defines a mechanism for controlling a daemon, and its interaction
+ with the native OS process in which its existance is confined.
+ </P>
+
+ <H2>Index</H2>
+ <OL>
+ <LI><A HREF="#1">Introduction</A>
+ <LI><A HREF="#2">Scope of this specification</A>
+ <LI><A HREF="#3">The Daemon interface and its life cycle</A>
+ <OL>
+ <LI><A HREF="#3A">Instantiation</A>
+ <LI><A HREF="#3B">Initialization</A>
+ <LI><A HREF="#3C">Startup</A>
+ <LI><A HREF="#3D">Stop</A>
+ <LI><A HREF="#3E">Destruction</A>
+ </OL>
+ </OL>
+
+ <A NAME="1"><H2>Introduction</H2></A>
+ <P>
+ Since 1994, the Java™ programming language evolved and became a
+ valid tool to develop, other than applets and client applications,
+ reliable and performant server applications. The major disadvantage of
+ the Java™ platform is that still today the only portable way to
+ start a Java™ applcation relies on a single point of entry: the
+ <CODE><EM CLASS="key">public static void</EM> main(<EM CLASS="ref">String</EM>[])</CODE>
+ method.
+ </P>
+ <P>
+ Having a single-point of entry is a valid solution for client
+ applications, where interactively a user can command to the application
+ to quit (which can terminate the Virtual Machine process at calling the
+ <CODE><EM CLASS="ref">System</EM>.exit(<EM CLASS="key">int</EM>)</CODE>
+ method), but in those cases where the application is not interactive
+ (server applications) there is currently no portable way to notify
+ the Virtual Machine of its imminent shutdown.
+ </P>
+ <P>
+ A server application written in Java might have to perform several tasks
+ before being able to shutdown the Virtual Machine process. For example
+ in the case of a Servlet container, before the VM process is shut down,
+ sessions might need to be serialized to disk, and web applications need
+ to be destroyed.
+ </P>
+ <P>
+ One common solution to this problem is to create (for example) a
+ <CODE><EM CLASS="ref">ServerSocket</EM></CODE> and wait for a particular
+ message to be issued. When the message is received, all operations
+ required to shut down the server applications are performed and at the
+ end the <CODE><EM CLASS="ref">System</EM>.exit</CODE> method is called
+ to terminate the Virtual Machine process. This method, however, implies
+ several disadvantages and risks: for example in case of a system-wide
+ shutdown, it might happen that the Virtual Machine process will be shut
+ down directly by the operating system, without notifying the running
+ server application. Or, for example, if an attacker finds out what is
+ the required message to send to the server, and discovers a way to send
+ this message to the running server application, he can easily interrupt
+ the operation of a server, bypassing all the security restrictions
+ implemented in the operating system.
+ </P>
+ <P>
+ Most multi-user operating systems already have a way in which server
+ applications are started and stopped, under Unix based operating systems
+ non interactive server applications are called <em>daemons</em> and are
+ controlled by the operating system with a set of specified
+ <em>signals</em>. Under Windows such programs are called <em>daemons</em>
+ and are controlled by appropriate calls to specific functions defined in
+ the application binary, but although the ways of dealing with the problem
+ are different, in both cases the operating system can notify a server
+ application of its imminent shutdown, and the application has the
+ ability to perform certain tasks before its process of execution is
+ destroyed.
+ </P>
+
+ <A NAME="2"><H2>Scope of this specification</H2></A>
+ <P>
+ The scope of this specification is to define an API in line with the
+ current Java™ Platform APIs to support an alternative invocation
+ mechanism which could be used instead of the above mentioned
+ <CODE><EM CLASS="key">public static void</EM> main(<EM CLASS="ref">String</EM>[])</CODE>
+ method. This specification cover the behavior and life cycle of what
+ we define as "Java ™ daemons", or, in other words,
+ non interactive Java™ applications.
+ </P>
+ <P>
+ This specification does not cover how the container of a Java™
+ daemon must be implemented, or how to build a native liaison between
+ the operating system and the <CODE><EM CLASS="ref">Daemon</EM></CODE>
+ interface, but defines the relation between the an operating system
+ process and the <CODE><EM CLASS="ref">Daemon</EM></CODE> implementation
+ life cycle. It should be trivial for implementors to build a native
+ liaison and container for Java™ daemons.
+ </P>
+ <P>
+ This specification, together with the related API documentation, can be
+ used by software deveopers to build portable non interactive applications
+ based on the Java™ platform.
+ </P>
+
+ <A NAME="3"><H2>The Daemon interface and its life cycle</H2></A>
+ <P>
+ The <CODE><EM CLASS="ref">Daemon</EM></CODE> interface (defined as
+ follows) is the main interface representing a Java™ daemon:
+ </P>
+<PRE>
+<EM CLASS="key">package</EM> org.apache.commons.daemon;
+
+<EM CLASS="key">public interface</EM> <EM CLASS="ref">Daemon</EM>
+<EM CLASS="key">extends</EM> <EM CLASS="ref">Runnable</EM> {
+
+ <EM CLASS="key">public void</EM> init(<EM CLASS="ref">DaemonContext</EM> context)
+ throws <EM CLASS="ref">Exception</EM>;
+
+ <EM CLASS="key">public void</EM> run();
+
+ <EM CLASS="key">public void</EM> die();
+
+ <EM CLASS="key">public void</EM> destroy();
+}</PRE>
+ <P>
+ A daemon is managed through a well defined life cycle that defines how
+ it is loaded, initialized, started, stopped and destroyed. This life
+ cycle is expressed in the API by the <CODE>init(...)</CODE>,
+ <CODE>run()</CODE>, <CODE>die()</CODE> and <CODE>destroy()</CODE> methods
+ of the <CODE><EM CLASS="ref">Daemon</EM></CODE> interface.
+ </P>
+
+ <A NAME="3A"><H3>Instantiation</H3></A>
+ <P>
+ The daemon container is responsible for instantiating daemons. Because
+ of this, concrete implementations of the <CODE><EM CLASS="ref">Daemon</EM></CODE>
+ interface must always expose a public void constructor, which will be
+ used by the daemon container to create instances of the class.
+ For example:
+ </P>
+
+<PRE>
+<EM CLASS="key">package</EM> mypackage;
+
+<EM CLASS="key">import</EM> org.apache.commons.daemon.*;
+
+
+<EM CLASS="key">public class</EM> <EM CLASS="ref">MyDaemon</EM>
+<EM CLASS="key">implements</EM> <EM CLASS="ref">Daemon</EM> {
+
+ <EM CLASS="com">/** This constructor must be here. */</EM>
+ <EM CLASS="key">public</EM> MyDaemon() {
+ super();
+ ...
+ }
+ ...
+}</PRE>
+ <P>
+ Once the Virtual Machine process is started in the underlying operating
+ system, and the Virtual Machine itself is created and configured, the
+ daemon container associated with its native liaison constructs a new
+ instance of the concrete class implementing the
+ <CODE><EM CLASS="ref">Daemon</EM></CODE> instance. It is not defined by
+ this specification how the instance is constructed, or how many instances
+ of one or more concrete daemons implementation can coexist in the same
+ Virtual Machine.
+ </P>
+ <P>
+ As a side note, in case of multiple daemons running within the scope
+ of the same virtual machine, developers should not rely on static
+ methods and variables for proper operation, as it is advisable for
+ security reasons to load each different daemon instance in a separate
+ class loader.
+ </P>
+
+ <A NAME="3B"><H3>Initialization</H3></A>
+ <P>
+ After the daemon instance has been constructed, the container must
+ initialize it before it can be started. Initialization is provided so
+ that a daemon can read persisten configuration data, access native
+ resources, and perform other one-time activities.
+ </P>
+ <P>
+ Under certain operating systems (typically Unix based operating systems),
+ and if the native liaison of the container supports and it is configured
+ accordingly, this method might be called with super-user privileges.
+ For example, within the scope of this method, it might be wise to create
+ all required <CODE><EM CLASS="ref">ServerSocket</EM></CODE> instances (as
+ under several operating systems this requires super-user privileges).
+ </P>
+ <P>
+ That said, it is very important that within the scope of this method
+ "untrusted" data cannot be processed (for example, starting
+ an acceptor thread on a <CODE><EM CLASS="ref">ServerSocket</EM></CODE>
+ which receives and processes data from unknown sources), as this would
+ serious security hazards.
+ </P>
+ <P>
+ The daemon container must guarantee that the <CODE>init(...)</CODE>
+ method is called at least once, and only once on an instance of a
+ daemon object, and that it will be called before any access to the
+ <CODE>run()</CODE>, <CODE>die()</CODE> or <CODE>destroy()</CODE>
+ methods.
+ </P>
+ <P>
+ During initialization, the daemon instance can throw any
+ <CODE><EM CLASS="ref">Exception</EM></CODE> preventing a the successful
+ completion of the <CODE>init(...)</CODE> method. In this case the daemon
+ instance must not be started, and the <CODE>destroy()</CODE> method must
+ not be called before the instance is released by the container to allow
+ garbage collecting.
+ </P>
+
+ <A NAME="3C"><H3>Startup</H3></A>
+ <P>
+ As the <CODE><EM CLASS="ref">Daemon</EM></CODE> interface extends the
+ <CODE><EM CLASS="ref">Runnable</EM></CODE> interface, to start the
+ operation of a daemon, the container calls the <CODE>run()</CODE> method
+ within the scope of a <CODE><EM CLASS="ref">Thread</EM></CODE>. A
+ daemon is said to be "running" until the thread
+ </P>
+
+
+
+ <HR>
+ <P CLASS="copyright">
+ Author Pier Fumagalli
+ <A HREF="mailto:pier.fumagalli@sun.com"><pier.fumagalli@sun.com></A>
+ <BR>
+ Copyright © 2001, The Apache Software Foundation
+ <A HREF="http://www.apache.org/"><http://www.apache.org/></A>
+ <BR>
+ All rights reserved.
+ </P>
+
+ <P CLASS="copyright">
+ Sun, Sun Microsystems, Solaris, and Java are trademarks or registered
+ trademarks of Sun Microsystems, Inc.
+ <A HREF="http://www.sun.com/"><http://www.sun.com/></A>
+ <BR>
+ UNIX® is a registered trademark in the United States and other
+ countries, exclusively licensed through X/Open Company, Ltd.
+ <A HREF="http://www.opengroup.org/"><http://www.opengroup.org/></A>
+ <BR>
+ Windows, WinNT and Win32 are registered trademark of Microsoft Corp.
+ <A HREF="http://www.microsoft.com/"><http://www.microsoft.com/></A>
+ </P>
+ </P>
+ </BODY>
+</HTML>
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/Daemon.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/Daemon.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/Daemon.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/Daemon.java Tue May 28 09:46:53 2019
@@ -0,0 +1,108 @@
+/*
+ * 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.daemon;
+
+/**
+ * Provides support for native daemon invocation. Using
+ * a platform dependant helper program, classes that implement the
+ * <code>Daemon</code> interface can be initialized, started and
+ * stopped according to the conventions of the underlying operating
+ * system.
+ * <p>
+ * Implementors of this interface must also provide a public constructor
+ * with no arguments so that instances can be created in an automated
+ * fashion.
+ * </p>
+ */
+public interface Daemon
+{
+
+ /**
+ * Initializes this <code>Daemon</code> instance.
+ * <p>
+ * This method gets called once the JVM process is created and the
+ * <code>Daemon</code> instance is created thru its empty public
+ * constructor.
+ * </p>
+ * <p>
+ * Under certain operating systems (typically Unix based operating
+ * systems) and if the native invocation framework is configured to do
+ * so, this method might be called with <i>super-user</i> privileges.
+ * </p>
+ * <p>
+ * For example, it might be wise to create <code>ServerSocket</code>
+ * instances within the scope of this method, and perform all operations
+ * requiring <i>super-user</i> privileges in the underlying operating
+ * system.
+ * </p>
+ * <p>
+ * Apart from set up and allocation of native resources, this method
+ * must not start the actual operation of the <code>Daemon</code> (such
+ * as starting threads calling the <code>ServerSocket.accept()</code>
+ * method) as this would impose some serious security hazards. The
+ * start of operation must be performed in the <code>start()</code>
+ * method.
+ * </p>
+ *
+ * @param context A <code>DaemonContext</code> object used to
+ * communicate with the container.
+ * @throws DaemonInitException An exception that prevented
+ * initialization where you want to display a nice message to the user,
+ * rather than a stack trace.
+ * @throws Exception Any exception preventing a successful
+ * initialization.
+ */
+ public void init(DaemonContext context)
+ throws DaemonInitException, Exception;
+
+ /**
+ * Starts the operation of this <code>Daemon</code> instance. This
+ * method is to be invoked by the environment after the init()
+ * method has been successfully invoked and possibly the security
+ * level of the JVM has been dropped. Implementors of this
+ * method are free to start any number of threads, but need to
+ * return control after having done that to enable invocation of
+ * the stop()-method.
+ *
+ * @throws Exception If the start was not successful
+ */
+ public void start()
+ throws Exception;
+
+ /**
+ * Stops the operation of this <code>Daemon</code> instance. Note
+ * that the proper place to free any allocated resources such as
+ * sockets or file descriptors is in the destroy method, as the
+ * container may restart the Daemon by calling start() after
+ * stop().
+ *
+ * @throws Exception If the stop was not successful
+ */
+ public void stop()
+ throws Exception;
+
+ /**
+ * Frees any resources allocated by this daemon such as file
+ * descriptors or sockets. This method gets called by the container
+ * after stop() has been called, before the JVM exits. The Daemon
+ * can not be restarted after this method has been called without a
+ * new call to the init() method.
+ */
+ public void destroy();
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonContext.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonContext.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonContext.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonContext.java Tue May 28 09:46:53 2019
@@ -0,0 +1,44 @@
+/*
+ * 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.daemon;
+
+
+/**
+ * Defines a set of methods that a Daemon instance can use to
+ * communicate with the Daemon container.
+ */
+public interface DaemonContext
+{
+
+ /**
+ * @return A {@link DaemonController} object that can be used to control
+ * the {@link Daemon} instance that this <code>DaemonContext</code>
+ * is passed to.
+ */
+ public DaemonController getController();
+
+ /**
+ * @return An array of {@link String} arguments supplied by the environment
+ * corresponding to the array of arguments given in the
+ * <code>public static void main()</code> method used as an entry
+ * point to most other java programs.
+ */
+ public String[] getArguments();
+
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonController.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonController.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonController.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonController.java Tue May 28 09:46:53 2019
@@ -0,0 +1,89 @@
+/*
+ * 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.daemon;
+
+
+/**
+ * Defines methods needed by the DaemonLoader.
+ */
+public interface DaemonController
+{
+
+ /**
+ * Shuts down the daemon.
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * shutdown
+ */
+ public void shutdown()
+ throws IllegalStateException;
+
+ /**
+ * Reloads daemon
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * reloaded
+ */
+ public void reload()
+ throws IllegalStateException;
+
+ /**
+ * Shuts down daemon and logs failed message.
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * shutdown
+ */
+ public void fail()
+ throws IllegalStateException;
+
+ /**
+ * Shuts down daemon and logs failed message.
+ *
+ * @param message The message to log
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * shutdown
+ */
+ public void fail(String message)
+ throws IllegalStateException;
+
+ /**
+ * Shuts down daemon and logs failed message.
+ *
+ * @param exception The exception to log
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * shutdown
+ */
+ public void fail(Exception exception)
+ throws IllegalStateException;
+
+ /**
+ * Shuts down daemon and logs failed message.
+ *
+ * @param message The message to log
+ * @param exception The exception to log
+ *
+ * @throws IllegalStateException If the daemon is not in a valid state to be
+ * shutdown
+ */
+ public void fail(String message, Exception exception)
+ throws IllegalStateException;
+
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonInitException.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonInitException.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonInitException.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonInitException.java Tue May 28 09:46:53 2019
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2010 Media Service Provider Ltd
+ *
+ * Licensed 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.daemon;
+
+/**
+ * Throw this during init if you can't initialise yourself for some expected
+ * reason. Using this exception will cause the exception's message to come out
+ * on stdout, rather than a dirty great stacktrace.
+ */
+public class DaemonInitException extends Exception {
+
+ private static final long serialVersionUID = 5665891535067213551L;
+
+ // don't rely on Throwable#getCause (jdk1.4)
+ private final Throwable cause;
+
+ public DaemonInitException(final String message) {
+ super(message);
+ this.cause = null;
+ }
+
+ public DaemonInitException(final String message, final Throwable cause) {
+ super(message);
+ this.cause = cause;
+ }
+
+ public String getMessageWithCause() {
+ final String extra = this.cause == null ? "" : ": " + this.cause.getMessage();
+ return getMessage() + extra;
+ }
+
+}
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonListener.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonListener.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonListener.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonListener.java Tue May 28 09:46:53 2019
@@ -0,0 +1,29 @@
+/*
+ * 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.daemon;
+
+import java.util.EventListener;
+
+/**
+ * EvenListener type wrapper.
+ */
+public interface DaemonListener extends EventListener
+{
+
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonPermission.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonPermission.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonPermission.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonPermission.java Tue May 28 09:46:53 2019
@@ -0,0 +1,440 @@
+/*
+ * 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.daemon;
+
+import java.security.Permission;
+import java.util.StringTokenizer;
+
+/**
+ * Represents the permissions to control and query the status of
+ * a <code>Daemon</code>. A <code>DaemonPermission</code> consists of a
+ * target name and a list of actions associated with it.
+ * <p>
+ * In this specification version the only available target name for this
+ * permission is "control", but further releases may add more target
+ * names to fine-tune the access that needs to be granted to the caller.
+ * </p>
+ * <p>
+ * Actions are defined by a string of comma-separated values, as shown in the
+ * table below. The empty string implies no permission at all, while the
+ * special "*" value implies all permissions for the given
+ * name:
+ * </p>
+ * <table width="100%" border="1">
+ * <caption>Supported Actions</caption>
+ * <tr>
+ * <th>Target"Name</th>
+ * <th>Action</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td rowspan="5">"control"</td>
+ * <td>"start"</td>
+ * <td>
+ * The permission to call the <code>start()</code> method in an instance
+ * of a <code>DaemonController</code> interface.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>"stop"</td>
+ * <td>
+ * The permission to call the <code>stop()</code> method in an instance
+ * of a <code>DaemonController</code> interface.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>"shutdown"</td>
+ * <td>
+ * The permission to call the <code>shutdown()</code> method in an instance
+ * of a <code>DaemonController</code> interface.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>"reload"</td>
+ * <td>
+ * The permission to call the <code>reload()</code> method in an instance
+ * of a <code>DaemonController</code> interface.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>"*"</td>
+ * <td>
+ * The special wildcard action implies all above-mentioned action. This is
+ * equal to construct a permission with the "start, stop, shutdown,
+ * reload" list of actions.
+ * </td>
+ * </tr>
+ * </table>
+ */
+public final class DaemonPermission extends Permission
+{
+
+ /* ====================================================================
+ * Constants.
+ */
+
+ private static final long serialVersionUID = -8682149075879731987L;
+
+ /**
+ * The target name when associated with control actions
+ * ("control").
+ */
+ protected static final String CONTROL = "control";
+
+ /**
+ * The target type when associated with control actions.
+ */
+ protected static final int TYPE_CONTROL = 1;
+
+ /**
+ * The action name associated with the permission to call the
+ * <code>DaemonController.start()</code> method.
+ */
+ protected static final String CONTROL_START = "start";
+
+ /**
+ * The action name associated with the permission to call the
+ * <code>DaemonController.stop()</code> method.
+ */
+ protected static final String CONTROL_STOP = "stop";
+
+ /**
+ * The action name associated with the permission to call the
+ * <code>DaemonController.shutdown()</code> method.
+ */
+ protected static final String CONTROL_SHUTDOWN = "shutdown";
+
+ /**
+ * The action name associated with the permission to call the
+ * <code>DaemonController.reload()</code> method.
+ */
+ protected static final String CONTROL_RELOAD = "reload";
+
+ /**
+ * The action mask associated with the permission to call the
+ * <code>DaemonController.start()</code> method.
+ */
+ protected static final int MASK_CONTROL_START = 0x01;
+
+ /**
+ * The action mask associated with the permission to call the
+ * <code>DaemonController.stop()</code> method.
+ */
+ protected static final int MASK_CONTROL_STOP = 0x02;
+
+ /**
+ * The action mask associated with the permission to call the
+ * <code>DaemonController.shutdown()</code> method.
+ */
+ protected static final int MASK_CONTROL_SHUTDOWN = 0x04;
+
+ /**
+ * The action mask associated with the permission to call the
+ * <code>DaemonController.reload()</code> method.
+ */
+ protected static final int MASK_CONTROL_RELOAD = 0x08;
+
+ /**
+ * The "wildcard" action implying all actions for the given
+ * target name.
+ */
+ protected static final String WILDCARD = "*";
+
+ /* ====================================================================
+ * Instance variables
+ */
+
+ /** The type of this permission object. */
+ private transient int type = 0;
+ /** The permission mask associated with this permission object. */
+ private transient int mask = 0;
+ /** The String representation of this permission object. */
+ private transient String desc = null;
+
+ /* ====================================================================
+ * Constructors
+ */
+
+ /**
+ * Creates a new <code>DaemonPermission</code> instance with a specified
+ * permission name.
+ * <p>
+ * This constructor will create a new <code>DaemonPermission</code>
+ * instance that <b>will not</b> grant any permission to the caller.
+ *
+ * @param target The target name of this permission.
+ * @throws IllegalArgumentException If the specified target name is not
+ * supported.
+ */
+ public DaemonPermission(final String target)
+ throws IllegalArgumentException
+ {
+ // Setup the target name of this permission object.
+ super(target);
+
+ // Check if the permission target name was specified
+ if (target == null) {
+ throw new IllegalArgumentException("Null permission name");
+ }
+
+ // Check if this is a "control" permission and set up accordingly.
+ if (CONTROL.equalsIgnoreCase(target)) {
+ type = TYPE_CONTROL;
+ return;
+ }
+
+ // If we got here, we have an invalid permission name.
+ throw new IllegalArgumentException("Invalid permission name \"" +
+ target + "\" specified");
+ }
+
+ /**
+ * Creates a new <code>DaemonPermission</code> instance with a specified
+ * permission name and a specified list of actions.
+ *
+ * @param target The target name of this permission.
+ * @param actions The list of actions permitted by this permission.
+ * @throws IllegalArgumentException If the specified target name is not
+ * supported, or the specified list of actions includes an
+ * invalid value.
+ */
+ public DaemonPermission(final String target, final String actions)
+ throws IllegalArgumentException
+ {
+ // Setup this instance's target name.
+ this(target);
+
+ // Create the appropriate mask if this is a control permission.
+ if (this.type == TYPE_CONTROL) {
+ this.mask = this.createControlMask(actions);
+ return;
+ }
+ }
+
+ /* ====================================================================
+ * Public methods
+ */
+
+ /**
+ * Returns the list of actions permitted by this instance of
+ * <code>DaemonPermission</code> in its canonical form.
+ *
+ * @return The canonicalized list of actions.
+ */
+ @Override
+ public String getActions()
+ {
+ if (this.type == TYPE_CONTROL) {
+ return this.createControlActions(this.mask);
+ }
+ return "";
+ }
+
+ /**
+ * Returns the hash code for this <code>DaemonPermission</code> instance.
+ *
+ * @return An hash code value.
+ */
+ @Override
+ public int hashCode()
+ {
+ this.setupDescription();
+ return this.desc.hashCode();
+ }
+
+ /**
+ * Checks if a specified object equals <code>DaemonPermission</code>.
+ *
+ * @return <b>true</b> or <b>false</b> wether the specified object equals
+ * this <code>DaemonPermission</code> instance or not.
+ */
+ @Override
+ public boolean equals(final Object object)
+ {
+ if (object == this) {
+ return true;
+ }
+
+ if (!(object instanceof DaemonPermission)) {
+ return false;
+ }
+
+ final DaemonPermission that = (DaemonPermission) object;
+
+ if (this.type != that.type) {
+ return false;
+ }
+ return this.mask == that.mask;
+ }
+
+ /**
+ * Checks if this <code>DaemonPermission</code> implies another
+ * <code>Permission</code>.
+ *
+ * @return <b>true</b> or <b>false</b> wether the specified permission
+ * is implied by this <code>DaemonPermission</code> instance or
+ * not.
+ */
+ @Override
+ public boolean implies(final Permission permission)
+ {
+ if (permission == this) {
+ return true;
+ }
+
+ if (!(permission instanceof DaemonPermission)) {
+ return false;
+ }
+
+ final DaemonPermission that = (DaemonPermission) permission;
+
+ if (this.type != that.type) {
+ return false;
+ }
+ return (this.mask & that.mask) == that.mask;
+ }
+
+ /**
+ * Returns a <code>String</code> representation of this instance.
+ *
+ * @return A <code>String</code> representing this
+ * <code>DaemonPermission</code> instance.
+ */
+ @Override
+ public String toString()
+ {
+ this.setupDescription();
+ return this.desc;
+ }
+
+ /* ====================================================================
+ * Private methods
+ */
+
+ /**
+ * Creates a String description for this permission instance.
+ */
+ private void setupDescription()
+ {
+ if (this.desc != null) {
+ return;
+ }
+
+ final StringBuffer buf = new StringBuffer();
+ buf.append(this.getClass().getName());
+ buf.append('[');
+ switch (this.type) {
+ case TYPE_CONTROL:
+ buf.append(CONTROL);
+ break;
+ default:
+ buf.append("UNKNOWN");
+ break;
+ }
+ buf.append(':');
+ buf.append(this.getActions());
+ buf.append(']');
+
+ this.desc = buf.toString();
+ }
+
+ /**
+ * Creates a permission mask for a given control actions string.
+ */
+ private int createControlMask(final String actions)
+ throws IllegalArgumentException
+ {
+ if (actions == null) {
+ return 0;
+ }
+
+ int mask = 0;
+ final StringTokenizer tok = new StringTokenizer(actions, ",", false);
+
+ while (tok.hasMoreTokens()) {
+ final String val = tok.nextToken().trim();
+
+ if (WILDCARD.equals(val)) {
+ return MASK_CONTROL_START | MASK_CONTROL_STOP |
+ MASK_CONTROL_SHUTDOWN | MASK_CONTROL_RELOAD;
+ }
+ else if (CONTROL_START.equalsIgnoreCase(val)) {
+ mask = mask | MASK_CONTROL_START;
+ }
+ else if (CONTROL_STOP.equalsIgnoreCase(val)) {
+ mask = mask | MASK_CONTROL_STOP;
+ }
+ else if (CONTROL_SHUTDOWN.equalsIgnoreCase(val)) {
+ mask = mask | MASK_CONTROL_SHUTDOWN;
+ }
+ else if (CONTROL_RELOAD.equalsIgnoreCase(val)) {
+ mask = mask | MASK_CONTROL_RELOAD;
+ }
+ else {
+ throw new IllegalArgumentException("Invalid action name \"" +
+ val + "\" specified");
+ }
+ }
+ return mask;
+ }
+
+ /** Creates a actions list for a given control permission mask. */
+ private String createControlActions(final int mask)
+ {
+ final StringBuffer buf = new StringBuffer();
+ boolean sep = false;
+
+ if ((mask & MASK_CONTROL_START) == MASK_CONTROL_START) {
+ sep = true;
+ buf.append(CONTROL_START);
+ }
+
+ if ((mask & MASK_CONTROL_STOP) == MASK_CONTROL_STOP) {
+ if (sep) {
+ buf.append(",");
+ }
+ else {
+ sep = true;
+ }
+ buf.append(CONTROL_STOP);
+ }
+
+ if ((mask & MASK_CONTROL_SHUTDOWN) == MASK_CONTROL_SHUTDOWN) {
+ if (sep) {
+ buf.append(",");
+ }
+ else {
+ sep = true;
+ }
+ buf.append(CONTROL_SHUTDOWN);
+ }
+
+ if ((mask & MASK_CONTROL_RELOAD) == MASK_CONTROL_RELOAD) {
+ if (sep) {
+ buf.append(",");
+ }
+ else {
+ sep = true;
+ }
+ buf.append(CONTROL_RELOAD);
+ }
+
+ return buf.toString();
+ }
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java Tue May 28 09:46:53 2019
@@ -0,0 +1,37 @@
+/*
+ * 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.daemon;
+
+/**
+ * Tags a Daemon as supporting some kind of
+ * signaling method that allows the java application to
+ * perform a custom action.
+ * <p>
+ * User must implement a signal method that will be called from
+ * native upon receiving {@code SIGUSR2} signal from the operating system.
+ * </p>
+ */
+public interface DaemonUserSignal
+{
+
+ /**
+ * Performs a custom action on received user signal.
+ */
+ void signal();
+
+}
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java Tue May 28 09:46:53 2019
@@ -0,0 +1,207 @@
+/*
+ * 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.daemon.support;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.text.ParseException;
+
+/**
+ * Used by jsvc for Daemon configuration.
+ * <p>
+ * Configuration is read from properties file.
+ * If no properties file is given the <code>daemon.properties</code>
+ * is used from the current directory.
+ * </p>
+ * <p>
+ * The properties file can have property values expanded at runtime
+ * by using System properties or execution environment. The part
+ * of the property value between <code>${</code> and <code>}</code>
+ * will be used as System property or environment key. If found then
+ * the entire <code>${foo}</code> will be replaced by the value of
+ * either system property or environment variable named <code>foo</code>.
+ * </p>
+ * <p>
+ * If no variable is found the <code>${foo}</code> will be passed as is.
+ * In case of <code>$${foo}</code> this will be unescaped and resulting
+ * value will be <code>${foo}</code>.
+ * </p>
+ *
+ */
+public final class DaemonConfiguration
+{
+ /**
+ * Default configuration file name.
+ */
+ protected final static String DEFAULT_CONFIG = "daemon.properties";
+ /**
+ * Property prefix
+ */
+ protected final static String PREFIX = "daemon.";
+ private final static String BTOKEN = "${";
+ private final static String ETOKEN = "}";
+
+
+ private final Properties configurationProperties;
+ private final Properties systemProperties;
+
+ /**
+ * Default constructor
+ */
+ public DaemonConfiguration()
+ {
+ configurationProperties = new Properties();
+ systemProperties = System.getProperties();
+ }
+
+ /**
+ * Loads the configuration properties file.
+ *
+ * @param fileName The properties file to load.
+ * @return <code>true</code> if the file was loaded.
+ */
+ public boolean load(String fileName)
+ {
+ boolean ok = false;
+ FileInputStream file = null;
+ try {
+ if (fileName == null) {
+ fileName = DEFAULT_CONFIG;
+ }
+ file = new FileInputStream(fileName);
+ configurationProperties.clear();
+ configurationProperties.load(file);
+ ok = true;
+ }
+ catch (final FileNotFoundException ex) {
+ // fileName does not exist
+ }
+ catch (final IOException ex) {
+ // Error reading properties file
+ } finally {
+ try {
+ if (file != null) {
+ file.close();
+ }
+ } catch (final IOException ex) {
+ }
+ }
+ return ok;
+ }
+
+ private String expandProperty(final String propValue)
+ throws ParseException
+ {
+ StringBuffer expanded;
+ int btoken;
+ int ctoken = 0;
+
+ if (propValue == null) {
+ return null;
+ }
+ expanded = new StringBuffer();
+ btoken = propValue.indexOf(BTOKEN);
+ while (btoken != -1) {
+ if (btoken > 0 && propValue.charAt(btoken - 1) == BTOKEN.charAt(0)) {
+ // Skip and unquote.
+ expanded.append(propValue.substring(ctoken, btoken));
+ ctoken = btoken + 1;
+ btoken = propValue.indexOf(BTOKEN, btoken + BTOKEN.length());
+ continue;
+ }
+ final int etoken = propValue.indexOf(ETOKEN, btoken);
+ if (etoken != -1) {
+ final String variable = propValue.substring(btoken + BTOKEN.length(), etoken);
+ String sysvalue = systemProperties.getProperty(variable);
+ if (sysvalue == null) {
+ // Try with the environment if there was no
+ // property by that name.
+ sysvalue = System.getenv(variable); // N.B. Deprecated in Java 1.3/1.4, but re-instated in Java 1.5+
+ }
+ if (sysvalue != null) {
+ final String strtoken = propValue.substring(ctoken, btoken);
+ expanded.append(strtoken);
+ expanded.append(sysvalue);
+ ctoken = etoken + ETOKEN.length();
+ }
+ }
+ else {
+ // We have "${" without "}"
+ throw new ParseException("Error while looking for teminating '" +
+ ETOKEN + "'", btoken);
+ }
+ btoken = propValue.indexOf(BTOKEN, etoken + ETOKEN.length());
+ }
+ // Add what's left.
+ expanded.append(propValue.substring(ctoken, propValue.length()));
+ return expanded.toString();
+ }
+
+ /**
+ * Gets the configuration property.
+ *
+ * @param name The name of the property to get.
+ *
+ * @throws ParseException if the property is wrongly formatted.
+ *
+ * @return Configuration property including any expansion/replacement
+ */
+ public String getProperty(final String name)
+ throws ParseException
+ {
+ if (name == null) {
+ return null;
+ }
+ return expandProperty(configurationProperties.getProperty(PREFIX + name));
+ }
+
+ /**
+ * Gets the configuration property array.
+ * <p>
+ * Property array is constructed form the list of properties
+ * which end with <code>[index]</code>
+ * </p>
+ * <pre>
+ * daemon.arg[0] = argument 1
+ * daemon.arg[1] = argument 2
+ * daemon.arg[2] = argument 3
+ * </pre>
+ * @param name The name of the property array to get.
+ *
+ * @throws ParseException if the property is wrongly formatted.
+ *
+ * @return Configuration property array including any expansion/replacement
+ */
+ public String[] getPropertyArray(final String name)
+ throws ParseException
+ {
+ final ArrayList<String> list = new ArrayList<String>();
+ String args;
+
+ // Load daemon.arg[0] ... daemon.arg[n] into the String array.
+ //
+ while ((args = getProperty(name + "[" + list.size() + "]")) != null) {
+ list.add(args);
+ }
+ return list.toArray(new String[list.size()]);
+ }
+}
+
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java Tue May 28 09:46:53 2019
@@ -0,0 +1,423 @@
+/*
+ * 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.daemon.support;
+
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.commons.daemon.DaemonController;
+import org.apache.commons.daemon.DaemonInitException;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Used by jsvc for Daemon management.
+ */
+public final class DaemonLoader
+{
+
+ // N.B. These static mutable variables need to be accessed using synch.
+ private static Controller controller = null; //@GuardedBy("this")
+ private static Object daemon = null; //@GuardedBy("this")
+ /* Methods to call */
+ private static Method init = null; //@GuardedBy("this")
+ private static Method start = null; //@GuardedBy("this")
+ private static Method stop = null; //@GuardedBy("this")
+ private static Method destroy = null; //@GuardedBy("this")
+ private static Method signal = null; //@GuardedBy("this")
+
+ public static void version()
+ {
+ System.err.println("java version \"" +
+ System.getProperty("java.version") + "\"");
+ System.err.println(System.getProperty("java.runtime.name") +
+ " (build " +
+ System.getProperty("java.runtime.version") + ")");
+ System.err.println(System.getProperty("java.vm.name") +
+ " (build " +
+ System.getProperty("java.vm.version") +
+ ", " + System.getProperty("java.vm.info") + ")");
+ System.err.println("commons daemon version \"" +
+ System.getProperty("commons.daemon.version") + "\"");
+ System.err.println("commons daemon process (id: " +
+ System.getProperty("commons.daemon.process.id") +
+ ", parent: " +
+ System.getProperty("commons.daemon.process.parent") + ")");
+ }
+
+ public static boolean check(final String cn)
+ {
+ try {
+ /* Check the class name */
+ if (cn == null) {
+ throw new NullPointerException("Null class name specified");
+ }
+
+ /* Get the ClassLoader loading this class */
+ final ClassLoader cl = DaemonLoader.class.getClassLoader();
+ if (cl == null) {
+ System.err.println("Cannot retrieve ClassLoader instance");
+ return false;
+ }
+
+ /* Find the required class */
+ final Class<?> c = cl.loadClass(cn);
+
+ /* This should _never_ happen, but doublechecking doesn't harm */
+ if (c == null) {
+ throw new ClassNotFoundException(cn);
+ }
+
+ /* Create a new instance of the daemon */
+ c.newInstance();
+
+ } catch (final Throwable t) {
+ /* In case we encounter ANY error, we dump the stack trace and
+ * return false (load, start and stop won't be called).
+ */
+ t.printStackTrace(System.err);
+ return false;
+ }
+ /* The class was loaded and instantiated correctly, we can return
+ */
+ return true;
+ }
+
+ public static boolean signal()
+ {
+ try {
+ if (signal != null) {
+ signal.invoke(daemon, new Object[0]);
+ return true;
+ }
+ System.out.println("Daemon doesn't support signaling");
+ } catch (final Throwable ex) {
+ System.err.println("Cannot send signal: " + ex);
+ ex.printStackTrace(System.err);
+ }
+ return false;
+ }
+
+ public static boolean load(final String className, String args[])
+ {
+ try {
+ /* Check if the underlying library supplied a valid list of
+ arguments */
+ if (args == null) {
+ args = new String[0];
+ }
+
+ /* Check the class name */
+ if (className == null) {
+ throw new NullPointerException("Null class name specified");
+ }
+
+ /* Get the ClassLoader loading this class */
+ final ClassLoader cl = DaemonLoader.class.getClassLoader();
+ if (cl == null) {
+ System.err.println("Cannot retrieve ClassLoader instance");
+ return false;
+ }
+ Class<?> c;
+ if (className.charAt(0) == '@') {
+ /* Wrap the class with DaemonWrapper
+ * and modify arguments to include the real class name.
+ */
+ c = DaemonWrapper.class;
+ final String[] a = new String[args.length + 2];
+ a[0] = "-start";
+ a[1] = className.substring(1);
+ System.arraycopy(args, 0, a, 2, args.length);
+ args = a;
+ }
+ else {
+ c = cl.loadClass(className);
+ }
+ /* This should _never_ happen, but double-checking doesn't harm */
+ if (c == null) {
+ throw new ClassNotFoundException(className);
+ }
+ /* Check interfaces */
+ boolean isdaemon = false;
+
+ try {
+ final Class<?> dclass = cl.loadClass("org.apache.commons.daemon.Daemon");
+ isdaemon = dclass.isAssignableFrom(c);
+ }
+ catch (final Exception cnfex) {
+ // Swallow if Daemon not found.
+ }
+
+ /* Check methods */
+ Class<?>[] myclass = new Class[1];
+ if (isdaemon) {
+ myclass[0] = DaemonContext.class;
+ }
+ else {
+ myclass[0] = args.getClass();
+ }
+
+ init = c.getMethod("init", myclass);
+
+ myclass = null;
+ start = c.getMethod("start", myclass);
+ stop = c.getMethod("stop", myclass);
+ destroy = c.getMethod("destroy", myclass);
+
+ try {
+ signal = c.getMethod("signal", myclass);
+ } catch (final NoSuchMethodException e) {
+ // Signalling will be disabled.
+ }
+
+ /* Create a new instance of the daemon */
+ daemon = c.newInstance();
+
+ if (isdaemon) {
+ /* Create a new controller instance */
+ controller = new Controller();
+
+ /* Set the availability flag in the controller */
+ controller.setAvailable(false);
+
+ /* Create context */
+ final Context context = new Context();
+ context.setArguments(args);
+ context.setController(controller);
+
+ /* Now we want to call the init method in the class */
+ final Object arg[] = new Object[1];
+ arg[0] = context;
+ init.invoke(daemon, arg);
+ }
+ else {
+ final Object arg[] = new Object[1];
+ arg[0] = args;
+ init.invoke(daemon, arg);
+ }
+
+ }
+ catch (final InvocationTargetException e) {
+ final Throwable thrown = e.getTargetException();
+ /* DaemonInitExceptions can fail with a nicer message */
+ if (thrown instanceof DaemonInitException) {
+ failed(((DaemonInitException) thrown).getMessageWithCause());
+ }
+ else {
+ thrown.printStackTrace(System.err);
+ }
+ return false;
+ }
+ catch (final Throwable t) {
+ /* In case we encounter ANY error, we dump the stack trace and
+ * return false (load, start and stop won't be called).
+ */
+ t.printStackTrace(System.err);
+ return false;
+ }
+ /* The class was loaded and instantiated correctly, we can return */
+ return true;
+ }
+
+ public static boolean start()
+ {
+ try {
+ /* Attempt to start the daemon */
+ final Object arg[] = null;
+ start.invoke(daemon, arg);
+
+ /* Set the availability flag in the controller */
+ if (controller != null) {
+ controller.setAvailable(true);
+ }
+
+ } catch (final Throwable t) {
+ /* In case we encounter ANY error, we dump the stack trace and
+ * return false (load, start and stop won't be called).
+ */
+ t.printStackTrace(System.err);
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean stop()
+ {
+ try {
+ /* Set the availability flag in the controller */
+ if (controller != null) {
+ controller.setAvailable(false);
+ }
+
+ /* Attempt to stop the daemon */
+ final Object arg[] = null;
+ stop.invoke(daemon, arg);
+ }
+ catch (final Throwable t) {
+ /* In case we encounter ANY error, we dump the stack trace and
+ * return false (load, start and stop won't be called).
+ */
+ t.printStackTrace(System.err);
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean destroy()
+ {
+ try {
+ /* Attempt to stop the daemon */
+ final Object arg[] = null;
+ destroy.invoke(daemon, arg);
+
+ daemon = null;
+ controller = null;
+ } catch (final Throwable t) {
+ /* In case we encounter ANY error, we dump the stack trace and
+ * return false (load, start and stop won't be called).
+ */
+ t.printStackTrace(System.err);
+ return false;
+ }
+ return true;
+ }
+
+ private static native void shutdown(boolean reload);
+ private static native void failed(String message);
+
+ public static class Controller
+ implements DaemonController
+ {
+
+ private boolean available = false;
+
+ private Controller()
+ {
+ super();
+ this.setAvailable(false);
+ }
+
+ private boolean isAvailable()
+ {
+ synchronized (this) {
+ return this.available;
+ }
+ }
+
+ private void setAvailable(final boolean available)
+ {
+ synchronized (this) {
+ this.available = available;
+ }
+ }
+
+ @Override
+ public void shutdown()
+ throws IllegalStateException
+ {
+ synchronized (this) {
+ if (!this.isAvailable()) {
+ throw new IllegalStateException();
+ }
+ this.setAvailable(false);
+ DaemonLoader.shutdown(false);
+ }
+ }
+
+ @Override
+ public void reload()
+ throws IllegalStateException
+ {
+ synchronized (this) {
+ if (!this.isAvailable()) {
+ throw new IllegalStateException();
+ }
+ this.setAvailable(false);
+ DaemonLoader.shutdown(true);
+ }
+ }
+
+ @Override
+ public void fail()
+ {
+ fail(null, null);
+ }
+
+ @Override
+ public void fail(final String message)
+ {
+ fail(message, null);
+ }
+
+ @Override
+ public void fail(final Exception exception)
+ {
+ fail(null, exception);
+ }
+
+ @Override
+ public void fail(final String message, final Exception exception)
+ {
+ synchronized (this) {
+ this.setAvailable(false);
+ String msg = message;
+ if (exception != null) {
+ if (msg != null) {
+ msg = msg + ": " + exception.toString();
+ }
+ else {
+ msg = exception.toString();
+ }
+ }
+ DaemonLoader.failed(msg);
+ }
+ }
+
+ }
+
+ public static class Context
+ implements DaemonContext
+ {
+
+ private DaemonController daemonController = null;
+
+ private String[] args = null;
+
+ @Override
+ public DaemonController getController()
+ {
+ return daemonController;
+ }
+
+ public void setController(final DaemonController controller)
+ {
+ this.daemonController = controller;
+ }
+
+ @Override
+ public String[] getArguments()
+ {
+ return args;
+ }
+
+ public void setArguments(final String[]args)
+ {
+ this.args = args;
+ }
+
+ }
+}
Added: tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java (added)
+++ tomee/deps/branches/commons-daemon/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java Tue May 28 09:46:53 2019
@@ -0,0 +1,285 @@
+/*
+ * 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.daemon.support;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+
+/**
+ * Implementation of the Daemon that allows running
+ * standard applications as daemons.
+ * The applications must have the mechanism to manage
+ * the application lifecycle.
+ *
+ */
+public class DaemonWrapper implements Daemon
+{
+
+ private final static String ARGS = "args";
+ private final static String START_CLASS = "start";
+ private final static String START_METHOD = "start.method";
+ private final static String STOP_CLASS = "stop";
+ private final static String STOP_METHOD = "stop.method";
+ private final static String STOP_ARGS = "stop.args";
+ private String configFileName = null;
+ private final DaemonConfiguration config;
+
+ private final Invoker startup;
+ private final Invoker shutdown;
+
+ public DaemonWrapper()
+ {
+ super();
+ config = new DaemonConfiguration();
+ startup = new Invoker();
+ shutdown = new Invoker();
+ }
+
+ /**
+ * Called from DaemonLoader on init stage.
+ * <p>
+ * Accepts the following configuration arguments:
+ * <ul>
+ * <li>-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults</li>
+ * <li>-start: set start class name</li>
+ * <li>-start-method: set start method name</li>
+ * <li>-stop: set stop class name</li>
+ * <li>-stop-method: set stop method name</li>
+ * <li>-stop-argument: set optional argument to stop method</li>
+ * <li>Anything else is treated as a startup argument</li>
+ * </ul>
+ * <p>
+ * The following "-daemon-properties" are recognized:
+ * <ul>
+ * <li>args (startup argument)</li>
+ * <li>start</li>
+ * <li>start.method</li>
+ * <li>stop</li>
+ * <li>stop.method</li>
+ * <li>stop.args</li>
+ * </ul>
+ * These are used to set the corresponding item if it has not already been
+ * set by the command arguments. <b>However, note that args and stop.args are
+ * appended to any existing values.</b>
+ */
+ @Override
+ public void init(final DaemonContext context)
+ throws Exception
+ {
+ final String[] args = context.getArguments();
+
+ if (args != null) {
+ int i;
+ // Parse our arguments and remove them
+ // from the final argument array we are
+ // passing to our child.
+ for (i = 0; i < args.length; i++) {
+ if (args[i].equals("--")) {
+ // Done with argument processing
+ break;
+ }
+ else if (args[i].equals("-daemon-properties")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ configFileName = args[i];
+ }
+ else if (args[i].equals("-start")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ startup.setClassName(args[i]);
+ }
+ else if (args[i].equals("-start-method")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ startup.setMethodName(args[i]);
+ }
+ else if (args[i].equals("-stop")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ shutdown.setClassName(args[i]);
+ }
+ else if (args[i].equals("-stop-method")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ shutdown.setMethodName(args[i]);
+ }
+ else if (args[i].equals("-stop-argument")) {
+ if (++i == args.length) {
+ throw new IllegalArgumentException(args[i - 1]);
+ }
+ final String[] aa = new String[1];
+ aa[0] = args[i];
+ shutdown.addArguments(aa);
+ }
+ else {
+ // This is not our option.
+ // Everything else will be forwarded to the main
+ break;
+ }
+ }
+ if (args.length > i) {
+ final String[] copy = new String[args.length - i];
+ System.arraycopy(args, i, copy, 0, copy.length);
+ startup.addArguments(copy);
+ }
+ }
+ if (config.load(configFileName)) {
+ // Setup params if not set via cmdline.
+ startup.setClassName(config.getProperty(START_CLASS));
+ startup.setMethodName(config.getProperty(START_METHOD));
+ // Merge the config with command line arguments
+ startup.addArguments(config.getPropertyArray(ARGS));
+
+ shutdown.setClassName(config.getProperty(STOP_CLASS));
+ shutdown.setMethodName(config.getProperty(STOP_METHOD));
+ shutdown.addArguments(config.getPropertyArray(STOP_ARGS));
+ }
+ startup.validate();
+ shutdown.validate();
+ }
+
+ /**
+ */
+ @Override
+ public void start()
+ throws Exception
+ {
+ startup.invoke();
+ }
+
+ /**
+ */
+ @Override
+ public void stop()
+ throws Exception
+ {
+ shutdown.invoke();
+ }
+
+ /**
+ */
+ @Override
+ public void destroy()
+ {
+ // Nothing for the moment
+ System.err.println("DaemonWrapper: instance " + this.hashCode() + " destroy");
+ }
+
+ // Internal class for wrapping the start/stop methods
+ class Invoker
+ {
+ private String name = null;
+ private String call = null;
+ private String[] args = null;
+ private Method inst = null;
+ private Class<?> main = null;
+
+ protected Invoker()
+ {
+ }
+
+ protected void setClassName(final String name)
+ {
+ if (this.name == null) {
+ this.name = name;
+ }
+ }
+ protected void setMethodName(final String name)
+ {
+ if (this.call == null) {
+ this.call = name;
+ }
+ }
+ protected void addArguments(final String[] args)
+ {
+ if (args != null) {
+ final ArrayList<String> aa = new ArrayList<String>();
+ if (this.args != null) {
+ aa.addAll(Arrays.asList(this.args));
+ }
+ aa.addAll(Arrays.asList(args));
+ this.args = aa.toArray(new String[aa.size()]);
+ }
+ }
+
+ protected void invoke()
+ throws Exception
+ {
+ if (name.equals("System") && call.equals("exit")) {
+ // Just call a System.exit()
+ // The start method was probably installed
+ // a shutdown hook.
+ System.exit(0);
+ }
+ else {
+ Object obj = null;
+ if ((inst.getModifiers() & Modifier.STATIC) == 0) {
+ // We only need object instance for non-static methods.
+ obj = main.newInstance();
+ }
+ final Object arg[] = new Object[1];
+
+ arg[0] = args;
+ inst.invoke(obj, arg);
+ }
+ }
+ // Load the class using reflection
+ protected void validate()
+ throws Exception
+ {
+ /* Check the class name */
+ if (name == null) {
+ name = "System";
+ call = "exit";
+ return;
+ }
+ if (args == null) {
+ args = new String[0];
+ }
+ if (call == null) {
+ call = "main";
+ }
+
+ // Get the ClassLoader loading this class
+ final ClassLoader cl = DaemonWrapper.class.getClassLoader();
+ if (cl == null) {
+ throw new NullPointerException("Cannot retrieve ClassLoader instance");
+ }
+ final Class<?>[] ca = new Class[1];
+ ca[0] = args.getClass();
+ // Find the required class
+ main = cl.loadClass(name);
+ if (main == null) {
+ throw new ClassNotFoundException(name);
+ }
+ // Find the required method.
+ // NoSuchMethodException will be thrown if matching method
+ // is not found.
+ inst = main.getMethod(call, ca);
+ }
+ }
+}
Added: tomee/deps/branches/commons-daemon/src/media/logo.xcf
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/media/logo.xcf?rev=1860225&view=auto
==============================================================================
Binary file - no diff available.
Propchange: tomee/deps/branches/commons-daemon/src/media/logo.xcf
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: tomee/deps/branches/commons-daemon/src/native/unix/.gitignore
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/native/unix/.gitignore?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/native/unix/.gitignore (added)
+++ tomee/deps/branches/commons-daemon/src/native/unix/.gitignore Tue May 28 09:46:53 2019
@@ -0,0 +1,8 @@
+/autom4te.cache
+/config.log
+/config.nice
+/configure
+/Makedefs
+/config.status
+/Makefile
+/jsvc
Added: tomee/deps/branches/commons-daemon/src/native/unix/INSTALL.txt
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/native/unix/INSTALL.txt?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/native/unix/INSTALL.txt (added)
+++ tomee/deps/branches/commons-daemon/src/native/unix/INSTALL.txt Tue May 28 09:46:53 2019
@@ -0,0 +1,81 @@
+To build the service libraries and binary under an UNIX operating
+system you will need:
+
+ An ANSI-C compliant compiler (GCC is good)
+ A Java Platform 2 compliant SDK
+ GNU AutoConf (when building from SVN).
+
+When building from SVN sources you need to build the "configure" program with:
+
+ sh support/buildconf.sh
+(Note it is possible to replace sh by any compatible shell like bash, ksh).
+
+Once the configure script is generated, run it (remember to specify
+either the --with-java=<dir> parameter or set the JAVA_HOME environment
+to point to your JDK installation. For example:
+
+ ./configure --with-java=/usr/java
+
+or
+
+ JAVA_HOME=/usr/java
+ export JAVA_HOME
+ ./configure
+
+Note: On Mac OS X <dir> is /System/Library/Frameworks/JavaVM.framework/Home.
+
+Depending on your JDK layout, configure might fail to find the JNI
+machine dependant include file (jni_md.h). If that's the case use the
+--with-os-type=<subdir> parameter where subdir points to the directory
+within JDK include directory containing jni_md.h file.
+
+
+If your operating system is supported, configure will go thru cleanly,
+otherwise it will report an error (please send us the details of your
+OS/JDK, or a patch against the sources).
+
+To build the binaries and libraries simply do:
+
+ make
+
+This will generate the file: ./jsvc.
+It should be straightforward from here on. To check the allowed parameters
+for the jsvc binary simply do
+
+ ./native/jsvc -help
+
+Note: On Linux the module capabilities should be loaded, when using -user root
+make sure you REALLY understand what capabilities does (for example for
+files access: the downgraded root may not be able to read some files!).
+
+Making 64-bit binaries
+
+To be able to build the 64-binaries for supported platforms enter the
+specific parameters before calling configure
+
+ export CFLAGS=-m64
+ export LDFLAGS=-m64
+ ./configure
+ make
+
+Making Universal binaries
+
+Some platforms like Mac OSX allow universal or fat binaries that allow
+both 32 and 64 binaries inside the same executable. To be able to build
+the fat binaries enter the specific parameters before calling configure
+
+ export CFLAGS="-arch i386 -arch x86_64"
+ export LDFLAGS="-arch i386 -arch x86_64"
+ ./configure
+ make
+
+Optional Build flags
+
+Make process allows specifying additional compilation flags at compile time
+by using EXTRA_CFLAGS and EXTRA_LDFLAGS either as environment variables
+or defined along the make command line
+
+ make EXTRA_CFLAGS="-march=i586"
+
+will cause -march=i586 to be added to the configure generated CFLAGS.
+The same applies to EXTRA_LDFLAGS which will be added at link stage.
Added: tomee/deps/branches/commons-daemon/src/native/unix/Makedefs.in
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/native/unix/Makedefs.in?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/native/unix/Makedefs.in (added)
+++ tomee/deps/branches/commons-daemon/src/native/unix/Makedefs.in Tue May 28 09:46:53 2019
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# @author Pier Fumagalli <ma...@eng.sun.com>
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+INCLUDES = @INCLUDES@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+RANLIB = @RANLIB@
+LDCMD = @LDCMD@
+STRIP = @STRIP@
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) -c $< -o $@
Added: tomee/deps/branches/commons-daemon/src/native/unix/Makefile.in
URL: http://svn.apache.org/viewvc/tomee/deps/branches/commons-daemon/src/native/unix/Makefile.in?rev=1860225&view=auto
==============================================================================
--- tomee/deps/branches/commons-daemon/src/native/unix/Makefile.in (added)
+++ tomee/deps/branches/commons-daemon/src/native/unix/Makefile.in Tue May 28 09:46:53 2019
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+SUBDIRS = native
+
+all: native/all
+
+native/all:
+ (cd native; $(MAKE) all)
+
+clean:
+ (cd native; $(MAKE) clean)
+
+distclean: clean
+ rm -f config.cache
+ rm -f config.log
+ rm -f config.status
+ rm -f config.nice
+ rm -f native/Makefile
+ rm -f Makefile
+ rm -f Makedefs
+ rm -rf autom4te.cache
+
+realclean: distclean
+ rm -f configure