Source Code Cross Referenced for CertAdminUtil.java in  » Portal » Open-Portal » com » sun » portal » cli » cert » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.cli.cert 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * CertAdminUtil.java
003:         * @author  ss133690
004:         * @version 0.1
005:         */package com.sun.portal.cli.cert;
006:
007:        import java.io.*;
008:        import com.sun.portal.log.common.PortalLogger;
009:        import java.util.Date;
010:        import java.text.SimpleDateFormat;
011:
012:        public class CertAdminUtil {
013:            /**
014:             * Displays the CertAdmin Menu.
015:             */
016:            static void showMenu() {
017:                //println("************************************************************************");
018:                println(CertAdminLocale
019:                        .getPFString("m7", CertAdminConstants.m7));
020:                //println("*********             Certificate Administration               *********");
021:                println(CertAdminLocale.getPFString("m71",
022:                        CertAdminConstants.m71));
023:                //println("************************************************************************");
024:                println(CertAdminLocale
025:                        .getPFString("m7", CertAdminConstants.m7));
026:                println();
027:                //println("1)  Generate Self-Signed Certificate");
028:                println(CertAdminLocale.getPFString("m72",
029:                        CertAdminConstants.m72));
030:                //println("2)  Generate Certificate Signing Request (CSR)");
031:                println(CertAdminLocale.getPFString("m73",
032:                        CertAdminConstants.m73));
033:                //println("3)  Add Root CA Certificate");
034:                println(CertAdminLocale.getPFString("m74",
035:                        CertAdminConstants.m74));
036:                //println("4)  Install Certificate From Certificate Authority (CA)");
037:                println(CertAdminLocale.getPFString("m75",
038:                        CertAdminConstants.m75));
039:                //println("5)  Delete Certificate");
040:                println(CertAdminLocale.getPFString("m76",
041:                        CertAdminConstants.m76));
042:                //println("6)  Modify Trust Attributes of Certificate (e.g., for PDC)");
043:                println(CertAdminLocale.getPFString("m77",
044:                        CertAdminConstants.m77));
045:                //println("7)  List Root CA Certificates");
046:                println(CertAdminLocale.getPFString("m78",
047:                        CertAdminConstants.m78));
048:                //println("8)  List All Certificates");
049:                println(CertAdminLocale.getPFString("m79",
050:                        CertAdminConstants.m79));
051:                //println("9)  println Certificate content");
052:                println(CertAdminLocale.getPFString("m711",
053:                        CertAdminConstants.m711));
054:                //println("10) Quit");
055:                println(CertAdminLocale.getPFString("m712",
056:                        CertAdminConstants.m712));
057:                //println("----------------------------");
058:                println(CertAdminLocale.getPFString("m713",
059:                        CertAdminConstants.m713));
060:                //print("choice: [10] ");
061:                print(CertAdminLocale.getPFString("m714",
062:                        CertAdminConstants.m714));
063:
064:            }
065:
066:            static int processMenuOption() {
067:                CertAdminUtil.println(CertAdminConstants.newline);
068:                showMenu();
069:                String input = readConsoleInput();
070:                int inputval = 99;
071:                try {
072:                    inputval = Integer.parseInt(input);
073:                } catch (Exception ex) {
074:                }
075:
076:                while ((!input.equals(""))
077:                        && ((inputval < 1) || (inputval > 10))) {
078:                    //println("Invalid Option!");
079:                    println(CertAdminLocale.getPFString("m8",
080:                            CertAdminConstants.m8));
081:                    print(CertAdminLocale.getPFString("m714",
082:                            CertAdminConstants.m714));
083:                    input = readConsoleInput();
084:                    try {
085:                        inputval = Integer.parseInt(input);
086:                    } catch (Exception ex) {
087:                    }
088:                }
089:                CertAdminUtil.println(CertAdminConstants.newline);
090:                return inputval;
091:
092:            }
093:
094:            static boolean yesno(String msg) {
095:                String input = question(msg);
096:                if (input.equalsIgnoreCase("Y") || input.equals("")) {
097:                    return true;
098:                } else {
099:                    return false;
100:                }
101:            }
102:
103:            static String question(String msg) {
104:                print(msg);
105:                return readConsoleInput();
106:            }
107:
108:            /**
109:             * Masks the input entered on the console.
110:             */
111:            static String questionMasked(String msg) {
112:                MaskingThread maskingthread = new MaskingThread(msg);
113:                Thread thread = new Thread(maskingthread);
114:                thread.start();
115:                String maskedInput = readConsoleInput();
116:                maskingthread.stopMasking();
117:                return maskedInput;
118:            }
119:
120:            //Checks if the specified file exist.
121:            static boolean fileExist(String file) {
122:                return new File(file).exists();
123:            }
124:
125:            //Reads a line from the specified file
126:            static String readLine(String infile) {
127:                try {
128:                    File file = new File(infile);
129:                    BufferedReader br = new BufferedReader(
130:                            new InputStreamReader(new FileInputStream(file)));
131:                    return br.readLine();
132:                } catch (Exception ex) {
133:                    return null;
134:                }
135:            }
136:
137:            //Writes a line to the specified file
138:            static boolean writeLine(String data, String outfile, boolean append) {
139:                try {
140:                    FileOutputStream fos = new FileOutputStream(outfile, append);
141:                    PrintWriter pw = new PrintWriter(fos, true);
142:                    pw.print(data);
143:                    pw.close();
144:                    return true;
145:                } catch (Exception ex) {
146:                    return false;
147:                }
148:            }
149:
150:            static boolean writeLine(String data, String outfile) {
151:                return writeLine(data, outfile, false);
152:            }
153:
154:            static boolean delete(String file) {
155:                try {
156:                    new File(file).delete();
157:                    return true;
158:                } catch (Exception ex) {
159:                    return false;
160:                }
161:            }
162:
163:            static boolean rename(String src, String dest) {
164:
165:                try {
166:                    File srcf = new File(src);
167:                    File destf = new File(dest);
168:                    srcf.renameTo(destf);
169:                    return true;
170:                } catch (Exception ex) {
171:                    return false;
172:                }
173:
174:            }
175:
176:            static boolean mkdir(String dir) {
177:                try {
178:                    File directory = new File(dir);
179:                    return directory.mkdir();
180:                } catch (Exception ex) {
181:                    return false;
182:                }
183:            }
184:
185:            static String[] list(String dir) {
186:                try {
187:                    File file = new File(dir);
188:                    if (!file.isDirectory()) {
189:                        String[] list = new String[1];
190:                        list[0] = dir;
191:                        return list;
192:                    } else {
193:                        return file.list();
194:                    }
195:                } catch (Exception ex) {
196:                    return new String[0];
197:                }
198:            }
199:
200:            static void exitOnError(String message) {
201:                println(message);
202:                System.exit(0);
203:            }
204:
205:            static void println(String msg) {
206:                System.out.println(msg);
207:            }
208:
209:            static void println() {
210:                println("");
211:            }
212:
213:            static void print(String msg) {
214:                System.out.print(msg);
215:            }
216:
217:            static void print() {
218:                print("");
219:            }
220:
221:            static String readConsoleInput() {
222:                String input;
223:                try {
224:                    input = new BufferedReader(new InputStreamReader(System.in))
225:                            .readLine();
226:                } catch (Exception ex) {
227:                    input = "";
228:                }
229:                return input.trim();
230:            }
231:
232:            static String getCurrentDateTime() {
233:                Date date = new Date();
234:                SimpleDateFormat sdf = new SimpleDateFormat("MMddyykkmmss");
235:                String sDate = sdf.format(date);
236:                return sDate.trim();
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.