private Map<String, List<String>> createDestinations()
            throws ModuleInitializationException {
        Map<String, List<String>> mdMap = new HashMap<String, List<String>>();
        for (MessageType type : MessageType.values()) {
            mdMap.put(type.toString(), new ArrayList<String>());
        }

        Iterator<String> parameters = parameterNames();
        String param;
        while (parameters.hasNext()) {
            param = parameters.next();
            if (param.startsWith("datastore")) {
                DatastoreConfig dsConfig = getDatastore(param);
                String[] msgTypes =
                        dsConfig.getParameter("messageTypes").split(" ");
                for (String msgType : msgTypes) {
                    if (!mdMap.containsKey(msgType)) {
                        throw new ModuleInitializationException(msgType
                                + " is not a supported MessageType.", getRole());
                    }
                }

                String destName = dsConfig.getParameter("name");
                String type = dsConfig.getParameter("type");
                boolean transacted =
                        Boolean.parseBoolean(dsConfig
                                .getParameter("transacted"));
                String ackMode = dsConfig.getParameter("ackMode");

                DestinationType destType = DestinationType.Topic;
                if (type.equalsIgnoreCase("queue")) {
                    destType = DestinationType.Queue;
                }

                int destAckMode = Session.AUTO_ACKNOWLEDGE;

                if (ackMode != null && ackMode.length() > 0) {
                    try {
                        destAckMode = Integer.parseInt(ackMode);
                    } catch (NumberFormatException e) {
                        throw new ModuleInitializationException("ackMode must be a number",
                                                                getRole());
                    }
                }

                try {
                    if (logger.isDebugEnabled()) {
                        logger.debug(String
                                .format("createDestination(%s, %s, %s, %s)",
                                        destName,
                                        destType,
                                        transacted,
                                        destAckMode));
                    }
                    jmsMgr.createDestination(destName,
                                             destType,
                                             transacted,
                                             destAckMode);
                } catch (Exception e) {
                    throw new ModuleInitializationException(e.getMessage(),
                                                            getRole());
                }

                for (String msgType : msgTypes) {
                    mdMap.get(msgType).add(destName);
                }
            }
        }
        return mdMap;
    }
private Map < String , List < String > > createDestinations ( ) throws ModuleInitializationException { Map < String , List < String > > mdMap = new HashMap < String , List < String > > ( ) ; for ( MessageType type : MessageType . values ( ) ) { mdMap . put ( type . toString ( ) , new ArrayList < String > ( ) ) ; } Iterator < String > parameters = parameterNames ( ) ; String param ; while ( parameters . hasNext ( ) ) { param = parameters . next ( ) ; if ( param . startsWith ( "datastore" ) ) { DatastoreConfig dsConfig = getDatastore ( param ) ; String [ ] msgTypes = dsConfig . getParameter ( "messageTypes" ) . split ( " " ) ; for ( String msgType : msgTypes ) { if ( ! mdMap . containsKey ( msgType ) ) { throw new ModuleInitializationException ( msgType + " is not a supported MessageType." , getRole ( ) ) ; } } String destName = dsConfig . getParameter ( "name" ) ; String type = dsConfig . getParameter ( "type" ) ; boolean transacted = Boolean . parseBoolean ( dsConfig . getParameter ( "transacted" ) ) ; String ackMode = dsConfig . getParameter ( "ackMode" ) ; DestinationType destType = DestinationType . Topic ; if ( type . equalsIgnoreCase ( "queue" ) ) { destType = DestinationType . Queue ; } int destAckMode = Session . AUTO_ACKNOWLEDGE ; if ( ackMode != null && ackMode . length ( ) > 0 ) { try { destAckMode = Integer . parseInt ( ackMode ) ; } catch ( NumberFormatException e ) { throw new ModuleInitializationException ( "ackMode must be a number" , getRole ( ) ) ; } } try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( String . format ( "createDestination(%s, %s, %s, %s)" , destName , destType , transacted , destAckMode ) ) ; } jmsMgr . createDestination ( destName , destType , transacted , destAckMode ) ; } catch ( Exception e ) { throw new ModuleInitializationException ( e . getMessage ( ) , getRole ( ) ) ; } for ( String msgType : msgTypes ) { mdMap . get ( msgType ) . add ( destName ) ; } } } return mdMap ; }
@return a <code>Map</code>ping of message type to destinations
@throws ModuleInitializationException