1 /*
2  * Created on Jul 11, 2008
3  * Created by Paul Gardner
4  *
5  * Copyright (C) Azureus Software, Inc, All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  */
19 
20 
21 package com.aelitis.azureus.core.subs;
22 
23 import java.net.URL;
24 import java.util.Map;
25 
26 import org.gudy.azureus2.pluginsimpl.local.utils.UtilitiesImpl;
27 
28 public interface
29 SubscriptionManager
30 	extends UtilitiesImpl.PluginSubscriptionManager
31 {
32 	public Subscription
create( String name, boolean is_public, String json )33 	create(
34 		String		name,
35 		boolean		is_public,
36 		String		json )
37 
38 		throws SubscriptionException;
39 
40 	public Subscription
createRSS( String name, URL url, int check_interval_mins, Map user_data )41 	createRSS(
42 		String		name,
43 		URL			url,
44 		int			check_interval_mins,
45 		Map			user_data )
46 
47 		throws SubscriptionException;
48 
49 	public Subscription
createRSS( String name, URL url, int check_interval_mins, boolean anonymous, Map user_data )50 	createRSS(
51 		String		name,
52 		URL			url,
53 		int			check_interval_mins,
54 		boolean		anonymous,
55 		Map			user_data )
56 
57 		throws SubscriptionException;
58 
59 		// creates a subscription that will always have the same identity for the given parameters
60 		// and can't be updated
61 
62 	public Subscription
createSingletonRSS( String name, URL url, int check_interval_mins )63 	createSingletonRSS(
64 		String		name,
65 		URL			url,
66 		int			check_interval_mins )
67 
68 		throws SubscriptionException;
69 
70 	public Subscription
createFromURI( String uri )71 	createFromURI(
72 		String		uri )
73 
74 		throws SubscriptionException;
75 
76 	public int
getKnownSubscriptionCount()77 	getKnownSubscriptionCount();
78 
79 	public int
getSubscriptionCount( boolean subscribed_only )80 	getSubscriptionCount(
81 		boolean	subscribed_only );
82 
83 	public Subscription[]
getSubscriptions()84 	getSubscriptions();
85 
86 	public Subscription[]
getSubscriptions( boolean subscribed_only )87    	getSubscriptions(
88    		boolean	subscribed_only );
89 
90 	public Subscription
getSubscriptionByID( String id )91 	getSubscriptionByID(
92 		String			id );
93 
94 		/**
95 		 * Full lookup
96 		 * @param hash
97 		 * @param listener
98 		 * @return
99 		 * @throws SubscriptionException
100 		 */
101 
102 	public SubscriptionAssociationLookup
lookupAssociations( byte[] hash, SubscriptionLookupListener listener )103 	lookupAssociations(
104 		byte[]						hash,
105 		SubscriptionLookupListener	listener )
106 
107 		throws SubscriptionException;
108 
109 	public SubscriptionAssociationLookup
lookupAssociations( byte[] hash, String[] networks, SubscriptionLookupListener listener )110 	lookupAssociations(
111 		byte[]						hash,
112 		String[]					networks,
113 		SubscriptionLookupListener	listener )
114 
115 		throws SubscriptionException;
116 
117 		/**
118 		 * Cached view of hash's subs
119 		 * @param hash
120 		 * @return
121 		 */
122 
123 	public Subscription[]
getKnownSubscriptions( byte[] hash )124 	getKnownSubscriptions(
125 		byte[]						hash );
126 
127 	public Subscription[]
getLinkedSubscriptions( byte[] hash )128 	getLinkedSubscriptions(
129 		byte[]						hash );
130 
131 	public SubscriptionScheduler
getScheduler()132 	getScheduler();
133 
134 	public int
getMaxNonDeletedResults()135 	getMaxNonDeletedResults();
136 
137 	public void
setMaxNonDeletedResults( int max )138 	setMaxNonDeletedResults(
139 		int			max );
140 
141 	public boolean
getAutoStartDownloads()142 	getAutoStartDownloads();
143 
144 	public void
setAutoStartDownloads( boolean auto_start )145 	setAutoStartDownloads(
146 		boolean		auto_start );
147 
148 	public int
getAutoStartMinMB()149 	getAutoStartMinMB();
150 
151 	public void
setAutoStartMinMB( int mb )152 	setAutoStartMinMB(
153 		int			mb );
154 
155 	public int
getAutoStartMaxMB()156 	getAutoStartMaxMB();
157 
158 	public void
setAutoStartMaxMB( int mb )159 	setAutoStartMaxMB(
160 		int			mb );
161 
162 	public int
getAutoDownloadMarkReadAfterDays()163 	getAutoDownloadMarkReadAfterDays();
164 
165 	public void
setAutoDownloadMarkReadAfterDays( int days )166 	setAutoDownloadMarkReadAfterDays(
167 		int		days );
168 
169 	public boolean
isRSSPublishEnabled()170 	isRSSPublishEnabled();
171 
172 	public void
setRSSPublishEnabled( boolean enabled )173 	setRSSPublishEnabled(
174 		boolean		enabled );
175 
176 	public boolean
isSearchEnabled()177 	isSearchEnabled();
178 
179 	public void
setSearchEnabled( boolean enabled )180 	setSearchEnabled(
181 		boolean		enabled );
182 
183 	public boolean
isSubsDownloadEnabled()184 	isSubsDownloadEnabled();
185 
186 	public void
setSubsDownloadEnabled( boolean enabled )187 	setSubsDownloadEnabled(
188 		boolean		enabled );
189 
190 	public boolean
hideSearchTemplates()191 	hideSearchTemplates();
192 
193 	public void
setActivateSubscriptionOnChange( boolean b )194 	setActivateSubscriptionOnChange(
195 		boolean		b );
196 
197 	public boolean
getActivateSubscriptionOnChange()198 	getActivateSubscriptionOnChange();
199 
200 	public String
getRSSLink()201 	getRSSLink();
202 
203 	public void
setRateLimits( String limits )204 	setRateLimits(
205 		String		limits );
206 
207 	public String
getRateLimits()208 	getRateLimits();
209 
210 	public void
addListener( SubscriptionManagerListener listener )211 	addListener(
212 		SubscriptionManagerListener	listener );
213 
214 	public void
removeListener( SubscriptionManagerListener listener )215 	removeListener(
216 		SubscriptionManagerListener	listener );
217 }
218