Search in sources :

Example 46 with RemoteException

use of java.rmi.RemoteException in project intellij-community by JetBrains.

the class Maven30ServerEmbedderImpl method resolvePlugin.

@Override
public Collection<MavenArtifact> resolvePlugin(@NotNull final MavenPlugin plugin, @NotNull final List<MavenRemoteRepository> repositories, int nativeMavenProjectId, final boolean transitive) throws RemoteException, MavenServerProcessCanceledException {
    try {
        Plugin mavenPlugin = new Plugin();
        mavenPlugin.setGroupId(plugin.getGroupId());
        mavenPlugin.setArtifactId(plugin.getArtifactId());
        mavenPlugin.setVersion(plugin.getVersion());
        MavenProject project = RemoteNativeMavenProjectHolder.findProjectById(nativeMavenProjectId);
        Plugin pluginFromProject = project.getBuild().getPluginsAsMap().get(plugin.getGroupId() + ':' + plugin.getArtifactId());
        if (pluginFromProject != null) {
            mavenPlugin.setDependencies(pluginFromProject.getDependencies());
        }
        final MavenExecutionRequest request = createRequest(null, Collections.<String>emptyList(), Collections.<String>emptyList(), Collections.<String>emptyList());
        DefaultMaven maven = (DefaultMaven) getComponent(Maven.class);
        RepositorySystemSession repositorySystemSession = maven.newRepositorySession(request);
        PluginDependenciesResolver pluginDependenciesResolver = getComponent(PluginDependenciesResolver.class);
        org.sonatype.aether.artifact.Artifact pluginArtifact = pluginDependenciesResolver.resolve(mavenPlugin, project.getRemotePluginRepositories(), repositorySystemSession);
        org.sonatype.aether.graph.DependencyNode node = pluginDependenciesResolver.resolve(mavenPlugin, pluginArtifact, null, project.getRemotePluginRepositories(), repositorySystemSession);
        PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
        node.accept(nlg);
        List<MavenArtifact> res = new ArrayList<MavenArtifact>();
        for (org.sonatype.aether.artifact.Artifact artifact : nlg.getArtifacts(true)) {
            if (!Comparing.equal(artifact.getArtifactId(), plugin.getArtifactId()) || !Comparing.equal(artifact.getGroupId(), plugin.getGroupId())) {
                res.add(MavenModelConverter.convertArtifact(RepositoryUtils.toArtifact(artifact), getLocalRepositoryFile()));
            }
        }
        return res;
    } catch (Exception e) {
        Maven3ServerGlobals.getLogger().info(e);
        return Collections.emptyList();
    }
}
Also used : DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) RepositorySystemSession(org.sonatype.aether.RepositorySystemSession) PreorderNodeListGenerator(org.sonatype.aether.util.graph.PreorderNodeListGenerator) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException) ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException) SettingsBuildingException(org.apache.maven.settings.building.SettingsBuildingException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) ContextException(org.codehaus.plexus.context.ContextException) InvalidRepositoryException(org.apache.maven.artifact.InvalidRepositoryException) PluginDependenciesResolver(org.apache.maven.plugin.internal.PluginDependenciesResolver) Plugin(org.apache.maven.model.Plugin)

Example 47 with RemoteException

use of java.rmi.RemoteException in project intellij-community by JetBrains.

the class Maven30ServerEmbedderImpl method reset.

@Override
public void reset() throws RemoteException {
    try {
        setConsoleAndIndicator(null, null);
        final ArtifactFactory artifactFactory = getComponent(ArtifactFactory.class);
        if (artifactFactory instanceof CustomMaven3ArtifactFactory) {
            ((CustomMaven3ArtifactFactory) artifactFactory).reset();
        }
        final ArtifactResolver artifactResolver = getComponent(ArtifactResolver.class);
        if (artifactResolver instanceof CustomMaven30ArtifactResolver) {
            ((CustomMaven30ArtifactResolver) artifactResolver).reset();
        }
        final RepositoryMetadataManager repositoryMetadataManager = getComponent(RepositoryMetadataManager.class);
        if (repositoryMetadataManager instanceof CustomMaven3RepositoryMetadataManager) {
            ((CustomMaven3RepositoryMetadataManager) repositoryMetadataManager).reset();
        }
    //((CustomWagonManager)getComponent(WagonManager.class)).reset();
    } catch (Exception e) {
        throw rethrowException(e);
    }
}
Also used : RepositoryMetadataManager(org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager) ArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException) ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException) SettingsBuildingException(org.apache.maven.settings.building.SettingsBuildingException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) ContextException(org.codehaus.plexus.context.ContextException) InvalidRepositoryException(org.apache.maven.artifact.InvalidRepositoryException)

Example 48 with RemoteException

