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


Java IArtifactRepositoryManager类代码示例

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


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

示例1: initProvisioningAgent

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
protected void initProvisioningAgent() {
	try {
		// Inject references
		BundleContext bundleContext = FrameworkUtil.getBundle(CheckUpdatesManager.class).getBundleContext();
		IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext);
		ContextInjectionFactory.inject(this, serviceContext);
		// get p2 agent for current system(Eclipse instance in this
		// case)
		// the location for the currently running system is null (see
		// docs)
		p2Agent = agentProvider.createAgent(null);
		session = new ProvisioningSession(p2Agent);
		artifactRepoManager = (IArtifactRepositoryManager) p2Agent
				.getService(IArtifactRepositoryManager.class.getName());
		metadataRepoManager = (IMetadataRepositoryManager) p2Agent
				.getService(IMetadataRepositoryManager.class.getName());

	} catch (Exception e) {
		System.exit(1);
	}
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:22,代码来源:CheckUpdatesManager.java

示例2: initProvisioningAgent

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
protected void initProvisioningAgent() throws RuntimeException {
	try {
		// Inject references
		BundleContext bundleContext = FrameworkUtil.getBundle(UpdateManager.class).getBundleContext();
		IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext);
		ContextInjectionFactory.inject(this, serviceContext);
		// get p2 agent for current system(Eclipse instance in this
		// case)
		// the location for the currently running system is null (see
		// docs)
		p2Agent = agentProvider.createAgent(null);
		session = new ProvisioningSession(p2Agent);
		artifactRepoManager = (IArtifactRepositoryManager) p2Agent
				.getService(IArtifactRepositoryManager.class.getName());
		metadataRepoManager = (IMetadataRepositoryManager) p2Agent
				.getService(IMetadataRepositoryManager.class.getName());

	} catch (Exception e) {
		throw new RuntimeException(Messages.UpdateManager_14, e);
	}
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:22,代码来源:UpdateManager.java

示例3: 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

示例4: 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

