001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /**
019: * @author Vladimir N. Molotkov
020: * @version $Revision$
021: */package java.security.cert;
022:
023: /**
024: * @com.intel.drl.spec_ref
025: *
026: */
027: public class LDAPCertStoreParameters implements CertStoreParameters {
028: // Default LDAP server name
029: private static final String DEFAULT_LDAP_SERVER_NAME = "localhost"; //$NON-NLS-1$
030: // Default LDAP server port number
031: private static final int DEFAULT_LDAP_PORT = 389;
032:
033: // LDAP server name for this cert store
034: private final String serverName;
035: // LDAP server port number for this cert store
036: private final int port;
037:
038: /**
039: * @com.intel.drl.spec_ref
040: */
041: public LDAPCertStoreParameters(String serverName, int port) {
042: this .port = port;
043: this .serverName = serverName;
044: if (this .serverName == null) {
045: throw new NullPointerException();
046: }
047: }
048:
049: /**
050: * @com.intel.drl.spec_ref
051: */
052: public LDAPCertStoreParameters() {
053: this .serverName = DEFAULT_LDAP_SERVER_NAME;
054: this .port = DEFAULT_LDAP_PORT;
055: }
056:
057: /**
058: * @com.intel.drl.spec_ref
059: */
060: public LDAPCertStoreParameters(String serverName) {
061: this .port = DEFAULT_LDAP_PORT;
062: this .serverName = serverName;
063: if (this .serverName == null) {
064: throw new NullPointerException();
065: }
066: }
067:
068: /**
069: * @com.intel.drl.spec_ref
070: */
071: public Object clone() {
072: try {
073: return super .clone();
074: } catch (CloneNotSupportedException e) {
075: return null;
076: }
077: }
078:
079: /**
080: * @com.intel.drl.spec_ref
081: */
082: public int getPort() {
083: return port;
084: }
085:
086: /**
087: * @com.intel.drl.spec_ref
088: */
089: public String getServerName() {
090: return serverName;
091: }
092:
093: /**
094: * @com.intel.drl.spec_ref
095: */
096: public String toString() {
097: StringBuffer sb = new StringBuffer(
098: "LDAPCertStoreParameters: [\n serverName: "); //$NON-NLS-1$
099: sb.append(getServerName());
100: sb.append("\n port: "); //$NON-NLS-1$
101: sb.append(getPort());
102: sb.append("\n]"); //$NON-NLS-1$
103: return sb.toString();
104: }
105: }
|