Beispiel #1
0
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerate the resource documents in the specified repository.
///
STRING MgProxyResourceService::EnumerateResourceDocuments(
    MgStringCollection* resources, CREFSTRING type, INT32 properties)
{
    STRING resourceList;
    MgCommand cmd;

    MG_TRY()

    cmd.ExecuteCommand(
        m_connProp,                                         // Connection
        MgCommand::knString,                                // Return type
        MgResourceService::opIdEnumerateResourceDocuments,  // Command code
        3,                                                  // Number of arguments
        Resource_Service,                                   // Service ID
        BUILD_VERSION(1,0,0),                               // Operation version
        MgCommand::knObject, resources,                     // Argument #1
        MgCommand::knString, &type,                         // Argument #2
        MgCommand::knInt32, properties,                     // Argument #3
        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    resourceList = *(cmd.GetReturnValue().val.m_str);
    delete cmd.GetReturnValue().val.m_str;

    MG_CATCH_AND_THROW(L"MgProxyResourceService.EnumerateResourceDocuments")

    return resourceList;
}
Beispiel #2
0
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerates the resources in the specified repository.
/// Resources of all types can be enumerated all at once, or only
/// resources of a given type.
///
MgByteReader* MgProxyResourceService::EnumerateResources(
    MgResourceIdentifier* resource, INT32 depth, CREFSTRING type,
    INT32 properties, CREFSTRING fromDate, CREFSTRING toDate, bool computeChildren)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdEnumerateResources,
                       7,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knInt32, depth,
                       MgCommand::knString, &type,
                       MgCommand::knInt32, properties,
                       MgCommand::knString, &fromDate,
                       MgCommand::knString, &toDate,
                       MgCommand::knInt8, (int)computeChildren,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #3
0
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerate all the parent Map Definition resources of the specified
/// resources.
///
MgSerializableCollection* MgProxyResourceService::EnumerateParentMapDefinitions(
    MgSerializableCollection* resources)
{
    MgCommand cmd;

    MG_TRY()

    assert(m_connProp != NULL);

    cmd.ExecuteCommand(
        m_connProp,                                         // Connection
        MgCommand::knObject,                                // Return type
        MgResourceService::opIdEnumerateParentMapDefinitions, // Command code
        1,                                                  // Number of arguments
        Resource_Service,                                   // Service ID
        BUILD_VERSION(1,0,0),                               // Operation version
        MgCommand::knObject, resources,                     // Argument #1
        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    MG_CATCH_AND_THROW(L"MgProxyResourceService.EnumerateParentMapDefinitions")

    return (MgSerializableCollection*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #4
0
///////////////////////////////////////////////////////////////////////////
/// \brief
/// Gets the contents of the specified resources.
///
MgStringCollection* MgProxyResourceService::GetResourceContents(MgStringCollection* resources,
        MgStringCollection* preProcessTags)
{
    Ptr<MgStringCollection> resourceContents;

    MG_TRY()

    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,                      // Connection
                       MgCommand::knObject,                            // Return type expected
                       MgResourceService::opIdGetResourceContents,     // Command Code
                       2,                                              // Count of arguments
                       Resource_Service,                               // Service Id
                       BUILD_VERSION(2,2,0),                           // Operation version
                       MgCommand::knObject, resources,                 // Argument#1
                       MgCommand::knObject, preProcessTags,            // Argument#2
                       MgCommand::knNone);                             // End of argument

    SetWarning(cmd.GetWarningObject());

    resourceContents = (MgStringCollection*)cmd.GetReturnValue().val.m_obj;

    // Decrypt the document if Substitution pre-processing is required.
    if(preProcessTags != NULL && resourceContents != NULL && preProcessTags->GetCount() == resourceContents->GetCount())
    {
        for(INT32 i = 0; i < resourceContents->GetCount(); i ++)
        {
            STRING tag = preProcessTags->GetItem(i);

            if (MgResourcePreProcessingType::Substitution == tag)
            {
                STRING cipherContent = resourceContents->GetItem(i);

                string cipherText, plainText;
                MgUtil::WideCharToMultiByte(cipherContent, cipherText);

                MG_CRYPTOGRAPHY_TRY()

                MgCryptographyUtil cryptoUtil;

                cryptoUtil.DecryptString(cipherText, plainText);

                MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceContents")

                STRING decryptedContent;
                MgUtil::MultiByteToWideChar(plainText, decryptedContent);
                resourceContents->SetItem(i, decryptedContent);
            }
        }
    }

    MG_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceContents")

    return resourceContents.Detach();
}
Beispiel #5
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the site version.
/// </summary>
/// <returns>
/// The site version.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
STRING MgServerAdmin::GetSiteVersion()
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,                                // Connection
                        MgCommand::knString,                      // Return type expected
                        MgServerAdminServiceOpId::GetSiteVersion, // Command Code
                        0,                                        // No of arguments
                        ServerAdmin_Service,                      // Service Id
                        BUILD_VERSION(1,0,0),                     // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    STRING retVal = *(cmd.GetReturnValue().val.m_str);
    delete cmd.GetReturnValue().val.m_str;

    return retVal;
}
Beispiel #6
0
///////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Returns tagged data for the specified resource.
/// </summary>
/// <param name="resource">
/// Resource identifier describing the resource.
/// </param>
/// <param name="dataName">
/// Name for data.  Either a resource-unique stream name for streams or a
/// resource-unique file name for file data.
/// </param>
/// <param name="preProcessTags">
/// Pre-processing to apply to resource data before returning.  An empty
/// string indicate no pre-processing. See MgResourcePreProcessingType for
/// a list of supported pre-processing tags.
/// </param>
/// <returns>
/// MgByteReader containing the previously updated or added tagged data.
/// </returns>
/// EXCEPTIONS:
/// MgRepositoryNotOpenException
///
/// MgResourceDataNotFoundException
/// MgInvalidResourceTypeException
///
MgByteReader* MgProxyResourceService::GetResourceData(
    MgResourceIdentifier* resource, CREFSTRING dataName,
    CREFSTRING preProcessTags)
{
    Ptr<MgByteReader> byteReader;

    MG_TRY()

    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdGetResourceData,
                       3,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knString, &dataName,
                       MgCommand::knString, &preProcessTags,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    byteReader = (MgByteReader*)cmd.GetReturnValue().val.m_obj;

    // Decrypt the document if Substitution pre-processing is required.

    if (MgResourcePreProcessingType::Substitution == preProcessTags
            && byteReader != NULL)
    {
        STRING mimeType = byteReader->GetByteSource()->GetMimeType();
        string cipherText, plainText;

        byteReader->ToStringUtf8(cipherText);

        MG_CRYPTOGRAPHY_TRY()

        MgCryptographyUtil cryptoUtil;

        cryptoUtil.DecryptString(cipherText, plainText);

        MG_CRYPTOGRAPHY_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceData")

        Ptr<MgByteSource> byteSource = new MgByteSource(
            (BYTE_ARRAY_IN)plainText.c_str(), (INT32)plainText.length());

        byteSource->SetMimeType(mimeType);
        byteReader = byteSource->GetReader();
    }

    MG_CATCH_AND_THROW(L"MgProxyResourceService.GetResourceData")

    return byteReader.Detach();
}
Beispiel #7
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the online status of the server.
/// </summary>
/// <returns>
/// True for online, False for offline.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
bool MgServerAdmin::IsOnline()
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knInt8,                      // Return type expected
                        MgServerAdminServiceOpId::IsOnline,     // Command Code
                        0,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (bool)cmd.GetReturnValue().val.m_i8;
}
Beispiel #8
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Enumerates the packages available in the package directory.
/// </summary>
///
/// <returns>
/// An MgStringCollection containing a list of packages in the packages directory
/// </returns>
///
/// EXCEPTIONS:
/// MgOutOfMemoryException
/// MgFileNotFoundException
/// MgFileIoException
MgStringCollection* MgServerAdmin::EnumeratePackages()
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                              // Connection
                        MgCommand::knObject,                    // Return type expected
                        MgServerAdminServiceOpId::EnumeratePackages, // Command Code
                        0,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgStringCollection*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #9
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets a list of entries for the specified repository type. The
/// following lists will be returned for the specified repository
/// type:
///     1) Session - A list of session IDs is returned.
///
/// This method only works on "Session" repositories.
/// If you specify a repository that is not supported this method
/// will throw an MgInvalidRepositoryTypeException exception.
/// </summary>
/// <param name="repositoryType">
/// The type of repository you want to list the entries for.
/// The following repositories are supported:
///     1) Session
/// </param>
/// <returns>
/// MgByteReader object representing the list of entries for the
/// repository type specified.
/// </returns>
/// EXCEPTIONS:
///   MgOutOfMemoryException
///   MgInvalidRepositoryTypeException
MgByteReader* MgProxyResourceService::EnumerateRepositories(CREFSTRING repositoryType)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdEnumerateRepositories,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knString, &repositoryType,
                       MgCommand::knNone);

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #10
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Clears the specified log.
/// </summary>
/// <param name="log">
/// The log to be cleared. (AccessLog, AdminLog, AuthenticationLog, ErrorLog,
/// SessionLog, TraceLog)
/// </param>
/// <returns>
/// True if the log was successfully cleared, false otherwise.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidArgumentException
/// MgNullReferenceException
bool MgServerAdmin::ClearLog(CREFSTRING log)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knInt8,                      // Return type expected
                        MgServerAdminServiceOpId::ClearLog,     // Command Code
                        1,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &log,              // Argument#1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (bool)cmd.GetReturnValue().val.m_i8;
}
Beispiel #11
0
//////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the header associated with the specified resource.
/// </summary>
/// <param name="resource">
/// Resource identifier for desired resource
/// </param>
/// <returns>
/// MgByteReader object representing the XML resource header.
/// </returns>
/// EXCEPTIONS:
/// MgRepositoryNotOpenException
///
/// MgInvalidResourceTypeException
MgByteReader* MgProxyResourceService::GetResourceHeader(MgResourceIdentifier* resource)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdGetResourceHeader,
                       1,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knObject, resource,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());
    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #12
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets current log of the specified package
/// </summary>
///
/// <param name="packageName">
/// The name of the package to get the status for.  Available packages can be
/// found by using EnumeratePackages().
/// </param>
///
/// <returns>
/// An MgByteReader containing the contents of the package's log.
/// </returns>
///
/// EXCEPTIONS:
/// MgFileNotFoundException
/// MgFileIoException
/// MgInvalidArgumentException
/// MgOutOfMemoryException
MgByteReader* MgServerAdmin::GetPackageLog(CREFSTRING packageName)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                                  // Connection
                        MgCommand::knObject,                        // Return type expected
                        MgServerAdminServiceOpId::GetPackageLog,    // Command Code
                        1,                                          // No of arguments
                        ServerAdmin_Service,                        // Service Id
                        BUILD_VERSION(1,0,0),                       // Operation version
                        MgCommand::knString, &packageName,          // Argument #1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #13
