Hi guys, anyone has an idea where to put the source code of phoenix-daemon-loader ? Its just one class. So maybe a bit overkill to create an extra svn project. Any ideas ? The code looks like this at the moment:
/*********************************************************************** * Copyright (c) 1999-2006 The Apache Software Foundation. * * All rights reserved. * * ------------------------------------------------------------------- * * 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.avalon.phoenix.launcher; import org.apache.avalon.phoenix.launcher.Main; import org.apache.commons.daemon.Daemon; import org.apache.commons.daemon.DaemonContext; import org.apache.commons.daemon.DaemonController; import java.util.Hashtable; import java.util.Observable; import java.util.Observer; /** * Phoenix launcher using Commons daemon. */ public class CommonsDaemonLauncher implements Daemon, Observer { private DaemonContext m_context; private DaemonController m_controller; private String[] m_args; /** * @see org.apache.commons.daemon.Daemon#init(DaemonContext) */ public void init(final DaemonContext daemonContext) throws Exception { m_context = daemonContext; m_controller = m_context.getController(); m_args = m_context.getArguments(); final Hashtable data = new Hashtable(); data.put(Observer.class.getName(), this); log("init application"); // We have to call this in init cause otherwise we not able to bind the ports! int exitCode = Main.startup(m_args, data, false); // Check if we should exit here cause the startup of phoenix fails if (exitCode == 1) { System.exit(exitCode); } } /** * @see org.apache.commons.daemon.Daemon#start() */ public void start() { log("starting application"); } /** * @see org.apache.commons.daemon.Daemon#stop() */ public void stop() { Main.shutdown(); } /** * @see org.apache.commons.daemon.Daemon#destroy() */ public void destroy() { } /** * @see java.util.Observer#update(Observable, Object) */ public void update(final Observable observable, final Object arg) { final String command = (null != arg) ? arg.toString() : ""; if (command.equals("restart")) { log("restart requested."); m_controller.reload(); log("restart completed."); } else if (command.equals("shutdown")) { log("shutdown requested."); m_controller.shutdown(); log("shutdown completed."); } else { throw new IllegalArgumentException("Unknown action " + command); } } /** * Loggin helper * * @param message The message to log to the console */ private void log(final String message) { System.out.print("CommonsDaemon: "); System.out.println(message); System.out.flush(); } }
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil