|
From: Frank V. C. <fr...@us...> - 2001-05-27 11:51:36
|
Update of /cvsroot/corelinux/clfw/src/libs/Persist
In directory usw-pr-cvs1:/tmp/cvs-serv11652/src/libs/Persist
Modified Files:
SchemaCatalog.cpp
Log Message:
420094 SchemaClass support in SchemaCatalog::createEntry
Index: SchemaCatalog.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/Persist/SchemaCatalog.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** SchemaCatalog.cpp 2001/04/25 03:27:22 1.11
--- SchemaCatalog.cpp 2001/05/27 11:51:33 1.12
***************
*** 81,84 ****
--- 81,85 ----
const FrameworkString defCollection("SetCollection");
const FrameworkString catMode("Write");
+ const FrameworkString schemaClass("SchemaClass");
//
***************
*** 295,307 ****
// Get the collection instance
! aSchemaCol = this->resolveCollectionAssignment(aCollection);
! // Get unique identifier for schema
! aUid = this->resolveUuidAssignment(aCollection);
! // Create and assign name and collection
! // SchemaPtr aSchema = this->createSchema( aUid, *aName, aSchemaCol );
// Make the catalog entry and persist
--- 296,311 ----
// Get the collection instance
! aSchemaCol = this->resolveCollectionAssignment( aCollection );
! // Get Schema class uid to use for instantiation
! UniversalIdentifierCref aSCUid
! (
! this->resolveSchemaClassUuid( aCollection )
! );
! // Get unique identifier for schema
! aUid = this->resolveUuidAssignment(aCollection);
// Make the catalog entry and persist
***************
*** 331,339 ****
aStore->setCollectionType( *aSchemaCol );
aStore->setSchemaUid( UniversalIdentifier( aUid.getValue() ) );
! aStore->setSchemaClassId
! (
! Schema::getTypeDescriptor()->getIdentifier()
! );
!
//
--- 335,339 ----
aStore->setCollectionType( *aSchemaCol );
aStore->setSchemaUid( UniversalIdentifier( aUid.getValue() ) );
! aStore->setSchemaClassId( aSCUid );
//
***************
*** 708,711 ****
--- 708,767 ----
//
+ // Get the user supplied class resolved or use the
+ // default corelinux::Schema type id
+ //
+
+ UniversalIdentifierCref SchemaCatalog::resolveSchemaClassUuid
+ (
+ CollectionPtr aCollection
+ )
+ {
+ MetaTypeCptr aType( Schema::getTypeDescriptor() );
+ FrameworkStringPtr aResult
+ (
+ Store::resolveValueAssignment
+ (
+ aCollection,
+ &schemaClass
+ )
+ );
+
+ if( aResult != NULLPTR )
+ {
+ //
+ // Segment and search
+ //
+
+ try
+ {
+ MetaClassPtr aClass( this->findClass(aResult->getValue()) );
+
+ // Make sure it is of type Schema
+
+ if( aClass->getType()->isTypeOf( aType ) == true )
+ {
+ aType = aClass->getType();
+ }
+ else
+ {
+ ; // do nothing
+ }
+
+ }
+ catch( DescriptorNotFoundRef aD )
+ {
+ ; // swallow, use default
+ }
+
+ }
+ else
+ {
+ ; // do nothing
+ }
+
+ return aType->getIdentifier();
+ }
+
+ //
// Resolve or default the schema collection type
//
***************
*** 885,888 ****
--- 941,971 ----
}
+
+ //
+ // Break up ontology::classname and resolve
+ //
+
+ MetaClassPtr SchemaCatalog::findClass( CharCptr aBase )
+ {
+ FrameworkString workString( aBase );
+ CharPtr workOntology( workString.getValue() );
+ CharPtr workClass( NULLPTR );
+ CharPtr needle( NULLPTR );
+
+ if( ( needle = std::strstr( workOntology,"::" ) ) != NULLPTR )
+ {
+ *needle++ = 0;
+ ++needle;
+ workClass = needle;
+ }
+ else
+ {
+ workClass = workOntology;
+ workOntology = NULLPTR;
+ }
+
+ return Ontology::getClassFor( workClass, workOntology );
+ }
+
//
|