use of java.rmi.RemoteException in project intellij-community by JetBrains.

the class TransferListenerAdapter method transferCompleted.

public void transferCompleted(TransferEvent event) {
    try {
        MavenServerDownloadListener listener = Maven2ServerGlobals.getDownloadListener();
        if (listener != null)
            listener.artifactDownloaded(event.getLocalFile(), event.getResource().getName());
    } catch (RemoteException e) {
        throw new RuntimeRemoteException(e);
    }
    checkCanceled();
    String resourceName = event.getResource().getName();
    DownloadData data = myDownloads.remove(resourceName);
    data.finished = true;
    updateProgress(resourceName, data);
}
Also used : MavenServerDownloadListener(org.jetbrains.idea.maven.server.MavenServerDownloadListener) RemoteException(java.rmi.RemoteException)

Example 49 with RemoteException

use of java.rmi.RemoteException in project intellij-community by JetBrains.

the class Maven3ServerIndexerImpl method addArtifact.

@Override
public MavenId addArtifact(int indexId, File artifactFile) throws RemoteException, MavenServerIndexerException {
    try {
        IndexingContext index = getIndex(indexId);
        ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile);
        if (artifactContext == null)
            return null;
        addArtifact(myIndexer, index, artifactContext);
        org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo();
        return new MavenId(a.groupId, a.artifactId, a.version);
    } catch (Exception e) {
        throw new MavenServerIndexerException(wrapException(e));
    }
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) IndexingContext(org.sonatype.nexus.index.context.IndexingContext) org.sonatype.nexus.index(org.sonatype.nexus.index) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ArchetypeDataSourceException(org.apache.maven.archetype.source.ArchetypeDataSourceException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException)

Example 50 with RemoteException

use of java.rmi.RemoteException in project intellij-community by JetBrains.

the class Maven3ServerEmbedderImpl method resolveTransitively.

@NotNull
@Override
public List<MavenArtifact> resolveTransitively(@NotNull List<MavenArtifactInfo> artifacts, @NotNull List<MavenRemoteRepository> remoteRepositories) throws RemoteException, MavenServerProcessCanceledException {
    try {
        Set<Artifact> toResolve = new LinkedHashSet<Artifact>();
        for (MavenArtifactInfo each : artifacts) {
            toResolve.add(createArtifact(each));
        }
        Artifact project = getComponent(ArtifactFactory.class).createBuildArtifact("temp", "temp", "666", "pom");
        Set<Artifact> res = getComponent(ArtifactResolver.class).resolveTransitively(toResolve, project, Collections.EMPTY_MAP, myLocalRepository, convertRepositories(remoteRepositories), getComponent(ArtifactMetadataSource.class)).getArtifacts();
        return MavenModelConverter.convertArtifacts(res, new THashMap<Artifact, MavenArtifact>(), getLocalRepositoryFile());
    } catch (ArtifactResolutionException e) {
        Maven3ServerGlobals.getLogger().info(e);
    } catch (ArtifactNotFoundException e) {
        Maven3ServerGlobals.getLogger().info(e);
    } catch (Exception e) {
        throw rethrowException(e);
    }
    return Collections.emptyList();
}
Also used : ArtifactResolutionException(org.apache.maven.artifact.resolver.ArtifactResolutionException) ArtifactFactory(org.apache.maven.artifact.factory.ArtifactFactory) ArtifactNotFoundException(org.apache.maven.artifact.resolver.ArtifactNotFoundException) Artifact(org.apache.maven.artifact.Artifact) ArtifactNotFoundException(org.apache.maven.artifact.resolver.ArtifactNotFoundException) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException) ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) RemoteException(java.rmi.RemoteException) ComponentLookupException(org.codehaus.plexus.component.repository.exception.ComponentLookupException) ContextException(org.codehaus.plexus.context.ContextException) ArtifactResolutionException(org.apache.maven.artifact.resolver.ArtifactResolutionException) InvalidRepositoryException(org.apache.maven.artifact.InvalidRepositoryException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

RemoteException (java.rmi.RemoteException)396 IOException (java.io.IOException)57 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)38 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)34 SSOException (com.iplanet.sso.SSOException)32 AMException (com.iplanet.am.sdk.AMException)31 EJBException (javax.ejb.EJBException)31 LocateRegistry (java.rmi.registry.LocateRegistry)30 Registry (java.rmi.registry.Registry)30 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)29 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)29 AMEventManagerException (com.iplanet.am.sdk.AMEventManagerException)29 UnsupportedEncodingException (java.io.UnsupportedEncodingException)27 InvocationTargetException (java.lang.reflect.InvocationTargetException)27 ArrayList (java.util.ArrayList)25 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)24 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)24 ConnectException (java.net.ConnectException)20 HashMap (java.util.HashMap)19 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)18