01: /*
02: * This file is part of DrFTPD, Distributed FTP Daemon.
03: *
04: * DrFTPD is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * DrFTPD is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with DrFTPD; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.drftpd.mirroring.archivetypes;
19:
20: import java.util.ArrayList;
21: import java.util.HashSet;
22: import java.util.Iterator;
23: import java.util.Properties;
24:
25: import net.sf.drftpd.ObjectNotFoundException;
26: import net.sf.drftpd.mirroring.Job;
27:
28: import org.apache.log4j.Logger;
29: import org.drftpd.PropertyHelper;
30: import org.drftpd.master.RemoteSlave;
31: import org.drftpd.mirroring.ArchiveType;
32: import org.drftpd.plugins.Archive;
33: import org.drftpd.remotefile.LinkedRemoteFileInterface;
34: import org.drftpd.sections.SectionInterface;
35:
36: /**
37: * @author zubov
38: * @version $Id: MoveReleaseToSpecificSlaves.java 1398 2006-01-14 20:54:51Z zubov $
39: */
40: public class MoveReleaseToSpecificSlaves extends ArchiveType {
41: private static final Logger logger = Logger
42: .getLogger(MoveReleaseToSpecificSlaves.class);
43:
44: public MoveReleaseToSpecificSlaves(Archive archive,
45: SectionInterface section, Properties props) {
46: super (archive, section, props);
47:
48: if (_slaveList.isEmpty()) {
49: throw new NullPointerException(
50: "Cannot continue, 0 destination slaves found for MoveReleaseToSpecificSlave for section "
51: + getSection().getName());
52: }
53:
54: _numOfSlaves = _slaveList.size();
55:
56: if (_numOfSlaves < 1) {
57: throw new IllegalArgumentException(
58: "numOfSlaves has to be > 0 for section "
59: + section.getName());
60: }
61: }
62:
63: public HashSet findDestinationSlaves() {
64: throw new UnsupportedOperationException(
65: "_slaveList needs to be set");
66: }
67:
68: protected boolean isArchivedDir(LinkedRemoteFileInterface lrf)
69: throws IncompleteDirectoryException, OfflineSlaveException {
70: return isArchivedToXSlaves(lrf, _numOfSlaves);
71: }
72:
73: public String toString() {
74: return "MoveReleaseToSpecificSlaves=[directory=["
75: + getDirectory().getPath() + "]dest=["
76: + outputSlaves(getRSlaves()) + "]numOfSlaves=["
77: + _numOfSlaves + "]]";
78: }
79: }
|