public Map getStringDecodedMap(final Map encodedMap, final Map defaults) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getStringDecodedMap", new Object[] {encodedMap,defaults});
        }

        final Map<String,Object> decoded = new HashMap<String,Object>();

        // Preload with the defaults - if the property exists in the input
        // it will override this default
        decoded.putAll(defaults);
        
        // Look at each property in turn.
        final Iterator keyList = encodedMap.keySet().iterator();
        while (keyList.hasNext()) {

            // These variables will point to the info to be placed
            // in the map.
            String propName = null;
            Object propVal = null;

            // Get the coded version of the name. This will start with one
            // of the prefix values. The codedName must have been non-null.
            String encodedKey = (String) keyList.next();
            String encodedVal = (String) encodedMap.get(encodedKey);

            // Extract the prefix.
            String prefix = null;

            int sepIndex = encodedKey.indexOf(PREFIX_SEPARATOR);

            if (sepIndex == -1) {
                // The separator was not found - this is really bad, and
                // suggests
                // that the encoding step was flawed.
                if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
                        SibTr.debug(TRACE, "Ignoring malformed encoded name: "
                                + encodedKey);

                continue;

            } else {
                // Extract the prefix and clean version of the name.
                prefix = encodedKey.substring(0, sepIndex);
                propName = encodedKey.substring(sepIndex
                        + PREFIX_SEPARATOR.length());

            }//if

            // Catch any number conversion errors that arise while converting
            // the
            // string to an object.
            try {

                // Decode the prefix to recreate the data type.
                if (PREFIX_NULL.equals(prefix)) {

                    // The value was null.
                    propVal = null;

                } else if (PREFIX_STRING.equals(prefix)) {

                    propVal = encodedVal;

                    // Because the value was not prefixed with PREFIX_NULL, we
                    // know that
                    // if this val is null, it was meant to be an empty
                    // string...
                    if (propVal == null) propVal = "";

                } else if (PREFIX_BOOLEAN.equals(prefix)) {

                    propVal = Boolean.valueOf(encodedVal);

                } else if (PREFIX_INT.equals(prefix)) {

                    propVal = Integer.valueOf(encodedVal);

                } else if (PREFIX_BYTE.equals(prefix)) {

                    propVal = Byte.valueOf(encodedVal);

                } else if (PREFIX_SHORT.equals(prefix)) {

                    propVal = Short.valueOf(encodedVal);

                } else if (PREFIX_FLOAT.equals(prefix)) {

                    propVal = Float.valueOf(encodedVal);

                } else if (PREFIX_DOUBLE.equals(prefix)) {

                    propVal = Double.valueOf(encodedVal);

                } else if (PREFIX_LONG.equals(prefix)) {

                    propVal = Long.valueOf(encodedVal);

                } else if (PREFIX_ROUTING_PATH.equals(prefix)) {
                    // encodedVal = array represented as one long string.
                    // This uses the Java 1.4 regex method on a string to split
                    // it into
                    // an array, with the individual strings being separated by
                    // the string passed in.
                    String[] array = encodedVal
                            .split(JmsraConstants.PATH_ELEMENT_SEPARATOR);

                    // propVal = what we want to return (a string array wrapper
                    // containing the string[])
                    String bigDestName = (String) encodedMap
                            .get(PREFIX_STRING + PREFIX_SEPARATOR
                                    + JmsInternalConstants.DEST_NAME);
                    propVal = StringArrayWrapper.create(array, bigDestName);
                } else {
                    // Did not match any of the known prefixes
                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr
                                .debug(TRACE, "Ignoring unknown prefix: "
                                        + prefix);
                    }

                    continue;

                }// (if)switch on prefix type.

                // We have successfully decoded the property, so now add it to
                // the
                // temporary map of properties.
                decoded.put(propName, propVal);

                if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                    SibTr.debug(TRACE, "retrieved: " + propName + " = "
                            + propVal);
                }

            } catch (final Exception exception) {

                FFDCFilter
                        .processException(
                                exception,
                                "com.ibm.ws.sib.api.jmsra.impl.JmsJcaReferenceUtilsImpl.getStringDecodedMap",
                                FFDC_PROBE_1, this);

                // Catch any NumberFormatException or similar thing that arises
                // from the attempt to convert the string to another data type.
                if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                    SibTr.debug(TRACE, "Error decoding string to object. ",
                            exception);
                }

                continue;

            }//try

        }//while

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "getStringDecodedMap", decoded);
        }
        return decoded;

    }
