当前位置: 首页>>代码示例>>Java>>正文


Java QueryUtil类代码示例

本文整理汇总了Java中org.eclipse.equinox.p2.query.QueryUtil的典型用法代码示例。如果您正苦于以下问题:Java QueryUtil类的具体用法?Java QueryUtil怎么用?Java QueryUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


QueryUtil类属于org.eclipse.equinox.p2.query包,在下文中一共展示了QueryUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryRepositoryForInstallableUnit

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Queries a repository for a specific {@link IInstallableUnit} (IU).
 *
 * @param repositoryURI the repository URI
 * @param installableUnitID the ID of the IU
 * @return the {@link IQueryResult}
 */
private IQueryResult<IInstallableUnit> queryRepositoryForInstallableUnit(URI repositoryURI, String installableUnitID) {

	// --- Load the repository ------------
	IQueryResult<IInstallableUnit> queryResult = null;
	try {
		IMetadataRepository metadataRepository = this.getMetadataRepositoryManager().loadRepository(repositoryURI, this.getProgressMonitor());
		// --- Query for the IU of interest -----
		if (metadataRepository != null) {
			queryResult = metadataRepository.query(QueryUtil.createIUQuery(installableUnitID), this.getProgressMonitor());
		}
		
	} catch (ProvisionException | OperationCanceledException e) {
		System.err.println("Error loading the repository at " + repositoryURI);
		e.printStackTrace();
	}

	return queryResult;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:P2OperationsHandler.java

示例2: getUpdatedGroups

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
private List<IInstallableUnit> getUpdatedGroups() {
	nullProgressMonitor = new NullProgressMonitor();
	this.agent = agent;

	MetadataRepositoryManager metadataRepositoryManager = new MetadataRepositoryManager(
			agent);

	try {
		loadRepository = metadataRepositoryManager.loadRepository(uri, 0,
				nullProgressMonitor);
	} catch (ProvisionException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	IQuery<IInstallableUnit> createQuery = QueryUtil.createIUGroupQuery();

	IQueryResult<IInstallableUnit> query = loadRepository.query(
			createQuery, nullProgressMonitor);
	List<IInstallableUnit> list = toList(query);
	return list;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:InstallNewSoftwareService.java

示例3: updateForPreferences

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
public void updateForPreferences() {
	IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
	setRepositoriesVisible(prefs
			.getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
	setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
	setShowLatestVersionsOnly(prefs
			.getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
	setGroupByCategory(prefs
			.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
	setShowDrilldownRequirements(prefs
			.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
	setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV));
	setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE));
	int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH);
	int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT);
	setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight));		
	
	if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
	if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(new UserVisibleRootQuery());
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:JSSP2Policy.java

