001
014
015 package com.liferay.portal.image;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020
021 import java.util.LinkedList;
022 import java.util.List;
023
024 import jodd.util.StringPool;
025
026 import org.im4java.core.IdentifyCmd;
027 import org.im4java.process.ProcessTask;
028
029
033 public class LiferayIdentifyCmd extends IdentifyCmd {
034
035 public ProcessTask getProcessTask(
036 String globalSearchPath, List<String> resourceLimits,
037 List<String> commandArguments)
038 throws Exception {
039
040 setGlobalSearchPath(globalSearchPath);
041
042 LinkedList<String> arguments = new LinkedList<String>();
043
044 arguments.addAll(_instance.getCommand());
045 arguments.addAll(resourceLimits);
046 arguments.addAll(commandArguments);
047
048 if (_log.isInfoEnabled()) {
049 StringBundler sb = new StringBundler(arguments.size() * 2);
050
051 for (String argument : arguments) {
052 sb.append(argument);
053 sb.append(StringPool.SPACE);
054 }
055
056 _log.info("Excecuting command '" + sb.toString() + "'");
057 }
058
059 return getProcessTask(arguments);
060 }
061
062 private static Log _log = LogFactoryUtil.getLog(LiferayIdentifyCmd.class);
063
064 private static LiferayIdentifyCmd _instance = new LiferayIdentifyCmd();
065
066 }