本文整理汇总了Java中org.apache.commons.daemon.DaemonInitException类的典型用法代码示例。如果您正苦于以下问题:Java DaemonInitException类的具体用法?Java DaemonInitException怎么用?Java DaemonInitException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DaemonInitException类属于org.apache.commons.daemon包,在下文中一共展示了DaemonInitException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws DaemonInitException, Exception {
if (!config.init(context.getArguments()))
throw new DaemonInitException("Invalid configuration.");
ClassLoader loader = SPLDaemon.class.getClassLoader();
InputStream params = loader.getResourceAsStream(DEFAULT_PARAMS_FILE);
if (params != null) {
MAVLinkShadow.getInstance().loadParams(params);
params.close();
} else {
logger.warn("File 'default.params' with initial parameters values not found.");
}
MAVLinkMessageQueue mtMessageQueue = new MAVLinkMessageQueue(config.getQueueSize());
tcpServer = new MAVLinkTcpServer(config.getMAVLinkPort(), mtMessageQueue);
MAVLinkMessageQueue moMessageQueue = new MAVLinkMessageQueue(config.getQueueSize());
MOMessageHandler moHandler = new MOMessageHandler(moMessageQueue);
httpServer = HttpServer.create(new InetSocketAddress(config.getRockblockPort()), 0);
httpServer.createContext(config.getHttpContext(),
new RockBlockHttpHandler(moHandler, config.getRockBlockIMEI()));
httpServer.setExecutor(null);
// TODO: Broadcast MO messages to all the connected clients.
RockBlockClient rockblock = new RockBlockClient(config.getRockBlockIMEI(),
config.getRockBlockUsername(),
config.getRockBlockPassword(),
config.getRockBlockURL());
MTMessagePump mtMsgPump = new MTMessagePump(mtMessageQueue, rockblock);
mtMsgPumpThread = new Thread(mtMsgPump, "mt-message-pump");
WSEndpoint.setMTQueue(mtMessageQueue);
wsServer = new Server("localhost", config.getWSPort(), "/gcs", WSEndpoint.class);
}
开发者ID:envirover,项目名称:SPLGroundControl,代码行数:40,代码来源:SPLDaemon.java
示例2: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws DaemonInitException{
logger.info("---- Initializing Jabbot ----");
logger.info("# Loading configuration file");
//File file = new File(CONFIG_FILE);
File file = new File(ClassLoader.getSystemResource(CONFIG_FILE).getFile());
FileConfigurationDao fileConfigurationDao = new FileConfigurationDao(file);
JabbotConfiguration configuration = fileConfigurationDao.getConfiguration();
logger.info("# Scanning extensions folder");
if(configuration.getExtensionsFolder() != null){
new ExtensionScanner(configuration.getExtensionsFolder()).run();
}
logger.info("# Registering configured bindings");
if(configuration.getServerList() != null) {
for (final BindingConfiguration connectionConfiguration : configuration.getServerList()) {
BindingManager.register(connectionConfiguration);
}
}
logger.info("# Initializing Event handlers");
this.registerEventHandlers();
logger.info("### Initialization completed");
}
开发者ID:midoricorp,项目名称:jabbot,代码行数:23,代码来源:Jabbot.java
示例3: parseCommandLine
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
protected void parseCommandLine(String[] args)
throws DaemonInitException, ConfigurationException, BiremeException {
Option help = new Option("help", "print this message");
Option configFile =
Option.builder("config_file").hasArg().argName("file").desc("config file location").build();
Options opts = new Options();
opts.addOption(help);
opts.addOption(configFile);
CommandLine cmd = null;
CommandLineParser parser = new DefaultParser();
try {
cmd = parser.parse(opts, args);
if (cmd.hasOption("help")) {
throw new ParseException("print help message");
}
} catch (ParseException e) {
HelpFormatter formatter = new HelpFormatter();
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out);
formatter.printHelp(writer, formatter.getWidth(), "Bireme", null, opts,
formatter.getLeftPadding(), formatter.getDescPadding(), null, true);
writer.flush();
String result = out.toString();
throw new DaemonInitException(result);
}
String config = cmd.getOptionValue("config_file", DEFAULT_CONFIG_FILE);
cxt = new Context(new Config(config));
}
开发者ID:HashDataInc,项目名称:bireme,代码行数:34,代码来源:Bireme.java
示例4: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws DaemonInitException, Exception {
if (instance != null)
throw new IllegalStateException("Mentor already initialized!");
instance = Mentor.get();
instance.init();
}
开发者ID:vsite-hr,项目名称:mentor,代码行数:8,代码来源:MentorDaemon.java
示例5: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public void init(final DaemonContext dc) throws DaemonInitException {
logger.debug("Initializing AgentShell from JSVC");
try {
init(dc.getArguments());
} catch (final ConfigurationException ex) {
throw new DaemonInitException("Initialization failed", ex);
}
}
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:9,代码来源:AgentShell.java
示例6: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext arg0) throws DaemonInitException, Exception {
context = new AnnotationConfigApplicationContext();
context.register(ScoreMarkConfig.class);
context.refresh();
scoreCalcuService = context.getBean(ScoreCalcuService.class);
consumer = context.getBean(QueueingConsumer.class);
mapper = context.getBean(ObjectMapper.class);
createWorkThread();
LOGGER.info("ScoreMarker daemon init done.");
}
开发者ID:imalexyang,项目名称:ExamStack,代码行数:13,代码来源:ScoreMarkerMain.java
示例7: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init ( DaemonContext daemonContext ) throws DaemonInitException, Exception
{
String configFile = "/etc/eclipsescada/ngp2modbus/ngp2modbus.json";
// config file would be the first command line parameter
if ( daemonContext.getArguments ().length > 0 )
{
configFile = daemonContext.getArguments ()[0];
}
// is config file accessible at all?
if ( !new File ( configFile ).canRead () )
{
String msg = "config file '" + configFile + "' does not exists or can not be read!";
System.err.println ( msg );
throw new DaemonInitException ( msg );
}
// check if config file is valid
try
{
FileInputStream is = new FileInputStream ( configFile );
NgpToModbusConfiguration config = NgpToModbusConfiguration.read ( is );
System.out.println ( config );
}
catch ( final Exception e )
{
e.printStackTrace ();
throw new DaemonInitException ( "config validation failed", e );
}
System.out.println ( "Staring Modbus converter with config file " + configFile );
m = new Ngp2Modbus ( configFile );
}
开发者ID:ibh-systems,项目名称:neoscada-misc,代码行数:36,代码来源:JsvcStarter.java
示例8: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext daemonContext) throws DaemonInitException, Exception
{
//System.out.println("deamon: init()");
String arguments[] = daemonContext.getArguments();
System.out.println(arguments);
GlobalRegistryServer.main(arguments);
}
开发者ID:reTHINK-project,项目名称:dev-registry-global,代码行数:9,代码来源:GlobalRegistryServer.java
示例9: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public void init(DaemonContext daemonContext) throws DaemonInitException, Exception {
logger = LoggerFactory.getLogger(DaemonWrapper.class);
logger.debug("DaemonWrapper initializing");
String[] args = daemonContext.getArguments();
dumblock = new Object();
stopped = false;
serverThread = new CliDispatcher(this,args,dumblock);
logger.debug("DaemonWrapper initialized");
}
开发者ID:emanuelecasadio,项目名称:CliDispatcher,代码行数:10,代码来源:DaemonWrapper.java
示例10: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws DaemonInitException, Exception {
LOGGER.info("Initializing " + getClass().getSimpleName());
this.context = context;
cfg = MainConfiguration.getCfg(System.getProperties());
Properties p = MainConfiguration.processArguments(context.getArguments());
if (p != null) {
cfg.applyProperties(p);
}
mainController = new Controller(cfg);
mainController.setDaemon(true);
}
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:14,代码来源:Main.java
示例11: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext dc) throws DaemonInitException {
s_logger.debug("Initializing AgentShell from JSVC");
try {
init(dc.getArguments());
} catch (ConfigurationException ex) {
throw new DaemonInitException("Initialization failed", ex);
}
}
开发者ID:apache,项目名称:cloudstack,代码行数:10,代码来源:AgentShell.java
示例12: main
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public static void main(final String[] args)
{
AgentDaemon daemon = new AgentDaemon();
if (args.length != 1)
{
AgentDaemon.usage();
return;
}
try
{
if (StringUtils.equals("start", args[0]))
{
daemon.init(null);
daemon.start();
}
else if (StringUtils.equals("stop", args[0]))
{
daemon.stop();
}
else
{
AgentDaemon.usage();
}
}
catch (DaemonInitException dix)
{
ERROR_RECORDER.error(dix.getMessage(), dix);
System.exit(-1);
}
}
开发者ID:cwsus,项目名称:esolutions,代码行数:35,代码来源:AgentDaemon.java
示例13: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext arg) throws DaemonInitException, Exception {
//TODO: get an xml config file from the command line
log.info("Linux daemon received init");
for (String s : arg.getArguments()) {
log.debug("Got argument: "+s);
}
if (!this.configure(DEFAULT_CONFIG_FILE)) {
throw new DaemonInitException("Error configuring logger with file: "+DEFAULT_CONFIG_FILE);
}
}
开发者ID:therealchalz,项目名称:softlogger,代码行数:12,代码来源:Softlogger.java
示例14: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext dc) throws DaemonInitException, Exception {
System.out.println("SVC INIT");
parseArguments(dc.getArguments(), this);
}
开发者ID:roscisz,项目名称:KernelHive,代码行数:6,代码来源:HiveCluster.java
示例15: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public static void init(DaemonContext arg0) throws DaemonInitException,
Exception {
// TODO Auto-generated method stub
// System.out.println("init");
logger.info("init");
}
开发者ID:282857484,项目名称:HBX_SNIMS_server,代码行数:7,代码来源:server_version_2.java
示例16: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public static void init(DaemonContext arg0) throws DaemonInitException,
Exception {
logger.info("init");
}
开发者ID:282857484,项目名称:HBX_SNIMS_server,代码行数:5,代码来源:server_version_3.java
示例17: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws DaemonInitException, Exception {
server = new Server();
}
开发者ID:sormuras,项目名称:cars,代码行数:5,代码来源:ServerDaemon.java
示例18: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext ctx) throws DaemonInitException, Exception {
this.procCtx = ctx;
}
开发者ID:Gadreel,项目名称:divconq,代码行数:5,代码来源:Daemon.java
示例19: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
@Override
public void init(DaemonContext arg0) throws DaemonInitException, Exception {
initLog4j();
}
开发者ID:apache,项目名称:cloudstack,代码行数:5,代码来源:UsageServer.java
示例20: init
import org.apache.commons.daemon.DaemonInitException; //导入依赖的package包/类
public void init(final DaemonContext dContext) throws DaemonInitException
{
final String methodName = AgentDaemon.CNAME + "#init(final DaemonContext dContext) throws DaemonInitException";
if (DEBUG)
{
DEBUGGER.debug(methodName);
DEBUGGER.debug("DaemonContext: {}", dContext);
}
JAXBContext context = null;
Unmarshaller marshaller = null;
final File xmlFile = new File(AgentConstants.CURRENT_DIRECTORY + System.getProperty(AgentDaemon.APP_CONFIG));
if (DEBUG)
{
DEBUGGER.debug("xmlFile: {}", xmlFile);
}
try
{
if (!(xmlFile.canRead()))
{
throw new DaemonInitException("No configuration file was located. Shutting down !");
}
// set the app configuration
context = JAXBContext.newInstance(ConfigurationData.class);
marshaller = context.createUnmarshaller();
ConfigurationData configData = (ConfigurationData) marshaller.unmarshal(xmlFile);
if (DEBUG)
{
DEBUGGER.debug("ConfigurationData: {}", configData);
}
String osName = System.getProperty("os.name").toLowerCase();
if (DEBUG)
{
DEBUGGER.debug("osName: {}", osName);
}
if (osName.indexOf("win") >= 0)
{
AgentDaemon.agentBean.setOsType(OSType.WINDOWS);
}
else if (osName.indexOf("mac") >= 0)
{
AgentDaemon.agentBean.setOsType(OSType.MAC);
}
else if ((osName.indexOf("nix") >= 0) || (osName.indexOf("sunos") >= 0) || (osName.indexOf("aix") >= 0))
{
AgentDaemon.agentBean.setOsType(OSType.UNIX);
}
AgentDaemon.agentBean.setHostName(InetAddress.getLocalHost().getHostName());
AgentDaemon.agentBean.setConfigData(configData);
}
catch (JAXBException jx)
{
ERROR_RECORDER.error(jx.getMessage(), jx);
this.exitCode = 1;
stop();
}
catch (UnknownHostException uhx)
{
ERROR_RECORDER.error(uhx.getMessage(), uhx);
this.exitCode = 1;
stop();
}
}
开发者ID:cwsus,项目名称:esolutions,代码行数:76,代码来源:AgentDaemon.java
注:本文中的org.apache.commons.daemon.DaemonInitException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论