{
return ocd;
}
}
ObjectClassDefinition xocd = null;
final Locale localeObj = Util.parseLocaleString( locale );
final ResourceBundle rb = osgiManager.resourceBundleManager.getResourceBundle( osgiManager.getBundleContext()
.getBundle(), localeObj );
final Map defaultConfig = osgiManager.getDefaultConfiguration();
// simple configuration properties
final ArrayList adList = new ArrayList();
for ( int i = 0; i < CONF_PROPS.length; i++ )
{
final String key = CONF_PROPS[i++];
final String defaultValue = ConfigurationUtil.getProperty( defaultConfig, key, CONF_PROPS[i] );
final String name = getString( rb, "metadata." + key + ".name", key ); //$NON-NLS-1$ //$NON-NLS-2$
final String descr = getString( rb, "metadata." + key + ".description", key ); //$NON-NLS-1$ //$NON-NLS-2$
adList.add( new AttributeDefinitionImpl( key, name, descr, defaultValue ) );
}
// log level is select - so no simple default value; requires localized option labels
adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_LOG_LEVEL, getString( rb,
"metadata.loglevel.name", OsgiManager.PROP_LOG_LEVEL ), //$NON-NLS-1$
getString( rb, "metadata.loglevel.description", OsgiManager.PROP_LOG_LEVEL ), //$NON-NLS-1$
AttributeDefinition.INTEGER, // type
new String[]
{ String.valueOf( ConfigurationUtil.getProperty( defaultConfig, OsgiManager.PROP_LOG_LEVEL,
OsgiManager.DEFAULT_LOG_LEVEL ) ) }, // default values
0, // cardinality
new String[]
{ // option labels
getString( rb, "log.level.debug", "Debug" ), //$NON-NLS-1$ //$NON-NLS-2$
getString( rb, "log.level.info", "Information" ), //$NON-NLS-1$ //$NON-NLS-2$
getString( rb, "log.level.warn", "Warn" ), //$NON-NLS-1$ //$NON-NLS-2$
getString( rb, "log.level.error", "Error" ), //$NON-NLS-1$ //$NON-NLS-2$
}, new String[]
{ "4", "3", "2", "1" } ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// list plugins - requires localized plugin titles
final TreeMap namesByClassName = new TreeMap();
final String[] defaultPluginsClasses = OsgiManager.PLUGIN_MAP;
for ( int i = 0; i < defaultPluginsClasses.length; i++ )
{
final String clazz = defaultPluginsClasses[i++];
final String label = defaultPluginsClasses[i];
final String name = getString( rb, label + ".pluginTitle", label ); //$NON-NLS-1$
namesByClassName.put( clazz, name );
}
final String[] classes = ( String[] ) namesByClassName.keySet().toArray( new String[namesByClassName.size()] );
final String[] names = ( String[] ) namesByClassName.values().toArray( new String[namesByClassName.size()] );
adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_ENABLED_PLUGINS, getString( rb,
"metadata.plugins.name", OsgiManager.PROP_ENABLED_PLUGINS ), //$NON-NLS-1$
getString( rb, "metadata.plugins.description", OsgiManager.PROP_ENABLED_PLUGINS ), //$NON-NLS-1$
AttributeDefinition.STRING, classes, Integer.MIN_VALUE, names, classes ) );
xocd = new ObjectClassDefinition()
{
private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
.toArray( new AttributeDefinition[adList.size()] );