KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > ui > web > admin > services > servicetypes > CustomActionType


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13 package org.ejbca.ui.web.admin.services.servicetypes;
14
15 import java.io.ByteArrayInputStream JavaDoc;
16 import java.io.ByteArrayOutputStream JavaDoc;
17 import java.io.IOException JavaDoc;
18 import java.util.ArrayList JavaDoc;
19 import java.util.Properties JavaDoc;
20
21 /**
22  * Class used to populate the fields in the customaction.jsp subview page.
23  *
24  * @author Philip Vendil 2006 sep 30
25  *
26  * @version $Id: CustomActionType.java,v 1.3 2006/10/26 11:02:17 herrvendil Exp $
27  */

28 public class CustomActionType extends ActionType {
29     
30     public static final String JavaDoc NAME = "CUSTOMACTION";
31     
32     public CustomActionType() {
33         super("customaction.jsp", NAME, true);
34     }
35
36     private String JavaDoc classPath;
37     
38     private String JavaDoc propertyText;
39
40     /**
41      * @return the propertyText
42      */

43     public String JavaDoc getPropertyText() {
44         return propertyText;
45     }
46
47     /**
48      * @param propertyText the propertyText to set
49      */

50     public void setPropertyText(String JavaDoc propertyText) {
51         this.propertyText = propertyText;
52     }
53
54     /**
55      * @param classPath the classPath to set
56      */

57     public void setClassPath(String JavaDoc classPath) {
58         this.classPath = classPath;
59     }
60
61     public String JavaDoc getClassPath() {
62         return classPath;
63     }
64
65     public Properties JavaDoc getProperties(ArrayList JavaDoc errorMessages) throws IOException JavaDoc{
66         Properties JavaDoc retval = new Properties JavaDoc();
67         retval.load(new ByteArrayInputStream JavaDoc(getPropertyText().getBytes()));
68         return retval;
69     }
70
71     public void setProperties(Properties JavaDoc properties) throws IOException JavaDoc{
72         ByteArrayOutputStream JavaDoc baos = new ByteArrayOutputStream JavaDoc();
73         properties.store(baos, null);
74         setPropertyText(new String JavaDoc(baos.toByteArray()));
75     }
76
77     
78     public boolean isCustom() {
79         return true;
80     }
81
82
83 }
84
Popular Tags