public void setAsText(String text) { try { ConfigProperties properties = new ConfigProperties(); String props = text; if (props.charAt(0) == '[') {
public void createResourceAdaptorEntity(String resourceAdaptorID, String entityName) throws ManagementConsoleException { ResourceAdaptorID id = (ResourceAdaptorID) managementConsole.getComponentIDMap().get(resourceAdaptorID); resourceManagementMBeanUtils.createResourceAdaptorEntity(id, entityName, new ConfigProperties()); }
public static ConfigProperties toProperties(PropertiesInfo propertiesInfo) throws ManagementConsoleException { ConfigProperties properties = new ConfigProperties(); for (String key : propertiesInfo.keySet()) { String[] nameAndType = key.split(" :: ", 2); // obtain a value depending on the type of property //String value = propertiesInfo.getProperty(key); Object value = propertiesInfo.getProperty(key); try { Class clazz = Class.forName(nameAndType[1]); Constructor con = clazz.getConstructor(String.class); value = con.newInstance((String)value); } catch (Exception e) { throw new ManagementConsoleException("Value of " + nameAndType[0] + " is not supported for type " + nameAndType[1] + "."); } Property property = new Property(nameAndType[0], nameAndType[1], value); properties.addProperty(property); } return properties; } }
ConfigProperties props = new ConfigProperties(); Element propsNode = (Element) propsNodeList.item(0);
/** * Creates an instance of the {@link ConfigProperties} for this component * * @return */ public ConfigProperties getDefaultConfigPropertiesInstance() { ConfigProperties defaultProperties = new ConfigProperties(); for (ConfigPropertyDescriptor mConfigProperty : getDescriptor().getConfigProperties()) { Object configPropertyValue = mConfigProperty.getConfigPropertyValue() == null ? null : ConfigProperties.Property.toObject(mConfigProperty.getConfigPropertyType(), mConfigProperty .getConfigPropertyValue()); defaultProperties.addProperty(new ConfigProperties.Property(mConfigProperty.getConfigPropertyName(), mConfigProperty.getConfigPropertyType(), configPropertyValue)); } return defaultProperties; }