ApplicationServices.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef APPLICATIONSERVICES_H
00011 #define APPLICATIONSERVICES_H
00012 
00013 #include "Service.h"
00014 #include "Subject.h"
00015 
00016 #include <string>
00017 
00018 class ConfigurationSettings;
00019 class DataVariantFactory;
00020 class ObjectFactory;
00021 class SessionManager;
00022 
00023 /** we should really include jni.h here but we want to avoid needing Java installed if getJvm() is not used **/
00024 struct JNIEnv_;
00025 typedef JNIEnv_ JNIEnv;
00026 struct JavaVM_;
00027 typedef JavaVM_ JavaVM;
00028 
00029 /**
00030  *  \ingroup ServiceModule
00031  *  Provides access to application specific interfaces.
00032  *
00033  *  This class provides a means for clients to access interfaces of
00034  *  singleton objects maintained in the Studio.
00035  *
00036  *  This subclass of Subject will notify upon the following conditions:
00037  *  - The application or session is closed.
00038  *  - Everything else documented in Subject.
00039  */
00040 class ApplicationServices : public Subject
00041 {
00042 public:
00043    /**
00044     *  Emitted when the application is closed.
00045     *
00046     *  The application is still fully created when this signal is emitted. Plug-
00047     *  ins should typically attach to SessionClosed instead.
00048     */
00049    SIGNAL_METHOD(ApplicationServices, ApplicationClosed)
00050 
00051    /**
00052     *  Emitted when the session is closed.
00053     *
00054     *  The session is still fully created when this signal is emitted. Plug-ins
00055     *  should attach to this signal if they need to do cleanup before being
00056     *  destroyed on session close.
00057     */
00058    SIGNAL_METHOD(ApplicationServices, SessionClosed)
00059 
00060    /**
00061     *  Queries whether the application is executing in batch mode.
00062     *
00063     *  @return  Returns \b true if the application is executing in batch mode.
00064     *           Returns \b false if the application is executing in interactive
00065     *           mode.
00066     *
00067     *  @see     isInteractive()
00068     */
00069    virtual bool isBatch() const = 0;
00070 
00071    /**
00072     *  Queries whether the application is executing in interactive mode.
00073     *
00074     *  @return  Returns \b true if the application is executing in interactive
00075     *           mode.  Returns \b false if the application is executing in
00076     *           batch mode.
00077     *
00078     *  @see     isBatch()
00079     */
00080    virtual bool isInteractive() const = 0;
00081 
00082    /**
00083     *  \cond INTERNAL
00084     *  Get the handle to the configuration settings currently being
00085     *  employed by the application.
00086     *
00087     *  @return   A pointer to an interface for the configuration settings.
00088     */
00089    virtual ConfigurationSettings* getConfigurationSettings() = 0;
00090    /// \endcond
00091 
00092    /**
00093     *  \cond INTERNAL
00094     *  Get the handle to the object factory currently being
00095     *  employed by the application.
00096     *
00097     *  @return   A pointer to an interface for the object factory.
00098     */
00099    virtual ObjectFactory* getObjectFactory() = 0;
00100    /// \endcond
00101 
00102    /**
00103     *  \cond INTERNAL
00104     *  Get the handle to the DataVariant factory currently being
00105     *  employed by the application.
00106     *
00107     *  @return   A pointer to an interface for the DataVariant factory.
00108     */
00109    virtual DataVariantFactory* getDataVariantFactory() = 0;
00110    /// \endcond
00111 
00112    /**
00113     *  \cond INTERNAL
00114     *  Get the handle to the session manager currently being
00115     *  employed by the application.
00116     *
00117     *  @return   A pointer to an interface for the session manager.
00118     */
00119    virtual SessionManager* getSessionManager() = 0;
00120    /// \endcond
00121 
00122    /**
00123     *  Get a Java VM
00124     *
00125     *  @param   pJvm
00126     *           return the JVM pointer
00127     *  @param   pEnv
00128     *           return the JNI environment pointer
00129     *
00130     *  @return  True on success or false on failure
00131     */
00132    virtual bool getJvm(JavaVM *&pJvm, JNIEnv *&pEnv) = 0;
00133 
00134 protected:
00135    /**
00136     * This will be cleaned up during application close.  Plug-ins do not
00137     * need to destroy it.
00138     */
00139    virtual ~ApplicationServices() {}
00140 };
00141 
00142 #endif

Software Development Kit - Opticks 4.9.0 Build 16218