001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him;
020:
021: import java.io.*;
022:
023: import org.openharmonise.him.editors.*;
024: import org.openharmonise.him.window.*;
025: import org.openharmonise.him.window.messages.*;
026: import org.openharmonise.vfs.metadata.*;
027:
028: /**
029: * The entry point for Content Manager.
030: *
031: * @author Matthew Large
032: * @version $Revision: 1.3 $
033: *
034: */
035: public class HarmoniseInformationManager {
036:
037: /**
038: * Virtual File System message router.
039: */
040: private VFSMessageRouter m_vfsRouter = null;
041:
042: public HarmoniseInformationManager() {
043: super ();
044: this .setup();
045: }
046:
047: /**
048: * Initialises Content Manager. Performs file system checks and sets
049: * up required system parameters.
050: *
051: */
052: private void setup() {
053:
054: this .checkFileSystem();
055:
056: System.setProperty("javax.net.ssl.trustStore",
057: "C:\\ContentManager\\auths\\ContentManager");
058: System.setProperty("javax.net.ssl.trustStorePassword",
059: "changeit");
060:
061: DisplayManager.getInstance().showMainWindow();
062: DisplayController displayController = new DisplayController(
063: DisplayManager.getInstance());
064:
065: ValueCache.getInstance().load("C:\\ContentManager\\vals.xml");
066: PropertyCache.getInstance().load(
067: "C:\\ContentManager\\props.xml");
068:
069: MessageHandler.getInstance().fireMessageEvent(
070: "Logged into the Harmonise Server",
071: MessageHandler.TYPE_INFORMATION);
072:
073: m_vfsRouter = new VFSMessageRouter();
074: }
075:
076: /**
077: * The main method (Program entry point).
078: *
079: * @param args No arguments required.
080: */
081: public static void main(String[] args) {
082: HarmoniseInformationManager manager = new HarmoniseInformationManager();
083:
084: }
085:
086: /**
087: * Checks the file system to ensure that all required paths exists and
088: * creates them if not.
089: *
090: */
091: private void checkFileSystem() {
092: File file = new File("C:\\ContentManager");
093: if (!file.exists()) {
094: file.mkdir();
095: }
096: file = new File("C:\\ContentManager\\auths");
097: if (!file.exists()) {
098: file.mkdir();
099: }
100: file = new File("C:\\ContentManager\\auths\\las");
101: if (!file.exists()) {
102: file.mkdir();
103: }
104: file = new File("C:\\ContentManager\\temp");
105: if (!file.exists()) {
106: file.mkdir();
107: }
108: EditorController.getInstance().clearTempDir();
109: file = new File("C:\\ContentManager\\temp\\edit");
110: if (!file.exists()) {
111: file.mkdir();
112: }
113: file = new File("C:\\ContentManager\\temp\\preview");
114: if (!file.exists()) {
115: file.mkdir();
116: }
117:
118: file = new File("C:\\ContentManager\\auths\\ContentManager");
119: //if(!file.exists()) {
120: InputStream is = HarmoniseInformationManager.class
121: .getResourceAsStream("/org/openharmonise/him/icons/files/ContentManager");
122: FileOutputStream fo = null;
123:
124: try {
125: fo = new FileOutputStream(file);
126: int nValue;
127: while ((nValue = is.read()) != -1) {
128: fo.write(nValue);
129: }
130: } catch (FileNotFoundException e) {
131: e.printStackTrace();
132: } catch (IOException e) {
133: e.printStackTrace();
134: }
135:
136: //}
137:
138: }
139:
140: }
|