Examples of QueryContext


Examples of org.modeshape.jcr.query.QueryContext

                                   RepositoryIndexes indexDefns,
                                   NodeTypes nodeTypes,
                                   PlanHints hints,
                                   Map<String, Object> variables ) {
        final QueryEngine queryEngine = queryEngine();
        final QueryContext queryContext = queryEngine.createQueryContext(context, repositoryCache, workspaceNames,
                                                                         overriddenNodeCachesByWorkspaceName, schemata,
                                                                         indexDefns, nodeTypes, new BufferManager(context),
                                                                         hints, variables);
        final org.modeshape.jcr.query.model.QueryCommand command = (org.modeshape.jcr.query.model.QueryCommand)query;
        return new CancellableQuery() {
            private final Lock lock = new ReentrantLock();
            private QueryResults results;

            @Override
            public QueryResults execute() throws QueryCancelledException, RepositoryException {
                try {
                    lock.lock();
                    if (results == null) {
                        // this will block and will hold the lock until it is done ...
                        results = queryEngine.execute(queryContext, command);
                    }
                    return results;
                } finally {
                    lock.unlock();
                }
            }

            @Override
            public boolean cancel() {
                return queryContext.cancel();
            }
        };
    }
View Full Code Here

Examples of org.neo4j.index.lucene.QueryContext

    }
  }
 
  public void getNodesWithHighPageRank(){
    Index<Node> ix = graphDB.index().forNodes("pageRank");
    QueryContext c = new QueryContext(new Object());
   
    IndexHits<Node> hits;
        hits = ix.query("pr", new QueryContext("*").sort("pr").top(200));
        for (Node hit: hits){
          System.out.println(hit.getProperty("pageRankValue"));
        }
  }
View Full Code Here

Examples of org.saiku.service.util.QueryContext

    tq.getProperties().putAll(cubeProperties);
    if (!context.containsKey(tq.getName())) {
      //Cube cub = olapDiscoverService.getNativeCube(tq.getCube());
      //Query query = new Query(tq.getName(), cub);
      //tq = Thin.convert(query, tq.getCube());
      QueryContext qt = new QueryContext(tq);
      qt.store(ObjectKey.QUERY, tq);
      this.context.put(tq.getName(), qt);
    }
    return tq;
  }
View Full Code Here

Examples of org.saiku.service.util.QueryContext

  }


  CellSet executeInternalQuery(@NotNull ThinQuery query) throws Exception {
    String runId = "RUN#:" + ID_GENERATOR.getAndIncrement();
    QueryContext queryContext = context.get(query.getName());

    if (queryContext == null) {
      queryContext = new QueryContext(query);
      this.context.put(query.getName(), queryContext);
    }

    OlapConnection con = olapDiscoverService.getNativeConnection(query.getCube().getConnection());
    if (StringUtils.isNotBlank(query.getCube().getCatalog())) {
      con.setCatalog(query.getCube().getCatalog());
    }

    if (queryContext.contains(ObjectKey.STATEMENT)) {
      Statement s = queryContext.getStatement();
      s.cancel();
      s.close();
      s = null;
      queryContext.remove();
    }

    OlapStatement stmt = con.createStatement();
    queryContext.store(ObjectKey.STATEMENT, stmt);

    query = updateQuery(query);

    try {
      String mdx = query.getParameterResolvedMdx();
      LOG.info(runId + "\tType:" + query.getType() + ":\n" + mdx);

      CellSet cs = stmt.executeOlapQuery(mdx);
      queryContext.store(ObjectKey.RESULT, cs);
      queryContext.store(ObjectKey.QUERY, query);
      return cs;
    } finally {
      stmt.close();
      queryContext.remove();
    }
  }
View Full Code Here

