public static IntraMDWMessenger newIntraMDWMessenger(String serverSpec)
        throws NamingException {
        if (serverSpec==null || serverSpec.equals("@")) {
            if (internalMessenger.equals(RMI))
                return new IntraMDWMessengerRmi(null);
            else if (internalMessenger.equals(JMS))
                return new IntraMDWMessengerJms(null);
            else return new IntraMDWMessengerRest(null, serviceContext);
        } else {
            String url = getEngineUrl(serverSpec);
            int k = url.indexOf("://");
            if (k<=0) throw new NamingException("Incorrect engine URL for " + serverSpec);
            String scheme = url.substring(0,k);
            if (scheme.equals("iiop") || scheme.equals("rmi"))
                return new IntraMDWMessengerRmi(url);
            if (scheme.equals("http") || scheme.equals("https"))
                return new IntraMDWMessengerRest(url, serviceContext);
            return new IntraMDWMessengerJms(url);
        }
    }
public static IntraMDWMessenger newIntraMDWMessenger ( String serverSpec ) throws NamingException { if ( serverSpec == null || serverSpec . equals ( "@" ) ) { if ( internalMessenger . equals ( RMI ) ) return new IntraMDWMessengerRmi ( null ) ; else if ( internalMessenger . equals ( JMS ) ) return new IntraMDWMessengerJms ( null ) ; else return new IntraMDWMessengerRest ( null , serviceContext ) ; } else { String url = getEngineUrl ( serverSpec ) ; int k = url . indexOf ( "://" ) ; if ( k <= 0 ) throw new NamingException ( "Incorrect engine URL for " + serverSpec ) ; String scheme = url . substring ( 0 , k ) ; if ( scheme . equals ( "iiop" ) || scheme . equals ( "rmi" ) ) return new IntraMDWMessengerRmi ( url ) ; if ( scheme . equals ( "http" ) || scheme . equals ( "https" ) ) return new IntraMDWMessengerRest ( url , serviceContext ) ; return new IntraMDWMessengerJms ( url ) ; } }
Server specification can be one of the following forms
a) URL of the form t3://host:port, iiop://host:port, rmi://host:port, http://host:port/context_and_path
b) a logical server name, in which case the URL is obtained from property mdw.remote.server.<server-name>
c) server_name@URL
d) null, in which case it indicates on the same site (same domain)
@param serverSpec see description above
@return the messenger for the corresponding server