Source Code Cross Referenced for CustomPublisherContainer.java in  » Authentication-Authorization » ejbca » org » ejbca » core » model » ca » publisher » 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.core.model.ca.publisher 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*************************************************************************
002:         *                                                                       *
003:         *  EJBCA: The OpenSource Certificate Authority                          *
004:         *                                                                       *
005:         *  This software is free software; you can redistribute it and/or       *
006:         *  modify it under the terms of the GNU Lesser General Public           *
007:         *  License as published by the Free Software Foundation; either         *
008:         *  version 2.1 of the License, or any later version.                    *
009:         *                                                                       *
010:         *  See terms of license at gnu.org.                                     *
011:         *                                                                       *
012:         *************************************************************************/package org.ejbca.core.model.ca.publisher;
013:
014:        import java.io.ByteArrayInputStream;
015:        import java.io.IOException;
016:        import java.security.cert.Certificate;
017:        import java.util.HashMap;
018:        import java.util.Iterator;
019:        import java.util.Properties;
020:
021:        import javax.ejb.EJBException;
022:
023:        import org.ejbca.core.model.log.Admin;
024:        import org.ejbca.core.model.ra.ExtendedInformation;
025:
026:        /**
027:         * CustomPublisherContainer is a class handling a custom publisher. It is used 
028:         * to store and retrieve custom publisher configuration to database.
029:         * 
030:         *
031:         * @version $Id: CustomPublisherContainer.java,v 1.4 2007/09/12 14:22:46 anatom Exp $
032:         */
033:        public class CustomPublisherContainer extends BasePublisher {
034:            private ICustomPublisher custompublisher = null;
035:
036:            public static final float LATEST_VERSION = 1;
037:
038:            public static final int TYPE_CUSTOMPUBLISHERCONTAINER = 1;
039:
040:            // Default Values
041:
042:            protected static final String CLASSPATH = "classpath";
043:            protected static final String PROPERTYDATA = "propertydata";
044:
045:            public CustomPublisherContainer() {
046:                super ();
047:                data.put(TYPE, new Integer(TYPE_CUSTOMPUBLISHERCONTAINER));
048:                setClassPath("");
049:                setPropertyData("");
050:            }
051:
052:            // Public Methods    
053:            /**
054:             *  Returns the class path of custom publisher used.
055:             */
056:            public String getClassPath() {
057:                return (String) data.get(CLASSPATH);
058:            }
059:
060:            /**
061:             *  Sets the class path of custom publisher used.
062:             */
063:            public void setClassPath(String classpath) {
064:                data.put(CLASSPATH, classpath);
065:            }
066:
067:            /**
068:             *  Returns the propertydata used to configure this custom publisher.
069:             */
070:            public String getPropertyData() {
071:                return (String) data.get(PROPERTYDATA);
072:            }
073:
074:            /**
075:             *  Sets the propertydata used to configure this custom publisher.
076:             */
077:            public void setPropertyData(String propertydata) {
078:                data.put(PROPERTYDATA, propertydata);
079:            }
080:
081:            public Properties getProperties() throws IOException {
082:                Properties prop = new Properties();
083:                prop
084:                        .load(new ByteArrayInputStream(getPropertyData()
085:                                .getBytes()));
086:                return prop;
087:            }
088:
089:            /**
090:             * @see org.ejbca.core.model.ca.publisher.BasePublisher
091:             */
092:            public boolean storeCertificate(Admin admin, Certificate incert,
093:                    String username, String password, String cafp, int status,
094:                    int type, long revocationDate, int revocationReason,
095:                    ExtendedInformation extendedinformation)
096:                    throws PublisherException {
097:                return this .getCustomPublisher().storeCertificate(admin,
098:                        incert, username, password, cafp, status, type,
099:                        revocationDate, revocationReason, extendedinformation);
100:            }
101:
102:            /**
103:             * @see org.ejbca.core.model.ca.publisher.BasePublisher
104:             */
105:            public boolean storeCRL(Admin admin, byte[] incrl, String cafp,
106:                    int number) throws PublisherException {
107:                return this .getCustomPublisher().storeCRL(admin, incrl, cafp,
108:                        number);
109:            }
110:
111:            /**
112:             * @see org.ejbca.core.model.ca.publisher.BasePublisher
113:             */
114:            public void revokeCertificate(Admin admin, Certificate cert,
115:                    String username, int reason) throws PublisherException {
116:                this .getCustomPublisher()
117:                        .revokeCertificate(admin, cert, reason);
118:            }
119:
120:            /**
121:             * @see org.ejbca.core.model.ca.publisher.BasePublisher
122:             */
123:            public void testConnection(Admin admin)
124:                    throws PublisherConnectionException {
125:                this .getCustomPublisher().testConnection(admin);
126:            }
127:
128:            // Private methods
129:            private ICustomPublisher getCustomPublisher() {
130:                if (custompublisher == null) {
131:                    try {
132:                        Class implClass = Class.forName(getClassPath());
133:                        Object obj = implClass.newInstance();
134:                        this .custompublisher = (ICustomPublisher) obj;
135:                        this .custompublisher.init(getProperties());
136:                    } catch (ClassNotFoundException e) {
137:                        throw new EJBException(e);
138:                    } catch (IllegalAccessException iae) {
139:                        throw new EJBException(iae);
140:                    } catch (IOException ioe) {
141:                        throw new EJBException(ioe);
142:                    } catch (InstantiationException ie) {
143:                        throw new EJBException(ie);
144:                    }
145:                }
146:
147:                return custompublisher;
148:            }
149:
150:            /** 
151:             * @see org.ejbca.core.model.ca.publisher.BasePublisher#clone()
152:             */
153:            public Object clone() throws CloneNotSupportedException {
154:                CustomPublisherContainer clone = new CustomPublisherContainer();
155:                HashMap clonedata = (HashMap) clone.saveData();
156:
157:                Iterator i = (data.keySet()).iterator();
158:                while (i.hasNext()) {
159:                    Object key = i.next();
160:                    clonedata.put(key, data.get(key));
161:                }
162:
163:                clone.loadData(clonedata);
164:                return clone;
165:            }
166:
167:            /* *
168:             * @see org.ejbca.core.model.ca.publisher.BasePublisher#getLatestVersion()
169:             */
170:            public float getLatestVersion() {
171:                return LATEST_VERSION;
172:            }
173:
174:            /**
175:             * Resets the current custom publisher
176:             * @see org.ejbca.core.model.UpgradeableDataHashMap#saveData()
177:             */
178:            public Object saveData() {
179:                this.custompublisher = null;
180:                return super.saveData();
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.