Examples of PgeMetadata


Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

   private PGETaskInstance createTestInstance(String workflowInstId)
         throws Exception {
      PGETaskInstance pgeTask = new PGETaskInstance();
      pgeTask.workflowInstId = workflowInstId;
      pgeTask.pgeMetadata = new PgeMetadata();
      pgeTask.pgeMetadata.replaceMetadata(NAME, "TestPGE");
      pgeTask.pgeConfig = new PgeConfig();
      File exeDir = new File(createTmpDir(), workflowInstId);
      pgeTask.pgeConfig.setExeDir(exeDir.getAbsolutePath());
      pgeTask.logger = pgeTask.createLogger();
View Full Code Here

Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

      config.addConfigProperty(NAME.getName(), PGE_NAME);
      config.addConfigProperty(REQUIRED_METADATA.getName(),
            PGE_REQUIRED_METADATA);
      config.addConfigProperty(PROPERTY_ADDERS.getName(), PROP_ADDERS);

      PgeMetadata pgeMet = pgeTask.createPgeMetadata(dynMet, config);
      assertEquals(1, pgeMet.getAllMetadata(NAME).size());
      assertEquals(PGE_NAME, pgeMet.getAllMetadata(NAME).get(0));
      assertEquals(2, pgeMet.getAllMetadata(REQUIRED_METADATA).size());
      assertTrue(pgeMet.getAllMetadata(REQUIRED_METADATA).contains("Filename"));
      assertTrue(pgeMet.getAllMetadata(REQUIRED_METADATA).contains(
            "FileLocation"));
      assertEquals(2, pgeMet.getAllMetadata(PROPERTY_ADDERS).size());
      assertTrue(pgeMet.getAllMetadata(PROPERTY_ADDERS).contains(
            "some.prop.adder.classpath"));
      assertTrue(pgeMet.getAllMetadata(PROPERTY_ADDERS).contains(
            "some.other.classpath"));

      // Verify still works when only one property adder is specified.
      pgeTask = createTestInstance();
      config = new WorkflowTaskConfiguration();
      config.addConfigProperty(PgeTaskMetKeys.PROPERTY_ADDERS.getName(),
            "one.prop.adder.only");

      pgeMet = pgeTask.createPgeMetadata(dynMet, config);
      assertEquals(1, pgeMet.getAllMetadata(PROPERTY_ADDERS).size());
      assertEquals("one.prop.adder.only", pgeMet
            .getAllMetadata(PROPERTY_ADDERS).get(0));
   }
