use of de.herrlock.manga.exceptions.InitializeException in project Manga by herrlock.
the class JDExport method execute.
public static void execute(final Properties p) {
logger.traceEntry();
String jdhome = p.getProperty(Configuration.JDFW);
if (jdhome == null || jdhome.trim().isEmpty()) {
throw new InitializeException("\"" + Configuration.JDFW + "\" must be set");
}
JDConfiguration conf = JDConfiguration.create(p);
MDownloader dlImpl = new JDExport(conf);
DownloadProcessor.getInstance().addDownload(dlImpl);
}
use of de.herrlock.manga.exceptions.InitializeException in project Manga by herrlock.
the class Configuration method _createUrl.
/**
* creates a {@link URL} from the property {@value #URL} in the given Properties
*
* @param p
* the {@link Properties} where to search for an url
* @return the created URL
* @throws InitializeException
* in case the URL is not availabile or malformed
*/
protected static URL _createUrl(final Properties p) throws InitializeException {
logger.traceEntry();
URL url = _createUrlNotRequired(p);
if (url == null) {
throw new InitializeException("url is not filled but required");
}
logger.debug("URL: {}", url);
return url;
}
use of de.herrlock.manga.exceptions.InitializeException in project Manga by herrlock.
the class Configuration method _createProxy.
/**
* Creates a {@link ProxyStorage} that serves as proxy
*
* @param p
* the {@link Properties} where to search for proxy-settings
* @return a {@link ProxyStorage} containing the proxy-settings. Does not return null, instead the {@link ProxyStorage}
* contains {@code null}-values
* @throws InitializeException
* in case the given url is malformed or cannot be resolved
*/
protected static ProxyStorage _createProxy(final Properties p) throws InitializeException {
logger.traceEntry();
// get proxy
try {
String proxyString = p.getProperty(PROXY);
if (proxyString != null && !"".equals(proxyString)) {
return createProxyStorage(proxyString);
}
} catch (final MalformedURLException | UnknownHostException ex) {
logger.error("", ex);
throw new InitializeException("proxy-url is malformed or not recognized.", ex);
}
logger.debug("No Proxy");
return new ProxyStorage();
}
use of de.herrlock.manga.exceptions.InitializeException in project Manga by herrlock.
the class ChapterList method getInstance.
/**
* creates an instance of {@linkplain ChapterList}, gets the right {@linkplain Details} from the {@linkplain URL} in the given
* {@link DownloadConfiguration}
*
* @param conf
* the {@link DownloadConfiguration} to use
* @return an instance of {@link ChapterList}; when no suitable Hoster can be detected {@code null}
*/
public static ChapterList getInstance(final DownloadConfiguration conf) {
logger.traceEntry("Configuration: {}", conf);
URL url = conf.getUrl();
Hoster h;
try {
h = Hosters.getHostByURL(url);
} catch (NoHosterFoundException ex) {
throw new InitializeException(ex);
}
logger.debug("Selected Hoster: {}", h.getName());
return h.getChapterList(conf);
}
Aggregations