001: /*
002: * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005: package com.sun.portal.monitoring.security;
006:
007: import java.util.StringTokenizer;
008:
009: public class CertificateContext {
010: public String getAlias() {
011: return alias;
012: }
013:
014: public void setAlias(String alias) {
015: this .alias = alias;
016: }
017:
018: public String getKeyAlg() {
019: return keyAlg;
020: }
021:
022: public void setKeyAlg(String keyAlg) {
023: this .keyAlg = keyAlg;
024: }
025:
026: public String getCn() {
027: return cn;
028: }
029:
030: public void setCn(String cn) {
031: this .cn = cn;
032: }
033:
034: public String getO() {
035: return o;
036: }
037:
038: public void setO(String o) {
039: this .o = o;
040: }
041:
042: public String getOu() {
043: return ou;
044: }
045:
046: public void setOu(String ou) {
047: this .ou = ou;
048: }
049:
050: public String getC() {
051: return c;
052: }
053:
054: public void setC(String c) {
055: this .c = c;
056: }
057:
058: private static String CN = "cn";
059: private static String OU = "ou";
060: private static String O = "o";
061: private static String C = "c";
062: private static String EQUALS = "=";
063: private static String COMMA = ",";
064:
065: public String getDn() {
066: StringBuffer result = new StringBuffer(CN).append(EQUALS);
067: result.append(cn);
068:
069: result.append(COMMA);
070: result.append(OU).append(EQUALS);
071: result.append(ou);
072:
073: result.append(COMMA);
074: result.append(O).append(EQUALS);
075: result.append(o);
076:
077: result.append(COMMA);
078: result.append(C).append(EQUALS);
079: result.append(c);
080:
081: return result.toString();
082: }
083:
084: public void setDn(String dn) {
085: StringTokenizer tokenizer = new StringTokenizer(dn, COMMA);
086:
087: if (tokenizer.hasMoreTokens()) {
088: String cnString = tokenizer.nextToken();
089: setCn(cnString.substring(CN.length() + EQUALS.length()));
090: }
091:
092: if (tokenizer.hasMoreTokens()) {
093: String ouString = tokenizer.nextToken();
094: setOu(ouString.substring(OU.length() + EQUALS.length()));
095: }
096:
097: if (tokenizer.hasMoreTokens()) {
098: String oString = tokenizer.nextToken();
099: setO(oString.substring(O.length() + EQUALS.length()));
100: }
101:
102: if (tokenizer.hasMoreTokens()) {
103: String cString = tokenizer.nextToken();
104: setC(cString.substring(C.length() + EQUALS.length()));
105: }
106: }
107:
108: public String getValidity() {
109: return validity;
110: }
111:
112: public void setValidity(String validity) {
113: this .validity = validity;
114: }
115:
116: private String alias;
117: private String keyAlg;
118: private String cn;
119: private String o;
120: private String ou;
121: private String c;
122: private String validity;
123: }
|