本文整理汇总了Java中org.eclipse.equinox.p2.core.ProvisionException类的典型用法代码示例。如果您正苦于以下问题:Java ProvisionException类的具体用法?Java ProvisionException怎么用?Java ProvisionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProvisionException类属于org.eclipse.equinox.p2.core包,在下文中一共展示了ProvisionException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: queryRepositoryForInstallableUnit
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的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.core.ProvisionException; //导入依赖的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: queryP2Repository
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的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
示例4: getAgent
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
public static IProvisioningAgent getAgent ( final URI location ) throws ProvisionException
{
final IProvisioningAgentProvider provider = INSTANCE.tracker.getService ();
if ( provider == null )
{
throw new IllegalStateException ( "Provisioning agent provider not found. Is P2 started?" );
}
return provider.createAgent ( location );
}
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:Activator.java
示例5: compareToDestination
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Takes an IArtifactDescriptor descriptor and the ProvisionException that was thrown when destination.getOutputStream(descriptor)
* and compares descriptor to the duplicate descriptor in the destination.
*
* Callers should verify the ProvisionException was thrown due to the artifact existing in the destination before invoking this method.
* @param descriptor
* @return the status of the compare
*/
private IStatus compareToDestination(IArtifactDescriptor descriptor) {
IArtifactDescriptor[] destDescriptors = destination.getArtifactDescriptors(descriptor.getArtifactKey());
IArtifactDescriptor destDescriptor = null;
for (int i = 0; destDescriptor == null && i < destDescriptors.length; i++) {
if (destDescriptors[i].equals(descriptor))
destDescriptor = destDescriptors[i];
}
if (destDescriptor == null)
return new Status(IStatus.INFO, Activator.ID, ProvisionException.ARTIFACT_EXISTS, Messages.Mirroring_noMatchingDescriptor, null);
return compare(source, descriptor, destination, destDescriptor);
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:20,代码来源:InstallerMirroring.java
示例6: createProfile
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Creates a profile.
*
* @param profileId Profile identifier
* @return Profile
* @throws ProvisionException on failure
*/
public IProfile createProfile(String profileId) throws ProvisionException {
IProfileRegistry profileRegistry = (IProfileRegistry)getAgent().getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(profileId);
// Note: On uninstall, the profile will always be available
if (profile == null) {
Map<String, String> properties = new HashMap<String, String>();
// Install location - this is where the p2 directory will be located
properties.put(IProfile.PROP_INSTALL_FOLDER, getInstallLocation().toString());
// Environment
EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Installer.getDefault().getContext(), EnvironmentInfo.class.getName());
String env = "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
properties.put(IProfile.PROP_ENVIRONMENTS, env);
// Profile identifier
properties.put(IProfile.PROP_NAME, profileId);
// Cache location - this is where features and plugins will be deployed
properties.put(IProfile.PROP_CACHE, getInstallLocation().toOSString());
// Set roaming. This will put a path relative to the OSGi configuration area in the config.ini
// so that the installation can be moved. Without roaming, absolute paths will be written
// to the config.ini and Software Update will not work correctly for a moved installation.
properties.put(IProfile.PROP_ROAMING, Boolean.TRUE.toString());
// Profile properties specified in install description
if (Installer.getDefault().getInstallManager().getInstallDescription().getProfileProperties() != null)
properties.putAll(Installer.getDefault().getInstallManager().getInstallDescription().getProfileProperties());
profile = profileRegistry.addProfile(profileId, properties);
}
return profile;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:37,代码来源:RepositoryManager.java
示例7: getInstallProfile
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Returns the profile for this installation. The profile is created if
* necessary.
*
* @return Profile Profile or <code>null</code> if no install location was specified
* @throws ProvisionException on failure to create the profile
*/
public IProfile getInstallProfile() throws ProvisionException {
IProfile profile = null;
if (getInstallLocation() != null) {
String profileId = getProfileId();
profile = getProfile(profileId);
if (profile == null) {
profile = createProfile(profileId);
}
}
return profile;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:21,代码来源:RepositoryManager.java
示例8: initializeRepositoryData
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Sets up the p2 repository
*
* @param repoLocation the string representation of a valid p2 repository
*/
public boolean initializeRepositoryData(String repoLocation){
File f = new File(repoLocation);
repositoryURI = f.toURI();
repositoryIUs = new ArrayList<IInstallableUnit>();
try{
metaRepo = InstallUtils.loadRepository(agent, repositoryURI);
repositoryIUs = InstallUtils.generateIUList(metaRepo);
}
catch(ProvisionException pe){
return false;
//pe.printStackTrace();
}
return true;
}
开发者ID:Pro-Nouns,项目名称:LinGUIne,代码行数:20,代码来源:P2Data.java
示例9: loadRepository
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Establishes all the repositories and repository managers needed for the install job
*
* @param agent the current ProvisioningAgent
* @param repositoryLocation the valid p2 repository location
* @return metadata repository object from a valid p2 repository
* @throws ProvisionException
*/
@SuppressWarnings("restriction")
public static IMetadataRepository loadRepository(IProvisioningAgent agent, URI repositoryLocation) throws ProvisionException{
final ProvisioningUI ui = ProvUIActivator.getDefault().getProvisioningUI();
IArtifactRepositoryManager artifactManager = ProvUI.getArtifactRepositoryManager(ui.getSession());
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
artifactManager.addRepository(repositoryLocation);
IMetadataRepository repository = manager.loadRepository(repositoryLocation, new NullProgressMonitor());
return repository;
}
开发者ID:Pro-Nouns,项目名称:LinGUIne,代码行数:18,代码来源:InstallUtils.java
示例10: findSources
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
@Override
public IPath findSources(File jar, IProgressMonitor monitor) {
if (!BundleUtil.isBundle(jar)) {
return null;
}
IArtifactKey artifactKey = BundleUtil.getArtifactKey(jar);
if (artifactKey == null || blackList.contains(artifactKey.getId())) {
return null;
}
IArtifactKey sourceKey = BundleUtil.toSourceKey(artifactKey);
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
List<URI> uris = Arrays
.asList(provisioningUI.getRepositoryTracker().getKnownRepositories(provisioningUI.getSession()));
Collections.sort(uris);// stupid trick to make eclipse.org repos being
// searched almost first
Path cacheFolder = SourceLookupPreferences.getInstance().getDownloadedSourcesDirectory();
for (URI repo : uris) {
if (monitor.isCanceled()) {
return null;
}
IArtifactRepository artifactRepo = null;
try {
artifactRepo = provisioningUI.loadArtifactRepository(repo, false, monitor);
} catch (ProvisionException ignored) {
ignored.printStackTrace();
// local urls seem to fail
}
if (artifactRepo == null || !artifactRepo.contains(sourceKey)) {
continue;
}
IArtifactDescriptor[] results = artifactRepo.getArtifactDescriptors(sourceKey);
if (results.length > 0) {
try {
return saveArtifact(artifactRepo, results[0], cacheFolder, monitor);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return null;
}
开发者ID:fbricon,项目名称:pde.source.lookup,代码行数:46,代码来源:P2SourceLocator.java
示例11: loadRepository
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
@Override
public synchronized List<IInstallableUnit> loadRepository(String uriString,
IProvisioningAgent agent) {
uri = null;
nullProgressMonitor = new NullProgressMonitor();
this.agent = agent;
if (!containsString(uriString, "http", false)
&& !(uriString.contains(".jar") || uriString.contains(".zip"))) {
uri = new File(uriString).toURI();
}
if (uri == null)
System.out.println("InstallNewSoftwareService uri " + uriString);
try {
uri = new URI(uriString);
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
MetadataRepositoryManager metadataRepositoryManager = new MetadataRepositoryManager(
agent);
try {
loadRepository = metadataRepositoryManager.loadRepository(uri,
IRepositoryManager.REPOSITORIES_ALL, nullProgressMonitor);
} catch (ProvisionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
IQuery<IInstallableUnit> createQuery = QueryUtil
.createIUAnyQuery();
// createIUCategoryQuery();
IQueryResult<IInstallableUnit> query = loadRepository.query(
createQuery, nullProgressMonitor);
List<IInstallableUnit> list = toList(query);
return list;
}
开发者ID:cplutte,项目名称:bts,代码行数:48,代码来源:InstallNewSoftwareService.java
示例12: mirror
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
private IStatus mirror(IArtifactDescriptor sourceDescriptor, boolean verbose) {
if (!includePacked && IArtifactDescriptor.FORMAT_PACKED.equals(sourceDescriptor.getProperty(IArtifactDescriptor.FORMAT)))
return Status.OK_STATUS;
IArtifactDescriptor targetDescriptor = raw ? sourceDescriptor : new ArtifactDescriptor(sourceDescriptor);
IArtifactDescriptor baselineDescriptor = getBaselineDescriptor(sourceDescriptor);
if (verbose)
System.out.println("Mirroring: " + sourceDescriptor.getArtifactKey() + " (Descriptor: " + sourceDescriptor + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MultiStatus compareStatus = new MultiStatus(Activator.ID, IStatus.OK, null, null);
boolean comparing = compare && !compareExclusions.contains(sourceDescriptor);
if (comparing) {
if (baselineDescriptor != null) {
//compare source & baseline
compareStatus.add(compare(baseline, baselineDescriptor, source, sourceDescriptor));
//compare baseline & destination
if (destination.contains(baselineDescriptor)) {
compareStatus.add(compareToDestination(baselineDescriptor));
return compareStatus;
}
} else if (destination.contains(targetDescriptor)) {
compareStatus.add(compareToDestination(sourceDescriptor));
return compareStatus;
}
}
//from source or baseline
IArtifactRepository sourceRepository = baselineDescriptor != null ? baseline : source;
sourceDescriptor = baselineDescriptor != null ? baselineDescriptor : sourceDescriptor;
targetDescriptor = baselineDescriptor != null ? baselineDescriptor : targetDescriptor;
IStatus status = null;
if (!destination.contains(targetDescriptor))
//actual download
status = downloadArtifact(sourceRepository, targetDescriptor, sourceDescriptor);
else {
String message = NLS.bind(Messages.mirror_alreadyExists, sourceDescriptor, destination);
status = new Status(IStatus.INFO, Activator.ID, ProvisionException.ARTIFACT_EXISTS, message, null);
}
if (comparing) {
compareStatus.add(status);
return compareStatus;
}
return status;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:47,代码来源:InstallerMirroring.java
示例13: loadCacheRepository
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Loads the cache repository if it is available. If the cache repository has already been loaded then it will be
* refreshed.
*
* @return <code>true</code> if cache repository was loaded.
* @throws ProvisionException on provisioning failure.
* @throws OperationCanceledException if operation was cancelled.
*/
private synchronized boolean loadCacheRepository() throws ProvisionException, OperationCanceledException {
boolean loaded = false;
IPath cacheLocation = getCacheLocation();
if (cacheLocation != null) {
// If cache repository is already loaded then refresh it
if ((cacheMetadataRepository != null) && (cacheArtifactRepository != null)) {
getMetadataRepositoryManager().refreshRepository(cacheMetadataRepository.getLocation(), null);
getArtifactRepositoryManager().refreshRepository(cacheArtifactRepository.getLocation(), null);
loaded = true;
}
// Load the cache repository
else {
File cacheFile = cacheLocation.toFile();
if (cacheFile.exists()) {
// Cache location (co-located)
URI repositoryLocation = cacheFile.toURI();
fireRepositoryStatus(IInstallRepositoryListener.RepositoryStatus.loadingStarted);
try {
getMetadataRepositoryManager().addRepository(repositoryLocation);
cacheMetadataRepository = getMetadataRepositoryManager().loadRepository(repositoryLocation, null);
if (cacheMetadataRepository != null) {
getArtifactRepositoryManager().addRepository(repositoryLocation);
cacheArtifactRepository = getArtifactRepositoryManager().loadRepository(repositoryLocation, null);
loaded = true;
}
}
catch (Exception e) {
unloadCacheRepository();
fireRepositoryError(repositoryLocation, e.getLocalizedMessage());
throw e;
}
}
}
// Load components
if (loaded) {
// Load components available in cache repository
IInstallComponent[] components = loadComponents(cacheMetadataRepository);
if (components.length > 0) {
// Mark the components as coming from the cache
for (IInstallComponent component : components) {
component.setProperty(PROPERTY_CACHE, Boolean.TRUE.toString());
}
// Fire notification
fireComponentsChanged();
}
fireRepositoryStatus(IInstallRepositoryListener.RepositoryStatus.loadingCompleted);
}
}
return loaded;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:67,代码来源:RepositoryManager.java
示例14: addInstallComponent
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Adds a new install component for an installable unit. If the installable
* unit is a category, it's member units will also be added.
*
* @param unit Installable unit
* @param parentGroup Parent component or <code>null</code>
* @return Added components or <code>null</code> if the component has already been added
* @throws ProvisionException on failure
*/
private List<IInstallComponent> addInstallComponent(IInstallableUnit unit, InstallComponent parentGroup) throws ProvisionException {
IInstallComponent existingComponent = getInstallComponent(unit.getId());
ArrayList<IInstallComponent> addedComponents = new ArrayList<IInstallComponent>();
InstallComponent component = null;
// Category IU
boolean isCategory = isCategoryIu(unit);
// If there is an existing component for the unit
if (existingComponent != null) {
// If category, add to existing component
if (isCategory)
component = (InstallComponent)existingComponent;
// Else do not allow duplicates units
else
return null;
}
// Create component
if (component == null) {
component = new InstallComponent(unit);
}
// If category unit, add members
if (isCategory) {
IQuery<IInstallableUnit> categoryQuery = QueryUtil.createIUCategoryMemberQuery(unit);
IQueryResult<IInstallableUnit> query = getMetadataRepositoryManager().query(categoryQuery, null);
Iterator<IInstallableUnit> iter = query.iterator();
while (iter.hasNext()) {
IInstallableUnit categoryMemberUnit = iter.next();
List<IInstallComponent> members = addInstallComponent(categoryMemberUnit, component);
if (members != null) {
addedComponents.addAll(members);
}
}
}
// Add component
if (existingComponent == null) {
if (parentGroup != null) {
parentGroup.addComponent(component);
}
// Set component parent
component.setParent(parentGroup);
// Add component
components.add(component);
addedComponents.add(component);
}
return addedComponents;
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:61,代码来源:RepositoryManager.java
示例15: checkForAvailableUpdates
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Finds available WSO2 features in current profile and search for updates
* to them in WSO2 p2 repository for updates.
*
* @param monitor
* @throws Exception
*/
public void checkForAvailableUpdates(IProgressMonitor monitor) throws Exception {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_18, 6);
// get all available IUs in update repository
IMetadataRepository metadataRepo = null;
try {
metadataRepo = metadataRepoManager.loadRepository(getDevStudioUpdateSite(), progress.newChild(1));
} catch (ProvisionException e) {
UpdateMetaFileReaderJob.promptUserError(
"The P2 Does not existed at the given location, please set the update/releases P2 for Developer Studio in the Preference Store",
"P2 Repository Error");
throw e;
}
IQuery<IInstallableUnit> allIUQuery = QueryUtil.createIUAnyQuery();
IQueryResult<IInstallableUnit> allIUQueryResult = metadataRepo.query(allIUQuery, progress.newChild(1));
// read artifact repository for updates
IArtifactRepository artifactRepo = artifactRepoManager.loadRepository(getDevStudioUpdateSite(),
progress.newChild(1));
// read meta-data of all available features
Map<String, EnhancedFeature> unsortedMap = loadWSO2FeaturesInRepo(artifactRepo, allIUQueryResult,
progress.newChild(1));
// sort the map in alphabetical order
Map<String, EnhancedFeature> allFeaturesInUpdateRepo = new TreeMap<String, EnhancedFeature>(unsortedMap);
// get all installed wso2 features
Collection<IInstallableUnit> installedWSO2Features = getInstalledWSO2Features(progress.newChild(1));
installedWSO2FeaturesMap = new HashMap<String, IInstallableUnit>();
for (IInstallableUnit iInstallableUnit : installedWSO2Features) {
installedWSO2FeaturesMap.put(iInstallableUnit.getId(), iInstallableUnit);
}
if (progress.isCanceled()) {
throw new OperationCanceledException();
}
URI[] repos = new URI[] { getDevStudioUpdateSite() };
updateOperation = new UpdateOperation(session, installedWSO2Features);
updateOperation.getProvisioningContext().setArtifactRepositories(repos);
updateOperation.getProvisioningContext().setMetadataRepositories(repos);
// resolve update operation
IStatus status = updateOperation.resolveModal(progress.newChild(1));
// user cancelled the job while resolving
if (status.getSeverity() == IStatus.CANCEL || progress.isCanceled()) {
throw new OperationCanceledException();
}
// there is nothing to update
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
featuresWithPossibleUpdates = new HashMap<String, EnhancedFeature>();
log.info(Messages.UpdateManager_19);
} else if (status.getSeverity() == IStatus.ERROR) { // resolution errors
// something wrong with the updates
log.info(Messages.UpdateManager_20);
} else {
// good to proceed installing updates
setPossibleUpdates(updateOperation.getPossibleUpdates(), allFeaturesInUpdateRepo);
}
// sort the available updates in alphabetical order
}
开发者ID:wso2,项目名称:developer-studio,代码行数:73,代码来源:UpdateManager.java
示例16: checkForAvailableFeatures
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Searches available features in WSO2 p2 repository for the current version
* of Developer Studio and filters new features that can be installed.
*
* @param monitor
* @throws Exception
*/
public void checkForAvailableFeatures(IProgressMonitor monitor) throws Exception {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_21, 5);
// get all available IUs in release repository
IMetadataRepository metadataRepository = null;
try {
metadataRepository = metadataRepoManager.loadRepository(getDevStudioReleaseSite(), progress.newChild(1));
} catch (ProvisionException e) {
UpdateMetaFileReaderJob.promptUserError(
"The P2 Does not existed at the given location, please set the update/releases P2 for Developer Studio in the Preference Store",
"P2 Repository Error");
throw e;
}
IQuery<IInstallableUnit> allIUQuery = QueryUtil.createIUAnyQuery();
IQueryResult<IInstallableUnit> allIUQueryResult = metadataRepository.query(allIUQuery, progress.newChild(1));
// load artifact repository for releases
IArtifactRepository artifactRepository = artifactRepoManager.loadRepository(getDevStudioReleaseSite(),
progress.newChild(1));
// read meta-data of all available features
Map<String, EnhancedFeature> allFeaturesInReleaseRepo = loadWSO2FeaturesInRepo(artifactRepository,
allIUQueryResult, progress.newChild(1));
Collection<IInstallableUnit> filteredIUs = filterInstallableUnits(WSO2_FEATURE_PREFIX, FEATURE_GROUP_IU_ID_SFX,
allIUQueryResult, progress.newChild(1));
allAvailableFeatures = new HashMap<String, IInstallableUnit>();
unsortedAvailableNewFeatures = new HashMap<String, EnhancedFeature>();
for (IInstallableUnit iInstallableUnit : filteredIUs) {
allAvailableFeatures.put(iInstallableUnit.getId(), iInstallableUnit);
if (!installedWSO2FeaturesMap.containsKey(iInstallableUnit.getId())) {
unsortedAvailableNewFeatures.put(iInstallableUnit.getId(),
allFeaturesInReleaseRepo.get(iInstallableUnit.getId()));
} else {
Version versionInstalled = installedWSO2FeaturesMap.get(iInstallableUnit.getId()).getVersion();
// if the version we have is greater than the installed version
// view it in the available feature list
if (versionInstalled != null && (iInstallableUnit.getVersion().compareTo(versionInstalled) == 1)) {
unsortedAvailableNewFeatures.put(iInstallableUnit.getId(),
allFeaturesInReleaseRepo.get(iInstallableUnit.getId()));
}
}
}
// sort the available new features according to alphabetical order
availableNewFeatures = new TreeMap<String, EnhancedFeature>(unsortedAvailableNewFeatures);
}
开发者ID:wso2,项目名称:developer-studio,代码行数:57,代码来源:UpdateManager.java
示例17: loadWSO2FeaturesInRepo
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
private Map<String, EnhancedFeature> loadWSO2FeaturesInRepo(IArtifactRepository artifactRepository,
IQueryResult<IInstallableUnit> allAvailableIUs, IProgressMonitor monitor)
throws ProvisionException, URISyntaxException, IOException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateManager_15, 10);
String tmpRoot = System.getProperty(JAVA_IO_TMPDIR) + File.separator + DEVS_UPDATER_TMP;
Collection<IInstallableUnit> wso2FeatureJars = filterInstallableUnits(WSO2_FEATURE_PREFIX,
FEATURE_JAR_IU_ID_SFX, allAvailableIUs, progress.newChild(1));
Map<String, EnhancedFeature> loadedFeatureMap = new HashMap<>();
for (IInstallableUnit iu : wso2FeatureJars) {
SubMonitor downloadProgress = SubMonitor.convert(progress, Messages.UpdateManager_16,
wso2FeatureJars.size() * 2);
Collection<IArtifactKey> artifacts = iu.getArtifacts();
// ideally there should be only one artifact in a feature.jar iu
for (IArtifactKey iArtifactKey : artifacts) {
IArtifactDescriptor[] artifactDescriptors = artifactRepository.getArtifactDescriptors(iArtifactKey);
File featureCacheRoot = new File(tmpRoot, iu.getId() + File.separator + iu.getVersion().toString());
File cachedFeatureDir = new File(featureCacheRoot, FEATURE_JAR_EXTRCT_FOLDER);
if (cachedFeatureDir.exists() && cachedFeatureDir.isDirectory()) {
downloadProgress.worked(2);
} else {
featureCacheRoot.mkdirs();
File jarFile = new File(featureCacheRoot, iu.getId());
try {
if (jarFile.exists()) {
// something is wrong with the file
// if it is there without the cache dir.
jarFile.delete();
}
FileOutputStream fop = new FileOutputStream(jarFile);
// jar iu only contains a single artifact. hence [0]
artifactRepository.getArtifact(artifactDescriptors[0], fop, downloadProgress.newChild(1));
cachedFeatureDir.mkdirs();
extractJar(jarFile, cachedFeatureDir);
downloadProgress.worked(1);
} catch (IOException e) {
throw new IOException(Messages.UpdateManager_17, e);
}
}
EnhancedFeature feature = readEnhancedMetadata(iu, cachedFeatureDir);
loadedFeatureMap.put(feature.getId(), feature);
}
}
return loadedFeatureMap;
}
开发者ID:wso2,项目名称:developer-studio,代码行数:53,代码来源:UpdateManager.java
示例18: shouldUpdate
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
public boolean shouldUpdate() {
try {
IProvisioningAgentProvider agentProvider= Activator.getDefault().getProvisioningAgentProvider();
if (agentProvider == null) {
Activator.getDefault().logErrorStatus("Could not find a provisioning agent provider.", new RuntimeException());
return false;
}
final IProvisioningAgent agent= agentProvider.createAgent(null);
IMetadataRepositoryManager metadataRepositoryManager= (IMetadataRepositoryManager)agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
if (metadataRepositoryManager == null) {
Activator.getDefault().logErrorStatus("Could not find the meta data repository manager.", new RuntimeException());
return false;
}
IArtifactRepositoryManager artifactRepositoryManager= (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
if (artifactRepositoryManager == null) {
Activator.getDefault().logErrorStatus("Could not find the artifact repository manager.", new RuntimeException());
return false;
}
metadataRepositoryManager.addRepository(getUpdateSiteURI(updateSite));
artifactRepositoryManager.addRepository(getUpdateSiteURI(updateSite));
metadataRepositoryManager.loadRepository(getUpdateSiteURI(updateSite), new NullProgressMonitor());
final IProfileRegistry registry= (IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
if (registry == null) {
Activator.getDefault().logErrorStatus("Could not find the profile registry.", new RuntimeException());
return false;
}
final IProfile profile= registry.getProfile(IProfileRegistry.SELF);
if (profile == null) {
Activator.getDefault().logErrorStatus("Could not find the profile.", new RuntimeException());
return false;
}
IQuery<IInstallableUnit> query= QueryUtil.createIUQuery(pluginID);
Collection<IInstallableUnit> iusToUpdate= profile.query(query, null).toUnmodifiableSet();
ProvisioningSession provisioningSession= new ProvisioningSession(agent);
final UpdateOperation updateOperation= new UpdateOperation(provisioningSession, iusToUpdate);
IStatus modalResolution= updateOperation.resolveModal(new NullProgressMonitor());
if (modalResolution.isOK())
return true;
} catch (ProvisionException e) {
Activator.getDefault().logErrorStatus("A provisioning exception occured while checking for updates.", e);
}
return false;
}
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:60,代码来源:BundleUpdater.java
示例19: deleteProfile
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Removes a profile.
*
* @param profileId Profile identifier
* @throws ProvisionException on failure
*/
public void deleteProfile(String profileId) throws ProvisionException {
IProfileRegistry profileRegistry = (IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
profileRegistry.removeProfile(profileId);
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:11,代码来源:RepositoryManager.java
示例20: startAgent
import org.eclipse.equinox.p2.core.ProvisionException; //导入依赖的package包/类
/**
* Starts the p2 bundles needed to continue with the install.
*
* @param agentLocation Agent location or <code>null</code> to use default agent.
* @throws ProvisionException on failure to start the agent
*/
private IProvisioningAgent startAgent(IPath agentLocation) throws ProvisionException {
IProvisioningAgentProvider provider = (IProvisioningAgentProvider) getService(Installer.getDefault().getContext(), IProvisioningAgentProvider.SERVICE_NAME);
return provider.createAgent(agentLocation == null ? null : agentLocation.toFile().toURI());
}
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:12,代码来源:RepositoryManager.java
注:本文中的org.eclipse.equinox.p2.core.ProvisionException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论