]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Still continue.
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Jul 2015 14:34:51 +0000 (16:34 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Jul 2015 14:34:51 +0000 (16:34 +0200)
15 files changed:
idl/SALOME_SDS.idl
src/SALOMESDS/SALOMESDS_BasicDataServer.cxx
src/SALOMESDS/SALOMESDS_BasicDataServer.hxx
src/SALOMESDS/SALOMESDS_DataScopeServer.cxx
src/SALOMESDS/SALOMESDS_DataScopeServer.hxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdExtServer.cxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdExtServer.hxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdOnlyServer.cxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdOnlyServer.hxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdWrServer.cxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjRdWrServer.hxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjServer.cxx
src/SALOMESDS/SALOMESDS_PickelizedPyObjServer.hxx
src/SALOMESDS/SALOMESDS_Transaction.cxx
src/SALOMESDS/SALOMESDS_Transaction.hxx

index 9986edfdc77ae43d9a18f5a021f70dd4f1ff7278..fac3ecdfba2a01aaf206de194eb0442bbc1b24c3 100644 (file)
@@ -84,6 +84,8 @@ module SALOME
   interface DataScopeServerTransaction : DataScopeServerBase
   {
     Transaction createRdOnlyVarTransac(in string varName, in ByteVec constValue) raises (SALOME::SALOME_Exception);
+    Transaction createRdExtVarTransac(in string varName, in ByteVec constValue) raises (SALOME::SALOME_Exception);
+    Transaction createRdWrVarTransac(in string varName, in ByteVec constValue) raises (SALOME::SALOME_Exception);
     void atomicApply(in ListOfTransaction transactions) raises (SALOME::SALOME_Exception);
   };
 
index d0f102838b3d8438b5f5db84e7bde847037113ed..d1bb917f5ef675a7379189d5e412daf34c21ac66 100644 (file)
@@ -28,7 +28,7 @@ using namespace SALOMESDS;
 
 int BasicDataServer::POA_CNT=0;
 
-BasicDataServer::BasicDataServer(DataScopeServer *father, const std::string& varName):_father(father),_var_name(varName)
+BasicDataServer::BasicDataServer(DataScopeServerBase *father, const std::string& varName):_father(father),_var_name(varName)
 {
   PortableServer::POA_var poa(_father->getPOA());
   PortableServer::POAManager_var pman(poa->the_POAManager());
index bf146b893bc887209fdbd768fb3609d79e85c04e..9d0bc679f478db2036af738ca07fafd34760312b 100644 (file)
 
 namespace SALOMESDS
 {
-  class DataScopeServer;
+  class DataScopeServerBase;
   
   class BasicDataServer : public RefCountServ, public virtual POA_SALOME::BasicDataServer
   {
   public:
-    BasicDataServer(DataScopeServer *father, const std::string& varName);
+    BasicDataServer(DataScopeServerBase *father, const std::string& varName);
     SALOME::DataScopeServer_ptr getMyDataScopeServer();
     char *getVarName();
     char *getScopeName();
@@ -48,7 +48,7 @@ namespace SALOMESDS
   protected:
     PortableServer::POA_var getPOA() const { return _poa; }
   protected:
-    DataScopeServer *_father;
+    DataScopeServerBase *_father;
   private:
     std::string _var_name;
     PortableServer::POA_var _poa;
index 82b1fa20c5ca06bc4faad398ad30510c8c009f05..c08cfc2ee6bb30ed09809bb069b1c81697d24ec2 100644 (file)
@@ -303,14 +303,72 @@ DataScopeServerTransaction::DataScopeServerTransaction(const DataScopeServerTran
 {
 }
 
+void DataScopeServerTransaction::createRdOnlyVarInternal(const std::string& varName, const SALOME::ByteVec& constValue)
+{
+  checkNotAlreadyExistingVar(varName);
+  PickelizedPyObjRdOnlyServer *tmp(new PickelizedPyObjRdOnlyServer(this,varName,constValue));
+  CORBA::Object_var ret(activateWithDedicatedPOA(tmp));
+  std::pair< SALOME::BasicDataServer_var, BasicDataServer * > p(SALOME::BasicDataServer::_narrow(ret),tmp);
+  _vars.push_back(p);
+}
+
+void DataScopeServerTransaction::createRdExtVarInternal(const std::string& varName, const SALOME::ByteVec& constValue)
+{
+  checkNotAlreadyExistingVar(varName);
+  PickelizedPyObjRdExtServer *tmp(new PickelizedPyObjRdExtServer(this,varName,constValue));
+  CORBA::Object_var ret(activateWithDedicatedPOA(tmp));
+  std::pair< SALOME::BasicDataServer_var, BasicDataServer * > p(SALOME::BasicDataServer::_narrow(ret),tmp);
+  _vars.push_back(p);
+}
+
+void DataScopeServerTransaction::createRdWrVarInternal(const std::string& varName, const SALOME::ByteVec& constValue)
+{
+  checkNotAlreadyExistingVar(varName);
+  PickelizedPyObjRdWrServer *tmp(new PickelizedPyObjRdWrServer(this,varName,constValue));
+  CORBA::Object_var ret(activateWithDedicatedPOA(tmp));
+  std::pair< SALOME::BasicDataServer_var, BasicDataServer * > p(SALOME::BasicDataServer::_narrow(ret),tmp);
+  _vars.push_back(p);
+}
+
 SALOME::Transaction_ptr DataScopeServerTransaction::createRdOnlyVarTransac(const char *varName, const SALOME::ByteVec& constValue)
 {
-  TransactionRdOnlyVarCreate *ret(new TransactionRdOnlyVarCreate(varName,constValue));
+  TransactionRdOnlyVarCreate *ret(new TransactionRdOnlyVarCreate(this,varName,constValue));
+  ret->checkNotAlreadyExisting();
+  PortableServer::ObjectId_var id(_poa->activate_object(ret));
+  CORBA::Object_var obj(_poa->id_to_reference(id));
+  return SALOME::Transaction::_narrow(obj);
+}
+
+SALOME::Transaction_ptr DataScopeServerTransaction::createRdExtVarTransac(const char *varName, const SALOME::ByteVec& constValue)
+{
+  TransactionRdExtVarCreate *ret(new TransactionRdExtVarCreate(this,varName,constValue));
+  ret->checkNotAlreadyExisting();
+  PortableServer::ObjectId_var id(_poa->activate_object(ret));
+  CORBA::Object_var obj(_poa->id_to_reference(id));
+  return SALOME::Transaction::_narrow(obj);
+}
+
+SALOME::Transaction_ptr DataScopeServerTransaction::createRdWrVarTransac(const char *varName, const SALOME::ByteVec& constValue)
+{
+  TransactionRdWrVarCreate *ret(new TransactionRdWrVarCreate(this,varName,constValue));
+  ret->checkNotAlreadyExisting();
   PortableServer::ObjectId_var id(_poa->activate_object(ret));
   CORBA::Object_var obj(_poa->id_to_reference(id));
   return SALOME::Transaction::_narrow(obj);
 }
 
+class TrustTransaction
+{
+public:
+  TrustTransaction():_must_rollback(0),_ptr(0) { }
+  void setTransaction(Transaction *t, bool *mustRollback) { if(!t || !mustRollback) throw Exception("TrustTransaction Error #1"); _must_rollback=mustRollback; t->prepareRollBackInCaseOfFailure(); }
+  void operate() { _ptr->perform(); }
+  ~TrustTransaction() { if(!_ptr) return ; if(*_must_rollback) _ptr->rollBack(); }
+private:
+  bool *_must_rollback;
+  Transaction *_ptr;
+};
+
 void DataScopeServerTransaction::atomicApply(const SALOME::ListOfTransaction& transactions)
 {
   std::size_t sz(transactions.length());
@@ -340,8 +398,15 @@ void DataScopeServerTransaction::atomicApply(const SALOME::ListOfTransaction& tr
       transactionsCpp[i]=elt;
       transactionsCpp[i].setHolder(this);
     }
-  for(std::size_t i=0;i<sz;i++)
-    transactionsCpp[i]->prepareRollBackInCaseOfFailure();
+  {// important do not merge loops ! 
+    std::vector<TrustTransaction> transactions2(sz);
+    bool mustRollback(true);
+    for(std::size_t i=0;i<sz;i++)
+      transactions2[i].setTransaction(transactionsCpp[i],&mustRollback);
+    for(std::size_t i=0;i<sz;i++)
+      transactions2[i].operate();
+    mustRollback=false;
+  }
 }
 
 DataScopeServerTransaction::~DataScopeServerTransaction()
index e91aec7e31a7eb4f65b2d4096d1529c6591a4b16..769270f43c98e90127a37384e21acc955ed8e84a 100644 (file)
@@ -48,9 +48,6 @@ namespace SALOMESDS
     CORBA::Boolean existVar(const char *varName);
     SALOME::BasicDataServer_ptr retrieveVar(const char *varName);
     void deleteVar(const char *varName);
-    SALOME::PickelizedPyObjRdOnlyServer_ptr createRdOnlyVar(const char *varName, const SALOME::ByteVec& constValue);
-    SALOME::PickelizedPyObjRdExtServer_ptr createRdExtVar(const char *varName, const SALOME::ByteVec& constValue);
-    SALOME::PickelizedPyObjRdWrServer_ptr createRdWrVar(const char *typeName, const char *varName);
     void shutdownIfNotHostedByDSM();
     ~DataScopeServerBase();
   public:
@@ -62,8 +59,9 @@ namespace SALOMESDS
     PyObject *getPickler() const { return _pickler; }
     PortableServer::POA_var getPOA() const { return _poa; }
     CORBA::ORB_var getORB() { return _orb; }
+    std::string getScopeNameCpp() const { return _name; }
     static std::string BuildTmpVarNameFrom(const std::string& varName);
-  protected:
+  public:
     std::vector< std::string> getAllVarNames() const;
     CORBA::Object_var activateWithDedicatedPOA(BasicDataServer *ds);
     void checkNotAlreadyExistingVar(const std::string& varName);
@@ -91,17 +89,21 @@ namespace SALOMESDS
 
   class SALOMESDS_EXPORT DataScopeServerTransaction : public DataScopeServerBase, public virtual POA_SALOME::DataScopeServerTransaction
   {
-  public:
+  public://not remotely callable
     DataScopeServerTransaction(CORBA::ORB_ptr orb, const std::string& scopeName);
     DataScopeServerTransaction(const DataScopeServerTransaction& other);
+    ~DataScopeServerTransaction();
+    void createRdOnlyVarInternal(const std::string& varName, const SALOME::ByteVec& constValue);
+    void createRdExtVarInternal(const std::string& varName, const SALOME::ByteVec& constValue);
+    void createRdWrVarInternal(const std::string& varName, const SALOME::ByteVec& constValue);
+  public://remotely callable
     SALOME::Transaction_ptr createRdOnlyVarTransac(const char *varName, const SALOME::ByteVec& constValue);
+    SALOME::Transaction_ptr createRdExtVarTransac(const char *varName, const SALOME::ByteVec& constValue);
+    SALOME::Transaction_ptr createRdWrVarTransac(const char *varName, const SALOME::ByteVec& constValue);
     void atomicApply(const SALOME::ListOfTransaction& transactions);
-    ~DataScopeServerTransaction();
   };
   
-  /*SALOME::Transaction_ptr createRdOnlyVar(const char *varName, const char *scopeName, const SALOME::ByteVec& constValue);
-  SALOME::Transaction_ptr createRdExtVar(const char *varName, const char *scopeName, const SALOME::ByteVec& constValue);
-  SALOME::Transaction_ptr createRdWrVar(const char *varName, const char *scopeName, const SALOME::ByteVec& constValue);
+  /*
   SALOME::Transaction_ptr addKeyValueInVarErrorIfAlreadyExisting(const char *varName, const char *scopeName, const SALOME::ByteVec& key, const SALOME::ByteVec& value);
   SALOME::Transaction_ptr addKeyValueInVarHard(const char *varName, const char *scopeName, const SALOME::ByteVec& key, const SALOME::ByteVec& value);
   SALOME::Transaction_ptr removeKeyInVarErrorIfNotAlreadyExisting(const char *varName, const char *scopeName, const SALOME::ByteVec& key);
index 50e2e05f6415ae762843fdf6983bdece9d82a319..0b1a196cc9461ad24aed793ea78c92f866890aec 100644 (file)
 
 using namespace SALOMESDS;
 
-PickelizedPyObjRdExtServer::PickelizedPyObjRdExtServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
+PickelizedPyObjRdExtServer::PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
 {
 }
 
 //! obj is consumed
-PickelizedPyObjRdExtServer::PickelizedPyObjRdExtServer(DataScopeServer *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
+PickelizedPyObjRdExtServer::PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
 {
 }
 
index 72ab708958fdceb92a8c3e38a9748c282e87b6fc..d982c165b4162b5ee036c39e6dea9ef872844153 100644 (file)
@@ -33,8 +33,8 @@ namespace SALOMESDS
   class PickelizedPyObjRdExtServer : public PickelizedPyObjServer, public virtual POA_SALOME::PickelizedPyObjRdExtServer
   {
   public:
-    PickelizedPyObjRdExtServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value);
-    PickelizedPyObjRdExtServer(DataScopeServer *father, const std::string& varName, PyObject *obj);
+    PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value);
+    PickelizedPyObjRdExtServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj);
     ~PickelizedPyObjRdExtServer();
     SALOME::PickelizedPyObjRdExtServer_ptr invokePythonMethodOn(const char *method, const SALOME::ByteVec& args);
   private:
index da86efb921beae9e1ecb1f98ecb2e11ad1614a4a..e8bef2342b637dfe431171ee69759e68aab9fd14 100644 (file)
 
 using namespace SALOMESDS;
 
-PickelizedPyObjRdOnlyServer::PickelizedPyObjRdOnlyServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
+PickelizedPyObjRdOnlyServer::PickelizedPyObjRdOnlyServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
 {
 }
 
-PickelizedPyObjRdOnlyServer::PickelizedPyObjRdOnlyServer(DataScopeServer *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
+PickelizedPyObjRdOnlyServer::PickelizedPyObjRdOnlyServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
 {
 }
 
index 9ae3bb221152af0e24f2e1c427c7ee9940f41bb2..a5047fdaa81369b27a412ccba00ba0e10ae93c57 100644 (file)
@@ -33,8 +33,8 @@ namespace SALOMESDS
   class PickelizedPyObjRdOnlyServer : public PickelizedPyObjServer, public virtual POA_SALOME::PickelizedPyObjRdOnlyServer
   {
   public:
-    PickelizedPyObjRdOnlyServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value);
-    PickelizedPyObjRdOnlyServer(DataScopeServer *father, const std::string& varName, PyObject *obj);
+    PickelizedPyObjRdOnlyServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value);
+    PickelizedPyObjRdOnlyServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj);
     ~PickelizedPyObjRdOnlyServer();
   };
 }
index 5e982de50a62c774473d2c6a16eab8cc56a031ed..cdb0d69222b6c7b879d0a3b566acd8038af10317 100644 (file)
 
 using namespace SALOMESDS;
 
-PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& typeName, const std::string& varName):PickelizedPyObjServer(father,varName,CreateDftObjFromType(father->getGlobals(),typeName))
+PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& typeName, const std::string& varName):PickelizedPyObjServer(father,varName,CreateDftObjFromType(father->getGlobals(),typeName))
 {
 }
 
-PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
+PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value):PickelizedPyObjServer(father,varName,value)
 {
 }
 
 //! obj is consumed
-PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
+PickelizedPyObjRdWrServer::PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj):PickelizedPyObjServer(father,varName,obj)
 {
 }
 
index 858ca771d3fc392669aac1acf3077a47103bea6f..b6fba2f21502175c481145ea04e125dfd071826d 100644 (file)
@@ -33,9 +33,9 @@ namespace SALOMESDS
   class PickelizedPyObjRdWrServer : public PickelizedPyObjServer, public virtual POA_SALOME::PickelizedPyObjRdWrServer
   {
   public:
-    PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& typeName, const std::string& varName);
-    PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value);
-    PickelizedPyObjRdWrServer(DataScopeServer *father, const std::string& varName, PyObject *obj);
+    PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& typeName, const std::string& varName);
+    PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value);
+    PickelizedPyObjRdWrServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj);
     ~PickelizedPyObjRdWrServer();
     void setSerializedContent(const SALOME::ByteVec& newValue);
     SALOME::PickelizedPyObjRdWrServer_ptr invokePythonMethodOn(const char *method, const SALOME::ByteVec& args);
index 1494250515953606714e9f4e8ae4429225eff380..2bc0c120c181adbf7447ec2f0784495561efb29c 100644 (file)
 
 using namespace SALOMESDS;
 
-PickelizedPyObjServer::PickelizedPyObjServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value):BasicDataServer(father,varName),_self(0)
+PickelizedPyObjServer::PickelizedPyObjServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value):BasicDataServer(father,varName),_self(0)
 {
   setSerializedContentInternal(value);
 }
 
 //! obj is consumed
-PickelizedPyObjServer::PickelizedPyObjServer(DataScopeServer *father, const std::string& varName, PyObject *obj):BasicDataServer(father,varName),_self(0)
+PickelizedPyObjServer::PickelizedPyObjServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj):BasicDataServer(father,varName),_self(0)
 {
   setNewPyObj(obj);
 }
index 2d94ca1d6a564c381575cc81c2f905a8bd32bbf4..e216262cd28cc1aac6cb25868a60bcb0ef8fd34e 100644 (file)
@@ -33,8 +33,8 @@ namespace SALOMESDS
   class PickelizedPyObjServer : public BasicDataServer, public virtual POA_SALOME::PickelizedPyObjServer
   {
   public:
-    PickelizedPyObjServer(DataScopeServer *father, const std::string& varName, const SALOME::ByteVec& value);
-    PickelizedPyObjServer(DataScopeServer *father, const std::string& varName, PyObject *obj);
+    PickelizedPyObjServer(DataScopeServerBase *father, const std::string& varName, const SALOME::ByteVec& value);
+    PickelizedPyObjServer(DataScopeServerBase *father, const std::string& varName, PyObject *obj);
     ~PickelizedPyObjServer();
     void setSerializedContent(const SALOME::ByteVec& newValue);
     SALOME::ByteVec *fetchSerializedContent();
index 3ceb547cdb55e6f977566c4ef0abd1aceaf7c7a0..31778707c7affd30f83a06bdafcec3b5fd2e96e6 100644 (file)
@@ -19,7 +19,6 @@
 // Author : Anthony GEAY (EDF R&D)
 
 #include "SALOMESDS_Transaction.hxx"
-#include "SALOMESDS_DataServerManager.hxx"
 #include "SALOMESDS_Exception.hxx"
 
 #include <sstream>
@@ -35,11 +34,47 @@ void Transaction::FromByteSeqToVB(const SALOME::ByteVec& bsToBeConv, std::vector
     buf[i]=bsToBeConv[i];
 }
 
-TransactionVarCreate::TransactionVarCreate(const std::string& varName, const SALOME::ByteVec& constValue):Transaction(varName)
+void Transaction::FromVBToByteSeq(const std::vector<unsigned char>& bsToBeConv, SALOME::ByteVec& ret)
+{
+  std::size_t sz(bsToBeConv.size());
+  ret.length(sz);
+  for(std::size_t i=0;i<sz;i++)
+    ret[i]=bsToBeConv[i];
+}
+
+TransactionVarCreate::TransactionVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):Transaction(dsct,varName)
 {
   FromByteSeqToVB(constValue,_data);
 }
 
 void TransactionVarCreate::prepareRollBackInCaseOfFailure()
 {//nothing it is not a bug
+  checkNotAlreadyExisting();
+}
+
+void TransactionVarCreate::rollBack()
+{
+  if(_dsct->existVar(_var_name.c_str()))
+    _dsct->deleteVar(_var_name.c_str());
+}
+
+void TransactionRdOnlyVarCreate::perform()
+{
+  SALOME::ByteVec data2;
+  FromVBToByteSeq(_data,data2);
+  _dsct->createRdOnlyVarInternal(_var_name,data2);
+}
+
+void TransactionRdExtVarCreate::perform()
+{
+  SALOME::ByteVec data2;
+  FromVBToByteSeq(_data,data2);
+  _dsct->createRdExtVarInternal(_var_name,data2);
+}
+
+void TransactionRdWrVarCreate::perform()
+{
+  SALOME::ByteVec data2;
+  FromVBToByteSeq(_data,data2);
+  _dsct->createRdWrVarInternal(_var_name,data2);
 }
index 5e8e513eccd78ea9498ff76223ab227512e092a9..805b8d6478d402a7b66ccffeec119e05621daaff 100644 (file)
@@ -25,6 +25,8 @@
 #include CORBA_SERVER_HEADER(SALOME_SDS)
 
 #include "SALOMESDS_Defines.hxx"
+#include "SALOMESDS_Exception.hxx"
+#include "SALOMESDS_DataServerManager.hxx"
 
 #include <string>
 #include <vector>
@@ -34,20 +36,26 @@ namespace SALOMESDS
   class SALOMESDS_EXPORT Transaction : public virtual POA_SALOME::Transaction
   {
   public:
-    Transaction(const std::string& varName):_var_name(varName) { }
+    Transaction(DataScopeServerTransaction *dsct, const std::string& varName):_dsct(dsct),_var_name(varName) { if(!_dsct) throw Exception("Transaction constructor error !"); }
     std::string getVarName() const { return _var_name; }
     virtual void prepareRollBackInCaseOfFailure() = 0;
+    virtual void perform() = 0;
+    virtual void rollBack() = 0;
   public:
     static void FromByteSeqToVB(const SALOME::ByteVec& bsToBeConv, std::vector<unsigned char>& ret);
+    static void FromVBToByteSeq(const std::vector<unsigned char>& bsToBeConv, SALOME::ByteVec& ret);
   protected:
+    DataScopeServerTransaction *_dsct;
     std::string _var_name;
   };
 
   class TransactionVarCreate : public Transaction
   {
   public:
-    TransactionVarCreate(const std::string& varName, const SALOME::ByteVec& constValue);
+    TransactionVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue);
+    void checkNotAlreadyExisting() { _dsct->checkNotAlreadyExistingVar(_var_name); }
     void prepareRollBackInCaseOfFailure();
+    void rollBack();
   protected:
     std::vector<unsigned char> _data;
   };
@@ -55,7 +63,22 @@ namespace SALOMESDS
   class TransactionRdOnlyVarCreate : public TransactionVarCreate
   {
   public:
-    TransactionRdOnlyVarCreate(const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(varName,constValue) { }
+    TransactionRdOnlyVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
+    void perform();
+  };
+
+  class TransactionRdExtVarCreate : public TransactionVarCreate
+  {
+  public:
+    TransactionRdExtVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
+    void perform();
+  };
+
+  class TransactionRdWrVarCreate : public TransactionVarCreate
+  {
+  public:
+    TransactionRdWrVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
+    void perform();
   };
 }