--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">\r
+ <booleanAttribute key="append.args" value="true"/>\r
+ <booleanAttribute key="automaticAdd" value="false"/>\r
+ <booleanAttribute key="automaticValidate" value="true"/>\r
+ <stringAttribute key="bootstrap" value=""/>\r
+ <stringAttribute key="checked" value="[NONE]"/>\r
+ <booleanAttribute key="clearConfig" value="true"/>\r
+ <stringAttribute key="configLocation" value="${workspace_loc}\-product\production\HIRTV\tmp"/>\r
+ <booleanAttribute key="default" value="true"/>\r
+ <booleanAttribute key="default_auto_start" value="false"/>\r
+ <intAttribute key="default_start_level" value="4"/>\r
+ <setAttribute key="deselected_workspace_bundles"/>\r
+ <booleanAttribute key="includeOptional" value="false"/>\r
+ <listAttribute key="org.eclipse.debug.ui.favoriteGroups">\r
+ <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>\r
+ <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>\r
+ </listAttribute>\r
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory -Dorg.eclipse.epp.logging.aeri.skipReports=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dlog4j.configurationFile=settings/log4j2.xml -Djetty.home=settings/jetty -Djetty.etc.config.urls=jetty.xml,jetty-ssl.xml,jetty-ssl-context.xml,jetty-http.xml,jetty-https.xml -Dgosh.home=configuration -Djava.io.tmpdir=tmp"/>\r
+ <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}\-product\production\HIRTV"/>\r
+ <stringAttribute key="pde.version" value="3.3"/>\r
+ <setAttribute key="selected_target_bundles">\r
+ <setEntry value="org.apache.commons.logging@default:default"/>\r
+ <setEntry value="org.apache.felix.gogo.command@default:default"/>\r
+ <setEntry value="org.apache.felix.gogo.runtime@default:default"/>\r
+ <setEntry value="org.apache.felix.gogo.shell@default:default"/>\r
+ <setEntry value="org.apache.logging.log4j.api@default:default"/>\r
+ <setEntry value="org.apache.logging.log4j.core@default:default"/>\r
+ <setEntry value="org.apache.logging.log4j.slf4j-impl@default:default"/>\r
+ <setEntry value="org.eclipse.equinox.console@default:default"/>\r
+ <setEntry value="org.eclipse.osgi@-1:true"/>\r
+ <setEntry value="slf4j.api@default:default"/>\r
+ <setEntry value="slf4j.simple@default:default"/>\r
+ </setAttribute>\r
+ <setAttribute key="selected_workspace_bundles"/>\r
+ <booleanAttribute key="show_selected_only" value="false"/>\r
+ <booleanAttribute key="tracing" value="false"/>\r
+ <booleanAttribute key="useCustomFeatures" value="false"/>\r
+ <booleanAttribute key="useDefaultConfigArea" value="false"/>\r
+</launchConfiguration>\r
--- /dev/null
+package user.jobengine.server.steps;\r
+\r
+import java.io.IOException;\r
+import java.nio.file.FileVisitResult;\r
+import java.nio.file.FileVisitor;\r
+import java.nio.file.Files;\r
+import java.nio.file.Path;\r
+import java.nio.file.Paths;\r
+import java.nio.file.SimpleFileVisitor;\r
+import java.nio.file.attribute.BasicFileAttributes;\r
+import java.nio.file.attribute.FileTime;\r
+\r
+import org.apache.commons.io.FilenameUtils;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+public class CopyImagesStep extends JobStep {\r
+ private static final Logger logger = LogManager.getLogger();\r
+\r
+ @StepEntry\r
+ public Object[] execute(String sourceFolder, String targetFolder) throws Exception {\r
+\r
+ FileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {\r
+ @Override\r
+ public FileVisitResult preVisitDirectory(Path folder, BasicFileAttributes attrs) throws IOException {\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult visitFile(Path source, BasicFileAttributes attrs) throws IOException {\r
+ FileVisitResult result = FileVisitResult.CONTINUE;\r
+\r
+ logger.info(getMarker(), "Checking path: {}", source.toString());\r
+ try {\r
+ String fileName = source.getFileName().toString();\r
+ String fileExtension = FilenameUtils.getExtension(source.toString()).toLowerCase();\r
+\r
+ Path target = Paths.get(targetFolder, fileName);\r
+\r
+ boolean needCopy = false;\r
+\r
+ if (!fileExtension.equals("jpg") && !fileExtension.equals("jpeg"))\r
+ return result;\r
+\r
+ if (target.toFile().exists()) {\r
+ FileTime sourceLastModified = Files.readAttributes(source, BasicFileAttributes.class)\r
+ .lastModifiedTime();\r
+ FileTime targetLastModified = Files.readAttributes(target, BasicFileAttributes.class)\r
+ .lastModifiedTime();\r
+ if (sourceLastModified.compareTo(targetLastModified) > 0)\r
+ needCopy = true;\r
+ } else\r
+ needCopy = true;\r
+\r
+ if (needCopy)\r
+ copyFile(source, target);\r
+\r
+ } catch (Exception e) {\r
+ logger.catching(e);\r
+ }\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public FileVisitResult visitFileFailed(Path path, IOException exc) throws IOException {\r
+ return FileVisitResult.CONTINUE;\r
+ }\r
+ };\r
+\r
+ try {\r
+ Files.walkFileTree(Paths.get(sourceFolder), visitor);\r
+ } catch (Exception e) {\r
+ logger.info("Error processing '{}'. System message: {}", sourceFolder, e.getMessage());\r
+ throw e;\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+ private void copyFile(Path source, Path target) {\r
+ logger.info(getMarker(), "Copy needed for {}", source);\r
+ try {\r
+ Files.copy(source, target);\r
+ } catch (Exception e) {\r
+ logger.error(getMarker(), "Error synchronize {} to {}. System message: {}", source, target, e.getMessage());\r
+ }\r
+ }\r
+\r
+}\r