Search in sources :

Example 1 with BPELPackageRepository

use of org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository in project carbon-business-process by wso2.

the class TenantProcessStoreImpl method init.

public void init() throws Exception {
    bpelDURepo = new File(parentProcessStore.getLocalDeploymentUnitRepo(), tenantId.toString());
    if (!bpelDURepo.exists() && !bpelDURepo.mkdirs()) {
        log.warn("Cannot create tenant " + tenantId + " BPEL deployment unit repository.");
    }
    repository = new BPELPackageRepository(tenantConfigRegistry, bpelDURepo, bpelArchiveRepo);
    repository.init();
}
Also used : BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) File(java.io.File)

Example 2 with BPELPackageRepository

use of org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method listDeployedPackagesPaginated.

public DeployedPackagesPaginated listDeployedPackagesPaginated(int page, String packageSearchString) throws PackageManagementException {
    int tPage = page;
    List<BPELPackageInfo> packages;
    DeployedPackagesPaginated paginatedPackages = new DeployedPackagesPaginated();
    TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
    BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
    try {
        // Can return null and we should handle that
        packages = packageRepo.getBPELPackages();
    } catch (Exception e) {
        String errorMessage = "Cannot get the BPEL Package list from repository.";
        log.error(errorMessage, e);
        throw new PackageManagementException(errorMessage, e);
    }
    if (packages != null) {
        // Calculating pagination information
        if (tPage < 0 || tPage == Integer.MAX_VALUE) {
            tPage = 0;
        }
        int startIndex = tPage * BPELConstants.ITEMS_PER_PAGE;
        int endIndex = (tPage + 1) * BPELConstants.ITEMS_PER_PAGE;
        int numberOfPackages = packages.size();
        int totalPackages = 0;
        BPELPackageInfo[] packagesArray = packages.toArray(new BPELPackageInfo[numberOfPackages]);
        for (int i = 0; i < numberOfPackages; i++) {
            if (!packagesArray[i].getName().toLowerCase().contains(packageSearchString.toLowerCase())) {
                continue;
            }
            int count = getPackageVersionCount(packagesArray[i]);
            if (totalPackages + count > startIndex && totalPackages < endIndex) {
                // In-order to get the total number of packages count
                // if (totalPackages >= endIndex) {
                // break;
                // }
                int maxRemainingPackages = totalPackages < startIndex && (totalPackages + count) > startIndex ? startIndex - (totalPackages + count) : endIndex - totalPackages;
                PackageType packageType = getPackageInfo(packagesArray[i], maxRemainingPackages);
                paginatedPackages.add_package(packageType);
            }
            totalPackages += count;
        }
        int pages = (int) Math.ceil((double) totalPackages / BPELConstants.ITEMS_PER_PAGE);
        paginatedPackages.setPages(pages);
    } else {
        // Returning empty result set with pages equal to zero for cases where null is returned from
        // BPEL repo.
        paginatedPackages.setPages(0);
    }
    return paginatedPackages;
}
Also used : PackageType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PackageType) DeployedPackagesPaginated(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.DeployedPackagesPaginated) BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) BPELUIException(org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException) BPELPackageInfo(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageInfo)

Example 3 with BPELPackageRepository

use of org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method listProcessesInPackage.

public PackageType listProcessesInPackage(String packageName) throws PackageManagementException {
    TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
    BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
    try {
        return getPackageInfo(packageRepo.getBPELPackageInfoForPackage(packageName.substring(0, packageName.lastIndexOf("-"))));
    } catch (Exception e) {
        String errMsg = "BPEL package: " + packageName + " failed to load from registry.";
        log.error(errMsg, e);
        throw new PackageManagementException(errMsg, e);
    }
}
Also used : BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) BPELUIException(org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)

Example 4 with BPELPackageRepository

use of org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method listDeployedPackagesPaginated.

public DeployedPackagesPaginated listDeployedPackagesPaginated(int page) throws PackageManagementException {
    int tPage = page;
    List<BPELPackageInfo> packages;
    DeployedPackagesPaginated paginatedPackages = new DeployedPackagesPaginated();
    TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
    BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
    try {
        // Can return null and we should handle that
        packages = packageRepo.getBPELPackages();
    } catch (Exception e) {
        String errorMessage = "Cannot get the BPEL Package list from repository.";
        log.error(errorMessage, e);
        throw new PackageManagementException(errorMessage, e);
    }
    if (packages != null) {
        // Calculating pagination information
        if (tPage < 0 || tPage == Integer.MAX_VALUE) {
            tPage = 0;
        }
        int startIndex = tPage * BPELConstants.ITEMS_PER_PAGE;
        int endIndex = (tPage + 1) * BPELConstants.ITEMS_PER_PAGE;
        int numberOfPackages = packages.size();
        int totalPackages = 0;
        BPELPackageInfo[] packagesArray = packages.toArray(new BPELPackageInfo[numberOfPackages]);
        for (int i = 0; i < numberOfPackages; i++) {
            int count = getPackageVersionCount(packagesArray[i]);
            if (totalPackages + count > startIndex && totalPackages < endIndex) {
                // In-order to get the total number of packages count
                // if (totalPackages >= endIndex) {
                // break;
                // }
                int maxRemainingPackages = totalPackages < startIndex && (totalPackages + count) > startIndex ? startIndex - (totalPackages + count) : endIndex - totalPackages;
                PackageType packageType = getPackageInfo(packagesArray[i], maxRemainingPackages);
                paginatedPackages.add_package(packageType);
            }
            totalPackages += count;
        }
        int pages = (int) Math.ceil((double) totalPackages / BPELConstants.ITEMS_PER_PAGE);
        paginatedPackages.setPages(pages);
    } else {
        // Returning empty result set with pages equal to zero for cases where null is returned from
        // BPEL repo.
        paginatedPackages.setPages(0);
    }
    return paginatedPackages;
}
Also used : PackageType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PackageType) DeployedPackagesPaginated(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.DeployedPackagesPaginated) BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) BPELUIException(org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException) BPELPackageInfo(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageInfo)

Example 5 with BPELPackageRepository

use of org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository in project carbon-business-process by wso2.

the class BPELPackageManagementServiceSkeleton method getLatestVersionInPackage.

/**
 * This method will return the latest version of the BPEL package
 * @param packageName BPEL package name
 * @return Latest package version
 * @throws PackageManagementException
 */
public String getLatestVersionInPackage(String packageName) throws PackageManagementException {
    TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
    BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
    try {
        return packageRepo.getBPELPackageInfoForPackage(packageName).getLatestVersion();
    } catch (Exception e) {
        String errMsg = "BPEL package: " + packageName + " failed to get latest version.";
        log.error(errMsg, e);
        throw new PackageManagementException(errMsg, e);
    }
}
Also used : BPELPackageRepository(org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl) PackageManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException) BPELUIException(org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)

Aggregations

BPELPackageRepository (org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository)5 BPELUIException (org.wso2.carbon.bpel.core.ode.integration.store.BPELUIException)4 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)4 PackageManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.PackageManagementException)4 BPELPackageInfo (org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageInfo)2 DeployedPackagesPaginated (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.DeployedPackagesPaginated)2 PackageType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PackageType)2 File (java.io.File)1