Package org.rhq.core.domain.bundle

Examples of org.rhq.core.domain.bundle.BundleVersion


    @TransactionAttribute(TransactionAttributeType.NEVER)
    public BundleFile addBundleFileViaURL(Subject subject, int bundleVersionId, String name, String version,
        Architecture architecture, String bundleFileUrl, String userName, String password) throws Exception {

        // Check authorization prior to performing any file download
        BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
        if (null == bundleVersion) {
            throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
        }
        checkCreateBundleVersionAuthz(subject, bundleVersion.getBundle().getId());

        File file = null;
        FileInputStream fis = null;
        try {
            file = downloadFile(bundleFileUrl, userName, password);
View Full Code Here


        int packageVersionId) throws Exception {

        if (null == name || "".equals(name.trim())) {
            throw new IllegalArgumentException("Invalid bundleFileName: " + name);
        }
        BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
        if (null == bundleVersion) {
            throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
        }
        PackageVersion packageVersion = entityManager.find(PackageVersion.class, packageVersionId);
        if (null == packageVersion) {
            throw new IllegalArgumentException("Invalid packageVersionId: " + packageVersionId);
        }

        // Check authorization
        checkCreateBundleVersionAuthz(subject, bundleVersion.getBundle().getId());

        // With all the plumbing in place, create and persist the BundleFile. Tie it to the Package if the caller
        // wants this BundleFile pinned to the most recent version.
        BundleFile bundleFile = new BundleFile();
        bundleFile.setBundleVersion(bundleVersion);
View Full Code Here

    @Override
    public Set<String> getBundleVersionFilenames(Subject subject, int bundleVersionId, boolean withoutBundleFileOnly)
        throws Exception {

        BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
        if (null == bundleVersion) {
            throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
        }

        checkCreateBundleVersionAuthz(subject, bundleVersion.getBundle().getId());

        Set<String> result = null;

        //new in 4.13 - we no longer throw an exception on failure to parse
        try {
            // parse the recipe (validation occurs here) and get the config def and list of files
            BundleType bundleType = bundleVersion.getBundle().getBundleType();
            RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());

            result = parseResults.getBundleFileNames();
        } catch (Exception e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Failed to parse the recipe of bundle version " + bundleVersionId
                    + " while trying to get the list of bundle file names: " + e.getMessage());
            }
        }

        if (result == null) {
            return Collections.emptySet();
        }

        if (withoutBundleFileOnly) {
            List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
            Set<String> allFilenames = result;
            result = new HashSet<String>(allFilenames.size() - bundleFiles.size());
            for (String filename : allFilenames) {
                boolean found = false;
                for (BundleFile bundleFile : bundleFiles) {
View Full Code Here

    }

    @Override
    public HashMap<String, Boolean> getAllBundleVersionFilenames(Subject subject, int bundleVersionId) throws Exception {

        BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
        if (null == bundleVersion) {
            throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
        }

        checkCreateBundleVersionAuthz(subject, bundleVersion.getBundle().getId());

        // parse the recipe (validation occurs here) and get the config def and list of files
        try {
            BundleType bundleType = bundleVersion.getBundle().getBundleType();
            RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());

            Set<String> filenames = parseResults.getBundleFileNames();
            HashMap<String, Boolean> result = new HashMap<String, Boolean>(filenames == null ? 0 : filenames.size());

            if (filenames != null && !filenames.isEmpty()) {
                List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
                for (String filename : filenames) {
                    boolean found = false;
                    for (BundleFile bundleFile : bundleFiles) {
                        String name = bundleFile.getPackageVersion().getGeneralPackage().getName();
                        if (name.equals(filename)) {
View Full Code Here

        entityManager.remove(doomed);
    }

    @Override
    public void deleteBundleVersion(Subject subject, int bundleVersionId, boolean deleteBundleIfEmpty) throws Exception {
        BundleVersion bundleVersion = this.entityManager.find(BundleVersion.class, bundleVersionId);
        if (null == bundleVersion) {
            return;
        }

        int bundleId = bundleVersion.getBundle().getId();

        checkDeleteBundleAuthz(subject, bundleId);

        // After we delete this bundle version, this is the version order value that is being removed.
        // Later we need to re-order the other bundles that are newer than this so their version orders are readjusted.
        int doomedBundleVersionOrder = bundleVersion.getVersionOrder();

        // deployments replace other deployments and have a self-referring FK.  The deployments
        // need to be removed in a way that will ensure that a replaced deployment is not removed
        // prior to the replacer.  To do this we'll just blanket update all the doomed deployments
        // to break the FK dependency with nulls.
View Full Code Here

    @RequiredPermission(Permission.MANAGE_BUNDLE)
    public void updateBundleVersionTags(Subject subject, int bundleVersionId, Set<Tag> tags) {

        Set<Tag> definedTags = addTags(subject, tags);
        BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);

        Set<Tag> previousTags = new HashSet<Tag>(bundleVersion.getTags());
        previousTags.removeAll(definedTags);
        for (Tag tag : previousTags) {
            tag.removeBundleVersion(bundleVersion);
        }
View Full Code Here

     */
    private Map<PackageVersion, File> downloadBundleFiles(BundleResourceDeployment resourceDeployment, File downloadDir)
        throws Exception {

        BundleDeployment bundleDeployment = resourceDeployment.getBundleDeployment();
        BundleVersion bundleVersion = bundleDeployment.getBundleVersion();

        Map<PackageVersion, File> packageVersionFiles = new HashMap<PackageVersion, File>();
        List<PackageVersion> packageVersions = getAllBundleVersionPackageVersions(bundleVersion);
        for (PackageVersion packageVersion : packageVersions) {
            File packageFile = new File(downloadDir, packageVersion.getFileName());
View Full Code Here

    public void testNonPlatformBundleDeploy_FileSystem_AbsolutePath() throws Exception {

        BundleType bundleType = new BundleType("bundleTypeName", im.bundleHandlerType);
        Bundle bundle = new Bundle("bundleName", bundleType, null, null);
        BundleVersion bundleVersion = new BundleVersion("bundleVersionName", "1.0", bundle, "");
        BundleDestination destination = new BundleDestination(bundle, "destName", null,
            MockInventoryManager.BUNDLE_CONFIG_NAME_FS, getPath("/tmp/dest")); // ABSOLUTE PATH
        BundleDeployment bundleDeployment = new BundleDeployment(bundleVersion, destination, "deploymentName");
        BundleResourceDeployment resourceDeployment = new BundleResourceDeployment(bundleDeployment, im.serverFS);
        BundleScheduleRequest request = new BundleScheduleRequest(resourceDeployment);
View Full Code Here

    }

    public void testNonPlatformBundleDeploy_FileSystem_RelativePath() throws Exception {
        BundleType bundleType = new BundleType("bundleTypeName", im.bundleHandlerType);
        Bundle bundle = new Bundle("bundleName", bundleType, null, null);
        BundleVersion bundleVersion = new BundleVersion("bundleVersionName", "1.0", bundle, "");
        BundleDestination destination = new BundleDestination(bundle, "destName", null,
            MockInventoryManager.BUNDLE_CONFIG_NAME_FS, "relative/path"); // RELATIVE PATH
        BundleDeployment bundleDeployment = new BundleDeployment(bundleVersion, destination, "deploymentName");
        BundleResourceDeployment resourceDeployment = new BundleResourceDeployment(bundleDeployment, im.serverFS);
        BundleScheduleRequest request = new BundleScheduleRequest(resourceDeployment);
View Full Code Here

    }

    public void testNonPlatformBundleDeploy_PluginConfig() throws Exception {
        BundleType bundleType = new BundleType("bundleTypeName", im.bundleHandlerType);
        Bundle bundle = new Bundle("bundleName", bundleType, null, null);
        BundleVersion bundleVersion = new BundleVersion("bundleVersionName", "1.0", bundle, "");
        BundleDestination destination = new BundleDestination(bundle, "destName", null,
            MockInventoryManager.BUNDLE_CONFIG_NAME_PC, "relative/path/pc");
        BundleDeployment bundleDeployment = new BundleDeployment(bundleVersion, destination, "deploymentName");
        BundleResourceDeployment resourceDeployment = new BundleResourceDeployment(bundleDeployment, im.serverPC);
        BundleScheduleRequest request = new BundleScheduleRequest(resourceDeployment);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.bundle.BundleVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.