Back to index

salome-kernel  6.5.0
SALOME_Launcher.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef __SALOME_LAUNCHER_HXX__
00024 #define __SALOME_LAUNCHER_HXX__
00025 
00026 #include "SALOME_Launcher_defs.hxx"
00027 
00028 #include <SALOMEconfig.h>
00029 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00030 #include "Launcher.hxx"
00031 
00032 #include <string>
00033 #include <list>
00034 
00035 class SALOME_NamingService;
00036 class SALOME_ContainerManager;
00037 class SALOME_ResourcesManager;
00038 
00039 class SALOMELAUNCHER_EXPORT SALOME_Launcher:
00040   public POA_Engines::SalomeLauncher,
00041   public PortableServer::RefCountServantBase
00042 {
00043 
00044 public:
00045   SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa);
00046   virtual ~SALOME_Launcher();
00047 
00048   // Main methods
00049   CORBA::Long createJob    (const Engines::JobParameters & job_parameters);
00050   void        launchJob    (CORBA::Long job_id);
00051   char *      getJobState  (CORBA::Long job_id);
00052   void        getJobResults(CORBA::Long job_id, const char * directory);
00053   CORBA::Boolean getJobDumpState(CORBA::Long job_id, const char * directory);
00054   void        stopJob      (CORBA::Long job_id);
00055   void        removeJob    (CORBA::Long job_id);
00056 
00057   // Useful methods
00058   CORBA::Long    createJobWithFile(const char * xmlExecuteFile, const char * clusterName);
00059   CORBA::Boolean testBatch        (const Engines::ResourceParameters& params);
00060 
00061   // SALOME Kernel service methods
00062   void Shutdown();
00063   CORBA::Long getPID();
00064 
00065   // Observer and introspection methods
00066   virtual void addObserver(Engines::SalomeLauncherObserver_ptr observer);
00067   virtual void removeObserver(Engines::SalomeLauncherObserver_ptr observer);
00068   virtual Engines::JobsList * getJobsList();
00069   virtual Engines::JobParameters * getJobParameters(CORBA::Long job_id);
00070 
00071   // Save and load methods
00072   virtual void loadJobs(const char* jobs_file);
00073   virtual void saveJobs(const char* jobs_file);
00074 
00075 
00076   static const char *_LauncherNameInNS;
00077 
00078 protected:
00079   // Internal methods
00080   virtual void notifyObservers(const std::string & event_name, const std::string & event_data);
00081 
00082 protected:
00083   CORBA::ORB_var _orb;
00084   PortableServer::POA_var _poa;
00085   SALOME_ContainerManager *_ContManager;
00086   SALOME_ResourcesManager *_ResManager;
00087   SALOME_NamingService *_NS;
00088 
00089   std::list<Engines::SalomeLauncherObserver_var> _observers;
00090 
00091   Launcher_cpp _l;
00092 };
00093 
00094 #endif