1. /*
  2. * Copyright 2002,2004 The Apache Software Foundation
  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. */
  17. package org.apache.tools.ant.taskdefs.optional.extension.resolvers;
  18. import java.io.File;
  19. import org.apache.tools.ant.BuildException;
  20. import org.apache.tools.ant.Project;
  21. import org.apache.tools.ant.taskdefs.optional.extension.Extension;
  22. import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
  23. /**
  24. * Resolver that just returns s specified location.
  25. *
  26. * @version $Revision: 1.6.2.4 $ $Date: 2004/03/09 17:01:46 $
  27. */
  28. public class LocationResolver
  29. implements ExtensionResolver {
  30. private String m_location;
  31. public void setLocation(final String location) {
  32. m_location = location;
  33. }
  34. public File resolve(final Extension extension,
  35. final Project project)
  36. throws BuildException {
  37. if (null == m_location) {
  38. final String message = "No location specified for resolver";
  39. throw new BuildException(message);
  40. }
  41. return project.resolveFile(m_location);
  42. }
  43. public String toString() {
  44. return "Location[" + m_location + "]";
  45. }
  46. }