FileDocCategorySizeDatePackage
CSIv2SSLTaggedComponentHandlerImpl.javaAPI DocGlassfish v2 API7823Fri May 04 22:34:54 BST 2007com.sun.enterprise.iiop

CSIv2SSLTaggedComponentHandlerImpl

public class CSIv2SSLTaggedComponentHandlerImpl extends org.omg.CORBA.LocalObject implements com.sun.corba.ee.spi.folb.CSIv2SSLTaggedComponentHandler, com.sun.corba.ee.spi.orb.ORBConfigurator
author
Harold Carr

Fields Summary
private static Logger
_logger
private final String
baseMsg
private com.sun.corba.ee.spi.orb.ORB
orb
Constructors Summary
Methods Summary
public voidconfigure(com.sun.corba.ee.spi.orb.DataCollector collector, com.sun.corba.ee.spi.orb.ORB orb)

	if (_logger.isLoggable(Level.FINE)) {
	    _logger.log(Level.FINE, ".configure->:");
	}

	this.orb = orb;
	try {
	    orb.register_initial_reference(
	        ORBConstants.CSI_V2_SSL_TAGGED_COMPONENT_HANDLER,
	        this);
	} catch (InvalidName e) {
	    _logger.log(Level.WARNING, ".configure: ", e);
	}

	if (_logger.isLoggable(Level.FINE)) {
	    _logger.log(Level.FINE, ".configure<-:");
	}
    
public java.util.Listextract(com.sun.corba.ee.spi.ior.IOR ior)

	List<SocketInfo> socketInfo = null;
        try {
	    if (_logger.isLoggable(Level.FINE)) {
		_logger.log(Level.FINE, baseMsg + ".extract->:");
	    }
            SecurityMechanismSelector selector = new SecurityMechanismSelector();
            IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate)ior.
                                 getProfile().getTaggedProfileTemplate();
            IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ;
            String host = primary.getHost().toLowerCase();

            ConnectionContext ctx = new ConnectionContext();
            socketInfo = selector.getSSLPorts(ior, ctx);
            selector.setClientConnectionContext(ctx);
            if (socketInfo == null) {
                if (_logger.isLoggable(Level.FINE)) {
		    _logger.log(Level.FINE, baseMsg
				+ ".extract: did not find SSL SocketInfo");
		}
            } else {
                if (_logger.isLoggable(Level.FINE)) {
		    _logger.log(Level.FINE, baseMsg
				+ ".extract: found SSL socketInfo");
		}
            }        
	    if (_logger.isLoggable(Level.FINE)) {
		_logger.log(Level.FINE, baseMsg 
			    + ".extract: Connection Context:" + ctx);		
	    }
        } catch ( Exception ex ) {
	    _logger.log(Level.WARNING, "Exception getting SocketInfo", ex);
        } finally {
	    if (_logger.isLoggable(Level.FINE)) {
		_logger.log(Level.FINE, baseMsg + ".extract<-: " + socketInfo);
	    }
	}
	return socketInfo;
    
public org.omg.IOP.TaggedComponentinsert(org.omg.PortableInterceptor.IORInfo iorInfo, java.util.List clusterInstanceInfo)


    ////////////////////////////////////////////////////
    //
    // CSIv2SSLTaggedComponentHandler
    //

        
 				   
    
	TaggedComponent result = null;
	try {
	    if (_logger.isLoggable(Level.FINE)) {
		_logger.log(Level.FINE, baseMsg + ".insert->:");
	    }

            List<com.sun.corba.ee.spi.folb.SocketInfo> socketInfos = new ArrayList<com.sun.corba.ee.spi.folb.SocketInfo>();
            for(ClusterInstanceInfo clInstInfo : clusterInstanceInfo){
                for(int endPIndex=0; endPIndex < clInstInfo.endpoints.length; endPIndex++){
                    com.sun.corba.ee.spi.folb.SocketInfo socketInfo = clInstInfo.endpoints[endPIndex];
                    if(socketInfo.type.equals("SSL") || socketInfo.type.equals("SSL_MUTUALAUTH")){
                        socketInfos.add(socketInfo);                  
                    }
                }                
            }

            org.omg.CORBA.ORB orb = com.sun.enterprise.util.ORBManager.getORB();
            int sslMutualAuthPort = -1;
            try {
                sslMutualAuthPort = 
		    ((com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt)iorInfo).  
			getServerPort("SSL_MUTUALAUTH");
            } catch (com.sun.corba.ee.spi.legacy.interceptor.UnknownType ute) {
                _logger.log(Level.FINE,".isnert: UnknownType exception", ute);
            }

            if(_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, 
                            ".insert: sslMutualAuthPort: " 
                            + sslMutualAuthPort);
            }

	    EjbDescriptor desc = CSIV2TaggedComponentInfo.getEjbDescriptor( iorInfo ) ;
            CSIV2TaggedComponentInfo ctc = new CSIV2TaggedComponentInfo( orb,
		sslMutualAuthPort);
            result = ctc.createSecurityTaggedComponent(socketInfos,desc);  
            return result;
	} finally {
	    if (_logger.isLoggable(Level.FINE)) {
		_logger.log(Level.FINE, baseMsg + ".insert<-: " + result);
	    }
	}