本文整理汇总了Java中org.eclipse.equinox.p2.query.IQueryResult类的典型用法代码示例。如果您正苦于以下问题:Java IQueryResult类的具体用法?Java IQueryResult怎么用?Java IQueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IQueryResult类属于org.eclipse.equinox.p2.query包,在下文中一共展示了IQueryResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getDownloadSize
import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
* Mentor Graphics: Returns the download size of the mirror.
*
* @return Mirror size in bytes.
*/
public long getDownloadSize() {
long size = 0;
Iterator<IArtifactKey> keys = null;
if (keysToMirror != null) {
keys = keysToMirror.iterator();
}
else {
IQueryResult<IArtifactKey> result = source.query(ArtifactKeyQuery.ALL_KEYS, null);
keys = result.iterator();
}
while (keys.hasNext()) {
IArtifactKey key = keys.next();
IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(key);
for (int j = 0; j < descriptors.length; j++) {
String downloadSize = descriptors[j].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE);
if (downloadSize != null) {
size += Long.parseLong(downloadSize);
}
}
}
return size;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:32,代码来源:InstallerMirroring.java
示例17: findMemberUnits
import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
* Finds all required members for an installable unit.
*
* @param parent Parent installable unit
* @param members Filled with the member installable units
*/
public void findMemberUnits(IInstallableUnit parent, List<IInstallableUnit> members) {
members.clear();
// Expression to get required IU's. This expression matches the expression used in
// QueryUtil.matchesRequirementsExpression to get category IU members.
IExpression matchesRequirementsExpression = ExpressionUtil.parse("$0.exists(r | this ~= r)");
IQuery<IInstallableUnit> query = QueryUtil.createMatchQuery(matchesRequirementsExpression,
parent.getRequirements());
IQueryResult<IInstallableUnit> result = getRepository().query(query, null);
Iterator<IInstallableUnit> iter = result.iterator();
while (iter.hasNext()) {
members.add(iter.next());
}
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:20,代码来源:RepositoryAdapter.java
示例18: findUnits
import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
* Returns installable units from a profile.
*
* @param versions Versions for installable units
* @return Installable units
*/
public IInstallableUnit[] findUnits(IVersionedId[] versions) {
ArrayList<IInstallableUnit> units = new ArrayList<IInstallableUnit>();
for (IVersionedId version : versions) {
IQueryResult<IInstallableUnit> query = getProfile().query(QueryUtil.createIUQuery(version), null);
Iterator<IInstallableUnit> iter = query.iterator();
while (iter.hasNext()) {
units.add(iter.next());
}
}
return units.toArray(new IInstallableUnit[units.size()]);
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:20,代码来源:ProfileAdapter.java
示例19: findAllDependentIUs
import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
* Returns all root IU's that require a specified IU in a profile.
*
* Note: This method does not work in all cases.
* @param unit Unit to get dependents for
* @return Dependent units
*
* Note: This routine is known to have problems as it doesn't check for 'strict' dependencies.
*/
public IInstallableUnit[] findAllDependentIUs(IInstallableUnit unit) {
// Dependent units
ArrayList<IInstallableUnit> dependents = new ArrayList<IInstallableUnit>();
// The units left to calculate dependencies for
Stack<IInstallableUnit> unitsToCalculate = new Stack<IInstallableUnit>();
// Start with getting dependencies for specified unit
unitsToCalculate.push(unit);
// Get the units in the profile
IQueryResult<IInstallableUnit> profileUnitsQuery = getProfile().query(QueryUtil.createIUAnyQuery(), null);
IInstallableUnit[] profileUnits = profileUnitsQuery.toArray(IInstallableUnit.class);
// While there are units to get dependents for
while (!unitsToCalculate.empty()) {
// Get units dependent on the specified unit
IInstallableUnit[] children = findDependentIUs(unitsToCalculate.pop(), profileUnits);
for (IInstallableUnit child : children) {
if (!dependents.contains(child)) {
// Add the unit as a dependent
dependents.add(child);
// Push so it's root dependencies are also calculated
unitsToCalculate.add(child);
}
}
}
return dependents.toArray(new IInstallableUnit[dependents.size()]);
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:38,代码来源:ProfileAdapter.java
示例20: findUnit
import org.eclipse.equinox.p2.query.IQueryResult; //导入依赖的package包/类
/**
* Finds the latest version of an installable unit in local repositories.
*
* @param spec Version specification
* @return Installable unit or <code>null</code>.
* @throws CoreException on failure
*/
public IInstallableUnit findUnit(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);
URI[] locations = manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL);
List<IMetadataRepository> queryables = new ArrayList<IMetadataRepository>(locations.length);
for (URI location : locations) {
queryables.add(getManager().loadRepository(location, new NullProgressMonitor()));
}
IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
IQueryable<IInstallableUnit> compoundQueryable = QueryUtil.compoundQueryable(queryables);
IQueryResult<IInstallableUnit> queryResult = compoundQueryable.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,代码行数:39,代码来源:RepositoryManagerAdapter.java
注:本文中的org.eclipse.equinox.p2.query.IQueryResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论