- This may seem obvious but, a deployment needs to be set up to get the metadata into the LSCS.
String fullPath = "/default/main/WORKAREA/shared/some/file.txt"; // sample pathCSFile file = client.getFile(new CSVPath(fullPath));if (file instanceof CSSimpleFile) { CSSimpleFile cssFile = (CSSimpleFile) file; }CSExtendedAttribute csEA = cssFile.getExtendedAttribute("some/EAKey"); String eaValue = csEA.getValue();
Nice, that will work and I understand. Then we would implement the WFMTask or appropiate interface. Copy the jar to iw-home/local/config/lib/content_center/customer_src/lib, run the toolkit and use the task in the work flow?
CSFile[]
getFiles(java.lang.String query)
public void execute(CSClient client, CSExternalTask task, Hashtable params)throws CSException { CSSimpleFile cssFile = null; CSFile[] files = task.getFiles("*"); for(int i = 0;i< files.length;i++){ if(files instanceof CSSimpleFile){ cssFile = (CSSimpleFile) files; CSExtendedAttribute[] eas = extractExtendedAttributes(cssFile); cssFile.setExtendedAttributes(eas); } } }
public class ExtractMetaData implements CSURLExternalTask{ public void execute(CSClient client, CSExternalTask task, Hashtable params)throws CSException { CSSimpleFile cssFile = null; CSAreaRelativePath[] files = task.getFiles(); String serverName = client.getContext().getServerName(); for(int i = 0;i< files.length;i++){ CSFile file = client.getFile(new CSVPath(serverName,task.getArea().getVPath(),files)); if(file!=null && file instanceof CSSimpleFile){ cssFile = (CSSimpleFile) file; CSExtendedAttribute[] eas = extractExtendedAttributes(cssFile); cssFile.setExtendedAttributes(eas); } } }...}
// assumes 'task' is a valid CSTask object// assumes 'client' is a valid CSClient object...try { CSAreaRelativePath[] flist = task.getFiles(); String areaPath = task.getArea().getVPath().toString(); for (CSAreaRelativePath relPath : flist) { String path = areaPath + "/" + relPath.toString(); CSSimpleFile csfile = (CSSimpleFile) client.getFile(new CSVPath(path)); ...} catch (CSException e) { ...}