示例5: Processor

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
public Processor ( final IProvisioningAgent agent, final File output, final URI repositoryLocation, final Properties properties ) throws Exception
{
    this.mapping = makeMappingInstance ( properties );

    this.agent = agent;
    this.output = output;
    this.properties = properties;
    this.repositoryLocation = repositoryLocation;

    this.metaManager = (IMetadataRepositoryManager)this.agent.getService ( IMetadataRepositoryManager.SERVICE_NAME );
    this.artManager = (IArtifactRepositoryManager)this.agent.getService ( IArtifactRepositoryManager.SERVICE_NAME );

    this.documentBuilderFactor = DocumentBuilderFactory.newInstance ();
    this.documentBuilder = this.documentBuilderFactor.newDocumentBuilder ();
    this.transformerFactory = TransformerFactory.newInstance ();

    this.organizationName = properties.getProperty ( "pom.origanization.name", "Eclipse Foundation" );
    this.organizationUrl = properties.getProperty ( "pom.origanization.url", "http://www.eclipse.org/" );

    this.licenseProvider = new LicenseProvider ( this.properties );

    this.scrubJars = Boolean.parseBoolean ( properties.getProperty ( "scrubJars" ) );

    this.checkQualifier = Boolean.parseBoolean ( properties.getProperty ( "checkQualifier", "true" ) );

    loadDevelopers ();
    setupBndTools ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:Processor.java

示例6: 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

示例7: createAgent

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
/**
 * Creates the P2 provisioning agent.
 * 
 * @param installLocation Install location or <code>null</code> to use installer agent
 * @param monitor Progress monitor or <code>null</code>
 * @return Provisioning agent or <code>null</code>
 */
public IProvisioningAgent createAgent(IPath installLocation, IProgressMonitor monitor) throws CoreException {
	try {
		boolean locationChanged = false;
		if ((installLocation != null) && !installLocation.equals(getInstallLocation())) {
			locationChanged = true;
		}
		
		// Agent not created or install location has changed
		if ((agent == null) || locationChanged) {
			this.installLocation = installLocation;

			if (monitor == null)
				monitor = new NullProgressMonitor();
			
			// Clear plan cache
			planCache.clear();
			
			// Start P2 agent
			agent = startAgent(getAgentLocation());
			// Setup certificate handling
			agent.registerService(UIServices.SERVICE_NAME, AuthenticationService.getDefault());
			// Meta-data repository manager
			metadataRepoMan = (IMetadataRepositoryManager)agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
			// Artifact repository manager
			artifactRepoMan = (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);

			IInstallDescription installDescription = Installer.getDefault().getInstallManager().getInstallDescription();
			
			if (installDescription != null) {
				// Initialize the profile identifier
				profileId = Installer.getDefault().getInstallManager().getInstallDescription().getProfileName();
				// If no profile specified, use the first installed profile
				if (profileId == null) {
					IProfileRegistry profileRegistry = (IProfileRegistry)getAgent().getService(IProfileRegistry.SERVICE_NAME);
					IProfile[] profiles = profileRegistry.getProfiles();
					if (profiles.length > 0) {
						profileId = profiles[0].getProfileId();
					}
				}

				// Initialize product repository if required
				if (productRepository != null) {
					productRepository.dispose();
				}
				if (installDescription.getProductRoot()) {
					productRepository = new ProductRepository(agent);
					productRepository.createRepository();
				}
			}
		}
	}
	catch (Exception e) {
		Installer.fail(e.getLocalizedMessage());
	}
	
	return agent;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:65,代码来源:RepositoryManager.java

示例8: getArtifactRepositoryManager

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
/**
 * @return Returns the artifact repository manager.
 */
private IArtifactRepositoryManager getArtifactRepositoryManager() {
	return artifactRepoMan;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:7,代码来源:RepositoryManager.java

示例9: getProvisioningContext

import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; //导入依赖的package包/类
/**
 * Returns the context for provisioning.  The context will be scoped to the installation repositories.  For an 
 * update, the context will also include the installed repositories.
 * 
 * @return Provisioning context
 */
public ProvisioningContext getProvisioningContext() {
	ProvisioningContext context = new ProvisioningContext(getAgent());
	
	ArrayList<URI> metadataRepositories = new ArrayList<URI>();
	ArrayList<URI> artifactRepositories = new ArrayList<URI>();
	
	// Add installer repositories
	metadataRepositories.addAll(Arrays.asList(getMetadataRepositoryLocations()));
	artifactRepositories.addAll(Arrays.asList(getArtifactRepositoryLocations()));

	// Add cache meta-data repository if available
	if (cacheMetadataRepository != null) {
		metadataRepositories.add(cacheMetadataRepository.getLocation());
	}
	// Add cache artifact repository if available
	if (cacheArtifactRepository != null) {
		artifactRepositories.add(cacheArtifactRepository.getLocation());
	}
	
	// If update then include installed repositories in addition to installer repositories.
	// Include only local installed repositories for much improved performance.
	IInstallMode mode = Installer.getDefault().getInstallManager().getInstallMode();
	if (mode.isUpdate()) {
		// Include all repositories or only local
		int flags = Installer.getDefault().getInstallManager().getInstallDescription().getIncludeAllRepositories() ?
				IRepositoryManager.REPOSITORIES_ALL : IRepositoryManager.REPOSITORIES_LOCAL;
		
		// Installed meta-data repositories
		IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager)getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
		URI[] installedMetadataLocations = metadataManager.getKnownRepositories(flags);
		metadataRepositories.addAll(Arrays.asList(installedMetadataLocations));
		
		// Installed artifact repositories
		IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager)agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
		URI[] installedArtifactLocations = artifactManager.getKnownRepositories(flags);
		artifactRepositories.addAll(Arrays.asList(installedArtifactLocations));
	}
	
	if (!metadataRepositories.isEmpty()) {
		context.setMetadataRepositories(metadataRepositories.toArray(new URI[metadataRepositories.size()]));
	}
	if (!artifactRepositories.isEmpty()) {
		context.setArtifactRepositories(artifactRepositories.toArray(new URI[artifactRepositories.size()]));
	}
	
	return context;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:54,代码来源:RepositoryManager.java

示例10: 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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。