Methods Summary |
---|
private static java.lang.String | PAR(java.lang.String s)
return PAR + s;
|
private static java.lang.String | VAR(java.lang.String s)
return VAR + s;
|
private java.lang.String | concat(java.lang.String prefix, java.lang.String part)
String result = null;
if ( prefix == null || prefix.length() == 0 )
{
result = part;
}
else
{
result = prefix + PART_DELIM + part;
}
return( result );
|
public static synchronized com.sun.enterprise.management.offline.OfflineDottedNamePrefixes | getInstance()
if ( INSTANCE == null )
{
INSTANCE = new OfflineDottedNamePrefixes();
}
return INSTANCE;
|
public java.lang.String | getPrefix(javax.management.ObjectName objectName)
final String j2eeType = objectName.getKeyProperty( J2EE_TYPE_KEY );
if ( j2eeType == null )
{
throw new IllegalArgumentException( "" + objectName );
}
String prefix = null;
final String[] template = getTemplate( j2eeType );
if ( template != null )
{
for( final String part : template )
{
String value = null;
if ( part.startsWith( VAR ) )
{
final String prop = varName( part );
value = objectName.getKeyProperty( prop );
if ( value == null )
{
throw new IllegalArgumentException(
"No property " + prop + " in " + objectName );
}
}
else
{
value = part;
}
prefix = concat( prefix, value );
}
}
return prefix;
|
private java.lang.String[] | getTemplate(java.lang.String j2eeType)
return mTemplates.get( j2eeType );
|
private java.util.Map | initTemplates()
final Map<String,String[]> templates = new HashMap<String,String[]>();
for( int i = 0; i < TEMPLATES.length; i += 2 )
{
final String j2eeType = (String)TEMPLATES[ i ];
final String[] template = (String[])TEMPLATES[ i + 1 ];
templates.put( j2eeType, template );
}
return templates;
|
private static java.lang.String | varName(java.lang.String s)
if ( ! s.startsWith( VAR ) )
{
throw new IllegalArgumentException( s );
}
return s.substring( VAR.length(), s.length() );
|