You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <nm...@byteaction.de> on 2006/07/22 12:47:02 UTC
SourceCode of phoenix-daemon-loader
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();
}
}
Re: SourceCode of phoenix-daemon-loader
Posted by Stefano Bagnara <ap...@bago.org>.
Norman Maurer wrote:
> 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:
At the moment I would add the file source to the "JAMES_PHOENIX.txt"
file that already explain the process to obtain our custom phoenix binary.
This is not a best practice but I wouldn't like to add a "phoenix class"
to james server source repository.
One furthe option would be to create our own branch of phoenix under
james and put there the changes described in JAMES_PHOENIX.txt plus
this class.
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
RE: SourceCode of phoenix-daemon-loader
Posted by "Noel J. Bergman" <no...@devtech.com>.
> an idea where to put the source code of phoenix-daemon-loader ?
Embed it in server/, same as I did for sendmail.py.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org