2 * jFCPlib - SubscribeUSK.java - Copyright © 2008 David Roden
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program 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.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package net.pterodactylus.fcp;
22 * With a “SubscribeUSK” a client requests to be notified if the edition number
25 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
27 public class SubscribeUSK extends FcpMessage implements Identifiable {
29 public SubscribeUSK(String identifier) {
30 super("SubscribeUSK");
31 setField("Identifier", identifier);
34 public SubscribeUSK(String uri, String identifier) {
40 public String getIdentifier() {
41 return getField("Identifier");
44 public String getUri() {
45 return getField("URI");
48 public void setUri(String uri) {
52 public boolean isActive() {
53 return !Boolean.parseBoolean(getField("DontPoll"));
57 * Sets whether updates for the USK are actively searched.
60 * <code>true</code> to actively search for newer editions,
61 * <code>false</code> to only watch for newer editions that are
62 * found from other requests
64 public void setActive(boolean active) {
65 setField("DontPoll", String.valueOf(!active));
68 public boolean isSparse() {
69 return Boolean.valueOf(getField("SparsePoll"));
72 public void setSparse(boolean sparse) {
73 setField("SparsePoll", String.valueOf(sparse));
76 public Priority getPriority() {
77 String priorityClass = getField("PriorityClass");
78 if (priorityClass != null) {
79 return Priority.valueOf(priorityClass);
81 return Priority.bulkSplitfile;
84 public void setPriority(Priority priority) {
85 setField("PriorityClass", priority.toString());
88 public Priority getActivePriority() {
89 String priorityClass = getField("PriorityClassProgress");
90 if (priorityClass != null) {
91 return Priority.valueOf(priorityClass);
93 return Priority.update;
96 public void setActivePriority(Priority activePriority) {
97 setField("PriorityClassProgress", activePriority.toString());
100 public boolean isRealTime() {
101 return Boolean.valueOf(getField("RealTimeFlag"));
104 public void setRealTime(boolean realTime) {
105 setField("RealTimeFlag", String.valueOf(realTime));
108 public boolean isIgnoreDateHints() {
109 return Boolean.valueOf(getField("IgnoreUSKDatehints"));
112 public void setIgnoreDateHints(boolean ignoreDateHints) {
113 setField("IgnoreUSKDatehints", String.valueOf(ignoreDateHints));