01: /*****************************************************************************
02: * Java Plug-in Framework (JPF)
03: * Copyright (C) 2004-2005 Dmitry Olshansky
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *****************************************************************************/package org.java.plugin.boot;
19:
20: import org.java.plugin.util.ExtendedProperties;
21:
22: /**
23: * Interface to plug custom code into JPF based application boot procedure. The
24: * implementation should contain logic on configuring and initializing (but not
25: * starting) application.
26: *
27: * @version $Id$
28: */
29: public interface ApplicationInitializer {
30: /**
31: * Configures this initializer instance, this method will be called once
32: * before any other method call in this class. There is no pre-defined
33: * configuration parameters, see concrete implementations for supported
34: * parameters.
35: * @param config application configuration data from
36: * <code>boot.properties</code> file and <code>System</code>
37: * properties as defaults
38: * @throws Exception if any error has occurred during initializer
39: * configuring
40: */
41: void configure(ExtendedProperties config) throws Exception;
42:
43: /**
44: * This method should configure and initialize an application instance to be
45: * started.
46: * @param errorHandler callback interface to report errors to the user,
47: * it is recommended to use this handler only for
48: * "non-fatal" errors and ask user via
49: * {@link BootErrorHandler#handleError(String, Exception)}
50: * or {@link BootErrorHandler#handleError(String, org.java.plugin.registry.IntegrityCheckReport)}
51: * if he wants to abort application boot process
52: * @param args command line arguments as they passed to program
53: * <code>main</code> method
54: * @return initialized application instance or <code>null</code> if
55: * initializing failed
56: * @throws Exception if any error has occurred during application
57: * initializing
58: */
59: Application initApplication(BootErrorHandler errorHandler,
60: String[] args) throws Exception;
61: }
|