5603 |
08 Apr 11 |
nicklas |
1 |
/** |
5603 |
08 Apr 11 |
nicklas |
$Id$ |
5603 |
08 Apr 11 |
nicklas |
3 |
|
5603 |
08 Apr 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5603 |
08 Apr 11 |
nicklas |
5 |
|
5603 |
08 Apr 11 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
5603 |
08 Apr 11 |
nicklas |
Available at http://base.thep.lu.se/ |
5603 |
08 Apr 11 |
nicklas |
8 |
|
5603 |
08 Apr 11 |
nicklas |
BASE is free software; you can redistribute it and/or |
5603 |
08 Apr 11 |
nicklas |
modify it under the terms of the GNU General Public License |
5603 |
08 Apr 11 |
nicklas |
as published by the Free Software Foundation; either version 3 |
5603 |
08 Apr 11 |
nicklas |
of the License, or (at your option) any later version. |
5603 |
08 Apr 11 |
nicklas |
13 |
|
5603 |
08 Apr 11 |
nicklas |
BASE is distributed in the hope that it will be useful, |
5603 |
08 Apr 11 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5603 |
08 Apr 11 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5603 |
08 Apr 11 |
nicklas |
GNU General Public License for more details. |
5603 |
08 Apr 11 |
nicklas |
18 |
|
5603 |
08 Apr 11 |
nicklas |
You should have received a copy of the GNU General Public License |
5603 |
08 Apr 11 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5603 |
08 Apr 11 |
nicklas |
21 |
*/ |
5603 |
08 Apr 11 |
nicklas |
22 |
package net.sf.basedb.util.extensions.manager.processor; |
5603 |
08 Apr 11 |
nicklas |
23 |
|
5603 |
08 Apr 11 |
nicklas |
24 |
import net.sf.basedb.util.extensions.manager.ExtensionsFileProcessor; |
5603 |
08 Apr 11 |
nicklas |
25 |
import net.sf.basedb.util.extensions.manager.ExtensionsManager; |
5603 |
08 Apr 11 |
nicklas |
26 |
import net.sf.basedb.util.extensions.manager.ExtensionsFile.WriteableExtensionsFile; |
5603 |
08 Apr 11 |
nicklas |
27 |
|
5603 |
08 Apr 11 |
nicklas |
28 |
/** |
5603 |
08 Apr 11 |
nicklas |
File processor implementation that marks all extension files |
5603 |
08 Apr 11 |
nicklas |
as processed. This should cause them not to be processed again |
5603 |
08 Apr 11 |
nicklas |
unless they have been modified or deleted. |
5603 |
08 Apr 11 |
nicklas |
32 |
|
5603 |
08 Apr 11 |
nicklas |
@author Nicklas |
5603 |
08 Apr 11 |
nicklas |
@since 3.0 |
5603 |
08 Apr 11 |
nicklas |
@base.modified $Date$ |
5603 |
08 Apr 11 |
nicklas |
36 |
*/ |
5603 |
08 Apr 11 |
nicklas |
37 |
public class MarkAsProcessedProcessor |
5603 |
08 Apr 11 |
nicklas |
38 |
implements ExtensionsFileProcessor |
5603 |
08 Apr 11 |
nicklas |
39 |
{ |
5603 |
08 Apr 11 |
nicklas |
40 |
|
5603 |
08 Apr 11 |
nicklas |
41 |
private int numFiles; |
5603 |
08 Apr 11 |
nicklas |
42 |
|
5603 |
08 Apr 11 |
nicklas |
43 |
public MarkAsProcessedProcessor() |
5603 |
08 Apr 11 |
nicklas |
44 |
{} |
5603 |
08 Apr 11 |
nicklas |
45 |
|
5603 |
08 Apr 11 |
nicklas |
46 |
/* |
5603 |
08 Apr 11 |
nicklas |
From the ExtensionsFileProcessor interface |
5603 |
08 Apr 11 |
nicklas |
48 |
------------------------------------------ |
5603 |
08 Apr 11 |
nicklas |
49 |
*/ |
5603 |
08 Apr 11 |
nicklas |
50 |
@Override |
5603 |
08 Apr 11 |
nicklas |
51 |
public void begin(ExtensionsManager manager, int numFiles) |
5603 |
08 Apr 11 |
nicklas |
52 |
{ |
5603 |
08 Apr 11 |
nicklas |
53 |
this.numFiles = 0; |
5603 |
08 Apr 11 |
nicklas |
54 |
} |
5603 |
08 Apr 11 |
nicklas |
55 |
|
5603 |
08 Apr 11 |
nicklas |
56 |
@Override |
5603 |
08 Apr 11 |
nicklas |
57 |
public void processFile(ExtensionsManager manager, WriteableExtensionsFile wFile) |
5603 |
08 Apr 11 |
nicklas |
58 |
{ |
5603 |
08 Apr 11 |
nicklas |
59 |
numFiles++; |
5603 |
08 Apr 11 |
nicklas |
60 |
wFile.markAsProcessed(); |
5603 |
08 Apr 11 |
nicklas |
61 |
} |
5603 |
08 Apr 11 |
nicklas |
62 |
|
5603 |
08 Apr 11 |
nicklas |
63 |
@Override |
5603 |
08 Apr 11 |
nicklas |
64 |
public void done(ExtensionsManager manager) |
5603 |
08 Apr 11 |
nicklas |
65 |
{} |
5603 |
08 Apr 11 |
nicklas |
66 |
|
5603 |
08 Apr 11 |
nicklas |
67 |
@Override |
5603 |
08 Apr 11 |
nicklas |
68 |
public void done(ExtensionsManager manager, Throwable t) |
5603 |
08 Apr 11 |
nicklas |
69 |
{} |
5603 |
08 Apr 11 |
nicklas |
70 |
// --------------------------------------------- |
5603 |
08 Apr 11 |
nicklas |
71 |
|
5603 |
08 Apr 11 |
nicklas |
72 |
/** |
5603 |
08 Apr 11 |
nicklas |
Get the number of files that was processed. |
5603 |
08 Apr 11 |
nicklas |
74 |
*/ |
5603 |
08 Apr 11 |
nicklas |
75 |
public int getNumFiles() |
5603 |
08 Apr 11 |
nicklas |
76 |
{ |
5603 |
08 Apr 11 |
nicklas |
77 |
return numFiles; |
5603 |
08 Apr 11 |
nicklas |
78 |
} |
5603 |
08 Apr 11 |
nicklas |
79 |
|
5603 |
08 Apr 11 |
nicklas |
80 |
|
5603 |
08 Apr 11 |
nicklas |
81 |
} |