5607 |
15 Apr 11 |
nicklas |
1 |
/** |
5607 |
15 Apr 11 |
nicklas |
$Id$ |
5607 |
15 Apr 11 |
nicklas |
3 |
|
5607 |
15 Apr 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5607 |
15 Apr 11 |
nicklas |
5 |
|
5607 |
15 Apr 11 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
5607 |
15 Apr 11 |
nicklas |
Available at http://base.thep.lu.se/ |
5607 |
15 Apr 11 |
nicklas |
8 |
|
5607 |
15 Apr 11 |
nicklas |
BASE is free software; you can redistribute it and/or |
5607 |
15 Apr 11 |
nicklas |
modify it under the terms of the GNU General Public License |
5607 |
15 Apr 11 |
nicklas |
as published by the Free Software Foundation; either version 3 |
5607 |
15 Apr 11 |
nicklas |
of the License, or (at your option) any later version. |
5607 |
15 Apr 11 |
nicklas |
13 |
|
5607 |
15 Apr 11 |
nicklas |
BASE is distributed in the hope that it will be useful, |
5607 |
15 Apr 11 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5607 |
15 Apr 11 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5607 |
15 Apr 11 |
nicklas |
GNU General Public License for more details. |
5607 |
15 Apr 11 |
nicklas |
18 |
|
5607 |
15 Apr 11 |
nicklas |
You should have received a copy of the GNU General Public License |
5607 |
15 Apr 11 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5607 |
15 Apr 11 |
nicklas |
21 |
*/ |
5607 |
15 Apr 11 |
nicklas |
22 |
package net.sf.basedb.util.extensions.manager.filter; |
5607 |
15 Apr 11 |
nicklas |
23 |
|
5607 |
15 Apr 11 |
nicklas |
24 |
import net.sf.basedb.util.extensions.manager.ExtensionsFile; |
5607 |
15 Apr 11 |
nicklas |
25 |
import net.sf.basedb.util.filter.Filter; |
5607 |
15 Apr 11 |
nicklas |
26 |
|
5607 |
15 Apr 11 |
nicklas |
27 |
/** |
5607 |
15 Apr 11 |
nicklas |
Filter implementation for extension files that |
5607 |
15 Apr 11 |
nicklas |
allow modified but invalid files to pass. |
5607 |
15 Apr 11 |
nicklas |
30 |
|
5607 |
15 Apr 11 |
nicklas |
@author Nicklas |
5607 |
15 Apr 11 |
nicklas |
@since 3.0 |
5607 |
15 Apr 11 |
nicklas |
@base.modified $Date$ |
5607 |
15 Apr 11 |
nicklas |
34 |
*/ |
5607 |
15 Apr 11 |
nicklas |
35 |
public class InvalidAndModifiedFilter |
5607 |
15 Apr 11 |
nicklas |
36 |
implements Filter<ExtensionsFile> |
5607 |
15 Apr 11 |
nicklas |
37 |
{ |
5607 |
15 Apr 11 |
nicklas |
38 |
|
6444 |
09 Apr 14 |
nicklas |
39 |
private static final org.slf4j.Logger log = |
6444 |
09 Apr 14 |
nicklas |
40 |
org.slf4j.LoggerFactory.getLogger(InvalidAndModifiedFilter.class); |
5607 |
15 Apr 11 |
nicklas |
41 |
|
5607 |
15 Apr 11 |
nicklas |
42 |
|
5607 |
15 Apr 11 |
nicklas |
43 |
/** |
5607 |
15 Apr 11 |
nicklas |
Create a new filter. |
5607 |
15 Apr 11 |
nicklas |
45 |
*/ |
5607 |
15 Apr 11 |
nicklas |
46 |
public InvalidAndModifiedFilter() |
5607 |
15 Apr 11 |
nicklas |
47 |
{} |
5607 |
15 Apr 11 |
nicklas |
48 |
|
5607 |
15 Apr 11 |
nicklas |
49 |
/* |
5607 |
15 Apr 11 |
nicklas |
From the Filter interface |
5607 |
15 Apr 11 |
nicklas |
51 |
------------------------- |
5607 |
15 Apr 11 |
nicklas |
52 |
*/ |
5607 |
15 Apr 11 |
nicklas |
53 |
@Override |
5607 |
15 Apr 11 |
nicklas |
54 |
public boolean evaluate(ExtensionsFile xtFile) |
5607 |
15 Apr 11 |
nicklas |
55 |
{ |
5607 |
15 Apr 11 |
nicklas |
56 |
if (xtFile.isValid() && !xtFile.hasError()) |
5607 |
15 Apr 11 |
nicklas |
57 |
{ |
5607 |
15 Apr 11 |
nicklas |
58 |
log.info("File has no errors (skipping): " + xtFile); |
5607 |
15 Apr 11 |
nicklas |
59 |
return false; |
5607 |
15 Apr 11 |
nicklas |
60 |
} |
5607 |
15 Apr 11 |
nicklas |
61 |
|
5607 |
15 Apr 11 |
nicklas |
62 |
if (!xtFile.wasModified()) |
5607 |
15 Apr 11 |
nicklas |
63 |
{ |
5607 |
15 Apr 11 |
nicklas |
64 |
log.info("File is not modified (skipping): " + xtFile); |
5607 |
15 Apr 11 |
nicklas |
65 |
return false; |
5607 |
15 Apr 11 |
nicklas |
66 |
} |
5607 |
15 Apr 11 |
nicklas |
67 |
|
5607 |
15 Apr 11 |
nicklas |
68 |
return true; |
5607 |
15 Apr 11 |
nicklas |
69 |
} |
5607 |
15 Apr 11 |
nicklas |
70 |
// ------------------------- |
5607 |
15 Apr 11 |
nicklas |
71 |
|
5607 |
15 Apr 11 |
nicklas |
72 |
|
5607 |
15 Apr 11 |
nicklas |
73 |
} |