Methods Summary |
---|
protected java.util.Set | _getAttributeNames()
final Set<String> attrNames =
GSetUtil.newSet( mConfigBean.getAttributeNames() );
// it does this sometimes!
assert( ! attrNames.contains( null ) );
attrNames.remove( null );
if ( hasDescription() )
{
attrNames.add( DESCRIPTION_ATTR );
}
return attrNames;
|
private java.lang.String | _getName()
String name = null;
final Set<String> attrNames = GSetUtil.newStringSet( getAttributeNames() );
for( final String nameKey : OldProps.getPossibleNameKeys() )
{
final String camelized = mConfigBean.camelize( nameKey );
if ( attrNames.contains( camelized ) )
{
try
{
name = (String)getAttribute( camelized );
if ( name != null )
{
break;
}
}
catch( AttributeNotFoundException e )
{
throw new RuntimeException( e );
}
}
}
return name;
|
static java.lang.String | _getType(java.lang.String xPath)
return ConfigXPathHelper.getLastNodeName( xPath );
|
protected void | debug(java.lang.Object o)
sdebug( o );
final String xpath = "" + mXPath;
AMXDebug.getInstance().getOutput( "ConfigBeanHelper" ).println( xpath + ": " + o );
|
public java.util.List | getAllChildren()
final List<ConfigBeanHelper> children = new ArrayList<ConfigBeanHelper>();
final ConfigBean[] configBeans = mConfigBean.getAllChildBeans();
if ( configBeans != null )
{
for( final ConfigBean configBean : configBeans )
{
if ( configBean != null )
{
final ConfigBeanHelper helper =
ConfigBeanHelperFactory.getInstance( getConfigContext() ).getHelper( configBean );
children.add( helper );
}
}
}
return children;
|
public java.util.List | getAllChildrenOfType(java.lang.String desiredType)
final List<ConfigBeanHelper> children = getAllChildren();
final List<ConfigBeanHelper> propertyChildren = new ArrayList<ConfigBeanHelper>();
for( final ConfigBeanHelper helper : children )
{
if ( desiredType.equals( helper.getType() ) )
{
propertyChildren.add( helper );
}
}
return propertyChildren;
|
public java.util.List | getAllObjectNameProps(java.util.Set ignoreTypes)
final List<String[]> props = new ArrayList<String[]>();
//debug( "\n--------------------------------------" );
// debug( xPath );
String[] pair = getTypeAndName();
props.add( pair );
String curXPath = ConfigXPathHelper.getParentXPath( getXPath() );
String lastXPath = null;
while ( ! curXPath.equals( lastXPath ) )
{
final ConfigBeanHelper helper =
ConfigBeanHelperFactory.getInstance( getConfigContext() ).getHelper( curXPath );
pair = helper.getTypeAndName();
if ( ! ignoreTypes.contains( pair[ 0 ] ) )
{
props.add( pair );
}
lastXPath = curXPath;
curXPath = helper.getParentXPath();
}
return props;
|
public java.lang.Object | getAttribute(java.lang.String attrName)
Object result = null;
if ( DESCRIPTION_ATTR.equals( attrName ) )
{
result = getDescription();
}
else
{
try
{
result = mConfigBean.getAttributeValue( attrName );
}
catch( RuntimeException e )
{
debug( "ATTR FAILED: " + attrName );
throw e;
}
}
return result;
|
protected java.lang.Class | getAttributeClass(java.lang.String attrName)Subclass may override this for special cases that are non-String.
return String.class;
|
public final java.lang.String[] | getAttributeNames()
return GSetUtil.toStringArray( _getAttributeNames() );
|
public com.sun.enterprise.config.ConfigBean | getConfigBean()
return mConfigBean;
|
public com.sun.enterprise.config.ConfigContext | getConfigContext()
return mConfigContext;
|
public java.lang.String | getDescription()
String result = (String)getValue( DESCRIPTION_ATTR );
return result;
|
protected javax.management.MBeanAttributeInfo | getMBeanAttributeInfo(java.lang.String attrName)Subclass may override this, or alternatly, just specify
the Class of the Attribute by overriding {@link #getAttributeClass}.
final String description = "";
final boolean isReadable = true;
final boolean isWriteable = true;
final boolean isIs = false;
assert( attrName != null );
final MBeanAttributeInfo info = new MBeanAttributeInfo(
attrName,
getAttributeClass( attrName ).getName(),
description,
isReadable,
isWriteable,
isIs );
return info;
|
public javax.management.MBeanInfo | getMBeanInfo()
final List<String> attrNames = ListUtil.newListFromArray( getAttributeNames() );
final MBeanOperationInfo[] operationInfos = new MBeanOperationInfo[0];
final MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[ attrNames.size() ];
int i = 0;
for( final String name : attrNames )
{
assert( name != null );
attributeInfos[ i ] = getMBeanAttributeInfo( name );
assert attributeInfos[ i ].getName() != null;
++i;
}
final MBeanInfo info =
new MBeanInfo( this.getClass().getName(),
"exposes Attributes from ConfigBean",
attributeInfos,
null,
operationInfos,
null );
for( final MBeanAttributeInfo xxx : info.getAttributes() )
{
assert( xxx.getName() != null );
}
return info;
|
public java.lang.String | getName()
return mName;
|
public java.lang.String | getParentXPath()
return ConfigXPathHelper.getParentXPath( getXPath() );
|
public javax.management.AttributeList | getProperties()
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "element-property" );
final AttributeList attrs = new AttributeList();
for( final String name : children.keySet() )
{
final ConfigBeanHelper helper = children.get( name );
final String value = getValueAttributeValue( helper );
attrs.add( new Attribute( name, value ) );
}
return attrs;
|
public java.lang.String | getPropertyValue(java.lang.String propertyName)
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "element-property" );
if ( ! children.containsKey( propertyName ) )
{
final String msg = "No such property: " +
StringUtil.quote( propertyName );
throw new IllegalArgumentException( msg );
}
return getValueAttributeValue( children.get( propertyName ) );
|
public java.util.Map | getSpecialChildMap(java.lang.String type)
if ( ! ("element-property".equals( type ) ||
"system-property".equals( type )) ||
"jvm-option".equals( type ) )
{
throw new IllegalArgumentException( type );
}
final List<ConfigBeanHelper> children = getAllChildrenOfType( type );
final Map<String,ConfigBeanHelper> m = new HashMap<String,ConfigBeanHelper>();
for( final ConfigBeanHelper helper : children )
{
try
{
final String name = (String)helper.getAttribute( NAME_ATTR );
m.put( name, helper );
}
catch( Exception e )
{
throw new RuntimeException(
"FAILURE getting Name Attribute for property element", e );
}
}
return m;
|
public javax.management.AttributeList | getSystemProperties()
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "system-property" );
final AttributeList attrs = new AttributeList();
for( final String name : children.keySet() )
{
final ConfigBeanHelper helper = children.get( name );
final String value = getValueAttributeValue( helper );
attrs.add( new Attribute( name, value ) );
}
return attrs;
|
public java.lang.String | getSystemPropertyValue(java.lang.String propertyName)
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "system-property" );
if ( ! children.containsKey( propertyName ) )
{
throw new IllegalArgumentException( propertyName );
}
return getValueAttributeValue( children.get( propertyName ) );
|
public java.lang.String | getType()
return mType;
|
public java.lang.String[] | getTypeAndName()
return new String[] { getType(), getName() };
|
protected java.lang.Object | getValue(java.lang.String valueName)When the ConfigBean is called for an array value that
can potentially exist, but doesn't, it tries to access an
array illegally. Not much we can do except return null.
Here's the stack trace:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.netbeans.modules.schema2beans.BeanProp.getValue(BeanProp.java:474)
at org.netbeans.modules.schema2beans.BaseBean.getValue(BaseBean.java:353)
at com.sun.enterprise.config.ConfigBean.getValue(ConfigBean.java:383)
Object value = null;
try
{
value = mConfigBean.getValue( valueName );
}
catch( Exception e )
{
debug( "ConfigBeanHelper.getValue: Exception accessing value: " + valueName );
//e.printStackTrace();
}
return value;
|
protected static java.lang.String | getValueAttributeValue(com.sun.enterprise.management.offline.ConfigBeanHelper helper)
try
{
final String value = (String)helper.getAttribute( VALUE_ATTR );
return value;
}
catch( Exception e )
{
throw new RuntimeException(
"FAILURE getting Value Attribute for property element ", e );
}
|
public java.lang.String | getXPath()
return mXPath;
|
public abstract java.lang.Object | handleInvoke(java.lang.String operationName, java.lang.Object[] args, java.lang.String[] types)
|
private boolean | hasDescription()
return hasValue( DESCRIPTION_ATTR );
|
protected boolean | hasValue(java.lang.String valueName)
boolean hasValue = false;
try
{
final Object value = mConfigBean.getValue( valueName );
// value may be null, but it still indicates that the value is possible
hasValue = true;
//sdebug( "HAS VALUE " + valueName + "=" + value );
}
catch( Exception e )
{
}
return hasValue;
|
protected void | sdebug(java.lang.Object o)
System.out.println( "" + o );
|
public void | setAttribute(javax.management.Attribute attr)
final Object value = attr.getValue();
setAttribute( attr.getName(), value );
|
public void | setAttribute(java.lang.String name, java.lang.Object value)
if ( DESCRIPTION_ATTR.equals( name ) )
{
setDescription( (String)value );
}
else
{
// Config API wants strings (only)
final String valueString = (value == null) ? null : ("" + value);
mConfigBean.setAttributeValue( name, valueString );
}
|
public void | setDescription(java.lang.String description)
mConfigBean.setValue( DESCRIPTION_ATTR, description );
|
public void | setProperty(javax.management.Attribute attr)
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "element-property" );
// this won't work for creating a new property!
final ConfigBeanHelper helper = children.get( attr.getName() );
if ( helper == null )
{
throw new IllegalArgumentException( attr.getName() );
}
setValueAttributeValue( helper, (String)attr.getValue() );
|
public void | setSystemProperty(javax.management.Attribute attr)
final Map<String,ConfigBeanHelper> children =
getSpecialChildMap( "system-property" );
// this won't work for creating a new property!
final ConfigBeanHelper helper = children.get( attr.getName() );
if ( helper == null )
{
throw new IllegalArgumentException( attr.getName() );
}
setValueAttributeValue( helper, (String)attr.getValue() );
|
private static void | setValueAttributeValue(com.sun.enterprise.management.offline.ConfigBeanHelper helper, java.lang.String value)
try
{
helper.setAttribute( VALUE_ATTR, value );
}
catch( Exception e )
{
throw new RuntimeException(
"FAILURE setting Value Attribute for property element ", e );
}
|
public void | unsupportedOperation(java.lang.String operationName, java.lang.Object[] args, java.lang.String[] types)
throw new IllegalArgumentException(
"invoke() unknown operation " + operationName + "()" );
|