Using Accelerated Content Services(ACS) from DFC
| January 2006 | |
|
Software Environment
| Feature | Tested on |
| Operating System | Windows 2000 Server SP4 |
| Compiler | Sun JDK 1.4.2_08 |
| Runtime | Sun JRE 1.4.2_08 |
| DFC | 5.3 SP1 |
| WDK | 5.3 SP1 |
| Webtop | 5.3 SP1 |
| Content Server | 5.3 SP1 |
Abstract
Accelerated Content Services(ACS) is a new feature in Server 5.3 SP1 that speeds up content transfer.This article shows how to use the ACS from DFC.
Description
When transferring content using a client like Webtop, the content is first brought from the content server to the app server machine running Webtop and then transferred from the app server machine to the client machine. Using ACS it is possible to skip one of the hops and directly transfer the content to the client instead of via the app server machine. This is done by means of URL based content transfer. Lets see how this can be done using DFC.
Content is first exported using DFCs export operation. However, instead of actually exporting the content, the operation creates a URL to the content. The client can then use the URL to download the content. To enable the export operation to create the ACS URL, the preferences can be set using the IDfExportOperation#setAcsPreferences(IDfAcsTransferPreferences) method of the IDfExportOperation or the IDfExportNode#setAcsPreferences(IDfAcsTransferPreferences) method of the IDfExportNode. Similar methods exist for IDfCheckoutOperation and IDfCheckoutNode interfaces.
The IDfAcsTransferPreferences instance can be obtained using IDfClientX#getAcsTransferPreferences(). The preference object sets properties such as the protocols to be used and the network locations serviced. For a default installation none of properties need to be set. The interface has a method called IDfAcsTransferPreferences#preferAcsTransfer(boolean isAcsTransferPreferred). This method controls whether ACS should be used or not. The default value is 'true'. Thus, you need to call this method only if you don't want to use ACS.
private static void testAcs(IDfSessionManager sessMgr, String repo)
throws DfException
{
IDfClientX clientX = new DfClientX();
IDfAcsTransferPreferences prefs = clientX.getAcsTransferPreferences();
System.out.println("Is Acs Preferred: "
+ prefs.isAcsTransferPreferred());
IDfSession sess = sessMgr.getSession(repo);
IDfDocument docObj = (IDfDocument) sess.getObject(new DfId(
"09017a128000017a"));
IDfExportOperation exportOp = clientX.getExportOperation();
exportOp.setAcsTransferPreferences(prefs);
IDfExportNode exportNode = (IDfExportNode) exportOp.add(docObj);
if (exportOp.execute())
{
IDfList nodes = exportOp.getNodes();
System.out.println("Export oper succeeded: " + nodes.getCount());
for (int i = 0, size = nodes.getCount(); i < size; i++)
{
IDfExportNode node = (IDfExportNode) nodes.get(i);
IDfEnumeration acsRequests = node.getAcsRequests();
System.out.println("Now printing Acs Requests");
while (acsRequests.hasMoreElements())
{
System.out.println("Printing ACS Request");
IDfAcsRequest acsRequest = (IDfAcsRequest) acsRequests
.nextElement();
System.out.println("Content Length: "
+ acsRequest.getContentLength());
System.out.println("Mime Type:" + acsRequest.getMimeType());
System.out.println("Protocol: " + acsRequest.getProtocol());
System.out
.println("Object Id: " + acsRequest.getObjectId());
String docURL = acsRequest.makeURL();
System.out.println("ACS URL: " + docURL);
getContent(acsRequest.getObjectId().getId(),docURL);
}
}
}
else
{
System.out.println("Oper failed");
IDfList errlst = exportOp.getErrors();
for (int i = 0; i < errlst.getCount(); i++)
{
System.out.println(errlst.getString(i));
}
}
}
|
The IDfAcsRequest interface contains a method called setContentOffset(...). This can be used to get content from a specific offset within the file. An interesting use-case for this method would be to recover from a broken download. For example, if you have already downloaded 9MB of a 10MB file, your code could remember the byte-offset and request only the last 10MB. This method should be called before calling the makeURL() method. The method setRecover(boolean) on the IDfAcsRequest interface is just a hint to the server that the client is capable of recovering from a broken download. In that case, the server performs optimizations such as maintaining the file handle for a certain amount of time after the connection is broken.
Troubleshooting
ACS is enabled by default. However, if you do have problems here are some things to check -
- Check if the Java Method Server has been started on the content server machine.
- Check if the docbroker mentioned in the dmcl.ini on the content server machine is visible from the server machine. Try pinging the docbroker from the content server machine.
WDK/Webtop uses ACS by default. ACS can be disabled by configuring the contentxfer->acs XML element in the app.xml file.
Source
Download
|