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


Java IArtifactRepositoryManager.addRepository方法代码示例

本文整理汇总了Java中org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager.addRepository方法的典型用法代码示例。如果您正苦于以下问题:Java IArtifactRepositoryManager.addRepository方法的具体用法?Java IArtifactRepositoryManager.addRepository怎么用?Java IArtifactRepositoryManager.addRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager的用法示例。


在下文中一共展示了IArtifactRepositoryManager.addRepository方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRepository

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入方法依赖的package包/类
private void addRepository(final IProvisioningAgent inAgent) {
	final IMetadataRepositoryManager lMetadataManager = (IMetadataRepositoryManager) inAgent
	        .getService(IMetadataRepositoryManager.SERVICE_NAME);
	final IArtifactRepositoryManager lArtifactManager = (IArtifactRepositoryManager) inAgent
	        .getService(IArtifactRepositoryManager.SERVICE_NAME);
	if (lMetadataManager == null || lArtifactManager == null) {
		log.warn("P2 metadata/artifact manager is null!"); //$NON-NLS-1$
		return;
	}

	try {
		final URI lURI = new URI(RelationsConstants.UPDATE_SITE);
		lMetadataManager.addRepository(lURI);
		lArtifactManager.addRepository(lURI);
	}
	catch (final URISyntaxException exc) {
		log.error(exc, exc.getMessage());
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:20,代码来源:RelationsLifeCycle.java

示例2: addRepository

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入方法依赖的package包/类
/**
 * Add a repository to declared updates repositories.
 * 
 * @param repo
 * @return
 */
public static boolean addRepository(IProvisioningAgent agent, String repo){
	System.out.println(">> adding repository " + repo);
	IMetadataRepositoryManager metadataManager =
		(IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
	IArtifactRepositoryManager artifactManager =
		(IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
	if (metadataManager == null) {
		System.out.println("metadataManager is null!!!");
		return false;
	}
	if (artifactManager == null) {
		System.out.println("artifactManager is null!!!");
		return false;
	}
	try {
		URI uri = new URI(repo);
		metadataManager.addRepository(uri);
		artifactManager.addRepository(uri);
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:31,代码来源:P2Util.java

示例3: loadRepository

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入方法依赖的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

示例4: shouldUpdate

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入方法依赖的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


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