/** * Creates an initialized SSL context created with the configured key and trust managers. It will * use the default provider. * * @param protocol The protocol to use. As per the Java SE 6 Cryptography Architecture document, * the set of supported protocols should include at least "SSLv3", "TLSv1", "TLSv1.1", and * "SSLv2Hello". It must not be {@code null}. * @return The created SSL context. * @throws GeneralSecurityException If a problem occurs while creating or initializing the SSL * context. */ public SSLContext createSSLContext(final String protocol) throws GeneralSecurityException { ensureNotNull(protocol); final SSLContext sslContext = SSLContext.getInstance(protocol); sslContext.init(keyManagers, trustManagers, null); return sslContext; }
/** * Creates a new monitor entry from the information contained in the provided entry. * * @param entry The entry providing information to use for this monitor entry. It must not be * {@code null}. */ public MonitorEntry(final Entry entry) { ensureNotNull(entry); this.entry = new ReadOnlyEntry(entry); monitorClass = getMonitorClass(entry); monitorName = getString(ATTR_MONITOR_NAME); }
/** * Creates a new instance of this canned response request handler that will immediately return a * response with the provided information to any request that is received. * * @param resultCode The result code to use for the responses. It must not be {@code null}. * @param matchedDN The matched DN to use for the responses. It may be {@code null} if no matched * DN should be included. * @param diagnosticMessage The diagnostic message to use for the responses. It may be {@code * null} if no diagnostic message should be included. * @param referralURLs The referral URLs to use for the responses. It may be empty or {@code null} * if no referral URLs should be included. * @param searchEntries The set of search result entries that should be returned for every search. * It may be {@code null} or empty if no entries are required. * @param searchReferences The set of search result references that should be returned for every * search. It may be {@code null} or empty if no references are required. */ public CannedResponseRequestHandler( final ResultCode resultCode, final String matchedDN, final String diagnosticMessage, final List<String> referralURLs, final Collection<? extends Entry> searchEntries, final Collection<SearchResultReference> searchReferences) { Validator.ensureNotNull(resultCode); clientConnection = null; final int rc = resultCode.intValue(); addResponseProtocolOp = new AddResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); bindResponseProtocolOp = new BindResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs, null); compareResponseProtocolOp = new CompareResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); deleteResponseProtocolOp = new DeleteResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); extendedResponseProtocolOp = new ExtendedResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs, null, null); modifyResponseProtocolOp = new ModifyResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); modifyDNResponseProtocolOp = new ModifyDNResponseProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); searchResultDoneProtocolOp = new SearchResultDoneProtocolOp(rc, matchedDN, diagnosticMessage, referralURLs); if ((searchEntries == null) || searchEntries.isEmpty()) { searchEntryProtocolOps = Collections.emptyList(); } else { final ArrayList<SearchResultEntryProtocolOp> l = new ArrayList<SearchResultEntryProtocolOp>(searchEntries.size()); for (final Entry e : searchEntries) { l.add(new SearchResultEntryProtocolOp(e)); } searchEntryProtocolOps = Collections.unmodifiableList(l); } if ((searchReferences == null) || searchReferences.isEmpty()) { searchReferenceProtocolOps = Collections.emptyList(); } else { final ArrayList<SearchResultReferenceProtocolOp> l = new ArrayList<SearchResultReferenceProtocolOp>(searchReferences.size()); for (final SearchResultReference r : searchReferences) { l.add(new SearchResultReferenceProtocolOp(r)); } searchReferenceProtocolOps = Collections.unmodifiableList(l); } }
/** * Specifies the SSL protocol string that will be used by calls to {@link #createSSLContext()} * that do not explicitly specify which protocol to use. * * @param defaultSSLProtocol The SSL protocol string that will be used by calls to create an SSL * context that do not explicitly specify which protocol to use. It must not be {@code null}. */ public static void setDefaultSSLProtocol(final String defaultSSLProtocol) { ensureNotNull(defaultSSLProtocol); DEFAULT_SSL_PROTOCOL.set(defaultSSLProtocol); }