DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Code Block |
|---|
public static void main(String[] argv) throws Exception
{
// (1) Load system properties.
Main.loadSystemProperties();
// (2) Read configuration properties.
Properties configProps = Main.loadConfigProperties();
// (23) Copy framework properties from the system properties.
Main.copySystemProperties(configProps);
// (34) See if the profile name property was specified.
String profileName = configProps.getProperty(BundleCache.CACHE_PROFILE_PROP);
// (34) See if the profile directory property was specified.
String profileDirName = configProps.getProperty(BundleCache.CACHE_PROFILE_DIR_PROP);
// Print welcome banner.
System.out.println("\nWelcome to Felix.");
System.out.println("=================\n");
// (45) If no profile or profile directory is specified in the
// properties, then ask for a profile name.
if ((profileName == null) && (profileDirName == null))
{
System.out.print("Enter profile name: ");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
{
profileName = in.readLine();
}
catch (IOException ex)
{
System.err.println("Could not read input.");
System.exit(-1);
}
System.out.println("");
if (profileName.length() != 0)
{
configProps.setProperty(BundleCache.CACHE_PROFILE_PROP, profileName);
}
}
// (6) A profile directory or name must be specified.
if ((profileDirName == null) && (profileName.length() == 0))
{
System.err.println("You must specify a profile name or directory.");
System.exit(-1);
}
try
{
// (57) Now create an instance of the framework.
m_felix = new Felix();
m_felix.start(
new MutablePropertyResolverImpl(new StringMap(configProps, false)),
null);
}
catch (Exception ex)
{
System.err.println("Could not create framework: " + ex);
ex.printStackTrace();
System.exit(-1);
}
}
|
...
- Load any system properties specified in the
system.propertiesfile; this file is typically located in theconf/directory of the Felix installation directory, but it can be specified directly using thefelix.system.propertiessystem property. This file is not needed to launch Felix and is provided merely for convenience when system properties must be specified. The file is a standard Java properties file, but it also supports property substitution using${<property-name} syntax. Property substitution can be nested; only system properties will be used for substitution. - Load any configuration properties specified in the
config.propertiesfile; this file is typically located in theconf/directory of the Felix installation directory, but it can be specified directly using thefelix.config.propertiessystem property. This file is used to configure the Felix instance created by the launcher. The file is a standard Java properties file, but it also supports property substitution using "${<property-name}" syntax. Property substitution can be nested; configuration and system properties will be used for substitution with configuration properties having precedence. - For convenience, any configuration properties that are set as system properties will be copied into the set of configuration properties to provide an easy way to add to or override configuration properties specified in the
config.propertiesfile. - Try to load the profile name or profile directory configuration properties. At least one of these must be specified so that the bundle cache knows where to save installed bundles.
- If either the profile name or profile directory configuration property has not been specified, then ask the user to specify a profile name and add it to the current set of configuration properties.
- Error if there is no profile name or profile directory.
- Create the Felix instance and call
start(), passing in the configuration properties.
The framework is not active until the start() method is called. If no shell bundles are specified in the config.properties file or if there is difficulty locating the shell bundles that are specified, then it will appear as if the framework is hung, but it is actually running without any way to interact with it since the shell bundles provide the only means of interaction.
| Anchor | ||||
|---|---|---|---|---|
|
...