Package org.eclipse.wst.common.componentcore.resources

Examples of org.eclipse.wst.common.componentcore.resources.IVirtualComponent


  @Override
public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException {
    if (!accept(project) || !"rar".equals(model.getPackaging())) { //$NON-NLS-1$
      return;
    }
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null) {
      return;
    }

    //Setting the maven-jar-plugin is necessary in order to embed generated class files
View Full Code Here


  @Override
public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException {
    if (!accept(project) || !"ejb".equals(model.getPackaging())) { //$NON-NLS-1$
      return;
    }
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null) {
      return;
    }

    setEjbPlugin(component, model);
View Full Code Here

   */
  public static String dumpProjectState(String startMessage, IProject project) {
    StringBuilder dump = new StringBuilder((startMessage == null) ? "" : startMessage); //$NON-NLS-1$
    dump.append("Current ").append(Thread.currentThread()).append(SEP); //$NON-NLS-1$
    String projectName = project.getName();
    IVirtualComponent component = ComponentCore.createComponent(project);
    if(component == null) {
      dump.append(projectName).append(" is not a IVirtualComponent").append(SEP); //$NON-NLS-1$
    } else {
      dump.append(projectName).append(" is a ").append(component.getClass().getSimpleName()).append(SEP); //$NON-NLS-1$
      dump.append("Underlying resources for the root folder are :").append(SEP); //$NON-NLS-1$
      for(IResource resource : component.getRootFolder().getUnderlyingResources()) {
        dump.append("  -").append(resource.getFullPath().append(SEP)); //$NON-NLS-1$
      }
      dump.append("deploy-name = ").append(component.getDeployedName()).append(SEP); //$NON-NLS-1$
      dumpFile(dump, project.getFile(".settings/org.eclipse.wst.common.component")); //$NON-NLS-1$
    }
    boolean hasModulecoreNature = ModuleCoreNature.getModuleCoreNature(project) != null;
    boolean isFlexible = ModuleCoreNature.isFlexibleProject(project);
    dump.append(projectName).append(" hasModuleCoreNature:").append(hasModulecoreNature).append(", isFlexible:") //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

  @Override
public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException {
    if (!accept(project) || !"app-client".equals(model.getPackaging())) { //$NON-NLS-1$
      return;
    }
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null) {
      return;
    }

    setAcrPlugin(component, model);
View Full Code Here

  @Override
  public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException {
    if (!accept(project) || !"war".equals(model.getPackaging())) { //$NON-NLS-1$
      return;
    }
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null) {
      return;
    }

    setWarPlugin(component, model);
View Full Code Here

   * @param project
   * @param path, ex. WEB-INF/web.xml
   * @return the underlying file corresponding to path, or null if no file exists.
   */
  public static IFile getWebResourceFile(IProject project, String path) {
      IVirtualComponent component = ComponentCore.createComponent(project);
      if (component == null) {
       return null;
      }
      IPath filePath = new Path(path);
      IContainer[] underlyingFolders = component.getRootFolder().getUnderlyingFolders();
      for (IContainer underlyingFolder : underlyingFolders) {
        IPath p = underlyingFolder.getProjectRelativePath().append(filePath);
        IFile f = project.getFile(p);
        if (f.exists()) {
         return f;
View Full Code Here

    }

    //MECLIPSEWTP-41 Fix the missing moduleCoreNature
    fixMissingModuleCoreNature(project, monitor);
   
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component != null) {

      if (config.isJarIncluded()) {
        addSourceLinks(component, mavenProject, monitor);
      } else {
        //project classes won't be jar'ed in the resulting rar.
        removeSourceLinks(component, mavenProject, monitor);
      }
     
      removeTestFolderLinks(project, mavenProject, monitor, "/")//$NON-NLS-1$
     
      linkFileFirst(project, customRaXml, "META-INF/ra.xml", monitor); //$NON-NLS-1$

      IPath contentDirPath = new Path("/").append(contentDir); //$NON-NLS-1$
     
      if (!WTPProjectsUtil.hasLink(project, ROOT_PATH, contentDirPath, monitor)) {
        component.getRootFolder().createLink(contentDirPath, IVirtualResource.NONE, monitor);
      }
     
      WTPProjectsUtil.setDefaultDeploymentDescriptorFolder(component.getRootFolder(), contentDirPath, monitor);
    }

    setNonDependencyAttributeToContainer(project, monitor);

    //Remove "library unavailable at runtime" warning. TODO is it relevant for connector projects?
View Full Code Here

   */
  @Override
public void setModuleDependencies(IProject project, MavenProject mavenProject, IProgressMonitor monitor)
      throws CoreException {

    IVirtualComponent rarComponent = ComponentCore.createComponent(project);
   
    Set<IVirtualReference> newRefs = new LinkedHashSet<IVirtualReference>();
   
    Set<Artifact> artifacts =  mavenProject.getArtifacts();
   
    //Adding artifact references in .component. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=297777#c1
    for(Artifact artifact : artifacts) {
      ArtifactHelper.fixArtifactHandler(artifact.getArtifactHandler());
      //Don't deploy pom, non runtime or optional dependencies
      if("pom".equals(artifact.getType()) || !SCOPE_FILTER_RUNTIME.include(artifact) || artifact.isOptional()) { //$NON-NLS-1$
        continue;
      }
     
      IMavenProjectFacade workspaceDependency = projectManager.getMavenProject(artifact.getGroupId(), artifact
          .getArtifactId(), artifact.getVersion());

      if(workspaceDependency != null && !workspaceDependency.getProject().equals(project)
          && workspaceDependency.getFullPath(artifact.getFile()) != null) {
        //artifact dependency is a workspace project
        IProject depProject = preConfigureDependencyProject(workspaceDependency, monitor);
        if (ModuleCoreNature.isFlexibleProject(depProject)) {
          newRefs.add(createReference(rarComponent, depProject, artifact));
        }
      } else {
        //artifact dependency should be added as a JEE module, referenced with M2_REPO variable
        newRefs.add(createReference(rarComponent, artifact));
      }
    }

    IVirtualReference[] newRefsArray = new IVirtualReference[newRefs.size()];
    newRefs.toArray(newRefsArray);
   
    //Only change the project references if they've changed
    IVirtualReference[] references = WTPProjectsUtil.extractHardReferences(rarComponent, false);
    if (WTPProjectsUtil.hasChanged(references, newRefsArray)) {
      rarComponent.setReferences(newRefsArray);
    }
  }
View Full Code Here

      rarComponent.setReferences(newRefsArray);
    }
  }

  private IVirtualReference createReference(IVirtualComponent rarComponent, IProject project, Artifact artifact) {
    IVirtualComponent depComponent = ComponentCore.createComponent(project);
    IVirtualReference depRef = ComponentCore.createReference(rarComponent, depComponent);
    String deployedFileName = FileNameMappingFactory.getDefaultFileNameMapping().mapFileName(artifact);
    depRef.setArchiveName(deployedFileName);
    return depRef;
  }
View Full Code Here

  }
 
  private IVirtualReference createReference(IVirtualComponent rarComponent, Artifact artifact) {
      //Create dependency component, referenced from the local Repo.
      String artifactPath = ArtifactHelper.getM2REPOVarPath(artifact);
      IVirtualComponent depComponent = ComponentCore.createArchiveComponent(rarComponent.getProject(), artifactPath);
      return ComponentCore.createReference(rarComponent, depComponent);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.componentcore.resources.IVirtualComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.