Search in sources :

Example 1 with SocketInfo

use of com.sun.corba.se.spi.transport.SocketInfo in project wildfly by wildfly.

the class CSIV2IORToSocketInfo method addAlternateSocketInfos.

private void addAlternateSocketInfos(IIOPProfileTemplate iiopProfileTemplate, final List result) {
    Iterator iterator = iiopProfileTemplate.iteratorById(TAG_ALTERNATE_IIOP_ADDRESS.value);
    while (iterator.hasNext()) {
        AlternateIIOPAddressComponent alternate = (AlternateIIOPAddressComponent) iterator.next();
        String hostname = alternate.getAddress().getHost().toLowerCase();
        int port = alternate.getAddress().getPort();
        SocketInfo socketInfo = createSocketInfo(hostname, port);
        result.add(socketInfo);
    }
}
Also used : Iterator(java.util.Iterator) IORToSocketInfo(com.sun.corba.se.spi.transport.IORToSocketInfo) SocketInfo(com.sun.corba.se.spi.transport.SocketInfo) AlternateIIOPAddressComponent(com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent)

Example 2 with SocketInfo

use of com.sun.corba.se.spi.transport.SocketInfo in project wildfly by wildfly.

the class CSIV2IORToSocketInfo method getSocketInfo.

public List getSocketInfo(IOR ior) {
    List result = new ArrayList();
    IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) ior.getProfile().getTaggedProfileTemplate();
    IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress();
    String hostname = primary.getHost().toLowerCase(Locale.ENGLISH);
    int primaryPort = primary.getPort();
    // NOTE: we could check for 0 (i.e., CSIv2) but, for a
    // non-CSIv2-configured client ORB talking to a CSIv2 configured
    // server ORB you might end up with an empty contact info list
    // which would then report a failure which would not be as
    // instructive as leaving a ContactInfo with a 0 port in the list.
    SocketInfo socketInfo;
    TransportAddress sslAddress = selectSSLTransportAddress(ior);
    SSL ssl = getSSL(ior);
    if (sslAddress != null) {
        socketInfo = createSSLSocketInfo(hostname, sslAddress.port);
    } else if (ssl != null) {
        socketInfo = createSSLSocketInfo(hostname, ssl.port);
    } else {
        // FIXME not all corba object export ssl port
        // if (clientRequiresSsl) {
        // throw new RuntimeException("Client requires SSL but target does not support it");
        // }
        socketInfo = createSocketInfo(hostname, primaryPort);
    }
    result.add(socketInfo);
    addAlternateSocketInfos(iiopProfileTemplate, result);
    return result;
}
Also used : TransportAddress(org.omg.CSIIOP.TransportAddress) IIOPAddress(com.sun.corba.se.spi.ior.iiop.IIOPAddress) ArrayList(java.util.ArrayList) IIOPProfileTemplate(com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate) IORToSocketInfo(com.sun.corba.se.spi.transport.IORToSocketInfo) SocketInfo(com.sun.corba.se.spi.transport.SocketInfo) ArrayList(java.util.ArrayList) List(java.util.List) CompoundSecMechList(org.omg.CSIIOP.CompoundSecMechList) SSL(org.omg.SSLIOP.SSL)

Aggregations

IORToSocketInfo (com.sun.corba.se.spi.transport.IORToSocketInfo)2 SocketInfo (com.sun.corba.se.spi.transport.SocketInfo)2 AlternateIIOPAddressComponent (com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent)1 IIOPAddress (com.sun.corba.se.spi.ior.iiop.IIOPAddress)1 IIOPProfileTemplate (com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 CompoundSecMechList (org.omg.CSIIOP.CompoundSecMechList)1 TransportAddress (org.omg.CSIIOP.TransportAddress)1 SSL (org.omg.SSLIOP.SSL)1