Background
The CachedFile IFileObject is used to synchronize XSLT files across a load balanced server farm. This is accomplished in two ways:
Attachments using a CachedFile IFileObject are automatically synchronized each time they are accessed, or every 5 minutes, whichever is less frequent, and
Monitoring the database for ConfigurationEntry rows for file overrides (ConfigurationEntry.Source = 'FileOverride')
Attachments using CachedFile
XSLTs uploaded or edited by power users typically use the 'Template' FileObject by default, and the Template file object should be configured as a CachedFile. A sample FileObject.config:
<FileObject>
<FileObjects>
<FileObject Name="AmazonS3" Type="qbo.Attachment.Amazon.S3FileObject, qbo.Attachment.Amazon" Uri="https://mybucket.s3.amazonaws.com"/>
<FileObject Name="Template" Type="qbo.Attachment.FileObjects.CachedFile, qbo.Attachment" Uri="AmazonS3" Compression="false"/>
<FileObject Name="SAN" Type="qbo.Attachment.FileObjects.UNCFile, qbo.Attachment" Uri="//MySan/Share/" Compression="false"/>
</FileObjects>
</FileObject>
The CachedFile IFileObject works as follows:
It's URI must match the name of another FileObject (a BaseFileObject) from which attachments will be copied
Attachments will be copied to a CacheFolder (c:\windows\temp by default)
This can be overridden from Design > Config > Modules > Attachment > Settings, CacheFolder
If CacheFolder is empty, then ScratchPad is used instead. Scratchpad defaults to c:\windows\temp
When accessing a file, the CacheFile will look for the file in the CacheFolder
If the file is missing, it will be copied from the BaseFileObject
If the file is present, but more than CacheDurationMinutes old, it will be re-copied from the BaseFileObject
CacheDurationMinutes defaults to 5 minutes, and can be overridden from Design > Config > Modules > Attachment > Settings
File Overrides
XSLTs that are installed with QBO source code deployments may be overridden as follows:
Ensure the CacheFolder is set to the root folder of the QBO3 website, and
Insert a row into ConfigurationEntry where Source = 'FileOverride'
Inserting rows into ConfigurationEntry can be done via the Import Framework, typically as part of a setup package. A sample snippet:
<ConfigurationEntryItem>
<ConfigurationEntry>Organization.Summary.xslt</ConfigurationEntry>
<Source>FileOverride</Source>
<ConfigurationKey>Organization.Summary.xslt</ConfigurationKey>
<ConfigurationXml>
<Path>AmazonS3://Templates/Contact/Organiztion.Summary.xslt</Path>
</ConfigurationXml>
</ConfigurationEntryItem>
Migrating to CachedFile
To migrate a QBO3 installation to use CachedFile, the following steps should be take:
Rename the existing Template file object entry to TemplateOld
Create a new FileObject entry called Template, using CachedFile (as described above)
UPDATE Attachment SET FileObjectAssembly = 'TemplateOld' WHERE FileObjectAssembly = 'Template'
For each Attachment using the TemplateOld FileObject, queue up Attachment/TransferFile?ID=X&FileObject=Template