Examples of org.sonar.server.search.QueryContext

  public void toQueryOptions_load_all_fields() throws Exception {
    RuleMapping mapping = new RuleMapping(languages, macroInterpreter, debtModel);
    SimpleGetRequest request = new SimpleGetRequest();
    request.setParam("p", "1");
    request.setParam("ps", "10");
    QueryContext queryContext = mapping.newQueryOptions(SearchOptions.create(request));

    assertThat(queryContext.getFieldsToReturn()).isEmpty();
  }
View Full Code Here

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

            IRequiredCapability[] requiredCapabilities = popedIU.getRequiredCapabilities();
            for (IRequiredCapability requiredCapability : requiredCapabilities) {
                String namespace = requiredCapability.getNamespace();
                String name = requiredCapability.getName();
                if (IInstallableUnit.NAMESPACE_IU_ID.equals(namespace) && name.endsWith("feature.group") && !name.startsWith("org.eclipse.equinox")) {
                    QueryContext queryContext = new QueryContext();
                    queryContext.setQuery(new InstallableUnitQuery(name, requiredCapability.getRange()));
                    queryContext.setQueryable(queryable);
                    InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
                    IInstallableUnit[] requiredIUs = (ProvisioningUtils.performIUQuery(installedIUQuery));
                    IInstallableUnit requiredIU = (requiredIUs.length == 0) ? null : requiredIUs[0];
                    if (requiredIU != null) {
                        Feature requiredFeature = wrapIU(requiredIU);
View Full Code Here

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

        IRequiredCapability[] requiredCapabilities = featureIU.getRequiredCapabilities();
        for (IRequiredCapability requiredCapability : requiredCapabilities) {
            String namespace = requiredCapability.getNamespace();
            String name = requiredCapability.getName();
            if (IInstallableUnit.NAMESPACE_IU_ID.equals(namespace) && name.endsWith("feature.group") && !name.startsWith("org.eclipse.equinox")) {
                QueryContext queryContext = new QueryContext();
                queryContext.setQuery(new InstallableUnitQuery(name, requiredCapability.getRange()));
                queryContext.setQueryable(queryable);
                InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
                IInstallableUnit requiredIU = ProvisioningUtils.performIUQuery(installedIUQuery)[0];
                if (requiredIU != null) {
                    requiredIUList.add(requiredIU);
                }
View Full Code Here

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

    public static IInstallableUnit[] deriveRepositoryIUsFromFeatures(FeatureInfo[] features) throws ProvisioningException {
        if (features == null) {
            return new IInstallableUnit[0];
        }

        QueryContext queryContext = new QueryContext();
        queryContext.setQueryable(RepositoryUtils.getQuerybleRepositoryManager(null));

        HashMap<String, IInstallableUnit> iuMap = new HashMap<String, IInstallableUnit>();

        for (FeatureInfo featureInfo : features) {
            Collector collector = new Collector();
View Full Code Here

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

        }
        IInstallableUnit[] ius = new IInstallableUnit[features.length];

        for (int i = 0; i < features.length; i++) {
            FeatureInfo feature = features[i];
            QueryContext queryContext = new QueryContext();
            queryContext.setQueryable(ProvisioningUtils.getProfile());
            queryContext.setQuery(new InstallableUnitQuery(feature.getFeatureID(), new VersionRange(feature.getFeatureVersion())));
            InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
            IInstallableUnit[] units = ProvisioningUtils.performIUQuery(installedIUQuery);
            ius[i] = units[0];
        }
        return ius;
View Full Code Here

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

    public static HttpSession getHttpSession(MessageContext messageContext) {
        return (HttpSession) messageContext.getProperty("comp.mgt.servlet.session");
    }

    public static HashMap<String, IInstallableUnit> getInstalledRootUnitsMap() {
        QueryContext queryContext = new QueryContext();
        queryContext.setQueryable(ProvisioningUtils.getProfile());
        InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
        IInstallableUnit[] installedUnits = ProvisioningUtils.performIUQuery(installedIUQuery);
        return getInstalledUnitsMap(installedUnits);
    }
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.