/** Constructs an <code>IIOPSSLSocketFactory</code> */
  public IIOPSSLSocketFactory() {
    try {
      if (Switch.getSwitch().getContainerType() == Switch.EJBWEB_CONTAINER) {
        ConfigContext configContext = ApplicationServer.getServerContext().getConfigContext();
        IiopService iiopBean = ServerBeansFactory.getIiopServiceBean(configContext);

        IiopListener[] iiopListeners = iiopBean.getIiopListener();
        int listenersLength = (iiopListeners != null) ? iiopListeners.length : 0;
        for (int i = 0; i < listenersLength; i++) {
          Ssl ssl = iiopListeners[i].getSsl();
          SSLInfo sslInfo = null;
          if (iiopListeners[i].isSecurityEnabled()) {
            if (ssl != null) {
              sslInfo =
                  init(
                      ssl.getCertNickname(),
                      ssl.isSsl2Enabled(),
                      ssl.getSsl2Ciphers(),
                      ssl.isSsl3Enabled(),
                      ssl.getSsl3TlsCiphers(),
                      ssl.isTlsEnabled());
            } else {
              sslInfo = getDefaultSslInfo();
            }
            portToSSLInfo.put(new Integer(iiopListeners[i].getPort()), sslInfo);
          }
        }

        if (iiopBean.getSslClientConfig() != null && iiopBean.getSslClientConfig().isEnabled()) {
          Ssl outboundSsl = iiopBean.getSslClientConfig().getSsl();
          if (outboundSsl != null) {
            clientSslInfo =
                init(
                    outboundSsl.getCertNickname(),
                    outboundSsl.isSsl2Enabled(),
                    outboundSsl.getSsl2Ciphers(),
                    outboundSsl.isSsl3Enabled(),
                    outboundSsl.getSsl3TlsCiphers(),
                    outboundSsl.isTlsEnabled());
          }
        }
        if (clientSslInfo == null) {
          clientSslInfo = getDefaultSslInfo();
        }
      } else {
        com.sun.enterprise.config.clientbeans.Ssl clientSsl = SSLUtils.getAppclientSsl();
        if (clientSsl != null) {
          clientSslInfo =
              init(
                  clientSsl.getCertNickname(),
                  clientSsl.isSsl2Enabled(),
                  clientSsl.getSsl2Ciphers(),
                  clientSsl.isSsl3Enabled(),
                  clientSsl.getSsl3TlsCiphers(),
                  clientSsl.isTlsEnabled());
        } else { // include case keystore, truststore jvm option
          clientSslInfo = getDefaultSslInfo();
        }
      }
    } catch (Exception e) {
      _logger.log(Level.SEVERE, "iiop.init_exception", e);
      throw new IllegalStateException(e.toString());
    }
  }
  public void handleUpdate(JTSEvent event) throws AdminEventListenerException {
    // Bug Id: 4666390 Handle no event in event list case
    if (event == null) {
      // do nothing
      return;
    }
    ArrayList configChangeList = event.getConfigChangeList();
    if (configChangeList == null) {
      // do nothing
      return;
    }
    // Bug Id: 4666390 End

    ConfigUpdate configUpdate = null;
    boolean match = false;
    for (int i = 0; i < configChangeList.size(); i++) {
      configUpdate = (ConfigUpdate) configChangeList.get(i);
      if (configUpdate.getXPath() != null
          && configUpdate.getXPath().endsWith(ServerTags.TRANSACTION_SERVICE)) {
        if (xPath.equals(configUpdate.getXPath())) {
          match = true;
          break;
        }
      }
    }
    if (match) { // TransactionService has been changed
      Set attributeSet = configUpdate.getAttributeSet();
      String next = null;
      for (Iterator iter = attributeSet.iterator(); iter.hasNext(); ) {
        next = (String) iter.next();
        if (next.equals(ServerTags.TIMEOUT_IN_SECONDS)) {
          _logger.log(Level.FINE, " Transaction Timeout interval event occurred");
          String oldTimeout = configUpdate.getOldValue(ServerTags.TIMEOUT_IN_SECONDS);
          String newTimeout = configUpdate.getNewValue(ServerTags.TIMEOUT_IN_SECONDS);
          if (oldTimeout.equals(newTimeout)) {
          } else {
            try {
              Switch.getSwitch()
                  .getTransactionManager()
                  .setDefaultTransactionTimeout(Integer.parseInt(newTimeout, 10));
            } catch (Exception ex) {
              _logger.log(Level.WARNING, "transaction.reconfig_txn_timeout_failed", ex);
            }
          } // timeout-in-seconds
        } else if (next.equals(ServerTags.KEYPOINT_INTERVAL)) {
          _logger.log(Level.FINE, "Keypoint interval event occurred");
          String oldKeyPoint = configUpdate.getOldValue(ServerTags.KEYPOINT_INTERVAL);
          String newKeyPoint = configUpdate.getNewValue(ServerTags.KEYPOINT_INTERVAL);
          if (oldKeyPoint.equals(newKeyPoint)) {
          } else {
            Configuration.setKeypointTrigger(Integer.parseInt(newKeyPoint, 10));
          }
        } else if (next.equals(ServerTags.RETRY_TIMEOUT_IN_SECONDS)) {
          String oldRetryTiemout = configUpdate.getOldValue(ServerTags.RETRY_TIMEOUT_IN_SECONDS);
          String newRetryTiemout = configUpdate.getNewValue(ServerTags.RETRY_TIMEOUT_IN_SECONDS);
          _logger.log(
              Level.FINE, "retry_timeout_in_seconds reconfig event occurred " + newRetryTiemout);
          if (oldRetryTiemout.equals(newRetryTiemout)) {
          } else {
            Configuration.setCommitRetryVar(newRetryTiemout);
          }
        } else {
          // Not handled dynamically. Restart is required.
          AdminEventMulticaster.notifyFailure(event, AdminEventResult.RESTART_NEEDED);
        }

        /*
        //This feature is currently dropped as it's not implemented totally
        else if (next.equals("commit-retries")) {
                          String oldCommitRetries = configUpdate.getOldValue("commit-retries");
                          String newCommitRetries = configUpdate.getNewValue("commit-retries");
                          if (oldCommitRetries.equals(newCommitRetries)) {
                          }
                          else {
                              Configuration.setCommitRetryVar(newCommitRetries);
                          }
                      } // commit-retries
                      */

      }
    }
  }