示例#1
0
void MgFeatureServiceCacheEntry::SetSchemas(CREFSTRING schemaName, MgStringCollection* classNames, bool serialized, MgFeatureSchemaCollection* schemas)
{
    STRING schemaKey, classKey;
    FormatKeys(m_classNameHintUsed, schemaName, classNames, schemaKey, classKey);

    Ptr<MgFeatureSchemaCacheItem> item = SetFeatureSchemaCacheItem(schemaKey);

    item->SetSchemas(classKey, serialized, schemas);
}
示例#2
0
void MgFeatureServiceCacheEntry::SetClassIdentityProperties(CREFSTRING schemaName, CREFSTRING className, MgPropertyDefinitionCollection* idProperties)
{
    STRING schemaKey, classKey;
    // Since this method requires a specific class name, the hint must be explicitly used.
    FormatKeys(true, schemaName, className, schemaKey, classKey);

    Ptr<MgFeatureSchemaCacheItem> item = SetFeatureSchemaCacheItem(schemaKey);

    item->SetClassIdentityProperties(classKey, idProperties);
}
示例#3
0
void MgFeatureServiceCacheEntry::SetClassDefinition(CREFSTRING schemaName, CREFSTRING className, MgClassDefinition* classDef)
{
    STRING schemaKey, classKey;
    // Since this method requires a specific class name, the hint must be explicitly used.
    FormatKeys(true, schemaName, className, schemaKey, classKey);

    Ptr<MgFeatureSchemaCacheItem> item = SetFeatureSchemaCacheItem(schemaKey);

    item->SetClassDefinition(classKey, classDef);
}
示例#4
0
MgFeatureSchemaCollection* MgFeatureServiceCacheEntry::GetSchemas(CREFSTRING schemaName, MgStringCollection* classNames, bool serialized)
{
    STRING schemaKey, classKey;
    INT32 classCount = FormatKeys(m_classNameHintUsed, schemaName, classNames, schemaKey, classKey);

    Ptr<MgFeatureSchemaCollection> data;
    Ptr<MgFeatureSchemaCacheItem> item = GetFeatureSchemaCacheItem(schemaKey);

    // Get the data from the current item.
    if (NULL != item.p)
    {
        data = item->GetSchemas(classKey, serialized);
    }

    // If the data is not found, then try to find it in the superset data from the current item or superset one.
    if (NULL == data.p)
    {
        if (0 == classCount)
        {
            ACE_ASSERT(classKey.empty());
            // If there is no class, then try to find the data in the superset data from the superset item.
            data = FindSchema(schemaKey, classKey, serialized, classCount);
        }
        else if (1 == classCount)
        {
            Ptr<MgFeatureSchemaCollection> supersetData;

            // Get the superset data from the current item.
            if (NULL != item.p && !classKey.empty())
            {
                supersetData = item->GetSchemas(L"", serialized);
            }

            // If the data is not found, then try to find it in the superset data from the superset item.
            if (NULL == supersetData.p)
            {
                data = FindSchema(schemaKey, classKey, serialized, classCount);
            }
            // Otherwise, determine if the superset data from the current item is reusable.
            else if (FindClass(supersetData.p, classKey))
            {
                data = supersetData;
            }
        }

        // Update the cache with the found data.
        if (NULL != data.p)
        {
            SetSchemas(schemaKey, classNames, serialized, data.p);
        }
    }

    return data.Detach();
}
示例#5
0
STRING MgFeatureServiceCacheEntry::GetSchemaXml(CREFSTRING schemaName, MgStringCollection* classNames)
{
    STRING schemaKey, classKey;
    FormatKeys(m_classNameHintUsed, schemaName, classNames, schemaKey, classKey);

    STRING data;
    Ptr<MgFeatureSchemaCacheItem> item = GetFeatureSchemaCacheItem(schemaKey);

    if (NULL != item.p)
    {
        data = item->GetSchemaXml(classKey);
    }

    return data;
}
示例#6
0
MgPropertyDefinitionCollection* MgFeatureServiceCacheEntry::GetClassIdentityProperties(CREFSTRING schemaName, CREFSTRING className)
{
    STRING schemaKey, classKey;
    // Since this method requires a specific class name, the hint must be explicitly used.
    FormatKeys(true, schemaName, className, schemaKey, classKey);

    Ptr<MgPropertyDefinitionCollection> data;
    Ptr<MgFeatureSchemaCacheItem> item = GetFeatureSchemaCacheItem(schemaKey);

    if (NULL != item.p)
    {
        data = item->GetClassIdentityProperties(classKey);
    }

    return data.Detach();
}
示例#7
0
INT32 MgFeatureServiceCacheEntry::FormatKeys(bool classNameHintUsed,
    CREFSTRING schemaName, MgStringCollection* classNames,
    REFSTRING schemaKey, REFSTRING classKey)
{
    typedef std::set<STRING, less<STRING> > MgClassKeySet;

    schemaKey = schemaName;
    classKey = L"";

    INT32 classCount = (NULL == classNames) ? 0 : classNames->GetCount();

    if (1 == classCount)
    {
        FormatKeys(classNameHintUsed, schemaName, classNames->GetItem(0), schemaKey, classKey);
    }
    else if (classNameHintUsed)
    {
        // Use a sorted key set to avoid duplicate class names and ensure uniqueness.
        MgClassKeySet classKeys;
        bool hasOneSchema = true;
        STRING savedSchemaKey;

        for (INT32 i = 0; i < classCount; ++i)
        {
            STRING currClassName = classNames->GetItem(i);
            STRING currSchemaKey, currClassKey;

            if (schemaName.empty())
            {
                MgUtil::ParseQualifiedClassName(currClassName, currSchemaKey, currClassKey);

                if (!currClassKey.empty())
                {
                    if (0 == classKeys.size())
                    {
                        savedSchemaKey = currSchemaKey;
                    }
                    else if (hasOneSchema && currSchemaKey != savedSchemaKey)
                    {
                        hasOneSchema = false;
                    }

                    classKeys.insert(currClassName);
                }
            }
            else
            {
                FormatKeys(classNameHintUsed, schemaName, currClassName, currSchemaKey, currClassKey);

                if (!currClassKey.empty())
                {
                    classKeys.insert(currClassKey);
                }
            }
        }

        // Convert a class name collection to a period (.) delimited string.
        for (MgClassKeySet::const_iterator i = classKeys.begin();
            i != classKeys.end(); ++i)
        {
            if (!classKey.empty())
            {
                classKey += MgUtil::sm_classPropertyQualifier;
            }

            classKey += *i;
        }

        classCount = INT32(classKeys.size());

        if (1 == classCount)
        {
            FormatKeys(classNameHintUsed, schemaName, *classKeys.begin(), schemaKey, classKey);
        }
        else if (schemaKey.empty() && hasOneSchema)
        {
            schemaKey = savedSchemaKey;
        }
    }

    if (classKey.empty())
    {
        classCount = 0;
    }

    return classCount;
}
示例#8
0
void Piano::SetKeyArray( ArrayOfInts array )
{
    m_key_array = array;
    FormatKeys();
}