source: trunk/projects/jar2lib/src/main/resources/project-files/jtools/include/javaTools.h @ 7718

Revision 7718, 4.7 KB checked in by hinerm, 9 years ago (diff)
  • Updated javaTools with future plans
  • Fixed class path bug
Line 
1//
2// javaTools.h
3//
4
5/*
6OME Bio-Formats ITK plugin for calling Bio-Formats from the Insight Toolkit.
7Copyright (c) 2008-@year@, UW-Madison LOCI.
8All rights reserved.
9
10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are met:
12    * Redistributions of source code must retain the above copyright
13      notice, this list of conditions and the following disclaimer.
14    * Redistributions in binary form must reproduce the above copyright
15      notice, this list of conditions and the following disclaimer in the
16      documentation and/or other materials provided with the distribution.
17    * Neither the name of the UW-Madison LOCI nor the
18      names of its contributors may be used to endorse or promote products
19      derived from this software without specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY UW-MADISON LOCI ''AS IS'' AND ANY
22EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24DISCLAIMED. IN NO EVENT SHALL UW-MADISON LOCI BE LIABLE FOR ANY
25DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*/
32
33/*
34IMPORTANT NOTE: Although this software is distributed according to a
35"BSD-style" license, it requires the OME Bio-Formats Java library to do
36anything useful, which is licensed under the GPL v2 or later.
37As such, if you wish to distribute this software with Bio-Formats itself,
38your combined work must be distributed under the terms of the GPL.
39*/
40
41#include <string>
42#include <iostream>
43#include "jace.h"
44#include "jace/JNIHelper.h"
45#include "jace/StaticVmLoader.h"
46#include "jace/JNIException.h"
47#include "jace/OptionList.h"
48
49using namespace std;
50
51/**
52 * JavaTools provides static helper methods used in more than one
53 * of the various BFITK plugin implementations.
54 */
55class JavaTools
56{
57  public:
58    typedef JavaTools      Self;
59
60    /**
61     * This method is used to instantiate a JVM with the following defaults:
62     * class path: working directory
63     * extra jars: none
64     * memory: 256MB
65     * headless: true
66     */
67    static void createJVM();
68
69    /**
70     * This method is used to instantiate a JVM with a custom class path.
71     */
72    static void createJVM(string jarlist);
73
74    /**
75     * This method is used to instantiate a JVM with custom memory specifications.
76     */
77    static void createJVM(int memory);
78
79    /**
80     * This method is used to instantiate a JVM with specified headless mode.
81     */
82    static void createJVM(bool headless);
83
84    /**
85     * This method is used to instantiate a JVM with a custom class path and
86     * memory specifications..
87     */
88    static void createJVM(string classdir, int memory);
89
90    /**
91     * This method is used to instantiate a JVM with a custom class path and
92     * specified headless mode.
93     */
94    static void createJVM(string classdir, bool headless);
95
96    /**
97     * This method is used to instantiate a JVM with extra jars and
98     * memory specifications..
99     */
100    static void createJVM(int memory, string jarlist);
101
102    /**
103     * This method is used to instantiate a JVM with extra jars and
104     * specified headless mode.
105     */
106    static void createJVM(bool headless, string jarlist);
107
108    /**
109     * This method is used to instantiate a JVM with a custom class path and
110     * additional jars.
111     */
112    static void createJVM(string classdir, string jarlist);
113
114    /**
115     * This method is used to instantiate a JVM with a custom class path,
116     * extra jars and custom memory specifications.
117     */
118    static void createJVM(string classdir, string jarlist, int memory);
119
120    /**
121     * This method is used to instantiate a JVM with a custom class path,
122     * extra jars and specified headless mode.
123     */
124    static void createJVM(string classdir, string jarlist, bool headless);
125
126    /**
127     * This method is the fundamental JVM creation method.
128     * classdir - specifies location of the core jar files, and extra jars (if present)
129     * jarlist - a ; separated list of additional jars to include in the JVM classpath.
130     *           jace-runtime.jar, loci_tools.jar and bio-formats.jar are always included.
131     * headless - whether to run headless or not
132     * memory - how much memory to instantiate the JVM with
133     */
134    static void createJVM(string classdir, string jarlist, bool headless, int memory);
135};
Note: See TracBrowser for help on using the repository browser.