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

Examples of org.wso2.carbon.component.mgt.core.query.QueryContext


        }
        return installedUnitsMap;
    }

    public static HashMap<String, IInstallableUnit> getAllInstalledUnitsMap() {
        QueryContext queryContext = new QueryContext();
        IInstallableUnit[] installedUnits = ProvisioningUtils.getAllInstalledIUs(queryContext);
        return getInstalledUnitsMap(installedUnits);
    }
View Full Code Here


     * @param features - list of features
     * @return - true if all are installed, else false
     */
    public static boolean areAllFeaturesInstalled(List<Feature> features) {
        for (Feature feature : features) {
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(feature.getId(),
                    feature.getVersionRange()));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] installableUnits = ProvisioningUtils.
                    performIUQuery(installedIUQuery);
            if (installableUnits == null || installableUnits.length == 0) {
View Full Code Here

     * @throws AxisFault if an exception occurs while quering the list of features.
     */
    public Feature[] getAllInstalledFeatures() throws AxisFault {
        Feature[] features = null;
        try {
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            features = ProvWSUtils.wrapInstalledFeatures(ProvisioningUtils.performIUQuery(installedIUQuery),
                    queryContext.getQueryable());
        } catch (Exception e) {
            handleException("Error occured quering installed features",
                    "failed.get.installed.features", e);
        }
        return features;
View Full Code Here

     * @throws AxisFault if an exception occurs while quering specified feature information
     */
    public FeatureInfo getInstalledFeatureInfo(String featureID, String featureVersion) throws AxisFault {
        FeatureInfo featureInfo = null;
        try {
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(featureID, Version.create(featureVersion)));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] installableUnits = ProvisioningUtils.performIUQuery(installedIUQuery);
            if (installableUnits == null || installableUnits.length == 0) {
                log.error("Error occured while quering feature information :" + featureID + "-" + featureVersion);
                throw new AxisFault("failed.get.feature.information");
View Full Code Here

    private void removeConsoleOrServerFeatures(String propertyValue) throws Exception {
        List<IInstallableUnit> iusToUninstall = new ArrayList<IInstallableUnit>();
        List<IInstallableUnit> iusToInstall = new ArrayList<IInstallableUnit>();

        QueryContext queryContext = new QueryContext();
        IInstallableUnit[] allInstalledIUs = ProvisioningUtils.getAllInstalledIUs(queryContext);
        for (IInstallableUnit iu : allInstalledIUs) {
            String categoryPropValue = iu.getProperty("org.wso2.carbon.p2.category.type");

            if (iu.getId().startsWith("org.eclipse.equinox")) {
View Full Code Here

        Feature[] features = null;
        try {
            if (location != null) {
                repoURI = new URI(location);
            }
            QueryContext queryContext = new QueryContext();
            queryContext.setShowLatestVersionsOnly(showOnlyTheLatestFeatures);
            queryContext.setQueryable(RepositoryUtils.getQuerybleRepositoryManager(repoURI));
            AvailableIUQuery availableIUQuery = new AvailableIUQuery(queryContext);
            IInstallableUnit[] installableUnits = ProvisioningUtils.performIUQuery(availableIUQuery);
            features = ProvWSUtils.wrapAvailableFeatures(installableUnits, queryContext.getQueryable());
        } catch (URISyntaxException e) {
            handleException("Invalid Repository Location :" + location, "invalid.repo.location", e);
        } catch (Exception e) {
            handleException("Error occured while quering installable features",
                    "failed.get.installable.features", e);
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

TOP

Related Classes of org.wso2.carbon.component.mgt.core.query.QueryContext

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.