use of com.biglybt.pif.utils.search.SearchProvider in project BiglyBT by BiglySoftware.
the class MetaSearchImpl method resolveProvider.
public SearchProvider resolveProvider(PluginEngine for_engine) {
List<EngineImpl> l = engines.getList();
for (EngineImpl e : l) {
if (e instanceof PluginEngine) {
PluginEngine pe = (PluginEngine) e;
SearchProvider provider = pe.getProvider();
if (provider != null) {
if (pe.getName().equals(for_engine.getName())) {
return (provider);
}
}
}
}
return (null);
}
use of com.biglybt.pif.utils.search.SearchProvider in project BiglyBT by BiglySoftware.
the class UtilitiesImpl method getSubscriptionManager.
@Override
public SubscriptionManager getSubscriptionManager() throws SubscriptionException {
try {
Method m = Class.forName("com.biglybt.core.subs.SubscriptionManagerFactory").getMethod("getSingleton");
final PluginSubscriptionManager sm = (PluginSubscriptionManager) m.invoke(null);
return (new SubscriptionManager() {
@Override
public void requestSubscription(URL url) {
sm.requestSubscription(url, new HashMap<String, Object>());
}
@Override
public void requestSubscription(URL url, Map<String, Object> options) {
sm.requestSubscription(url, options);
}
@Override
public void requestSubscription(SearchProvider sp, Map<String, Object> search_parameters) throws SubscriptionException {
sm.requestSubscription(sp, search_parameters);
}
@Override
public Subscription[] getSubscriptions() {
PluginSubscription[] p_subs = sm.getSubscriptions(true);
Subscription[] subs = new Subscription[p_subs.length];
for (int i = 0; i < subs.length; i++) {
final PluginSubscription p_sub = p_subs[i];
subs[i] = new Subscription() {
@Override
public String getID() {
return (p_sub.getID());
}
@Override
public String getName() {
return (p_sub.getName());
}
@Override
public boolean isSearchTemplate() {
return (p_sub.isSearchTemplate());
}
@Override
public SubscriptionResult[] getResults() {
PluginSubscriptionResult[] p_results = p_sub.getResults(false);
SubscriptionResult[] results = new SubscriptionResult[p_results.length];
for (int i = 0; i < results.length; i++) {
final PluginSubscriptionResult p_res = p_results[i];
results[i] = new SubscriptionResult() {
private Map<Integer, Object> map = p_res.toPropertyMap();
@Override
public Object getProperty(int property_name) {
return (map.get(property_name));
}
@Override
public boolean isRead() {
return (p_res.getRead());
}
@Override
public void setRead(boolean read) {
p_res.setRead(read);
}
};
}
return (results);
}
};
}
return (subs);
}
});
} catch (Throwable e) {
throw (new SubscriptionException("Subscriptions unavailable", e));
}
}
Aggregations