1 //
2 // ========================================================================
3 // Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.maven.plugin;
20
21 import java.io.File;
22 import java.util.Collections;
23 import java.util.List;
24
25 /**
26 * ScanTargetPattern
27 *
28 * Utility class to provide the ability for the mvn jetty:run
29 * mojo to be able to specify filesets of extra files to
30 * regularly scan for changes in order to redeploy the webapp.
31 *
32 * For example:
33 *
34 * <scanTargetPattern>
35 * <directory>/some/place</directory>
36 * <includes>
37 * <include>some ant pattern here </include>
38 * <include>some ant pattern here </include>
39 * </includes>
40 * <excludes>
41 * <exclude>some ant pattern here </exclude>
42 * <exclude>some ant pattern here </exclude>
43 * </excludes>
44 * </scanTargetPattern>
45 */
46 public class ScanTargetPattern
47 {
48 private File _directory;
49 private ScanPattern _pattern;
50
51 /**
52 * @return the _directory
53 */
54 public File getDirectory()
55 {
56 return _directory;
57 }
58
59 /**
60 * @param directory the directory to set
61 */
62 public void setDirectory(File directory)
63 {
64 this._directory = directory;
65 }
66
67 public void setIncludes (List<String> includes)
68 {
69 if (_pattern == null)
70 _pattern = new ScanPattern();
71 _pattern.setIncludes(includes);
72 }
73
74 public void setExcludes(List<String> excludes)
75 {
76 if (_pattern == null)
77 _pattern = new ScanPattern();
78 _pattern.setExcludes(excludes);
79 }
80
81 public List<String> getIncludes()
82 {
83 return (_pattern == null? Collections.emptyList() : _pattern.getIncludes());
84 }
85
86 public List<String> getExcludes()
87 {
88 return (_pattern == null? Collections.emptyList() : _pattern.getExcludes());
89 }
90
91 }