Search in sources :

Example 1 with IStringMap

use of com.helger.commons.collection.attr.IStringMap in project as2-server by phax.

the class SocketCommandProcessor method initDynamicComponent.

@Override
public void initDynamicComponent(@Nonnull final IAS2Session aSession, @Nullable final IStringMap aParams) throws OpenAS2Exception {
    final StringMap aParameters = aParams == null ? new StringMap() : new StringMap(aParams);
    final String sPort = aParameters.getAsString(ATTR_PORTID);
    try {
        final int nPort = Integer.parseInt(sPort);
        final SSLServerSocketFactory aSSLServerSocketFactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
        m_aSSLServerSocket = (SSLServerSocket) aSSLServerSocketFactory.createServerSocket(nPort);
        final String[] aEnabledCipherSuites = getEnabledAnonymousCipherSuites(m_aSSLServerSocket.getEnabledCipherSuites(), m_aSSLServerSocket.getSupportedCipherSuites());
        m_aSSLServerSocket.setEnabledCipherSuites(aEnabledCipherSuites);
    } catch (final IOException e) {
        throw new OpenAS2Exception(e);
    } catch (final NumberFormatException e) {
        throw new OpenAS2Exception("Error converting portid parameter '" + sPort + "': " + e);
    }
    m_sUserID = aParameters.getAsString(ATTR_USERID);
    if (StringHelper.hasNoText(m_sUserID))
        throw new OpenAS2Exception("missing 'userid' parameter");
    m_sPassword = aParameters.getAsString(ATTR_PASSWORD);
    if (StringHelper.hasNoText(m_sPassword))
        throw new OpenAS2Exception("missing 'password' parameter");
    try {
        m_aParser = new SocketCommandParser();
    } catch (final Exception e) {
        throw new OpenAS2Exception(e);
    }
}
Also used : StringMap(com.helger.commons.collection.attr.StringMap) IStringMap(com.helger.commons.collection.attr.IStringMap) OpenAS2Exception(com.helger.as2lib.exception.OpenAS2Exception) WrappedOpenAS2Exception(com.helger.as2lib.exception.WrappedOpenAS2Exception) SSLServerSocketFactory(javax.net.ssl.SSLServerSocketFactory) IOException(java.io.IOException) IOException(java.io.IOException) OpenAS2Exception(com.helger.as2lib.exception.OpenAS2Exception) WrappedOpenAS2Exception(com.helger.as2lib.exception.WrappedOpenAS2Exception)

Aggregations

OpenAS2Exception (com.helger.as2lib.exception.OpenAS2Exception)1 WrappedOpenAS2Exception (com.helger.as2lib.exception.WrappedOpenAS2Exception)1 IStringMap (com.helger.commons.collection.attr.IStringMap)1 StringMap (com.helger.commons.collection.attr.StringMap)1 IOException (java.io.IOException)1 SSLServerSocketFactory (javax.net.ssl.SSLServerSocketFactory)1