public Map getStringDecodedMap ( final Map encodedMap , final Map defaults ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getStringDecodedMap" , new Object [ ] { encodedMap , defaults } ) ; } final Map < String , Object > decoded = new HashMap < String , Object > ( ) ; decoded . putAll ( defaults ) ; final Iterator keyList = encodedMap . keySet ( ) . iterator ( ) ; while ( keyList . hasNext ( ) ) { String propName = null ; Object propVal = null ; String encodedKey = ( String ) keyList . next ( ) ; String encodedVal = ( String ) encodedMap . get ( encodedKey ) ; String prefix = null ; int sepIndex = encodedKey . indexOf ( PREFIX_SEPARATOR ) ; if ( sepIndex == - 1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) SibTr . debug ( TRACE , "Ignoring malformed encoded name: " + encodedKey ) ; continue ; } else { prefix = encodedKey . substring ( 0 , sepIndex ) ; propName = encodedKey . substring ( sepIndex + PREFIX_SEPARATOR . length ( ) ) ; } try { if ( PREFIX_NULL . equals ( prefix ) ) { propVal = null ; } else if ( PREFIX_STRING . equals ( prefix ) ) { propVal = encodedVal ; if ( propVal == null ) propVal = "" ; } else if ( PREFIX_BOOLEAN . equals ( prefix ) ) { propVal = Boolean . valueOf ( encodedVal ) ; } else if ( PREFIX_INT . equals ( prefix ) ) { propVal = Integer . valueOf ( encodedVal ) ; } else if ( PREFIX_BYTE . equals ( prefix ) ) { propVal = Byte . valueOf ( encodedVal ) ; } else if ( PREFIX_SHORT . equals ( prefix ) ) { propVal = Short . valueOf ( encodedVal ) ; } else if ( PREFIX_FLOAT . equals ( prefix ) ) { propVal = Float . valueOf ( encodedVal ) ; } else if ( PREFIX_DOUBLE . equals ( prefix ) ) { propVal = Double . valueOf ( encodedVal ) ; } else if ( PREFIX_LONG . equals ( prefix ) ) { propVal = Long . valueOf ( encodedVal ) ; } else if ( PREFIX_ROUTING_PATH . equals ( prefix ) ) { String [ ] array = encodedVal . split ( JmsraConstants . PATH_ELEMENT_SEPARATOR ) ; String bigDestName = ( String ) encodedMap . get ( PREFIX_STRING + PREFIX_SEPARATOR + JmsInternalConstants . DEST_NAME ) ; propVal = StringArrayWrapper . create ( array , bigDestName ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Ignoring unknown prefix: " + prefix ) ; } continue ; } decoded . put ( propName , propVal ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "retrieved: " + propName + " = " + propVal ) ; } } catch ( final Exception exception ) { FFDCFilter . processException ( exception , "com.ibm.ws.sib.api.jmsra.impl.JmsJcaReferenceUtilsImpl.getStringDecodedMap" , FFDC_PROBE_1 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Error decoding string to object. " , exception ) ; } continue ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getStringDecodedMap" , decoded ) ; } return decoded ; }
Turns a Map encoded in the form described above into a decoded map in
which the keys are the actual key names that were previously encoded, and
the values are the primitive wrapper objects that previously represented
the state.

@param encodedMap
the map to decode
@param defaults
the default set of properties to be used (those in the encoded will override these)
@return the decoded map