KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > HarmoniseInformationManager


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.him;
20
21 import java.io.*;
22
23 import org.openharmonise.him.editors.*;
24 import org.openharmonise.him.window.*;
25 import org.openharmonise.him.window.messages.*;
26 import org.openharmonise.vfs.metadata.*;
27
28
29 /**
30  * The entry point for Content Manager.
31  *
32  * @author Matthew Large
33  * @version $Revision: 1.3 $
34  *
35  */

36 public class HarmoniseInformationManager {
37
38     /**
39      * Virtual File System message router.
40      */

41     private VFSMessageRouter m_vfsRouter = null;
42
43     public HarmoniseInformationManager() {
44         super();
45         this.setup();
46     }
47     
48     /**
49      * Initialises Content Manager. Performs file system checks and sets
50      * up required system parameters.
51      *
52      */

53     private void setup() {
54         
55         this.checkFileSystem();
56         
57         System.setProperty("javax.net.ssl.trustStore", "C:\\ContentManager\\auths\\ContentManager");
58         System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
59         
60         DisplayManager.getInstance().showMainWindow();
61         DisplayController displayController = new DisplayController(DisplayManager.getInstance());
62
63         ValueCache.getInstance().load("C:\\ContentManager\\vals.xml");
64         PropertyCache.getInstance().load("C:\\ContentManager\\props.xml");
65         
66
67         MessageHandler.getInstance().fireMessageEvent("Logged into the Harmonise Server", MessageHandler.TYPE_INFORMATION);
68         
69         m_vfsRouter = new VFSMessageRouter();
70     }
71     
72     /**
73      * The main method (Program entry point).
74      *
75      * @param args No arguments required.
76      */

77     public static void main(String JavaDoc[] args) {
78         HarmoniseInformationManager manager = new HarmoniseInformationManager();
79         
80     }
81     
82     /**
83      * Checks the file system to ensure that all required paths exists and
84      * creates them if not.
85      *
86      */

87     private void checkFileSystem() {
88         File file = new File("C:\\ContentManager");
89         if(!file.exists()) {
90             file.mkdir();
91         }
92         file = new File("C:\\ContentManager\\auths");
93         if(!file.exists()) {
94             file.mkdir();
95         }
96         file = new File("C:\\ContentManager\\auths\\las");
97         if(!file.exists()) {
98             file.mkdir();
99         }
100         file = new File("C:\\ContentManager\\temp");
101         if(!file.exists()) {
102             file.mkdir();
103         }
104         EditorController.getInstance().clearTempDir();
105         file = new File("C:\\ContentManager\\temp\\edit");
106         if(!file.exists()) {
107             file.mkdir();
108         }
109         file = new File("C:\\ContentManager\\temp\\preview");
110         if(!file.exists()) {
111             file.mkdir();
112         }
113         
114         
115         file = new File("C:\\ContentManager\\auths\\ContentManager");
116         //if(!file.exists()) {
117
InputStream is = HarmoniseInformationManager.class.getResourceAsStream("/org/openharmonise/him/icons/files/ContentManager");
118             FileOutputStream fo = null;
119
120             try {
121                 fo = new FileOutputStream(file);
122                 int nValue;
123                 while((nValue=is.read())!=-1) {
124                     fo.write(nValue);
125                 }
126             } catch (FileNotFoundException e) {
127                 e.printStackTrace();
128             } catch (IOException e) {
129                 e.printStackTrace();
130             }
131             
132                 
133         //}
134

135     }
136
137 }
138
Popular Tags