|
Adds resource data to the specified resource.
- Remarks:
- This uploads the data and stores it in the repository. It does not perform any necessary conversion (for example, converting a version 2 SDF file into a version 3 SDF).
- Note:
- If you load raster files though the MapGuide Studio UI, they are converted to .TIF format. However, raster files loaded through the API are not converted, so the API supports more file formats than the UI. The API supports all the formats supported by the FDO Provider for Raster. For details, see the appendix "Autodesk FDO Provider for Raster" in the FDO Developer's Guide.
.NET Syntax
virtual void SetResourceData(MgResourceIdentifier resource, string dataName, string dataType, MgByteReader data);
|
Java Syntax
virtual void SetResourceData(MgResourceIdentifier resource, String dataName, String dataType, MgByteReader data);
|
PHP Syntax
virtual void SetResourceData(MgResourceIdentifier resource, string dataName, string dataType, MgByteReader data);
|
- Parameters:
-
| resource | (MgResourceIdentifier) Resource to which this data is to be associated. |
| dataName | (String/string) Name for the data.
This name must match an element name within the XML content document. If the data name is UserCredentials , then MgResourceTag::Username and MgResourceTag::Password can be inserted into the XML content document to represent provider specific username and/or password.
If resource data with the same name has already been set for this resource, the API will overwrite the old setting. No exception is generated. The data name may be any valid UTF-8 string |
| dataType | (String/string) Data type for the resource data. It must match one of the types defined in MgResourceDataType and is case sensitive. Data names must be unique. |
| data | (MgByteReader) Data to set. |
- Returns:
- Returns nothing.
Examples (PHP)
This example sets resource data and stores it as a file: // Assuming that $resourceService has already been initialized
// Assuming that 'Library://Geography/Calgary points of interest.FeatureSource' has already been added to the repository
$resourceID = new MgResourceIdentifier('Library://Geography/Calgary points of interest.FeatureSource');
$byteSource = new MgByteSource('C:\Data\Calgary\Data\Calgary_points.sdf');
$data = $byteSource->GetReader();
$resourceService->SetResourceData($resourceID, 'locations of points of interest', 'File', $data);
This example sets resource data and stores it as a stream: // Assuming that 'Library://Geography/Calgary symbols.SymbolSet' has already been added to the repository
$resourceID = new MgResourceIdentifier('Library://Geography/Trees.SymbolLibrary');
$byteSource = new MgByteSource('C:\Data\Calgary\Data\markers.dwf');
$data = $byteSource->GetReader();
$resourceService->SetResourceData($resourceID, 'symbols for points of interest', 'Stream', $data);
This example sets the embedded credentials for a resource and stores it as a string. The string data type must be used for embedded credentials. The data name must be MgResourceDataName::UserCredentials. // Assuming that 'Library://Geography/database connnection.FeatureSource' has already been added to the repository
$resourceID = new MgResourceIdentifier('Library://Geography/database connnection.FeatureSource');
$byteSource = new MgByteSource('C:\Data\Calgary\Data\credentials.txt');
$data = $byteSource->GetReader();
$dataName = new MgResourceDataName();
$resourceService->SetResourceData($resourceID, MgResourceDataName::UserCredentials, 'String', $data);
- Exceptions:
-
- See also:
- EnumerateResourceData
GetResourceData
RenameResourceData
DeleteResourceData
|