Source Code Cross Referenced for BatchToolProperties.java in  » Authentication-Authorization » ejbca » org » ejbca » ui » cli » batch » 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 » Authentication Authorization » ejbca » org.ejbca.ui.cli.batch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*************************************************************************
02:         *                                                                       *
03:         *  EJBCA: The OpenSource Certificate Authority                          *
04:         *                                                                       *
05:         *  This software is free software; you can redistribute it and/or       *
06:         *  modify it under the terms of the GNU Lesser General Public           *
07:         *  License as published by the Free Software Foundation; either         *
08:         *  version 2.1 of the License, or any later version.                    *
09:         *                                                                       *
10:         *  See terms of license at gnu.org.                                     *
11:         *                                                                       *
12:         *************************************************************************/package org.ejbca.ui.cli.batch;
13:
14:        import java.io.File;
15:        import java.io.FileInputStream;
16:        import java.io.FileNotFoundException;
17:        import java.io.IOException;
18:        import java.util.Properties;
19:
20:        import org.apache.log4j.Logger;
21:
22:        /**
23:         * Class used to manage the batch tool property file.
24:         * 
25:         * @author Philip Vendil 2006 sep 19
26:         *
27:         * @version $Id: BatchToolProperties.java,v 1.4 2006/12/13 09:49:04 anatom Exp $
28:         */
29:        public class BatchToolProperties {
30:
31:            private static final String PROPERTY_KEYSPEC = "keys.spec";
32:            private static final String PROPERTY_KEYALG = "keys.alg";
33:
34:            Properties batchToolProperties = new Properties();
35:            private static final Logger log = Logger
36:                    .getLogger(BatchToolProperties.class);
37:
38:            BatchToolProperties() {
39:                load();
40:            }
41:
42:            /**
43:             * Returns the configured keysize
44:             * Default is 1024
45:             */
46:            public String getKeySpec() {
47:                return batchToolProperties
48:                        .getProperty(PROPERTY_KEYSPEC, "1024");
49:            }
50:
51:            /**
52:             * Returns the configured key algorithm
53:             * Default is RSA, can be ECDSA
54:             */
55:            public String getKeyAlg() {
56:                return batchToolProperties.getProperty(PROPERTY_KEYALG, "RSA");
57:            }
58:
59:            /**
60:             * Method that tries to read the property file 'batchtool.properties'
61:             * in the home directory then in the current directory and finally 
62:             * in the bin\batchtool.properties 
63:             *
64:             */
65:            private void load() {
66:                File file = new File(System.getProperty("user.home"),
67:                        "batchtool.properties");
68:                try {
69:                    try {
70:                        FileInputStream fis = new FileInputStream(file);
71:                        batchToolProperties.load(fis);
72:                    } catch (FileNotFoundException e) {
73:                        try {
74:                            FileInputStream fis = new FileInputStream(
75:                                    "batchtool.properties");
76:                            batchToolProperties.load(fis);
77:                        } catch (FileNotFoundException e1) {
78:                            try {
79:                                FileInputStream fis = new FileInputStream(
80:                                        "bin/batchtool.properties");
81:                                batchToolProperties.load(fis);
82:                            } catch (FileNotFoundException e2) {
83:                                log
84:                                        .info("Could not find any batchtool property file, default values will be used.");
85:                                log.debug(e);
86:                            }
87:                        }
88:                    }
89:                } catch (IOException e) {
90:                    log.error("Error reading batchtool property file ");
91:                    log.debug(e);
92:                }
93:            }
94:
95:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.