Package org.rhq.core.domain.content

Examples of org.rhq.core.domain.content.Architecture


            File file = files.values().iterator().next();

            int bundleVersionId = Integer.parseInt(getFormField(formFields, "bundleVersionId", null));
            String name = getFormField(formFields, "name", file.getName());
            String version = getFormField(formFields, "version", Integer.toString(bundleVersionId));
            Architecture architecture = new Architecture(getFormField(formFields, "arch", "noarch"));
            InputStream fileStream = new FileInputStream(file);
            try {
                BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
                BundleFile bundleFile = bundleManager.addBundleFile(subject, bundleVersionId, name, version,
                    architecture, fileStream);
View Full Code Here


    public void testPersistSafely() throws Throwable {

        final String pkgName = "testPersistSafelyPackage";
        final String pvName = "testPersistSafelyPackageVersion version";
        final PackageType pkgType = packageType1;
        final Architecture arch = architecture1;

        // these will not have any JPA stubs inside them (i.e. no lazy exceptions will occur with these)
        Package pkgPojo = new Package(pkgName, pkgType);
        PackageVersion pvPojo = new PackageVersion(pkgPojo, pvName, arch);
        Configuration configPojo = new Configuration();
View Full Code Here

        ResourceType resourceType1 = new ResourceType("platform-" + System.currentTimeMillis(), "TestPlugin",
            ResourceCategory.PLATFORM, null);
        em.persist(resourceType1);
        em.flush();

        Architecture architecture1 = em.find(Architecture.class, 1);

        // Add package types to resource type
        packageType1 = new PackageType();
        packageType1.setName("package1-" + System.currentTimeMillis());
        packageType1.setDescription("");
View Full Code Here

                try {
                    Resource resource = SessionTestHelper.createNewResource(em, "testPkgBitsResource");
                    PackageType pkgType = new PackageType("testPkgBitsPT", resource.getResourceType());
                    org.rhq.core.domain.content.Package pkg = new Package("testPkgBitsP", pkgType);
                    Architecture arch = new Architecture("testPkgArch");
                    PackageVersion pkgVer = new PackageVersion(pkg, "1", arch);

                    em.persist(pkgType);
                    em.persist(pkg);
                    em.persist(arch);
View Full Code Here

                LoadedPackageBitsComposite composite;
                try {
                    Resource resource = SessionTestHelper.createNewResource(em, "testPkgBitsLargeResource");
                    PackageType pkgType = new PackageType("testPkgBitsLargePT", resource.getResourceType());
                    org.rhq.core.domain.content.Package pkg = new Package("testPkgBitsLargeP", pkgType);
                    Architecture arch = new Architecture("testPkgLargeArch");
                    PackageVersion pkgVer = new PackageVersion(pkg, "1", arch);

                    em.persist(pkgType);
                    em.persist(pkg);
                    em.persist(arch);
View Full Code Here

        BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", null, b1);
        assertNotNull(bv2);
        assertEquals("1.1", bv2.getVersion());

        // let's add a bundle file so we can ensure our deletion will also delete the file too
        bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testDeleteBundle", "1.0", new Architecture(
            "noarch"), "content".getBytes());
        BundleFileCriteria bfCriteria = new BundleFileCriteria();
        bfCriteria.addFilterBundleVersionId(bv2.getId());
        bfCriteria.fetchPackageVersion(true);
        PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
View Full Code Here

        assertNotNull(bv2);
        assertEquals("1.1", bv2.getVersion());

        // let's add a bundle file so we can ensure our deletion will also delete the file too
        bundleManager.addBundleFileViaByteArray(overlord, bv2.getId(), "testDeleteBundleVersion", "1.0",
            new Architecture("noarch"), "content".getBytes());
        BundleFileCriteria bfCriteria = new BundleFileCriteria();
        bfCriteria.addFilterBundleVersionId(bv2.getId());
        bfCriteria.fetchPackageVersion(true);
        PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
        assert files.size() == 1 : files;
View Full Code Here

        assertNotNull(bv2);
        assertEquals("1.1", bv2.getVersion());

        // let's add a bundle file so we can ensure our deletion will also delete the file too
        bundleManager.addBundleFileViaByteArray(subject, bv2.getId(), "testDeleteBundleVersion", "1.0",
            new Architecture("noarch"), "content".getBytes());
        BundleFileCriteria bfCriteria = new BundleFileCriteria();
        bfCriteria.addFilterBundleVersionId(bv2.getId());
        bfCriteria.fetchPackageVersion(true);
        PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
        assert files.size() == 1 : files;
View Full Code Here

                // which would cause our tx to rollback. the next sync should help us survive this failure.
                pkg = this.contentManager.persistOrMergePackageSafely(pkg);
            }

            // find and, if necessary create, the architecture
            Architecture arch = new Architecture(newDetails.getArchitectureName());

            if (!knownArchitectures.containsKey(arch)) {
                q = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
                q.setParameter("name", arch.getName());

                try {
                    arch = (Architecture) q.getSingleResult();
                    knownArchitectures.put(arch, arch); // cache it so we don't have to keep querying the DB
                } catch (NoResultException nre) {
                    log.info("Content source adapter found a previously unknown architecture [" + arch
                        + "] - it will be added to the list of known architectures");
                }
            } else {
                arch = knownArchitectures.get(arch);
            }

            // now finally create the new package version - this cascade-persists down several levels
            // note that other content sources might already be previously defined this, so only
            // persist it if it does not yet exist
            PackageVersion pv = new PackageVersion(pkg, newDetails.getVersion(), arch);
            pv.setDisplayName(newDetails.getDisplayName());
            pv.setDisplayVersion(newDetails.getDisplayVersion());
            pv.setExtraProperties(newDetails.getExtraProperties());
            pv.setFileCreatedDate(newDetails.getFileCreatedDate());
            pv.setFileName(newDetails.getFileName());
            pv.setFileSize(newDetails.getFileSize());
            pv.setLicenseName(newDetails.getLicenseName());
            pv.setLicenseVersion(newDetails.getLicenseVersion());
            pv.setLongDescription(newDetails.getLongDescription());
            pv.setMD5(newDetails.getMD5());
            pv.setMetadata(newDetails.getMetadata());
            pv.setSHA256(newDetails.getSHA256());
            pv.setShortDescription(newDetails.getShortDescription());

            q = entityManager.createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY);
            q.setParameter("packageName", newDetails.getName());
            q.setParameter("packageTypeName", pt.getName());
            q.setParameter("resourceType", rt);
            q.setParameter("architectureName", arch.getName());
            q.setParameter("version", newDetails.getVersion());

            try {
                PackageVersion pvExisting = (PackageVersion) q.getSingleResult();
View Full Code Here

                generalPackage = new Package(discoveredPackage.getName(), packageType);
                generalPackage = persistOrMergePackageSafely(generalPackage);
            }

            // Create a new package version and attach to the general package
            Architecture packageArchitecture;
            Query architectureQuery = entityManager.createNamedQuery(Architecture.QUERY_FIND_BY_NAME);
            architectureQuery.setFlushMode(FlushModeType.COMMIT);
            architectureQuery.setParameter("name", discoveredPackage.getArchitectureName());

            // We don't have an architecture enum, so it's very possible the plugin will pass in a crap string here.
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.content.Architecture

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.