KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensugar > cube > Launcher


1 /*
2  * JEFFREE: Java(TM) Embedded Framework FREE
3  * Copyright (C) 1999-2003 - Opensugar
4  *
5  * The contents of this file are subject to the Jeffree Public License,
6  * as defined by the file JEFFREE_LICENSE.TXT
7  *
8  * You may not use this file except in compliance with the License.
9  * You may obtain a copy of the License on the Objectweb web site
10  * (www.objectweb.org).
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14  * the specific terms governing rights and limitations under the License.
15  *
16  * The Original Code is JEFFREE, including the java package com.opensugar.cube,
17  * released January 1, 2003.
18  *
19  * The Initial Developer of the Original Code is Opensugar.
20  * The Original Code is Copyright Opensugar.
21  * All Rights Reserved.
22  *
23  * Initial developer(s): Pierre Scokaert (Opensugar)
24  * Contributor(s):
25  */

26
27 package com.opensugar.cube;
28
29 import com.opensugar.cube.simple.CubeWithoutPermissions;
30
31 import java.io.File JavaDoc;
32 import java.util.Observer JavaDoc;
33
34 public class Launcher {
35
36    public static void main( String JavaDoc[] args ) {
37       main( args, null );
38    }
39
40    public static void main( String JavaDoc[] args, Object JavaDoc splashScreen ) {
41       new Launcher( null, splashScreen );
42    }
43
44    public Launcher( File JavaDoc baseDirectory, Object JavaDoc splashScreen ) {
45       AbstractCube cube = newCube( baseDirectory );
46
47       Observer JavaDoc progressListener = null;
48       if ( splashScreen instanceof Observer JavaDoc ) {
49          progressListener = (Observer JavaDoc)splashScreen;
50       }
51
52       cube.startup( progressListener );
53
54       if ( splashScreen != null ) {
55          try {
56             Thread.sleep( 500 );
57          }
58          catch ( InterruptedException JavaDoc ignore ) {}
59          ( (java.awt.Window JavaDoc)splashScreen ).dispose();
60          splashScreen = null;
61       }
62
63       Object JavaDoc obj = new Object JavaDoc();
64       synchronized( obj ) {
65          try {
66             obj.wait();
67          }
68          catch ( InterruptedException JavaDoc ignore ) {}
69       }
70    }
71
72    // if org.osgi.framework.permissions is null --> do permissions if jvm supports them
73
// if org.osgi.framework.permissions is true --> do permissions, and exit if jvm does not support them
74
// otherwise, don't do permissions
75
protected AbstractCube newCube( File JavaDoc baseDirectory ) {
76       return newCubeWithoutPermissions( baseDirectory );
77    }
78
79    private AbstractCube newCubeWithoutPermissions( File JavaDoc baseDirectory ) {
80       return new CubeWithoutPermissions( baseDirectory );
81    }
82
83 }
84
Popular Tags