Examples of ProfileModificationAction


Examples of org.wso2.carbon.component.mgt.core.profile.ProfileModificationAction

     * @return an instance of ProvisioningActionResultInfo which contain the result of the review
     * @throws AxisFault if an exception occurs while reviewing the specified provisionging action
     */
    public ProvisioningActionResultInfo reviewProvisioningAction(ProvisioningActionInfo provActionInfo)
            throws AxisFault {
        ProfileModificationAction profModificationAction =
                ProfileModificationActionFactory.getProfileModificationAction(provActionInfo.getActionType());
        if (profModificationAction == null) {
            handleException("Error occured while reviewing provisioning action",
                    "failed.review.prov.action");
        }

        if (log.isDebugEnabled()) {
            log.debug("Reviewing the provisioning action: " + profModificationAction.getActionType());
        }

        ProvisioningActionResultInfo provisioningActionResultInfo = null;
        try {
            //Derive IInstallableUnits from the features to be installed. These are available in added repositories
            IInstallableUnit[] repositoryIUs = ProvWSUtils.deriveRepositoryIUsFromFeatures(
                    provActionInfo.getFeaturesToInstall());
            profModificationAction.setIusToInstall(repositoryIUs);

            //Derive IInstallableUnits from the features to be uninstalled.
            //These features are alread installed, hence available in the profile           
            IInstallableUnit[] profileIUs = ProvWSUtils.deriveProfileIUsFromFeatures(
                    provActionInfo.getFeaturesToUninstall());
            profModificationAction.setIusToUninstall(profileIUs);

            //This is required for revert operations.
            profModificationAction.setTimestamp(provActionInfo.getTimestamp());
            //Review the profile modifiation operation
            ResolutionResult resolutionResult = profModificationAction.reviewProfileChangeAction(
                    ProvisioningUtils.getProfile());
            //Wrap ResolutionResult so that it can be send through the wire.
            provisioningActionResultInfo = ProvWSUtils.wrapResolutionResult(resolutionResult);

            int severity = resolutionResult.getSummaryStatus().getSeverity();
            if (severity == IStatus.ERROR) {
                provisioningActionResultInfo.setProceedWithInstallation(false);
                if (log.isDebugEnabled()) {
                    log.debug("Failed to proceed with the provisioning action due an error," +
                            resolutionResult.getSummaryReport());
                }
            } else {
                provisioningActionResultInfo.setProceedWithInstallation(true);
                ProvWSUtils.saveResolutionResult(profModificationAction.getActionType(), resolutionResult,
                        MessageContext.getCurrentMessageContext());
                if (log.isDebugEnabled()) {
                    log.debug("Successfully reviewed the provisioning action");
                }
            }
View Full Code Here

Examples of org.wso2.carbon.component.mgt.core.profile.ProfileModificationAction

        int uninstallableFeatures = 0;
        List<ProfileHistory> profileHistoryList = new ArrayList<ProfileHistory>();
        try {
            long[] timestamps = ProvisioningUtils.getProfileTimestamps(IProfileRegistry.SELF);

            ProfileModificationAction profModificationAction =
                    ProfileModificationActionFactory.getProfileModificationAction(
                            ProfileModificationActionFactory.REVERT_ACTION);

            for (long timestamp : timestamps) {
                profModificationAction.setTimestamp(timestamp);
                ResolutionResult resolutionResult = profModificationAction.reviewProfileChangeAction(
                        ProvisioningUtils.getProfile());

                if (resolutionResult.getReviewedInstallableUnits() != null) {
                    installableFeatures = resolutionResult.getReviewedInstallableUnits().length;
                }
View Full Code Here

Examples of org.wso2.carbon.component.mgt.core.profile.ProfileModificationAction

                iusToUninstall.add(iu);
            }
        }

        //Uninstalling all the composite features.
        ProfileModificationAction profModificationAction =
                ProfileModificationActionFactory.getProfileModificationAction(
                        ProfileModificationActionFactory.UNINSTALL_ACTION);
        profModificationAction.setIusToUninstall(iusToUninstall.toArray(new IInstallableUnit[iusToUninstall.size()]));

        ResolutionResult resolutionResult = profModificationAction.reviewProfileChangeAction(
                ProvisioningUtils.getProfile());
        ProvisioningUtils.performProvisioningAction(resolutionResult);

        //Installing server, console and common features depending on the action
        profModificationAction =
                ProfileModificationActionFactory.getProfileModificationAction(
                        ProfileModificationActionFactory.INSTALL_ACTION);
        profModificationAction.setIusToInstall(iusToInstall.toArray(new IInstallableUnit[iusToInstall.size()]));

        resolutionResult = profModificationAction.reviewProfileChangeAction(
                ProvisioningUtils.getProfile());
        ProvisioningUtils.performProvisioningAction(resolutionResult);
    }
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.