diff --git a/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.cpp b/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.cpp index 4350ac0a..b773703f 100644 --- a/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.cpp +++ b/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.cpp @@ -258,8 +258,3 @@ Filesystem::NodeFactory::create(const string& type) return 0; } } - -void -Filesystem::NodeFactory::destroy() -{ -} diff --git a/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.h b/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.h index b0639cca..ebc15654 100644 --- a/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.h +++ b/cpp/demo/Manual/evictorFilesystem/PersistentFilesystemI.h @@ -57,12 +57,11 @@ class DirectoryI : public PersistentDirectory IceUtil::Mutex _mutex; }; -class NodeFactory : public Ice::ObjectFactory +class NodeFactory : public Ice::ValueFactory { public: virtual Ice::ObjectPtr create(const std::string&); - virtual void destroy(); }; } diff --git a/cpp/demo/Manual/evictorFilesystem/Server.cpp b/cpp/demo/Manual/evictorFilesystem/Server.cpp index fd085585..52b80248 100644 --- a/cpp/demo/Manual/evictorFilesystem/Server.cpp +++ b/cpp/demo/Manual/evictorFilesystem/Server.cpp @@ -23,9 +23,9 @@ class FilesystemApp : public Ice::Application // // Install object factories. // - Ice::ObjectFactoryPtr factory = new NodeFactory; - communicator()->addObjectFactory(factory, PersistentFile::ice_staticId()); - communicator()->addObjectFactory(factory, PersistentDirectory::ice_staticId()); + Ice::ValueFactoryPtr factory = new NodeFactory; + communicator()->addValueFactory(factory, PersistentFile::ice_staticId()); + communicator()->addValueFactory(factory, PersistentDirectory::ice_staticId()); // // Create an object adapter. diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp index 4415b8e2..0af5bb74 100644 --- a/cpp/src/Freeze/ObjectStore.cpp +++ b/cpp/src/Freeze/ObjectStore.cpp @@ -43,7 +43,7 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face // // Create a sample servant with this type // - ObjectFactoryPtr factory = _communicator->findObjectFactory(facetType); + ValueFactoryPtr factory = _communicator->findValueFactory(facetType); if(factory == 0) { throw DatabaseException(__FILE__, __LINE__, "No object factory registered for type-id '" + facetType + "'"); @@ -129,13 +129,13 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face } // - // Berkeley DB expects file paths to be UTF8 encoded. We keep + // Berkeley DB expects file paths to be UTF8 encoded. We keep // _dbName as a native string here, while it might have // been better to convert it to UTF-8, changing this isn't // possible without potentially breaking backward compatibility // with deployed databases. // - _db->open(txn, + _db->open(txn, IceUtil::nativeToUTF8(evictor->filename(), IceUtil::getProcessStringConverter()).c_str(), _dbName.c_str(), DB_BTREE, flags, FREEZE_DB_MODE); diff --git a/cpp/src/Freeze/ObjectStore.h b/cpp/src/Freeze/ObjectStore.h index 4e7eb674..e0e1b347 100644 --- a/cpp/src/Freeze/ObjectStore.h +++ b/cpp/src/Freeze/ObjectStore.h @@ -30,7 +30,7 @@ class ObjectStoreBase { public: - ObjectStoreBase(const std::string&, const std::string&, bool, EvictorIBase*, + ObjectStoreBase(const std::string&, const std::string&, bool, EvictorIBase*, const std::vector&, bool); virtual ~ObjectStoreBase(); @@ -79,7 +79,7 @@ class ObjectStoreBase bool insert(const Ice::Identity&, const ObjectRecord&, const TransactionIPtr&); bool remove(const Ice::Identity&, const TransactionIPtr&); - + EvictorIBase* evictor() const; // @@ -92,13 +92,13 @@ class ObjectStoreBase const Ice::EncodingVersion& encoding() const; const std::string& facet() const; bool keepStats() const; - + protected: bool loadImpl(const Ice::Identity&, ObjectRecord&); private: - + IceUtil::UniquePtr _db; std::string _facet; std::string _dbName; @@ -117,7 +117,7 @@ class ObjectStore : public ObjectStoreBase, public Cache public: ObjectStore(const std::string& facet, const std::string facetType, - bool createDb, EvictorIBase* evictor, + bool createDb, EvictorIBase* evictor, const std::vector& indices = std::vector(), bool populateEmptyIndices = false) : ObjectStoreBase(facet, facetType, createDb, evictor, indices, populateEmptyIndices) @@ -130,7 +130,7 @@ class ObjectStore : public ObjectStoreBase, public Cache protected: - virtual IceUtil::Handle + virtual IceUtil::Handle load(const Ice::Identity& ident) { ObjectRecord rec; @@ -144,7 +144,7 @@ class ObjectStore : public ObjectStoreBase, public Cache } } - virtual void + virtual void pinned(const IceUtil::Handle& element, typename ObjectCache::Position p) { element->init(p); @@ -155,19 +155,19 @@ class ObjectStore : public ObjectStoreBase, public Cache // Inline member function definitions // -inline Db* +inline Db* ObjectStoreBase::db() const { return _db.get(); } -inline const Ice::CommunicatorPtr& +inline const Ice::CommunicatorPtr& ObjectStoreBase::communicator() const { return _communicator; } -inline const Ice::EncodingVersion& +inline const Ice::EncodingVersion& ObjectStoreBase::encoding() const { return _encoding; diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp index 577c3aa7..d46e5551 100644 --- a/cpp/src/FreezeScript/Data.cpp +++ b/cpp/src/FreezeScript/Data.cpp @@ -2475,10 +2475,10 @@ FreezeScript::ObjectRef::setValue(const ObjectDataPtr& value) } // -// ObjectFactory +// ValueFactory // Ice::ObjectPtr -FreezeScript::ObjectFactory::create(const string& id) +FreezeScript::ValueFactory::create(const string& id) { Ice::ObjectPtr result; @@ -2512,19 +2512,14 @@ FreezeScript::ObjectFactory::create(const string& id) } void -FreezeScript::ObjectFactory::destroy() -{ -} - -void -FreezeScript::ObjectFactory::activate(const DataFactoryPtr& factory, const Slice::UnitPtr& unit) +FreezeScript::ValueFactory::activate(const DataFactoryPtr& factory, const Slice::UnitPtr& unit) { assert(!_factory && !_unit); _factory = factory; _unit = unit; } void -FreezeScript::ObjectFactory::deactivate() +FreezeScript::ValueFactory::deactivate() { _factory = 0; _unit = 0; diff --git a/cpp/src/FreezeScript/Data.h b/cpp/src/FreezeScript/Data.h index 54bd66e1..11005c03 100644 --- a/cpp/src/FreezeScript/Data.h +++ b/cpp/src/FreezeScript/Data.h @@ -566,12 +566,11 @@ class ObjectRef : public Data }; typedef IceUtil::Handle ObjectRefPtr; -class ObjectFactory : public Ice::ObjectFactory +class ValueFactory : public Ice::ValueFactory { public: virtual Ice::ObjectPtr create(const std::string&); - virtual void destroy(); void activate(const DataFactoryPtr&, const Slice::UnitPtr&); void deactivate(); @@ -581,7 +580,7 @@ class ObjectFactory : public Ice::ObjectFactory DataFactoryPtr _factory; Slice::UnitPtr _unit; }; -typedef IceUtil::Handle ObjectFactoryPtr; +typedef IceUtil::Handle ValueFactoryPtr; class ClassNotFoundException { diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp index 54bd0981..25c6d390 100644 --- a/cpp/src/FreezeScript/DumpDB.cpp +++ b/cpp/src/FreezeScript/DumpDB.cpp @@ -54,7 +54,7 @@ class DescriptorHandler : public IceXML::Handler public: DescriptorHandler(const DataFactoryPtr&, const Slice::UnitPtr&, const ErrorReporterPtr&, - const FreezeScript::ObjectFactoryPtr&); + const FreezeScript::ValueFactoryPtr&); virtual void startElement(const std::string&, const IceXML::Attributes&, int, int); virtual void endElement(const std::string&, int, int); @@ -70,7 +70,7 @@ class DescriptorHandler : public IceXML::Handler ErrorReporterPtr _errorReporter; DescriptorPtr _current; DumpDBDescriptorPtr _descriptor; - FreezeScript::ObjectFactoryPtr _objectFactory; + FreezeScript::ValueFactoryPtr _valueFactory; }; } @@ -475,8 +475,8 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator } in.close(); } - FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; - communicator->addObjectFactory(objectFactory, ""); + FreezeScript::ValueFactoryPtr valueFactory = new FreezeScript::ValueFactory; + communicator->addValueFactory(valueFactory, ""); DbEnv dbEnv(0); DbTxn* txn = 0; @@ -511,7 +511,7 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator try { FreezeScript::DataFactoryPtr factory = new FreezeScript::DataFactory(communicator, unit, errorReporter); - FreezeScript::DescriptorHandler dh(factory, unit, errorReporter, objectFactory); + FreezeScript::DescriptorHandler dh(factory, unit, errorReporter, valueFactory); istringstream istr(descriptors); IceXML::Parser::parse(istr, dh); @@ -820,8 +820,8 @@ FreezeScript::SliceVisitor::visitEnum(const Slice::EnumPtr& v) // FreezeScript::DescriptorHandler::DescriptorHandler(const DataFactoryPtr& factory, const Slice::UnitPtr& unit, const ErrorReporterPtr& errorReporter, - const FreezeScript::ObjectFactoryPtr& objectFactory) : - _factory(factory), _unit(unit), _errorReporter(errorReporter), _objectFactory(objectFactory) + const FreezeScript::ValueFactoryPtr& valueFactory) : + _factory(factory), _unit(unit), _errorReporter(errorReporter), _valueFactory(valueFactory) { } @@ -857,7 +857,7 @@ FreezeScript::DescriptorHandler::startElement(const string& name, const IceXML:: _errorReporter->descriptorError(" must be a child of ", line); } - d = new RecordDescriptor(_current, line, _factory, _errorReporter, attributes, _unit, _objectFactory); + d = new RecordDescriptor(_current, line, _factory, _errorReporter, attributes, _unit, _valueFactory); } else if(name == "dump") { diff --git a/cpp/src/FreezeScript/DumpDescriptors.cpp b/cpp/src/FreezeScript/DumpDescriptors.cpp index 6cb11ac2..10d3f480 100644 --- a/cpp/src/FreezeScript/DumpDescriptors.cpp +++ b/cpp/src/FreezeScript/DumpDescriptors.cpp @@ -1237,11 +1237,11 @@ FreezeScript::RecordDescriptor::RecordDescriptor(const DescriptorPtr& parent, in const ErrorReporterPtr& errorReporter, const IceXML::Attributes& attributes, const Slice::UnitPtr& unit, - const FreezeScript::ObjectFactoryPtr& objectFactory) : + const FreezeScript::ValueFactoryPtr& valueFactory) : Descriptor(parent, line, factory, errorReporter), ExecutableContainerDescriptor(parent, line, factory, errorReporter, attributes, "record"), _unit(unit), - _objectFactory(objectFactory) + _valueFactory(valueFactory) { } @@ -1251,7 +1251,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/, ExecuteIn // // Temporarily add an object factory. // - _objectFactory->activate(_factory, _unit); + _valueFactory->activate(_factory, _unit); // // Iterate over the database. @@ -1320,7 +1320,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/, ExecuteIn { dbc->close(); } - _objectFactory->deactivate(); + _valueFactory->deactivate(); throw; } @@ -1328,7 +1328,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/, ExecuteIn { dbc->close(); } - _objectFactory->deactivate(); + _valueFactory->deactivate(); } // diff --git a/cpp/src/FreezeScript/DumpDescriptors.h b/cpp/src/FreezeScript/DumpDescriptors.h index e79d11f1..f9f4dbc0 100644 --- a/cpp/src/FreezeScript/DumpDescriptors.h +++ b/cpp/src/FreezeScript/DumpDescriptors.h @@ -244,15 +244,15 @@ class RecordDescriptor : public ExecutableContainerDescriptor public: RecordDescriptor(const DescriptorPtr&, int, const DataFactoryPtr&, const ErrorReporterPtr&, - const IceXML::Attributes&, const Slice::UnitPtr&, - const FreezeScript::ObjectFactoryPtr&); + const IceXML::Attributes&, const Slice::UnitPtr&, + const FreezeScript::ValueFactoryPtr&); virtual void execute(const SymbolTablePtr&, ExecuteInfo*); private: Slice::UnitPtr _unit; - FreezeScript::ObjectFactoryPtr _objectFactory; + FreezeScript::ValueFactoryPtr _valueFactory; }; typedef IceUtil::Handle RecordDescriptorPtr; diff --git a/cpp/src/FreezeScript/Transformer.cpp b/cpp/src/FreezeScript/Transformer.cpp index e2756753..cae41ec3 100644 --- a/cpp/src/FreezeScript/Transformer.cpp +++ b/cpp/src/FreezeScript/Transformer.cpp @@ -57,7 +57,7 @@ struct TransformInfoI : public TransformInfo virtual ObjectDataMap& getObjectDataMap(); Ice::CommunicatorPtr communicator; - FreezeScript::ObjectFactoryPtr objectFactory; + FreezeScript::ValueFactoryPtr valueFactory; Slice::UnitPtr oldUnit; Slice::UnitPtr newUnit; Db* oldDb; @@ -1885,7 +1885,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/) // // Temporarily add an object factory. // - _info->objectFactory->activate(_info->factory, _info->oldUnit); + _info->valueFactory->activate(_info->factory, _info->oldUnit); // // Iterate over the database. @@ -1940,7 +1940,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/) { dbc->close(); } - _info->objectFactory->deactivate(); + _info->valueFactory->deactivate(); throw; } @@ -1948,7 +1948,7 @@ FreezeScript::RecordDescriptor::execute(const SymbolTablePtr& /*sym*/) { dbc->close(); } - _info->objectFactory->deactivate(); + _info->valueFactory->deactivate(); } void @@ -3004,7 +3004,7 @@ FreezeScript::assignOrTransform(const DataPtr& dest, const DataPtr& src, bool co void FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator, - const FreezeScript::ObjectFactoryPtr& objectFactory, + const FreezeScript::ValueFactoryPtr& valueFactory, const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, Db* oldDb, Db* newDb, DbTxn* newDbTxn, const Freeze::ConnectionPtr& connection, const string& newDbName, const string& facetName, bool purgeObjects, ostream& errors, @@ -3013,7 +3013,7 @@ FreezeScript::transformDatabase(const Ice::CommunicatorPtr& communicator, TransformInfoIPtr info = new TransformInfoI; info->communicator = communicator; - info->objectFactory = objectFactory; + info->valueFactory = valueFactory; info->oldUnit = oldUnit; info->newUnit = newUnit; info->oldDb = oldDb; diff --git a/cpp/src/FreezeScript/Transformer.h b/cpp/src/FreezeScript/Transformer.h index 58b3fb90..5eead4e8 100644 --- a/cpp/src/FreezeScript/Transformer.h +++ b/cpp/src/FreezeScript/Transformer.h @@ -20,7 +20,7 @@ namespace FreezeScript void transformDatabase(const Ice::CommunicatorPtr&, - const FreezeScript::ObjectFactoryPtr& objectFactory, + const FreezeScript::ValueFactoryPtr& valueFactory, const Slice::UnitPtr&, const Slice::UnitPtr&, Db*, Db*, DbTxn*, const Freeze::ConnectionPtr&, const std::string&, const std::string&, bool, std::ostream&, bool, std::istream&); diff --git a/cpp/src/FreezeScript/transformdb.cpp b/cpp/src/FreezeScript/transformdb.cpp index 17b19f5c..0ec4516e 100644 --- a/cpp/src/FreezeScript/transformdb.cpp +++ b/cpp/src/FreezeScript/transformdb.cpp @@ -114,7 +114,7 @@ findType(const Slice::UnitPtr& u, const string& type) static void transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, - const FreezeScript::ObjectFactoryPtr& objectFactory, + const FreezeScript::ValueFactoryPtr& valueFactory, DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName, const Freeze::ConnectionPtr& connectionNew, vector& dbs, const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, @@ -174,7 +174,7 @@ transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, // istringstream istr(descriptors); string facet = (name == "$default" ? string("") : name); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, + FreezeScript::transformDatabase(communicator, valueFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, dbName, facet, purgeObjects, cerr, suppress, istr); db.close(0); @@ -200,7 +200,7 @@ transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, // Execute the transformation descriptors. // istringstream istr(descriptors); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, + FreezeScript::transformDatabase(communicator, valueFactory, oldUnit, newUnit, &db, dbNew, txnNew, connectionNew, dbName, "", purgeObjects, cerr, suppress, istr); db.close(0); @@ -757,8 +757,8 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator return EXIT_FAILURE; } - FreezeScript::ObjectFactoryPtr objectFactory = new FreezeScript::ObjectFactory; - communicator->addObjectFactory(objectFactory, ""); + FreezeScript::ValueFactoryPtr valueFactory = new FreezeScript::ValueFactory; + communicator->addValueFactory(valueFactory, ""); // // Transform the database. @@ -830,13 +830,13 @@ run(const Ice::StringSeq& originalArgs, const Ice::CommunicatorPtr& communicator // for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) { - transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew, + transformDb(p->second.evictor, communicator, valueFactory, dbEnv, dbEnvNew, p->first, connectionNew, dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); } } else { - transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, + transformDb(evictor, communicator, valueFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); } }