View Full Code Here

Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

    private void build(Element root, String namespace, PgeConfig pgeConfig,
            PgeMetadata pgeMetadata) throws MalformedURLException, Exception {

        // load custom metadata
        PgeMetadata localPgeMetadata = this.getCustomMetadata((Element) root
                .getElementsByTagName(CUSTOM_METADATA_TAG).item(0), pgeMetadata);
        PgeMetadata curPgeMetadata = new PgeMetadata();
        curPgeMetadata.replaceMetadata(pgeMetadata);
        curPgeMetadata.replaceMetadata(localPgeMetadata);
        Metadata curMetadata = curPgeMetadata.asMetadata();
       
        // load dynamic config file info
        List<DynamicConfigFile> configFileList = this.getDynConfigFile(
                (Element) root.getElementsByTagName(DYN_INPUT_FILES_TAG)
                        .item(0), curMetadata);
View Full Code Here

Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

        }
    }

    private PgeMetadata getCustomMetadata(Element customMetadataElem, PgeMetadata pgeMetadata)
            throws MalformedURLException, Exception {
      PgeMetadata localPgeMetadata = new PgeMetadata();
      PgeMetadata curPgeMetadata = new PgeMetadata();
      curPgeMetadata.replaceMetadata(pgeMetadata);
      Metadata curPlusLocalMetadata = new Metadata();
      curPlusLocalMetadata.addMetadata(curPgeMetadata.asMetadata().getHashtable());
     
        if (customMetadataElem != null) {
            NodeList customMetadataList = customMetadataElem
                    .getElementsByTagName(METADATA_TAG);
            for (int i = 0; i < customMetadataList.getLength(); i++) {
                Element metadataElement = (Element) customMetadataList.item(i);
                String key = metadataElement.getAttribute(KEY_ATTR);
                if (key.equals(""))
                  key = this.fillIn(metadataElement.getAttribute(KEY_GEN_ATTR), curPlusLocalMetadata);
                if (!metadataElement.getAttribute(KEYREF_ATTR).equals("")) {
                  String val = metadataElement.getAttribute(KEYREF_ATTR);
                    if (metadataElement.getAttribute(ENV_REPLACE_NO_RECUR_ATTR)
                            .toLowerCase().equals("true"))
                        val = this.fillIn(val, curPlusLocalMetadata, false);
                    else if (!metadataElement.getAttribute(ENV_REPLACE_ATTR)
                            .toLowerCase().equals("false"))
                        val = this.fillIn(val, curPlusLocalMetadata);
                  localPgeMetadata.linkKey(key, val);
                  curPgeMetadata.linkKey(key, val);
                }else {
                  String val = metadataElement.getAttribute(VAL_ATTR);
                  if (val.equals(""))
                    val = metadataElement.getTextContent();
                    if (metadataElement.getAttribute(ENV_REPLACE_NO_RECUR_ATTR)
                            .toLowerCase().equals("true"))
                        val = this.fillIn(val, curPlusLocalMetadata, false);
                    else if (!metadataElement.getAttribute(ENV_REPLACE_ATTR)
                            .toLowerCase().equals("false"))
                        val = this.fillIn(val, curPlusLocalMetadata);
                    List<String> valList = new Vector<String>();
                    if (!metadataElement.getAttribute(SPLIT_ATTR)
                            .toLowerCase().equals("false"))
                      valList.addAll(Arrays.asList((val + ",").split(",")));
                    else
                      valList.add(val);
                    localPgeMetadata.replaceMetadata(key, valList);
                    curPgeMetadata.replaceMetadata(key, valList);
                }
                if (metadataElement.getAttribute(WORKFLOW_MET_ATTR)
                        .toLowerCase().equals("true"))
                  localPgeMetadata.markAsDynamicMetadataKey(key);
               
                List<String> values = curPgeMetadata.getAllMetadata(key);
                if (values != null) {
                   curPlusLocalMetadata.replaceMetadata(key, values);
                }
            }
        }
View Full Code Here

Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

      for (String key : dynMetadata.getAllKeys()) {
         logger.finest(
               "Adding dynamic metadata: key = [" + key + "] value = "
                     + dynMetadata.getAllMetadata(key));
      }
      return new PgeMetadata(staticMetadata, dynMetadata);
   }
View Full Code Here

Examples of org.apache.oodt.cas.pge.metadata.PgeMetadata

*/
public class TestFileStager extends TestCase {

   public void testCreateFileManagerClient() throws Exception {
      // Test throws case.
      PgeMetadata pgeMetadata = createStrictMock(PgeMetadata.class);
      expect(pgeMetadata.getMetadata(PgeTaskMetKeys.QUERY_FILE_MANAGER_URL))
            .andReturn(null);
      replay(pgeMetadata);

      try {
         FileStager.createFileManagerClient(pgeMetadata);
         fail("Should have thrown Exception");
      } catch (Exception e) { /* expect throw */
      }
      verify(pgeMetadata);

      // Test success case.
      System.setProperty("filemgr.catalog.factory", "");
      System.setProperty("filemgr.repository.factory", "");
      int port = 9876;
      XmlRpcFileManager filemgr = new XmlRpcFileManager(port);
      String filemgrUrl = "http://localhost:" + port;
      pgeMetadata = createStrictMock(PgeMetadata.class);
      expect(pgeMetadata.getMetadata(PgeTaskMetKeys.QUERY_FILE_MANAGER_URL))
            .andReturn(filemgrUrl);
      replay(pgeMetadata);

      assertEquals(filemgrUrl, FileStager.createFileManagerClient(pgeMetadata)
            .getFileManagerUrl().toString());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.