Example usage for javax.ejb TransactionAttributeType NOT_SUPPORTED

List of usage examples for javax.ejb TransactionAttributeType NOT_SUPPORTED

Introduction

In this page you can find the example usage for javax.ejb TransactionAttributeType NOT_SUPPORTED.

Prototype

TransactionAttributeType NOT_SUPPORTED

To view the source code for javax.ejb TransactionAttributeType NOT_SUPPORTED.

Click Source Link

Document

The container invokes an enterprise bean method whose transaction attribute NOT_SUPPORTED with an unspecified transaction context.

Usage

From source file:org.rhq.enterprise.server.system.SystemManagerBean.java

@RequiredPermission(Permission.MANAGE_SETTINGS)
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public long vacuumAppdef(Subject whoami) {
    return vacuum(whoami, TABLES_TO_VACUUM);
}

From source file:org.rhq.enterprise.server.test.StrippedDownStartupBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void createStorageNodeVersionColumnIfNeeded() {
    Connection connection = null;
    try {/* w  w w  .j  a v  a 2 s .  c  o  m*/
        connection = dataSource.getConnection();
        StorageNodeVersionColumnUpgrader versionColumnUpgrader = new StorageNodeVersionColumnUpgrader();
        versionColumnUpgrader.upgrade(connection, RHQ_VERSION);
        versionColumnUpgrader.setVersionForAllNodes(connection, RHQ_VERSION);
    } catch (Exception e) {
        LOG.error("Could not check storage node version column", e);
    } finally {
        JDBCUtil.safeClose(connection);
    }
}

From source file:org.rhq.enterprise.server.test.StrippedDownStartupBean.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void createServerVersionColumnIfNeeded() {
    Connection connection = null;
    try {//from   w w  w .j  a v  a  2 s .c  o  m
        connection = dataSource.getConnection();
        ServerVersionColumnUpgrader versionColumnUpgrader = new ServerVersionColumnUpgrader();
        versionColumnUpgrader.upgrade(connection, RHQ_VERSION);
        versionColumnUpgrader.setVersionForAllServers(connection, RHQ_VERSION);
    } catch (Exception e) {
        LOG.error("Could not check server version column", e);
    } finally {
        JDBCUtil.safeClose(connection);
    }
}

From source file:ru.simplgroupp.passportinfo.csv.CsvUtil.java

@Timeout
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void execute() {
    log.info("----Invoked: " + System.currentTimeMillis());
    processURL(propsHolder.getCsvURL());
}

From source file:ru.simplgroupp.passportinfo.csv.CsvUtil.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void processURL(String url) {
    try {//from www. j a  v  a 2 s .  c o  m
        log.info("URL to download archive is : {}", url);

        File bz2File = null;
        FileInputStream fis = null;
        try {

            /*CronJobLog jobLog = new CronJobLog();
            jobLog.setStartDate(new Date());
            jobLog.setUploadType(CronJobLog.TYPE_URL);*/
            bz2File = File.createTempFile(TMP_FILE_PREFIX, ".bz2");
            FileUtils.copyURLToFile(new URL(url), bz2File);
            log.info("Downloading complete; archive file for reading - {}", bz2File.getAbsolutePath());
            fis = new FileInputStream(bz2File);
            BufferedInputStream bis = new BufferedInputStream(fis);
            BZip2CompressorInputStream bz2In = new BZip2CompressorInputStream(bis);
            copyInDb(bz2In, CronJobLogType.URL);
            /*try {
            csvCopyUtil.copyInDb(bzIn);
            jobLog.setStatus(CronJobLog.STATUS_SUCCESS);
                    
            } catch (Exception e) {
            jobLog.setStatus(CronJobLog.STATUS_ERROR);
            jobLog.setErrorDesc(e.getMessage());
            } finally {
            jobLog.setEndDate(new Date());
            cronJobLogFacade.create(jobLog);
            }*/

        } catch (Exception e) {
            throw new PassportInfoException("Exception during csv file extraction by URL" + url, e);
        } finally {
            try {
                if (fis != null) {
                    fis.close();
                }
            } catch (IOException ex) {
                throw ex;
            }

            if (bz2File.delete()) {
                log.info("File \"{}\" deleted", bz2File.getAbsolutePath());
            }
        }

    } catch (Exception e) {
        log.error("Error just happened", e);
    }
}

From source file:ru.simplgroupp.passportinfo.csv.CsvUtil.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void copyInDb(InputStream is, CronJobLogType type) {
    try {//from  ww  w.  j av  a2s.  c o  m
        File normFile = normalizeInputStreamFile(is);
        FileInputStream fin = new FileInputStream(normFile);

        CronJobLog jobLog = new CronJobLog();
        jobLog.setStartDate(new Date());
        jobLog.setUploadType(type.toString());
        try {
            csvCopyUtil.copyInDb(fin);
            jobLog.setStatus(CronJobLog.STATUS_SUCCESS);

        } catch (Exception e) {
            jobLog.setStatus(CronJobLog.STATUS_ERROR);
            jobLog.setErrorDesc(e.getMessage());
            log.error("Error cpoying passports into db...", e);
        } finally {
            fin.close();
            if (normFile.delete()) {
                log.info("File \"{}\" deleted", normFile.getAbsolutePath());
            }

            jobLog.setEndDate(new Date());
            cronJobLogFacade.create(jobLog);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:ru.simplgroupp.passportinfo.ui.CsvUploadView.java

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void handleFileUpload(FileUploadEvent event) throws Exception {
    file = event.getFile();/* w  w  w . j a  va 2  s .c o m*/
    log.info("File uploaded:" + file);
    if (file != null) {

        String str = file.getFileName();
        String ext = str.substring(str.lastIndexOf('.'), str.length());
        log.info("Uploaded file name: {}; extension: {}", str, ext);
        if (ext.equalsIgnoreCase(".csv")) {
            //copyUtil.copyInDb(file.getInputstream());
            csvUtil.copyInDb(file.getInputstream(), CronJobLogType.FILEUPLOAD);

        }
        if (ext.equalsIgnoreCase(".bz2")) {
            //copyUtil.copyInDb(new BZip2CompressorInputStream(file.getInputstream()));
            csvUtil.copyInDb(new BZip2CompressorInputStream(file.getInputstream()), CronJobLogType.FILEUPLOAD);
        }
        FacesMessage message = new FacesMessage("File ",
                file.getFileName() + "was successfully uploaded. Database refresh started.");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }
}