@Test public void testGetWorkflowDescriptorFile() { File folder = new File("src/test/resources/org/springframework/data/hadoop/admin/util/test"); String[] descriptors = HadoopWorkflowUtils.getWorkflowDescriptor(folder); Assert.assertNotNull(descriptors); }
public static String[] getWorkflowDescriptor(File workflowArtifactFolder) { String result[] = null; if (!workflowArtifactFolder.exists()) { return result; } File[] xmlFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".xml"); } }); File[] propertiesFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".properties"); } }); if (xmlFiles != null && xmlFiles.length == 1 && propertiesFiles != null && propertiesFiles.length == 1) { result = new String[2]; result[0] = xmlFiles[0].getAbsolutePath(); result[1] = propertiesFiles[0].getAbsolutePath(); } else { logger.warn("uploaded workflow descriptor is incorrect"); } return result; }
HadoopWorkflowUtils { public static String[] getWorkflowDescriptor(File workflowArtifactFolder) { String result[] = null; if (!workflowArtifactFolder.exists()) { return result; } File[] xmlFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".xml"); } }); File[] propertiesFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".properties"); } }); if (xmlFiles != null && xmlFiles.length == 1 && propertiesFiles != null && propertiesFiles.length == 1) { result = new String[2]; result[0] = xmlFiles[0].getAbsolutePath(); result[1] = propertiesFiles[0].getAbsolutePath(); } else { logger.warn("uploaded workflow descriptor is incorrect"); } return result; } }
HadoopWorkflowUtils { public static String[] getWorkflowDescriptor(File workflowArtifactFolder) { String result[] = null; if (!workflowArtifactFolder.exists()) { return result; } File[] xmlFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".xml"); } }); File[] propertiesFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".properties"); } }); if (xmlFiles != null && xmlFiles.length == 1 && propertiesFiles != null && propertiesFiles.length == 1) { result = new String[2]; result[0] = xmlFiles[0].getAbsolutePath(); result[1] = propertiesFiles[0].getAbsolutePath(); } else { logger.warn("uploaded workflow descriptor is incorrect"); } return result; }  }
HadoopWorkflowUtils { public static String[] getWorkflowDescriptor(File workflowArtifactFolder) { String result[] = null; if (!workflowArtifactFolder.exists()) { return result; } File[] xmlFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".xml"); } }); File[] propertiesFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".properties"); } }); if (xmlFiles != null && xmlFiles.length == 1 && propertiesFiles != null && propertiesFiles.length == 1) { result = new String[2]; result[0] = xmlFiles[0].getAbsolutePath(); result[1] = propertiesFiles[0].getAbsolutePath(); } else { logger.warn("uploaded workflow descriptor is incorrect"); } return result; }  static WorkflowArtifacts getWorkflowArtifacts(File workflowArtifactFolder); static String[] getWorkflowDescriptor(File workflowArtifactFolder); static boolean isValidWorkflow(List<FileInfo> files); static URL[] getWorkflowLibararies(File workflowArtifactFolder); static ClassLoader getWorkflowClassLoader(File workflowArtifactFolder); static boolean isSpringBatchJob(ApplicationContext context, WorkflowArtifacts artifacts); static void createAndRegisterSpringBatchJob(ApplicationContext context, final WorkflowArtifacts artifacts); static String generateSpringBatchJobName(final WorkflowArtifacts artifacts); static void unregisterSpringBatchJob(ApplicationContext context, String springBatchJobName); static String getWorkflowDescriptor(final WorkflowArtifacts artifacts); static void processAndRegisterWorkflow(File parentFolder, ApplicationContext context); static WorkflowArtifacts processUploadedFile(final File parentFolder); static void registerSpringBatchJob(WorkflowArtifacts artifacts, ApplicationContext context); }
HadoopWorkflowUtils { public static String[] getWorkflowDescriptor(File workflowArtifactFolder) { String result[] = null; if (!workflowArtifactFolder.exists()) { return result; } File[] xmlFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".xml"); } }); File[] propertiesFiles = workflowArtifactFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".properties"); } }); if (xmlFiles != null && xmlFiles.length == 1 && propertiesFiles != null && propertiesFiles.length == 1) { result = new String[2]; result[0] = xmlFiles[0].getAbsolutePath(); result[1] = propertiesFiles[0].getAbsolutePath(); } else { logger.warn("uploaded workflow descriptor is incorrect"); } return result; }  static WorkflowArtifacts getWorkflowArtifacts(File workflowArtifactFolder); static String[] getWorkflowDescriptor(File workflowArtifactFolder); static boolean isValidWorkflow(List<FileInfo> files); static URL[] getWorkflowLibararies(File workflowArtifactFolder); static ClassLoader getWorkflowClassLoader(File workflowArtifactFolder); static boolean isSpringBatchJob(ApplicationContext context, WorkflowArtifacts artifacts); static void createAndRegisterSpringBatchJob(ApplicationContext context, final WorkflowArtifacts artifacts); static String generateSpringBatchJobName(final WorkflowArtifacts artifacts); static void unregisterSpringBatchJob(ApplicationContext context, String springBatchJobName); static String getWorkflowDescriptor(final WorkflowArtifacts artifacts); static void processAndRegisterWorkflow(File parentFolder, ApplicationContext context); static WorkflowArtifacts processUploadedFile(final File parentFolder); static void registerSpringBatchJob(WorkflowArtifacts artifacts, ApplicationContext context); static String fileURLPrefix; static String springHadoopJobPrefix; static String springHadoopTaskName; }