public static int [ ] parseSpecStr ( String in ) { if ( in == null ) { return new int [ 0 ] ; } in = in . replaceAll ( " " , "" ) ; in = in . trim ( ) ; if ( in . length ( ) == 0 ) { return new int [ 0 ] ; } String [ ] tokens = in . split ( "," ) ; int [ ] toReturn = new int [ tokens . length ] ; for ( int i = 0 ; i < tokens . length ; i ++ ) { tokens [ i ] = tokens [ i ] . trim ( ) ; try { toReturn [ i ] = Integer . parseInt ( tokens [ i ] ) ; } catch ( NumberFormatException e ) { if ( tokens [ i ] . equals ( "*" ) && i == 0 ) { toReturn [ i ] = PmiConstants . ALL_DATA ; } // invalid configuration specification, set to undefined (no op) else { toReturn [ i ] = PmiConstants . LEVEL_UNDEFINED ; } } } return toReturn ; }
Helper function to parse the configuration s spec strings .