/sdm/src/com/google/code/sagetvaddons/sdm/properties/PluginPropertyOnCompleteCommand.java

http://sagetv-addons.googlecode.com/ · Java · 45 lines · 19 code · 7 blank · 19 comment · 2 complexity · 065c7649199778bbc835388f4732d70a MD5 · raw file

  1. /*
  2. * Copyright 2011 Battams, Derek
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.google.code.sagetvaddons.sdm.properties;
  17. import sage.SageTVPlugin;
  18. import sagex.api.Utility;
  19. import sagex.plugin.IPropertyValidator;
  20. import com.google.code.sagetvaddons.sdm.Plugin;
  21. /**
  22. * @author dbattams
  23. *
  24. */
  25. public final class PluginPropertyOnCompleteCommand extends PluginPropertyServerPersisted {
  26. static private final String PROP_NAME = Plugin.PROP_PREFIX + "on_complete_cmd";
  27. static private final String PROP_DEFAULT = "";
  28. public PluginPropertyOnCompleteCommand() {
  29. super(SageTVPlugin.CONFIG_FILE, PROP_NAME, PROP_DEFAULT, "On Download Completed Hook", "Specify a command to execute everytime a download completes successfully.");
  30. setValidator(new IPropertyValidator() {
  31. @Override
  32. public void validate(String prop, String val) throws Exception {
  33. if(!"".equals(val) && !Utility.IsFilePath(val))
  34. throw new IllegalArgumentException(String.format("Specified file does not exist on SageTV server! [%s]", val));
  35. }
  36. });
  37. }
  38. }