Search in sources :

Example 11 with MDRuntimeException

use of de.herrlock.manga.exceptions.MDRuntimeException in project Manga by herrlock.

the class SettingsFileDownloader method execute.

public static void execute() {
    logger.traceEntry();
    Properties p = new Properties();
    // load properties
    try (InputStream fIn = new FileInputStream(Constants.SETTINGS_FILE)) {
        p.load(fIn);
    } catch (IOException ex) {
        throw new MDRuntimeException(ex);
    }
    // properties loaded successful
    DownloadConfiguration conf = DownloadConfiguration.create(p);
    SettingsFileDownloader dlImpl = new SettingsFileDownloader(conf);
    DownloadProcessor.getInstance().addDownload(dlImpl);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) MDRuntimeException(de.herrlock.manga.exceptions.MDRuntimeException) IOException(java.io.IOException) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) DownloadConfiguration(de.herrlock.manga.util.configuration.DownloadConfiguration)

Example 12 with MDRuntimeException

use of de.herrlock.manga.exceptions.MDRuntimeException in project Manga by herrlock.

the class IndexerMain method exportHtmlIndex.

public static void exportHtmlIndex(final OutputStream out, final IndexerConfiguration conf) {
    Index index = Indexer.createIndex(conf);
    try (InputStream xmlDocument = Indexer.class.getResourceAsStream("manga2datatable.xsl")) {
        Source xsl = new StreamSource(xmlDocument);
        Source xml = new JAXBSource(createMarshaller(), index);
        Result target = new StreamResult(out);
        try {
            Transformer transformer = TransformerFactory.newInstance().newTransformer(xsl);
            transformer.transform(xml, target);
        } catch (TransformerFactoryConfigurationError | TransformerException ex) {
            throw new MDRuntimeException(ex);
        }
    } catch (IOException | JAXBException ex) {
        throw new MDRuntimeException(ex);
    }
}
Also used : TransformerFactoryConfigurationError(javax.xml.transform.TransformerFactoryConfigurationError) Transformer(javax.xml.transform.Transformer) StreamResult(javax.xml.transform.stream.StreamResult) ZipInputStream(java.util.zip.ZipInputStream) InputStream(java.io.InputStream) StreamSource(javax.xml.transform.stream.StreamSource) JAXBException(javax.xml.bind.JAXBException) Index(de.herrlock.manga.index.entity.Index) MDRuntimeException(de.herrlock.manga.exceptions.MDRuntimeException) IOException(java.io.IOException) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) JAXBSource(javax.xml.bind.util.JAXBSource) JAXBSource(javax.xml.bind.util.JAXBSource) StreamResult(javax.xml.transform.stream.StreamResult) Result(javax.xml.transform.Result) TransformerException(javax.xml.transform.TransformerException)

Example 13 with MDRuntimeException

use of de.herrlock.manga.exceptions.MDRuntimeException in project Manga by herrlock.

the class JDExport method executeGetFileProperties.

public static void executeGetFileProperties() {
    Properties p = new Properties();
    try {
        try (InputStream fIn = new FileInputStream(Constants.SETTINGS_FILE)) {
            p.load(fIn);
        }
    } catch (IOException ex) {
        throw new MDRuntimeException(ex);
    }
    execute(p);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) MDRuntimeException(de.herrlock.manga.exceptions.MDRuntimeException) IOException(java.io.IOException) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Aggregations

MDRuntimeException (de.herrlock.manga.exceptions.MDRuntimeException)13 IOException (java.io.IOException)11 URL (java.net.URL)6 InputStream (java.io.InputStream)4 MalformedURLException (java.net.MalformedURLException)3 HosterListEntry (de.herrlock.manga.index.entity.HosterListEntry)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 URLClassLoader (java.net.URLClassLoader)2 Path (java.nio.file.Path)2 Properties (java.util.Properties)2 TreeSet (java.util.TreeSet)2 Attributes (java.util.jar.Attributes)2 Manifest (java.util.jar.Manifest)2 Document (org.jsoup.nodes.Document)2 Element (org.jsoup.nodes.Element)2 Elements (org.jsoup.select.Elements)2 Predicate (com.google.common.base.Predicate)1 MDException (de.herrlock.manga.exceptions.MDException)1 Index (de.herrlock.manga.index.entity.Index)1