示例4: updateForPreferences

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
public void updateForPreferences() {
		IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
		setRepositoriesVisible(prefs
				.getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
		setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
		setShowLatestVersionsOnly(prefs
				.getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
		setGroupByCategory(prefs
				.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
		setShowDrilldownRequirements(prefs
				.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
		if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
			setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
		else
			setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
		if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
			setVisibleInstalledIUQuery(QueryUtil.ALL_UNITS);
//		else
//			setVisibleInstalledIUQuery(new UserVisibleRootQuery());

	}
 
开发者ID:tmfev,项目名称:IDRT-Import-and-Mapping-Tool,代码行数:22,代码来源:CloudPolicy.java

示例5: findUnit

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Finds the latest version of an installable unit in a repository.
 * 
 * @param spec Version specification
 * @return Installable unit or <code>null</code>.
 * @throws CoreException on failure
 */
public IInstallableUnit findUnit(IVersionedId spec) {
	String id = spec.getId();
	Version version = spec.getVersion();
	VersionRange range = VersionRange.emptyRange;
	if (version != null && !version.equals(Version.emptyVersion))
		range = new VersionRange(version, true, version, true);
	
	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
	IQueryResult<IInstallableUnit> queryResult = getRepository().query(query, new NullProgressMonitor());
	
	Iterator<IInstallableUnit> matches = queryResult.iterator();
	// pick the newest match
	IInstallableUnit newest = null;
	while (matches.hasNext()) {
		IInstallableUnit candidate = matches.next();
		if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0))
			newest = candidate;
	}
	
	return newest;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:29,代码来源:RepositoryAdapter.java

示例6: findUnit

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Returns the latest version of an installable unit in a profile.
 * 
 * @param id Installable unit identifier
 * @return Latest version found or <code>null</code>
 */
public IInstallableUnit findUnit(String id) {
	IInstallableUnit unit = null;
	if (getProfile() != null) {
		IQueryResult<IInstallableUnit> query = getProfile().query(QueryUtil.createIUQuery(id), null);
		Iterator<IInstallableUnit> iter = query.iterator();
		while (iter.hasNext()) {
			IInstallableUnit foundUnit = iter.next();
			if ((unit == null) || (unit.getVersion().compareTo(unit.getVersion()) > 0)) {
				unit = foundUnit;
			}
		}
	}
	
	return unit;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:22,代码来源:ProfileAdapter.java

示例7: findUnitAll

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Finds the latest version of an installable unit in all repositories.
 * 
 * @param spec Version specification
 * @return Installable unit or <code>null</code>.
 * @throws CoreException on failure
 */
public IInstallableUnit findUnitAll(IVersionedId spec) throws CoreException {
	String id = spec.getId();
	if (id == null) {
		Installer.fail(InstallMessages.Error_NoId);
	}
	Version version = spec.getVersion();
	VersionRange range = VersionRange.emptyRange;
	if (version != null && !version.equals(Version.emptyVersion))
		range = new VersionRange(version, true, version, true);
	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
	Iterator<IInstallableUnit> matches = getManager().query(query, null).iterator();
	// pick the newest match
	IInstallableUnit newest = null;
	while (matches.hasNext()) {
		IInstallableUnit candidate = matches.next();
		if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0))
			newest = candidate;
	}
	if (newest == null)
	{
		Installer.fail(InstallMessages.Error_IUNotFound + id);
	}
	return newest;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:32,代码来源:RepositoryManagerAdapter.java

示例8: queryP2Repository

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
private Iterator<IInstallableUnit> queryP2Repository(IProgressMonitor monitor, String updateURL)
		throws URISyntaxException {
	if (monitor == null) {
		monitor = new NullProgressMonitor();
	}

	SubMonitor progress = SubMonitor.convert(monitor, "", 6);
	// get all available IUs in update repository
	IMetadataRepository metadataRepo = null;
	try {
		metadataRepo = metadataRepoManager.loadRepository(new URI(updateURL), progress.newChild(1));
	} catch (ProvisionException e) {
		System.exit(1);
	}
	IQuery<IInstallableUnit> allIUQuery = QueryUtil.createIUAnyQuery();
	IQueryResult<IInstallableUnit> allIUQueryResult = metadataRepo.query(allIUQuery, progress.newChild(1));

	Iterator<IInstallableUnit> iterator = allIUQueryResult.iterator();

	if (progress.isCanceled()) {
		throw new OperationCanceledException();
	}
	return iterator;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:25,代码来源:CheckUpdatesManager.java

示例9: updateForPreferences

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
public void updateForPreferences() {
	IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
	setRepositoriesVisible(prefs
			.getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
	setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
	setShowLatestVersionsOnly(prefs
			.getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
	setGroupByCategory(prefs
			.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
	setShowDrilldownRequirements(prefs
			.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
	if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
	if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(new UserVisibleRootQuery());

}
 
开发者ID:winture,项目名称:wt-studio,代码行数:22,代码来源:CloudPolicy.java

示例10: updateForPreferences

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
public void updateForPreferences(){
	
	IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
	setRepositoriesVisible(prefs.getBoolean(PreferenceConstants.REPOSITORIES_VISIBLE));
	setRestartPolicy(prefs.getInt(PreferenceConstants.RESTART_POLICY));
	setShowLatestVersionsOnly(prefs.getBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY));
	setGroupByCategory(prefs.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
	setShowDrilldownRequirements(prefs
		.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
	setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV));
	setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE));
	int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH);
	int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT);
	setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight));
	
	if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(QueryUtil.createIUGroupQuery());
	if (prefs.getBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES))
		setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
	else
		setVisibleAvailableIUQuery(new UserVisibleRootQuery());
	setContactAllSites(false);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:26,代码来源:ElexisCloudPolicy.java

示例11: checkIfInstalled

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Checks if a specific {@link IInstallableUnit} (IU) is installed
 * 
 * @param installableUnitID The ID of the IU of interest
 * @return true if the IU is installed
 */
public boolean checkIfInstalled(String installableUnitID) {

	// --- Query the p2 profile for the InstallableUnit of interest -----------
	IProfileRegistry profileRegistry = (IProfileRegistry) this.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
	IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(installableUnitID);
	IQueryResult<IInstallableUnit> queryResult = profile.query(query, this.getProgressMonitor());

	return !(queryResult.isEmpty());
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:17,代码来源:P2OperationsHandler.java

示例12: getInstalledFeatures

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
/**
 * Returns the installed features.
 *
 * @return the installed features
 * @throws Exception the exception
 */
public List<IInstallableUnit> getInstalledFeatures() throws Exception {
	if (this.iuList==null) {
		
		IProfileRegistry profileRegistry = (IProfileRegistry) this.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME);
		IProfile profile = null;
		if (this.isDevelopmentMode==true) {
			if (profileRegistry.getProfiles().length>0) {
				profile = profileRegistry.getProfiles()[0];
			}
			
		} else {
			profile = profileRegistry.getProfile(IProfileRegistry.SELF);
		}
		if (profile==null) {
			throw new Exception("Unable to access p2 profile - This is not possible when starting the application from the IDE!");
		}
		
		// --- Create the IU list -------------------------------
		this.iuList = new ArrayList<IInstallableUnit>();
		IQuery<IInstallableUnit> query = QueryUtil.createIUGroupQuery();
		IQueryResult<IInstallableUnit> queryResult = profile.query(query, null);
		
		for (IInstallableUnit feature : queryResult) {
			if (QueryUtil.isProduct(feature) == false) {
				iuList.add(feature);
			}
		}
		
	}
	return iuList;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:38,代码来源:P2OperationsHandler.java

示例13: process

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
public void process ( final IProgressMonitor pm ) throws Exception
{
    this.output.mkdirs ();

    System.out.println ( "Loading metadata..." );
    this.metaRepo = this.metaManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "Loading artifacts..." );
    this.artRepo = this.artManager.loadRepository ( this.repositoryLocation, pm );
    System.out.println ( "done!" );

    for ( final URI uri : this.validationRepositoryUris )
    {
        System.out.format ( "Loading validation repository: %s%n", uri );
        final IMetadataRepository repo = this.metaManager.loadRepository ( uri, pm );
        this.validationRepositories.put ( uri, repo );
        System.out.println ( "Done!" );
    }

    final IQuery<IInstallableUnit> query = QueryUtil.createIUAnyQuery ();
    final IQueryResult<IInstallableUnit> result = this.metaRepo.query ( query, pm );

    for ( final IInstallableUnit iu : result )
    {
        processUnit ( iu, pm );
    }

    writeUploadScript ();

    for ( final Map.Entry<MavenReference, Set<String>> entry : this.metadata.entrySet () )
    {
        writeMetaData ( entry.getKey (), entry.getValue () );
    }

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:35,代码来源:Processor.java

示例14: listInstalledSoftware

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
@Override
public List<IInstallableUnit> listInstalledSoftware(
		IProvisioningAgent agen, int i) {

	this.agent = agen;
	IProfileRegistry service = (IProfileRegistry) agen
			.getService(IProfileRegistry.SERVICE_NAME);

	IQueryable<IInstallableUnit> queryable = service.getProfile("_SELF_");

	if(queryable==null){
		return null;
	}
	NullProgressMonitor monitor = new NullProgressMonitor();
	IQuery<IInstallableUnit> createIU = null;
	if (i == GROUP) {
		createIU = QueryUtil.createIUGroupQuery();
	} else if (i == CATEGORY) {
		createIU = QueryUtil.createIUCategoryQuery();
	} else if (i == ANY) {

		createIU = QueryUtil.createIUAnyQuery();
	}
	IQueryResult<IInstallableUnit> query = queryable.query(createIU,
			monitor);

	List<IInstallableUnit> list = org.ramo.klevis.p2.core.util.Utils
			.toList(query);

	return list;

}
 
开发者ID:cplutte,项目名称:bts,代码行数:33,代码来源:UninstallSoftwareService.java

示例15: extractFromCategory

import org.eclipse.equinox.p2.query.QueryUtil; //导入依赖的package包/类
@Override
public List<IInstallableUnit> extractFromCategory(IInstallableUnit category) {

	IQuery<IInstallableUnit> createIUCategoryMemberQuery = QueryUtil
			.createIUCategoryMemberQuery(category);

	IQueryResult<IInstallableUnit> query = loadRepository.query(
			createIUCategoryMemberQuery, nullProgressMonitor);

	return toList(query);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:InstallNewSoftwareService.java


注:本文中的org.eclipse.equinox.p2.query.QueryUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。