25 #include <Ice/ObjectAdapter.h>
41 const DatabaseInterfacePrx& databasePrx,
42 const CollectionInterfacePrx& collection,
44 databasePrx(databasePrx), snapshotListCollection(collection),
ic(
ic)
54 WorkingMemorySnapshotInterfacePrx
56 const std::string& name,
57 const AbstractWorkingMemoryInterfacePrx& workingMemory,
58 const Ice::Current&
c)
64 snapshot->saveWorkingMemory(workingMemory);
66 const DBStorableData dbSnapshot = dbSerializer->serialize(snapshot);
68 return createSnapshotProxy(snapshot,
c);
71 WorkingMemorySnapshotInterfacePrx
73 const std::string& name,
74 const AbstractWorkingMemoryInterfacePrx& workingMemory,
75 const Ice::StringSeq& entityIdList,
76 const Ice::Current&
c)
82 snapshot->saveWorkingMemorySubset(workingMemory, entityIdList);
84 const DBStorableData dbSnapshot = dbSerializer->serialize(snapshot);
86 return createSnapshotProxy(snapshot,
c);
89 WorkingMemorySnapshotInterfacePrx
96 return createSnapshotProxy(snapshot,
c);
99 throw SnapshotNotFoundException(
100 "Snapshot not found, check that corresponding record exists in " +
101 snapshotListCollection->getNS() +
" collection",
107 const WorkingMemorySnapshotInterfacePrx& snapshot,
110 SnapshotMap::iterator itSnap = openedSnapshots.find(snapshot->ice_getIdentity());
112 if (itSnap != openedSnapshots.end())
114 openedSnapshots.erase(itSnap);
120 const std::string& name,
121 const AbstractWorkingMemoryInterfacePrx& workingMemory,
122 const Ice::Current&
c)
130 snapshot->restoreWorkingMemory(workingMemory);
134 throw SnapshotNotFoundException(
"SnapshotNotFound", name);
166 WorkingMemorySnapshotInterfacePrx
168 const Ice::Current&
c)
171 openedSnapshots[snapId] = snapshot;
172 Ice::ObjectPrx node =
c.adapter->add(snapshot, snapId);
173 return WorkingMemorySnapshotInterfacePrx::uncheckedCast(node);
177 WorkingMemorySnapshotListSegment::findSnapshot(
const std::string& name)
179 DBStorableData dbSnapshot =
182 if (!dbSnapshot.JSON.empty())
185 dbSerializer->deserialize(dbSnapshot, snapshot);
198 id.name = (parentMemory ? parentMemory->getMemoryName() :
"") +
"_" + segmentName;
205 return snapshotListCollection->count();
213 for (NameList::const_iterator it = snapshotNames.begin(); it != snapshotNames.end(); ++it)