Examples of ContentSource


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

            query.setParameter("name", "testUpdateContentSource");
            query.setParameter("typeName", "testUpdateContentSourceCST");
            results = query.getResultList();

            if (results.size() > 0) {
                ContentSource deleteMe = (ContentSource) results.get(0);
                em.remove(deleteMe);
            }

            query = em.createNamedQuery(ContentSource.QUERY_FIND_BY_NAME_AND_TYPENAME);
            query.setParameter("name", "testUpdateContentSource2");
            query.setParameter("typeName", "testUpdateContentSourceCST2");
            results = query.getResultList();

            if (results.size() > 0) {
                ContentSource deleteMe = (ContentSource) results.get(0);
                em.remove(deleteMe);
            }

            query = em.createNamedQuery(ContentSource.QUERY_FIND_BY_NAME_AND_TYPENAME);
            query.setParameter("name", "testConstraintViolation");
            query.setParameter("typeName", "testConstraintViolationCST");
            results = query.getResultList();

            if (results.size() > 0) {
                ContentSource deleteMe = (ContentSource) results.get(0);
                em.remove(deleteMe);
            }

            query = em.createNamedQuery(ContentSourceType.QUERY_FIND_BY_NAME);
            query.setParameter("name", "testUpdateContentSourceCST");
View Full Code Here

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

                //   Create a content source type and a content source
                ContentSourceType type = new ContentSourceType("testGetSyncResultsListCST");
                Set<ContentSourceType> types = new HashSet<ContentSourceType>();
                types.add(type);
                contentSourceMetadataManager.registerTypes(types); // this blows away any previous existing types
                ContentSource contentSource = new ContentSource("testGetSyncResultsListCS", type);
                contentSource = contentSourceManager.simpleCreateContentSource(overlord, contentSource);

                //   Create an imported (non-candidate) repo associated with the source
                Repo importedRepo = new Repo("imported repo");
                importedRepo.addContentSource(contentSource);
                importedRepo = repoManager.createRepo(overlord, importedRepo);

                //   Create a candidate repo associated with that source
                Repo candidateRepo = new Repo(candidateRepoName);
                candidateRepo.setCandidate(true);
                candidateRepo.addContentSource(contentSource);
                candidateRepo = repoManager.createRepo(overlord, candidateRepo);

                // Test
                RepoCriteria criteria = new RepoCriteria();
                criteria.addFilterCandidate(true);
                criteria.addFilterContentSourceIds(contentSource.getId());
                criteria.fetchRepoContentSources(true);

                PageList<Repo> foundRepos = repoManager.findReposByCriteria(overlord, criteria);

                // Verify
View Full Code Here

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

                ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
                Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
                types.add(contentSourceType);
                contentSourceMetadataManager.registerTypes(types);

                ContentSource source1 = new ContentSource("testSource1", contentSourceType);
                source1 = contentSourceManager.simpleCreateContentSource(overlord, source1);

                ContentSource source2 = new ContentSource("testSource2", contentSourceType);
                source2 = contentSourceManager.simpleCreateContentSource(overlord, source2);

                // -> Only has source to delete, should be deleted
                Repo repo1 = new Repo("repo1");
                repo1.setCandidate(true);
View Full Code Here

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

                Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
                types.add(contentSourceType);
                contentSourceMetadataManager.registerTypes(types);

                ContentSource source = new ContentSource("testSource1", contentSourceType);
                source = contentSourceManager.simpleCreateContentSource(overlord, source);

                Repo repo = new Repo(oldName);
                repo = repoManager.createRepo(overlord, repo);

                repoManager.simpleAddContentSourcesToRepo(overlord, repo.getId(), new int[] { source.getId() });

                // Test
                repo.setName(newName);
                repoManager.updateRepo(overlord, repo);