0
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Checks to see if the specified resource exists.
///
bool MgProxyResourceService::ResourceExists(MgResourceIdentifier* resource)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,                                  // Connection
                       MgCommand::knInt8,                           // Return type expected
                       MgResourceService::opIdResourceExists,       // Command code
                       1,                                           // Number of arguments
                       Resource_Service,                            // Service ID
                       BUILD_VERSION(1,0,0),                        // Operation version
                       MgCommand::knObject, resource,               // Argument #1
                       MgCommand::knNone);                          // End of argument

    SetWarning(cmd.GetWarningObject());

    return (bool)cmd.GetReturnValue().val.m_i8;
}
Beispiel #14
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the configuration properties for the specified property section.
/// </summary>
/// <param name="propertySection">
/// The property section to get.
/// </param>
/// <returns>
/// The collection of configuration properties associated with the specified property section.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidPropertySectionException
/// MgPropertySectionNotAvailableException
MgPropertyCollection* MgServerAdmin::GetConfigurationProperties(CREFSTRING propertySection)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knObject,                    // Return type expected
                        MgServerAdminServiceOpId::GetConfigurationProperties, // Command Code
                        1,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &propertySection,  // Argument#1
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgPropertyCollection*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #15
0
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// Gets the contents of the specified log between two dates.  A maximum 24 hour
/// period is allowed to be retrieved.  This will use the current file name convention
/// for the log so if the filename was changed it will be unable to find entries
/// located previous files.
/// </summary>
/// <param name="log">
/// The log to retrieve. (AccessLog, AdminLog, AuthenticationLog, ErrorLog,
/// MapLayerAccessLog, SessionLog, TraceLog)
/// </param>
/// <param name="fromDate">
/// Date & time to start pulling entries from
/// </param>
/// <param name="toDate">
/// Last date & time to pull entries for
/// </param>
/// <returns>
/// The log contents in a ByteReader.
/// </returns>
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
/// MgInvalidLogTypeException
/// MgNullReferenceException
/// MgInvalidArgumentException
/// MgOutOfMemoryException
MgByteReader* MgServerAdmin::GetLog(CREFSTRING log, MgDateTime* fromDate, MgDateTime* toDate)
{
    MgCommand cmd;
    cmd.ExecuteCommand(m_connProp,                            // Connection
                        MgCommand::knObject,                    // Return type expected
                        MgServerAdminServiceOpId::GetLog,       // Command Code
                        3,                                      // No of arguments
                        ServerAdmin_Service,                    // Service Id
                        BUILD_VERSION(1,0,0),                   // Operation version
                        MgCommand::knString, &log,              // Argument#1
                        MgCommand::knObject, fromDate,          // Argument#2
                        MgCommand::knObject, toDate,            // Argument#3
                        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #16
0
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Retrieves the current status of the specified package.
///
/// \param packageName
/// The name of the package to get the status for.
/// Available packages can be found by using EnumeratePackages().
///
/// \return
/// The status of the package.
///
MgPackageStatusInformation* MgServerAdmin::GetPackageStatus(CREFSTRING packageName)
{
    ACE_ASSERT(m_connProp != NULL);
    MgCommand cmd;

    cmd.ExecuteCommand(
        m_connProp,                                         // Connection
        MgCommand::knObject,                                // Return type
        MgServerAdminServiceOpId::GetPackageStatus,         // Command Code
        1,                                                  // Number of arguments
        ServerAdmin_Service,                                // Service ID
        BUILD_VERSION(1,0,0),                               // Operation version
        MgCommand::knString, &packageName,                  // Argument #1
        MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgPackageStatusInformation*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #17
0
///////////////////////////////////////////////////////////////////////////////
/// \brief
/// Enumerates the unmanaged data
///
MgByteReader* MgProxyResourceService::EnumerateUnmanagedData(
    CREFSTRING path, bool recursive, CREFSTRING type, CREFSTRING filter)
{
    MgCommand cmd;

    cmd.ExecuteCommand(m_connProp,
                       MgCommand::knObject,
                       MgResourceService::opIdEnumerateUnmanagedData,
                       4,
                       Resource_Service,
                       BUILD_VERSION(1,0,0),
                       MgCommand::knString, &path,
                       MgCommand::knInt8, (int)recursive,
                       MgCommand::knString, &type,
                       MgCommand::knString, &filter,
                       MgCommand::knNone);

    SetWarning(cmd.GetWarningObject());

    return (MgByteReader*)cmd.GetReturnValue().val.m_obj;
}
Beispiel #18
0
MgSerializableCollection* MgServerAdmin::RegisterServicesOnServers(
    MgSerializableCollection* serverInfoList)
{
    MgCommand cmd;

    MG_TRY()

    cmd.ExecuteCommand(m_connProp,                                          // Connection
                        MgCommand::knObject,                                // Return type
                        MgServerAdminServiceOpId::RegisterServicesOnServers,// Command code
                        1,                                                  // Number of arguments
                        ServerAdmin_Service,                                // Service ID
                        BUILD_VERSION(1,0,0),                               // Operation version
                        MgCommand::knObject, serverInfoList,                // Argument #1
                        MgCommand::knNone );

    SetWarning(cmd.GetWarningObject());

    MG_CATCH_AND_THROW(L"MgServerAdmin.RegisterServicesOnServers")

    return (MgSerializableCollection*)cmd.GetReturnValue().val.m_obj;
}