Methods Summary |
---|
public static boolean | checkIfAttributesAndPropertiesAreResolvable(com.sun.enterprise.config.ConfigBean element, java.lang.String instanceName)this method tests if all attributes and properties of the tested config element are fully resolvable
(not consist of unresolvable ${...} - varibles inside
final PropertyResolver resolver = new PropertyResolver(element.getConfigContext(), instanceName);
final String[] attrNames = element.getAttributeNames();
//first - check attributes;
if(attrNames!=null)
{
for(int i=0; i<attrNames.length; i++)
{
String value = element.getAttributeValue(attrNames[i]);
if(value!=null && !resolver.isResolvable(value, true))
{
return false;
}
}
}
//then - properties;
ElementProperty[] props = getElementProperties(element);
if(props!=null)
{
for(int i=0; i<props.length; i++)
{
String value = props[i].getValue();
if(value!=null && !resolver.isResolvable(value, true))
{
return false;
}
}
}
return true;
|
protected static void | debug(java.lang.String s)
//TODO: change this to app server logging
System.out.println(s);
|
protected static void | error(java.lang.String s)
//TODO: change this to app server logging
System.out.println(s);
|
private static com.sun.enterprise.config.serverbeans.ElementProperty[] | getElementProperties(com.sun.enterprise.config.ConfigBean element)
Class cl = element.getClass();
ElementProperty[] props = null;
try
{
Method method = cl.getDeclaredMethod("getElementProperty");
props = (ElementProperty[])method.invoke(element);
}
catch (Exception e)
{
}
return props;
|
public java.lang.Object | getPropertyElementValue(java.lang.String propertyName)Gets MBean's property value.
Class cl = m_baseConfigBean.getClass();
ElementProperty prop;
try
{
Method method = cl.getDeclaredMethod("getElementPropertyByName", new Class[]{Class.forName("java.lang.String")});
prop = (ElementProperty)method.invoke(m_baseConfigBean, new Object[]{propertyName});
}
catch (Exception e)
{
String msg = /*localStrings.getString*/( "admin.server.core.mbean.config.getattribute.undefined_properties_in_base_element"+ propertyName );
throw new MBeanException(new MBeanConfigException( msg ));
}
if(prop==null) {
String msg = /*localStrings.getString*/( "admin.server.core.mbean.config.getattribute_properties_not_found_in_base_element"+ propertyName );
throw new MBeanException(new MBeanConfigException( msg ));
}
return prop.getValue();
|
protected static void | info(java.lang.String s)
//TODO: change this to app server logging
System.out.println(s);
|
protected static boolean | isDebugEnabled()/
public String getAttributeValue(String name) throws MBeanException,AttributeNotFoundException
{
//FIXME change to CoinfigMBeanBase implementation
if(m_baseConfigBean==null)
return null;
if(name.startsWith(PROPERTY_NAME_PREFIX))
{
// get property value
return (String)getPropertyElementValue(name.substring(PROPERTY_NAME_PREFIX.length()));
}
else
return m_baseConfigBean.getAttributeValue(name);
}
public String setAttributeValue(String name, String value) throws MBeanException,AttributeNotFoundException
{
//FIXME change to CoinfigMBeanBase implementation
if(m_baseConfigBean==null)
return null;
if(name.startsWith(PROPERTY_NAME_PREFIX))
{
// set property value
setPropertyElementValue(new Attribute(name.substring(PROPERTY_NAME_PREFIX.length()), value), false);
}
else
m_baseConfigBean.setAttributeValue(name, value);
return value;
}
/**
call app server logging
return true;
|
public void | setPropertyElementValue(javax.management.Attribute attr, boolean bAllowsEmptyValue)Sets MBean's property value.
String propertyName = attr.getName();
String value = (String)attr.getValue();
Class cl = m_baseConfigBean.getClass();
ElementProperty prop;
try
{
Method method = cl.getDeclaredMethod("getElementPropertyByName", new Class[]{Class.forName("java.lang.String")});
prop = (ElementProperty)method.invoke(m_baseConfigBean, new Object[]{propertyName});
}
catch (Exception e)
{
String msg = /*localStrings.getString*/( "admin.server.core.mbean.config.setattribute_undefined_properties_in_base_element"+ propertyName );
throw new MBeanException(new MBeanConfigException( msg ));
}
if(prop==null && value!=null && (bAllowsEmptyValue || !value.equals("")))
{
prop = new ElementProperty();
prop.setName(propertyName);
prop.setValue(value);
try
{
Method method = cl.getDeclaredMethod("addElementProperty", new Class[]{prop.getClass()});
method.invoke(m_baseConfigBean, new Object[]{prop});
}
catch (Exception e)
{
String msg = /*localStrings.getString*/( "admin.server.core.mbean.config.setproperty_invoke_error"+propertyName );
throw new MBeanException(new MBeanConfigException( msg ));
}
}
else
{
if(value==null || (!bAllowsEmptyValue && value.equals("")))
{
try
{
Method method = cl.getDeclaredMethod("removeElementProperty", new Class[]{prop.getClass()});
method.invoke(m_baseConfigBean, new Object[]{prop});
}
catch (Exception e)
{
String msg = /*localStrings.getString*/( "admin.server.core.mbean.config.setproperty_could_not_remove_propery"+ propertyName );
throw new MBeanException(new MBeanConfigException( msg ));
}
}
else
prop.setValue(value);
}
/* try
{
m_configContext.flush();
}
catch (ConfigException e)
{
throw new MBeanException(new MBeanConfigException(e.getMessage()));
}
*/
|