Search in sources :

Example 1 with HumanTaskStoreException

use of org.wso2.carbon.humantask.core.store.HumanTaskStoreException in project carbon-business-process by wso2.

the class HumanTaskPackageRepository method addLatestArchiveToRegistryCollection.

/**
 * Add latest human task package zip to the registry
 *
 * @param humanTaskDeploymentUnit
 * @param humanTaskFile
 * @throws HumanTaskStoreException
 * @throws RegistryException
 */
private void addLatestArchiveToRegistryCollection(HumanTaskDeploymentUnit humanTaskDeploymentUnit, File humanTaskFile) throws HumanTaskStoreException, RegistryException {
    FileInputStream fileInputStream = null;
    try {
        Resource latestHumanTaskArchive = configRegistry.newResource();
        fileInputStream = new FileInputStream(humanTaskFile);
        latestHumanTaskArchive.setContent(fileInputStream);
        configRegistry.put(HumanTaskPackageRepositoryUtils.getHumanTaskPackageArchiveResourcePath(humanTaskDeploymentUnit.getPackageName()), latestHumanTaskArchive);
    } catch (FileNotFoundException ex) {
        String errMsg = "HumanTask package zip file couldn't found on given location " + humanTaskFile.getAbsolutePath();
        throw new HumanTaskStoreException(errMsg, ex);
    } catch (RegistryException ex) {
        String errMsg = "Exception occurred while adding latest archive to registry collection";
        throw new RegistryException(errMsg, ex);
    } finally {
        if (fileInputStream != null) {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                log.warn("Cannot close file input stream.", e);
            }
        }
    }
}
Also used : HumanTaskStoreException(org.wso2.carbon.humantask.core.store.HumanTaskStoreException) Resource(org.wso2.carbon.registry.core.Resource) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) FileInputStream(java.io.FileInputStream)

Example 2 with HumanTaskStoreException

use of org.wso2.carbon.humantask.core.store.HumanTaskStoreException in project carbon-business-process by wso2.

the class HumanTaskPackageRepository method addLatestArchiveToRegistryCollection.

/**
 * Add latest human task package zip to the registry
 *
 * @param deploymentUnitDAO
 * @param humanTaskFile
 * @throws RegistryException
 * @throws HumanTaskStoreException
 */
private void addLatestArchiveToRegistryCollection(DeploymentUnitDAO deploymentUnitDAO, File humanTaskFile) throws HumanTaskStoreException, RegistryException {
    FileInputStream fileInputStream = null;
    try {
        Resource latestHumanTaskArchive = configRegistry.newResource();
        fileInputStream = new FileInputStream(humanTaskFile);
        latestHumanTaskArchive.setContent(fileInputStream);
        configRegistry.put(HumanTaskPackageRepositoryUtils.getHumanTaskPackageArchiveResourcePath(deploymentUnitDAO.getPackageName()), latestHumanTaskArchive);
    } catch (FileNotFoundException ex) {
        String errMsg = "HumanTask package zip file couldn't found on given location " + humanTaskFile.getAbsolutePath();
        throw new HumanTaskStoreException(errMsg, ex);
    } catch (RegistryException ex) {
        String errMsg = "Exception occurred while adding latest archive to registry collection";
        throw new RegistryException(errMsg, ex);
    } finally {
        if (fileInputStream != null) {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                log.warn("Cannot close file input stream.", e);
            }
        }
    }
}
Also used : HumanTaskStoreException(org.wso2.carbon.humantask.core.store.HumanTaskStoreException) Resource(org.wso2.carbon.registry.core.Resource) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) FileInputStream(java.io.FileInputStream)

Aggregations

FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 HumanTaskStoreException (org.wso2.carbon.humantask.core.store.HumanTaskStoreException)2 Resource (org.wso2.carbon.registry.core.Resource)2 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)2