/* DigiDoc4J library
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/
package org.digidoc4j.impl.bdoc;
import org.digidoc4j.Container;
import org.digidoc4j.ContainerBuilder;
import org.digidoc4j.ContainerOpener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BDocContainerBuilder extends ContainerBuilder {
private static final Logger logger = LoggerFactory.getLogger(BDocContainerBuilder.class);
protected BDocContainer createNewContainer() {
if (configuration == null) {
return new NewBDocContainer();
} else {
return new NewBDocContainer(configuration);
}
}
protected Container openContainerFromFile() {
if (configuration == null) {
return ContainerOpener.open(containerFilePath);
} else {
return ContainerOpener.open(containerFilePath, configuration);
}
}
protected Container openContainerFromStream() {
if (configuration == null) {
boolean actAsBigFilesSupportEnabled = true;
return ContainerOpener.open(containerInputStream, actAsBigFilesSupportEnabled);
}
return ContainerOpener.open(containerInputStream, configuration);
}
@Override
public ContainerBuilder usingTempDirectory(String temporaryDirectoryPath) {
logger.warn("BDoc containers don't support setting temp directories");
return this;
}
}