/*
 This file is part of the software framework JStatCom, 
 a library for building applications for data based analysis.

 Copyright (C) 2000-2005  Markus Kraetzig

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as
 published by the Free Software Foundation; either version 2.1 of the
 License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 */

package com.jstatcom.engine.ox;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.jstatcom.engine.ConfigHolder;
import com.jstatcom.engine.Engine;
import com.jstatcom.engine.EngineTypes;
import com.jstatcom.engine.LoadTypes;
import com.jstatcom.engine.SysRun;
import com.jstatcom.model.JSCConstants;
import com.jstatcom.model.JSCData;
import com.jstatcom.model.JSCTypes;

/**
 * Engine implementation to handle calls to the Ox program. Ox can be downloaded
 * from http://www.nuff.ox.ac.uk/Users/Doornik/doc/ox/. It must be installed to
 * run this engine. The exact location of the Ox dll must be set in
 * jox/engine_config.xml. A dialog will appear to ask for it, if
 * it was not set before.
 * 

* The engine can create objects from Ox classes and invoke methods defined by * those classes. Modules (.ox or .oxo files) must reside in the * jox subfolder. Static methods cannot be called directly, but * only member functions of Ox classes. *

* This engine takes JSCData arrays as arguments and return types and * automatically does the conversion to and from the corresponding Ox types. * Input and return parameters of the respective Ox function have to be known * and the correct JSCTypes have to be specified. *

* Usage Example:
* It is assumed, that there is a module oxmodule.ox(o) in the * jox subfolder: *

* * #include <oxstd.h>
* // more includes
* * class MyClass {
*   decl lags;
*   MyClass();
*   setLags(const p);
*   ... // more declarations
* }
* MyClass::setLags(const p){
*   lags = p;
* }
* ... // more member methods
*
*

* The Java call to that module could look like this: *

* * Engine ox = EngineTypes.OX.getEngine();
* ox.load("oxmodule", OxLoadTypes.OXO, null);
* ox.load("MyClass", OxLoadTypes.CLASS, new JSCData[]{new JSCInt("arg", 3)}); // new MyClass(3)
* ox.call("setLags", new JSCData[]{new JSCInt("lags", 3), null) // myclass.setLags(3);
*
* * @author Markus Kraetzig */ public final class OxEngine implements Engine { private static final Logger log = Logger.getLogger(OxEngine.class); private static OxEngine ox = null; private boolean EXIT_STATUS = true; private List loadedModules = new ArrayList(); /** * Returns an instance of the OxEngine that is a Singleton. * * @return an engine instance * @throws RuntimeException * if the native support libraries cannot be found */ public static OxEngine getInstance() { if (ox == null) { ox = new OxEngine(); } return ox; } /** * Creates a OxEngine and loads the necessary system * libraries: *

Ads help maintain this website.