Search in sources :

Example 1 with GsaConfigParser

use of org.codelibs.fess.util.GsaConfigParser in project fess by codelibs.

the class AdminBackupAction method importGsaXml.

private void importGsaXml(final String fileName, final File tempFile) {
    final GsaConfigParser configParser = ComponentUtil.getComponent(GsaConfigParser.class);
    try (final InputStream in = new FileInputStream(tempFile)) {
        configParser.parse(new InputSource(in));
    } catch (final IOException e) {
        logger.warn("Failed to process gsa.xml file: {}", fileName, e);
    } finally {
        deleteTempFile(tempFile);
    }
    configParser.getWebConfig().ifPresent(c -> webConfigBhv.insert(c));
    configParser.getFileConfig().ifPresent(c -> fileConfigBhv.insert(c));
    labelTypeBhv.batchInsert(Arrays.stream(configParser.getLabelTypes()).collect(Collectors.toList()));
}
Also used : InputSource(org.xml.sax.InputSource) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) GsaConfigParser(org.codelibs.fess.util.GsaConfigParser)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 GsaConfigParser (org.codelibs.fess.util.GsaConfigParser)1 InputSource (org.xml.sax.InputSource)1