View Full Code Here

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

            contentSourceId).executeUpdate();

        entityManager.createNamedQuery(PackageVersionContentSource.DELETE_BY_CONTENT_SOURCE_ID).setParameter(
            "contentSourceId", contentSourceId).executeUpdate();

        ContentSource cs = entityManager.find(ContentSource.class, contentSourceId);
        if (cs != null) {
            if (cs.getConfiguration() != null) {
                entityManager.remove(cs.getConfiguration());
            }

            List<ContentSourceSyncResults> results = cs.getSyncResults();
            if (results != null) {
                int[] ids = new int[results.size()];
                for (int i = 0; i < ids.length; i++) {
                    ids[i] = results.get(i).getId();
                }
View Full Code Here

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

    @RequiredPermission(Permission.MANAGE_REPOSITORIES)
    public ContentSource getContentSource(Subject subject, int contentSourceId) {
        Query q = entityManager.createNamedQuery(ContentSource.QUERY_FIND_BY_ID_WITH_CONFIG);
        q.setParameter("id", contentSourceId);

        ContentSource contentSource = null;

        try {
            contentSource = (ContentSource) q.getSingleResult();
        } catch (NoResultException nre) {
        }
View Full Code Here

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

    public ContentSource getContentSourceByNameAndType(Subject subject, String name, String typeName) {
        Query q = entityManager.createNamedQuery(ContentSource.QUERY_FIND_BY_NAME_AND_TYPENAME);
        q.setParameter("name", name);
        q.setParameter("typeName", typeName);

        ContentSource cs = null;

        try {
            cs = (ContentSource) q.getSingleResult();
        } catch (NoResultException nre) {
        }
View Full Code Here

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

    public ContentSource updateContentSource(Subject subject, ContentSource contentSource, boolean syncNow)
        throws ContentSourceException {

        log.debug("User [" + subject + "] is updating content source [" + contentSource + "]");

        ContentSource loaded = entityManager.find(ContentSource.class, contentSource.getId());

        obfuscatePasswords(contentSource);
               
        if (contentSource.getConfiguration() == null) {
            // this is a one-to-one and hibernate can't auto delete this orphan (HHH-2608), we manually do it here
            if (loaded.getConfiguration() != null) {
                entityManager.remove(loaded.getConfiguration());
            }
        }

        // before we merge the change, look to see if the name is changing because if it is
        // we need to unschedule the sync job due to the fact that the job data has the name in it.
        if (!loaded.getName().equals(contentSource.getName())) {
            log.info("Content source [" + loaded.getName() + "] is being renamed to [" + contentSource.getName()
                + "].  Will now unschedule the old sync job");
            try {
                ContentServerPluginContainer pc = ContentManagerHelper.getPluginContainer();
                pc.unscheduleProviderSyncJob(loaded);
            } catch (Exception e) {
View Full Code Here

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

    @RequiredPermission(Permission.MANAGE_REPOSITORIES)
    public void synchronizeAndLoadContentSource(Subject subject, int contentSourceId) {
        try {
            ContentServerPluginContainer pc = ContentManagerHelper.getPluginContainer();
            ContentSource contentSource = entityManager.find(ContentSource.class, contentSourceId);

            if (contentSource != null) {
                pc.syncProviderNow(contentSource);
            } else {
                log.warn("Asked to synchronize a non-existing content source [" + contentSourceId + "]");
View Full Code Here

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

        // Setup a HashSet so we can add missing files to the results list without getting dupes in the Set
        // Then translate at the end to a List.
        HashSet<PackageVersionContentSource> uniquePVs = new HashSet<PackageVersionContentSource>();
        uniquePVs.addAll(dbList);

        ContentSource contentSource = entityManager.find(ContentSource.class, contentSourceId);
        // Only check if it is a FILESYSTEM backed contentsource
        if (contentSource.getDownloadMode().equals(DownloadMode.FILESYSTEM)) {
            List<PackageVersionContentSource> allPackageVersions = contentSourceManager
                .getPackageVersionsFromContentSource(subject, contentSourceId, pc);
            for (PackageVersionContentSource item : allPackageVersions) {
                PackageVersion pv = item.getPackageVersionContentSourcePK().getPackageVersion();
                File verifyFile = getPackageBitsLocalFilesystemFile(pv.getId(), pv.getFileName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.