本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
示例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());
}
示例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;
}
示例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 () );
}
}
示例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;
}
示例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);
}