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


Java IQueryResult类代码示例

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


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

示例1: installIU

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
 * Installs an {@link IInstallableUnit} from a p2 repository.
 * 
 * @param installableUnitID the ID of the IU to be installed
 * @param repositoryURI the repository ID
 * @return true if successful
 */
public boolean installIU(String installableUnitID, URI repositoryURI) {

	// --- Make sure the repository is known and enabled ---------
	this.addRepository(repositoryURI);

	// --- Query the repository for the IU of interest -----------
	IQueryResult<IInstallableUnit> queryResult = this.queryRepositoryForInstallableUnit(repositoryURI, installableUnitID);

	if (queryResult.isEmpty() == false) {

		// --- If found, trigger an InstallOperation ---------------
		InstallOperation installOperation = new InstallOperation(this.getProvisioningSession(), queryResult.toSet());
		IStatus result = this.performOperation(installOperation);
		return result.isOK();

	} else {

		// --- If not, print an error message -----------------------
		String errorMessage = "Installable unit " + installableUnitID + " could not be found in the repositoty " + repositoryURI;
		System.err.println(errorMessage);
		return false;

	}

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

示例2: getRepositoryForInstallableUnit

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
 * Gets the repository for the {@link IInstallableUnit} (IU) with the given ID.
 *
 * @param installableUnitID the ID of the IU of interest
 * @return the repository, null if no known repository contains the IU
 */
public URI getRepositoryForInstallableUnit(String installableUnitID) {

	try {
		// --- Get a list of all known repositories ---------------------------------
		IMetadataRepositoryManager metadataRepositoryManager = (IMetadataRepositoryManager) this.getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
		URI[] knownRepositories = metadataRepositoryManager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);
		
		// --- Check if the repository contains an IU with the requested ID ---------
		for (URI repository : knownRepositories) {
			IQueryResult<IInstallableUnit> queryResult = this.queryRepositoryForInstallableUnit(repository, installableUnitID);
			if (queryResult != null && queryResult.isEmpty() == false) {
				return repository;
			}
		}
		
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	// --- No repository containing the IU could be found ---------------------------
	return null;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:29,代码来源:P2OperationsHandler.java

示例3: queryRepositoryForInstallableUnit

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例4: getUpdatedGroups

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例5: findUnit

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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.IQueryResult; //导入依赖的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: queryP2Repository

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例8: filterInstallableUnits

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
private Collection<IInstallableUnit> filterInstallableUnits(String idPrefix, String idSuffix,
		IQueryResult<IInstallableUnit> queryResult, IProgressMonitor monitor) throws OperationCanceledException {
	if (monitor == null) {
		monitor = new NullProgressMonitor();
	}
	Collection<IInstallableUnit> wso2IUs = new ArrayList<IInstallableUnit>();
	Iterator<IInstallableUnit> iterator = queryResult.iterator();
	SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_24, queryResult.toSet().size());

	while (iterator.hasNext()) {
		if (progress.isCanceled()) {
			throw new OperationCanceledException();
		}
		IInstallableUnit iu = iterator.next();
		String versionedID = iu.getId();
		progress.subTask(Messages.UpdateManager_25 + versionedID);
		if (versionedID != null && versionedID.startsWith(idPrefix) && versionedID.endsWith(idSuffix)) {
			wso2IUs.add(iu);
		}
		progress.worked(1);
	}
	return wso2IUs;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:24,代码来源:UpdateManager.java

示例9: checkIfInstalled

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例10: getInstalledFeatures

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例11: process

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例12: listInstalledSoftware

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例13: toList

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
private List<IInstallableUnit> toList(IQueryResult<IInstallableUnit> query) {
	List<IInstallableUnit> list = new ArrayList<IInstallableUnit>();
	for (IInstallableUnit iInstallableUnit : query) {

		System.out.println(iInstallableUnit);
		list.add(iInstallableUnit);

	}
	return list;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:11,代码来源:InstallNewSoftwareService.java

示例14: extractFromCategory

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的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

示例15: toList

import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
public static List<IInstallableUnit> toList(IQueryResult<IInstallableUnit> query) {
	List<IInstallableUnit> list = new ArrayList<IInstallableUnit>();
	for (IInstallableUnit iInstallableUnit : query) {

		System.out.println(iInstallableUnit);
		list.add(iInstallableUnit);

	}
	return list;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:11,代码来源:Utils.java


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