Package org.rhq.enterprise.server.plugin.pc.drift

Examples of org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginFacet


            driftDTO.setDirectory(drift.getDirectory());
            drifts.add(driftDTO);
        }
        changeSetDTO.setDrifts(drifts);

        DriftServerPluginFacet driftServerPlugin = getServerPlugin();
        try {
            return driftServerPlugin.persistChangeSet(subject, changeSetDTO);
        } catch (Exception e) {
            throw new RuntimeException("Failed to pin snapshot", e);
        }
    }
View Full Code Here


    @Override
    @TransactionAttribute(NOT_SUPPORTED)
    public String getDriftFileBits(Subject subject, String hash) {
        log.debug("Retrieving drift file content for " + hash);
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();
        return driftServerPlugin.getDriftFileBits(subject, hash);
    }
View Full Code Here

    }

    @Override
    public byte[] getDriftFileAsByteArray(Subject subject, String hash) {
        log.debug("Retrieving drift file content for " + hash);
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();
        return driftServerPlugin.getDriftFileAsByteArray(subject, hash);
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Override
    public FileDiffReport generateUnifiedDiffByIds(Subject subject, String driftId1, String driftId2) {
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterId(driftId1);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        List<? extends Drift<?, ?>> result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
        if (result.size() != 1) {
            throw new IllegalArgumentException("Drift record not found: " + driftId1);
        }
        Drift drift1 = result.get(0);

        criteria.addFilterId(driftId2);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
        if (result.size() != 1) {
            throw new IllegalArgumentException("Drift record not found: " + driftId2);
        }
        Drift drift2 = result.get(0);
View Full Code Here

                // change set. And we need the definition id to pass to the
                // drift server plugin.
                entityManager.persist(driftDef);
                DriftDefinitionTemplate template = driftDef.getTemplate();
                if (template != null && template.isPinned()) {
                    DriftServerPluginFacet driftServerPlugin = getServerPlugin();
                    driftServerPlugin.copyChangeSet(subject, template.getChangeSetId(), driftDef.getId(), resourceId);
                }
            }
            resource.setAgentSynchronizationNeeded();

            AgentClient agentClient = agentManager.getAgentClient(subjectManager.getOverlord(), resourceId);
View Full Code Here

        criteria.addFilterId(driftId);
        criteria.fetchChangeSet(true);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        DriftDetails driftDetails = new DriftDetails();
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();

        DriftFile newFile = null;
        DriftFile oldFile = null;

        PageList<? extends Drift<?, ?>> results = driftServerPlugin.findDriftsByCriteria(subject, criteria);
        if (results.size() == 0) {
            log.warn("Unable to get the drift details for drift id " + driftId
                + ". No drift object found with that id.");
            return null;
        }

        Drift<?, ?> drift = results.get(0);
        driftDetails.setDrift(drift);
        try {
            switch (drift.getCategory()) {
            case FILE_ADDED:
                newFile = driftServerPlugin.getDriftFile(subject, drift.getNewDriftFile().getHashId());
                driftDetails.setNewFileStatus(newFile.getStatus());
                break;
            case FILE_CHANGED:
                newFile = driftServerPlugin.getDriftFile(subject, drift.getNewDriftFile().getHashId());
                oldFile = driftServerPlugin.getDriftFile(subject, drift.getOldDriftFile().getHashId());

                driftDetails.setNewFileStatus(newFile.getStatus());
                driftDetails.setOldFileStatus(oldFile.getStatus());

                driftDetails.setPreviousChangeSet(loadPreviousChangeSet(subject, drift));
                break;
            case FILE_REMOVED:
                oldFile = driftServerPlugin.getDriftFile(subject, drift.getOldDriftFile().getHashId());
                driftDetails.setOldFileStatus(oldFile.getStatus());
                break;
            }
        } catch (Exception e) {
            log.error("An error occurred while loading the drift details for drift id " + driftId + ": "
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.plugin.pc.drift.DriftServerPluginFacet

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.