Search in sources :

Example 1 with FileStorage

use of org.olat.core.util.vfs.FileStorage in project OpenOLAT by OpenOLAT.

the class MailManagerImpl method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    VFSContainer root = mailModule.getRootForAttachments();
    attachmentStorage = new FileStorage(root);
    PublisherData pdata = getPublisherData();
    SubscriptionContext scontext = getSubscriptionContext();
    notificationsManager.getOrCreatePublisher(scontext, pdata);
    Properties p = null;
    try {
        velocityEngine = new VelocityEngine();
        p = new Properties();
        p.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
        p.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, "org.olat.core.gui.render.velocity.InfinispanResourceCache");
        p.setProperty("runtime.log.logsystem.log4j.category", "syslog");
        velocityEngine.init(p);
    } catch (Exception e) {
        throw new RuntimeException("config error " + p.toString());
    }
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) VFSContainer(org.olat.core.util.vfs.VFSContainer) FileStorage(org.olat.core.util.vfs.FileStorage) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) Properties(java.util.Properties) PublisherData(org.olat.core.commons.services.notifications.PublisherData) SendFailedException(javax.mail.SendFailedException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException) MessagingException(javax.mail.MessagingException) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) AddressException(javax.mail.internet.AddressException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 2 with FileStorage

use of org.olat.core.util.vfs.FileStorage in project OpenOLAT by OpenOLAT.

the class CertificatesManagerImpl method afterPropertiesSet.

@Override
public void afterPropertiesSet() {
    // create the folders
    getCertificateTemplatesRoot();
    templatesStorage = new FileStorage(getCertificateTemplatesRootContainer());
    getCertificateRoot();
    usersStorage = new FileStorage(getCertificateRootContainer());
    Properties p = null;
    try {
        velocityEngine = new VelocityEngine();
        p = new Properties();
        p.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
        p.setProperty("runtime.log.logsystem.log4j.category", "syslog");
        velocityEngine.init(p);
    } catch (Exception e) {
        throw new RuntimeException("config error " + p.toString());
    }
    // deploy script
    try (InputStream inRasteriez = CertificatesManager.class.getResourceAsStream("rasterize.js")) {
        Path rasterizePath = getRasterizePath();
        Files.copy(inRasteriez, rasterizePath, StandardCopyOption.REPLACE_EXISTING);
    } catch (Exception e) {
        log.error("Can not read rasterize.js library for PhantomJS PDF generation", e);
    }
    try (InputStream inQRCodeLib = CertificatesManager.class.getResourceAsStream("qrcode.min.js")) {
        Path qrCodeLibPath = getQRCodeLibPath();
        Files.copy(inQRCodeLib, qrCodeLibPath, StandardCopyOption.REPLACE_EXISTING);
    } catch (Exception e) {
        log.error("Can not read qrcode.min.js for QR Code PDF generation", e);
    }
    // start the queues
    try {
        startQueue();
    } catch (JMSException e) {
        log.error("", e);
    }
}
Also used : Path(java.nio.file.Path) VelocityEngine(org.apache.velocity.app.VelocityEngine) InputStream(java.io.InputStream) FileStorage(org.olat.core.util.vfs.FileStorage) JMSException(javax.jms.JMSException) Properties(java.util.Properties) CorruptedCourseException(org.olat.course.CorruptedCourseException) IOException(java.io.IOException) JMSException(javax.jms.JMSException)

Example 3 with FileStorage

use of org.olat.core.util.vfs.FileStorage in project openolat by klemens.

the class MailManagerImpl method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    VFSContainer root = mailModule.getRootForAttachments();
    attachmentStorage = new FileStorage(root);
    PublisherData pdata = getPublisherData();
    SubscriptionContext scontext = getSubscriptionContext();
    notificationsManager.getOrCreatePublisher(scontext, pdata);
    Properties p = null;
    try {
        velocityEngine = new VelocityEngine();
        p = new Properties();
        p.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
        p.setProperty(RuntimeConstants.RESOURCE_MANAGER_CACHE_CLASS, "org.olat.core.gui.render.velocity.InfinispanResourceCache");
        p.setProperty("runtime.log.logsystem.log4j.category", "syslog");
        velocityEngine.init(p);
    } catch (Exception e) {
        throw new RuntimeException("config error " + p.toString());
    }
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) VFSContainer(org.olat.core.util.vfs.VFSContainer) FileStorage(org.olat.core.util.vfs.FileStorage) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) Properties(java.util.Properties) PublisherData(org.olat.core.commons.services.notifications.PublisherData) SendFailedException(javax.mail.SendFailedException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException) MessagingException(javax.mail.MessagingException) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) AddressException(javax.mail.internet.AddressException) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 4 with FileStorage

use of org.olat.core.util.vfs.FileStorage in project openolat by klemens.

the class QPoolFileStorage method init.

@PostConstruct
public void init() {
    VFSContainer rootContainer = qpoolModule.getRootContainer();
    fileStorage = new FileStorage(rootContainer);
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) FileStorage(org.olat.core.util.vfs.FileStorage) PostConstruct(javax.annotation.PostConstruct)

Example 5 with FileStorage

use of org.olat.core.util.vfs.FileStorage in project OpenOLAT by OpenOLAT.

the class QPoolFileStorage method init.

@PostConstruct
public void init() {
    VFSContainer rootContainer = qpoolModule.getRootContainer();
    fileStorage = new FileStorage(rootContainer);
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) FileStorage(org.olat.core.util.vfs.FileStorage) PostConstruct(javax.annotation.PostConstruct)

Aggregations

FileStorage (org.olat.core.util.vfs.FileStorage)6 IOException (java.io.IOException)4 Properties (java.util.Properties)4 VelocityEngine (org.apache.velocity.app.VelocityEngine)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 FileNotFoundException (java.io.FileNotFoundException)2 InputStream (java.io.InputStream)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Path (java.nio.file.Path)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 PostConstruct (javax.annotation.PostConstruct)2 JMSException (javax.jms.JMSException)2 MessagingException (javax.mail.MessagingException)2 SendFailedException (javax.mail.SendFailedException)2 AddressException (javax.mail.internet.AddressException)2 MethodInvocationException (org.apache.velocity.exception.MethodInvocationException)2 ParseErrorException (org.apache.velocity.exception.ParseErrorException)2 ResourceNotFoundException (org.apache.velocity.exception.ResourceNotFoundException)2 PublisherData (org.olat.core.commons.services.notifications.PublisherData)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2