org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager Java Examples

The following examples show how to use org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateManager.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example #2
Source File: P2Util.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example #3
Source File: Processor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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.organization.name", "Eclipse Foundation" );
    this.organizationUrl = properties.getProperty ( "pom.organization.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 ();
}
 
Example #4
Source File: Processor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 ();
}