Search in sources :

Example 1 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class MirrorStandaloneTest method testIgnoreErrorShouldNotThrowException.

@Test
public void testIgnoreErrorShouldNotThrowException() throws FacadeException {
    MirrorOptions mirrorOptions = new MirrorOptions();
    mirrorOptions.setIgnoreErrors(true);
    subject.mirrorStandalone(sourceRepos("invalid/wrong_checksum"), destinationRepo, Collections.singletonList(new IUDescription("jarsigning", "0.0.1.201109191414")), mirrorOptions, targetFolder);
}
Also used : IUDescription(org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription) MirrorOptions(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions) Test(org.junit.Test)

Example 2 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class MirrorApplicationServiceImpl method mirrorStandalone.

@Override
public void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<IUDescription> seedIUs, MirrorOptions mirrorOptions, BuildOutputDirectory tempDirectory) throws FacadeException {
    IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
    try {
        final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, mirrorOptions.isIncludePacked());
        mirrorApp.setSlicingOptions(createSlicingOptions(mirrorOptions));
        mirrorApp.setIgnoreErrors(mirrorOptions.isIgnoreErrors());
        try {
            // we want to see mirror progress as this is a possibly long-running operation
            mirrorApp.setVerbose(true);
            mirrorApp.setLog(new LogListener(mavenContext.getLogger()));
            mirrorApp.setSourceIUs(querySourceIus(seedIUs, mirrorApp.getCompositeMetadataRepository(), sources));
            IStatus returnStatus = mirrorApp.run(null);
            checkStatus(returnStatus, mirrorOptions.isIgnoreErrors());
        } catch (ProvisionException e) {
            throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
        }
    } finally {
        agent.stop();
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) IStatus(org.eclipse.core.runtime.IStatus) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent)

Example 3 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class PublisherServiceImpl method validateProfile.

void validateProfile(File profileFile) throws FacadeException {
    Properties profileProperties = new Properties();
    try {
        FileInputStream stream = new FileInputStream(profileFile);
        try {
            profileProperties.load(stream);
            validateProfile(profileProperties, profileFile);
        } finally {
            stream.close();
        }
    } catch (IOException e) {
        throw new FacadeException(e);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) IOException(java.io.IOException) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream)

Example 4 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class VerifyIntegrityRepositoryMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    File repositoryDir = getBuildDirectory().getChild("repository");
    logger.info("Verifying p2 repositories in " + repositoryDir);
    VerifierService verifier = p2.getService(VerifierService.class);
    URI repositoryUri = repositoryDir.toURI();
    try {
        if (!verifier.verify(repositoryUri, repositoryUri, getBuildDirectory())) {
            throw new MojoFailureException("The repository is invalid.");
        }
    } catch (FacadeException e) {
        throw new MojoExecutionException("Verification failed", e);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) VerifierService(org.eclipse.tycho.p2.tools.verifier.facade.VerifierService) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) File(java.io.File) URI(java.net.URI)

Example 5 with FacadeException

use of org.eclipse.tycho.p2.tools.FacadeException in project tycho by eclipse.

the class Activator method createProvisioningAgent.

public static IProvisioningAgent createProvisioningAgent(final BuildOutputDirectory targetDirectory) throws FacadeException {
    ServiceReference<?> serviceReference = context.getServiceReference(IProvisioningAgentProvider.SERVICE_NAME);
    IProvisioningAgentProvider agentFactory = (IProvisioningAgentProvider) context.getService(serviceReference);
    try {
        return agentFactory.createAgent(targetDirectory.getChild("p2agent").toURI());
    } catch (ProvisionException e) {
        throw new FacadeException(e);
    } finally {
        context.ungetService(serviceReference);
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgentProvider(org.eclipse.equinox.p2.core.IProvisioningAgentProvider)

Aggregations

FacadeException (org.eclipse.tycho.p2.tools.FacadeException)12 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)5 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)4 DependencySeed (org.eclipse.tycho.core.resolver.shared.DependencySeed)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)3 IUDescription (org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription)3 IOException (java.io.IOException)2 MojoFailureException (org.apache.maven.plugin.MojoFailureException)2 IStatus (org.eclipse.core.runtime.IStatus)2 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 DestinationRepositoryDescriptor (org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)2 PublisherService (org.eclipse.tycho.p2.tools.publisher.facade.PublisherService)2 FileInputStream (java.io.FileInputStream)1 URI (java.net.URI)1 Properties (java.util.Properties)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IProvisioningAgentProvider (org.eclipse.equinox.p2.core.IProvisioningAgentProvider)1 RecreateRepositoryApplication (org.eclipse.equinox.p2.internal.repository.tools.RecreateRepositoryApplication)1