Package org.wso2.carbon.component.mgt.core

Examples of org.wso2.carbon.component.mgt.core.ResolutionResult


                    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;
                }

                if (resolutionResult.getReviewedUninstallableUnits() != null) {
                    uninstallableFeatures = resolutionResult.getReviewedUninstallableUnits().length;
                }

                if (installableFeatures != 0 || uninstallableFeatures != 0) {
                    profileHistoryList.add(ProvWSUtils.getProfileHistoryFromTimestamp(timestamp));
                }
View Full Code Here


        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 =
View Full Code Here

                                                     ProvisioningPlan plan,
                                                     MultiStatus originalStatus)
            throws ProvisioningException {
        IEngine engine = ServiceHolder.getP2Engine();

        ResolutionResult report = new ResolutionResult();
        report.setProvisioningPlan(plan);

        if (nothingToDo(originalRequest)) {
            report.addSummaryStatus(new Status(IStatus.ERROR, "temp", 10050,
                    "Cannot complete the request.  See the error log for details.", null));
            IStatus[] details = originalStatus.getChildren();
            for (IStatus detail : details) {
                report.addSummaryStatus(detail);
            }
            return report;
        }

        // If there was already some status supplied before resolution, this should get included
        // with the report.
        if (originalStatus != null && originalStatus.getChildren().length > 0) {
            report.addSummaryStatus(originalStatus);
        }

        // If the overall plan had a non-OK status, capture that in the report.
        if (!plan.getStatus().isOK()) {
            report.addSummaryStatus(plan.getStatus());
        }

        // Now we compare what was requested with what is going to happen.
        if (plan.getStatus().getSeverity() != IStatus.ERROR) {
            IInstallableUnit[] iusAdded = originalRequest.getAddedInstallableUnits();
            for (IInstallableUnit anIusAdded : iusAdded) {
                RequestStatus rs = plan.getRequestStatus(anIusAdded);
                if (rs.getSeverity() == IStatus.ERROR) {
                    // This is a serious error so it must also appear in the overall status
                    IStatus fail = new Status(IStatus.ERROR, "temp", 10011, anIusAdded.getId() +
                            " is not applicable to the current configuration and will not be installed.", null);
                    report.addStatus(anIusAdded, fail);
                    report.addSummaryStatus(fail);
                    report.addFailedInstallableUnit(anIusAdded);
                } else {
                    report.addReviewedInstallableUnit(anIusAdded);
                }
            }
            IInstallableUnit[] iusRemoved = originalRequest.getRemovedInstallableUnits();
            for (IInstallableUnit anIusRemoved : iusRemoved) {
                RequestStatus rs = plan.getRequestStatus(anIusRemoved);
                if (rs.getSeverity() == IStatus.ERROR) {
                    // We are making assumptions here about why the planner chose to ignore an uninstall.
                    IStatus fail = new Status(IStatus.INFO, "temp", 10007, anIusRemoved.getId() +
                            " cannot be fully uninstalled because other installed software requires it.  " +
                            "The parts that are not required will be uninstalled.", null);
                    report.addStatus(anIusRemoved, fail);
                    report.addSummaryStatus(fail);
                    report.addFailedUninstallableUnit(anIusRemoved);
                } else {
                    report.addReviewedUninstallableUnit(anIusRemoved);
                }
            }
        }

        // Now process the side effects
        Map sideEffects = plan.getSideEffectChanges();
        for (Object o : sideEffects.keySet()) {
            IInstallableUnit iu = (IInstallableUnit) o;
            RequestStatus rs = (RequestStatus) sideEffects.get(iu);
            if (rs.getInitialRequestType() == RequestStatus.ADDED) {
                report.addStatus(iu, new Status(rs.getSeverity(), "temp", 10010, iu.getId() +
                        " will also be installed in order to complete this operation.", null));
                report.addReviewedInstallableUnit(iu);
            } else {
                report.addStatus(iu, new Status(rs.getSeverity(), "temp", 10009, iu.getId() +
                        " must be uninstalled in order to complete this operation.", null));
                report.addReviewedUninstallableUnit(iu);
            }
        }

        long size = 0;
        if (report.getReviewedInstallableUnits().length != 0) {
            size = getSize(plan,
                    plan.getProfileChangeRequest().getProfile(), engine, new ProvisioningContext(), null);
        }
        report.setInstallationSize(getFormattedSize(size));
        return report;
    }
View Full Code Here

    private int ownerTenantId;
    private CacheManagerFactoryImpl cacheManagerFactory;

    public HazelcastCacheManager(String name, CacheManagerFactoryImpl cacheManagerFactory) {
        this.cacheManagerFactory = cacheManagerFactory;
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        if (carbonContext == null) {
            throw new IllegalStateException("CarbonContext cannot be null");
        }
        ownerTenantDomain = carbonContext.getTenantDomain();
        if (ownerTenantDomain == null) {
            throw new IllegalStateException("Tenant domain cannot be " + ownerTenantDomain);
        }
        ownerTenantId = carbonContext.getTenantId();
        if (ownerTenantId == MultitenantConstants.INVALID_TENANT_ID) {
            throw new IllegalStateException("Tenant ID cannot be " + ownerTenantId);
        }
        this.name = name;
        status = Status.STARTED;
View Full Code Here

    private long capacity = CachingConstants.DEFAULT_CACHE_CAPACITY;
    private EvictionAlgorithm evictionAlgorithm = CachingConstants.DEFAULT_EVICTION_ALGORITHM;

    public CacheImpl(String cacheName, CacheManager cacheManager) {
        CarbonContext carbonContext = CarbonContext.getThreadLocalCarbonContext();
        if (carbonContext == null) {
            throw new IllegalStateException("CarbonContext cannot be null");
        }
        ownerTenantDomain = carbonContext.getTenantDomain();
        if (ownerTenantDomain == null) {
            throw new IllegalStateException("Tenant domain cannot be " + ownerTenantDomain);
        }
        ownerTenantId = carbonContext.getTenantId();
        if (ownerTenantId == MultitenantConstants.INVALID_TENANT_ID) {
            throw new IllegalStateException("Tenant ID cannot be " + ownerTenantId);
        }
        this.cacheName = cacheName;
        this.cacheManager = cacheManager;
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here

TOP

Related Classes of org.wso2.carbon.component.mgt.core.ResolutionResult

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.