Skip to content

Commit a6f7614

Browse files
committed
Working on labcas
1 parent 5523cfe commit a6f7614

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

common/src/main/java/gov/nasa/jpl/edrn/labcas/FileManagerUtils.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ public class FileManagerUtils {
3535
}
3636

3737
private static final Logger LOG = Logger.getLogger(FileManagerUtils.class.getName());
38+
39+
public static void reload() throws Exception {
40+
41+
XmlRpcFileManagerClient client = new XmlRpcFileManagerClient(new URL(FILEMANAGER_URL));
42+
43+
boolean status = client.refreshConfigAndPolicy();
44+
LOG.info("File Manager reoloaded, status="+status);
45+
Thread.sleep(5000); // FIXME: sleep 5 seconds
46+
47+
}
3848

3949
/**
4050
* Method to add a new dataset, or update an existing dataset, into the File Manager.
@@ -93,11 +103,7 @@ public static void updateDataset(String dataset) throws Exception {
93103
File productTypesXmlFile = new File(FileManagerUtils.getDatasetDir(dataset), "/policy/product-types.xml");
94104
XmlStructFactory.writeProductTypeXmlDocument(producTypes, productTypesXmlFile.getAbsolutePath());
95105
LOG.info("Written XML file="+ productTypesXmlFile.getAbsolutePath());
96-
97-
// send updated object to the File Manager
98-
String productTypeId = client.addProductType(productType);
99-
LOG.info("Updated product type="+productTypeId);
100-
106+
101107
}
102108

103109

common/src/main/java/gov/nasa/jpl/edrn/labcas/tasks/LabcasUpdateTaskInstance.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public void run(Metadata metadata, WorkflowTaskConfiguration config) throws Work
3131
// update dataset object in File Manager
3232
FileManagerUtils.updateDataset(dataset);
3333

34+
// reload the catalog configuration so that the new product type is available for publishing
35+
FileManagerUtils.reload();
36+
3437

3538
} catch(Exception e) {
3639
e.printStackTrace();

common/src/main/java/gov/nasa/jpl/edrn/labcas/tasks/LabcasUploadInitTaskInstance.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.io.FilenameFilter;
55
import java.util.logging.Logger;
66

7-
import org.apache.commons.lang.WordUtils;
87
import org.apache.oodt.cas.metadata.Metadata;
98
import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
109
import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
@@ -78,7 +77,10 @@ public void run(Metadata metadata, WorkflowTaskConfiguration config) throws Work
7877

7978
// must upload the same product type through the File Manager XML/RPC interface so it can be used right away
8079
// without waiting for the static XML metadata to be ingested at the next startup
81-
Utils.addProductType(productType, datasetDescription, datasetMetadata);
80+
//Utils.addProductType(productType, datasetDescription, datasetMetadata);
81+
82+
// reload the catalog configuration so that the new product type is available for publishing
83+
FileManagerUtils.reload();
8284

8385
} catch(Exception ioe) {
8486
throw new WorkflowTaskInstanceException(ioe.getMessage());

0 commit comments

Comments
 (0)