org.eclipse.jst.j2ee.jca_1.1.501.v201111030500

16:45:45.731 INFO  jd.cli.Main - Decompiling org.eclipse.jst.j2ee.jca_1.1.501.v201111030500.jar
package org.eclipse.jst.j2ee.internal.jca.archive.operations;

import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;

/**
 * @deprecated
 */
public class ConnectorComponentExportOperation
  extends J2EEArtifactExportOperation
{
  public ConnectorComponentExportOperation() {}
  
  public ConnectorComponentExportOperation(IDataModel model)
  {
    super(model);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.archive.operations.ConnectorComponentExportOperation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.archive.operations;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions;
import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl;
import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl.FilesHolder;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.jca.modulecore.util.ConnectorArtifactEdit;
import org.eclipse.wst.common.componentcore.ArtifactEdit;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualContainer;
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;

public class ConnectorComponentLoadStrategyImpl
  extends ComponentLoadStrategyImpl
{
  private int dotJavaLength = ".java".length();
  private List alreadyIndexed = new ArrayList();
  private Map classesMap;
  private IFile knownDD;
  public static String[] knownLibExtensions = { ".jar", 
    ".zip", 
    ".so", 
    ".o", 
    ".sl", 
    ".dll" };
  
  public ConnectorComponentLoadStrategyImpl(IVirtualComponent vComponent)
  {
    this(vComponent, true);
  }
  
  public ConnectorComponentLoadStrategyImpl(IVirtualComponent vComponent, boolean includeClasspathComponents)
  {
    super(vComponent, includeClasspathComponents);
    knownDD = vComponent.getRootFolder().getFile("META-INF/ra.xml").getUnderlyingFile();
  }
  
  public List getFiles()
  {
    addNestedJARsFromSourceRoots();
    aggregateSourceFiles();
    return filesHolder.getFiles();
  }
  
  private void addNestedJARsFromSourceRoots()
  {
    IPackageFragmentRoot[] sourceRoots = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
    for (int i = 0; i < sourceRoots.length; i++) {
      try
      {
        File aFile = getNestedJar(sourceRoots[i]);
        if (aFile != null) {
          filesHolder.addFile(aFile);
        }
      }
      catch (JavaModelException e)
      {
        Logger.getLogger().logError(e);
      }
    }
  }
  
  private File getNestedJar(IPackageFragmentRoot sourceRoot)
    throws JavaModelException
  {
    IPath outputPath = sourceRoot.getRawClasspathEntry().getOutputLocation();
    if (outputPath == null)
    {
      IProject project = vComponent.getProject();
      try
      {
        if (project.hasNature("org.eclipse.jdt.core.javanature"))
        {
          IJavaProject javaProject = JavaCore.create(project);
          outputPath = javaProject.getOutputLocation();
        }
      }
      catch (CoreException e)
      {
        Logger.getLogger().logError(e);
      }
      if (outputPath == null) {
        return null;
      }
    }
    IFolder javaOutputFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(outputPath);
    indexClassesForOutputFolder(javaOutputFolder);
    IContainer sourceContainer = (IContainer)sourceRoot.getResource();
    
    int sourceContainerSegmentCount = sourceContainer.getProjectRelativePath().segmentCount();
    boolean isModuleRoot = knownDD.getProjectRelativePath().toString().startsWith(sourceContainer.getProjectRelativePath().toString());
    Set iFilesSet = new HashSet();
    boolean foundJava = gatherFilesForJAR(iFilesSet, sourceContainer, isModuleRoot, false, sourceContainerSegmentCount);
    if ((!isModuleRoot) || (foundJava))
    {
      List iFilesList = Collections.list(Collections.enumeration(iFilesSet));
      for (int i = 0; i < iFilesList.size(); i++) {
        filesHolder.removeIFile((IFile)iFilesList.get(i));
      }
      File nestedArchive = createNestedArchive(iFilesList, sourceContainer, javaOutputFolder);
      return nestedArchive;
    }
    return null;
  }
  
  private boolean gatherFilesForJAR(Collection iFiles, IContainer current, boolean isModuleRoot, boolean foundJava, int sourceContainerSegmentCount)
  {
    try
    {
      members = current.members();
    }
    catch (CoreException core)
    {
      IResource[] members;
      throw new ArchiveRuntimeException(core);
    }
    IResource[] members;
    IContainer ddFolder = vComponent.getRootFolder().getFolder("META-INF").getUnderlyingFolder();
    
    boolean localFoundJava = foundJava;
    for (int i = 0; i < members.length; i++)
    {
      IResource res = members[i];
      if (res.getType() == 2)
      {
        if (!ddFolder.equals(res)) {
          localFoundJava = (gatherFilesForJAR(iFiles, (IFolder)res, isModuleRoot, localFoundJava, sourceContainerSegmentCount)) || (localFoundJava);
        }
      }
      else
      {
        IFile srcFile = (IFile)res;
        if (belongsInNestedJAR(srcFile, isModuleRoot))
        {
          if (isJava(srcFile))
          {
            if (exportSource) {
              iFiles.add(srcFile);
            }
            String className = srcFile.getProjectRelativePath().removeFirstSegments(sourceContainerSegmentCount).toString();
            className = className.substring(0, className.length() - dotJavaLength);
            List classes = retrieveClasses(className);
            if (classes != null)
            {
              Iterator iterator = classes.iterator();
              while (iterator.hasNext())
              {
                IFile clazz = (IFile)iterator.next();
                if (!iFiles.contains(clazz)) {
                  iFiles.add(clazz);
                }
              }
            }
          }
          else if (!iFiles.contains(srcFile))
          {
            iFiles.add(srcFile);
          }
          if (isModuleRoot) {
            localFoundJava = (localFoundJava) || (isJava(srcFile)) || (isClass(srcFile));
          }
        }
      }
    }
    return localFoundJava;
  }
  
  private File createNestedArchive(List files, IContainer sourceContainer, IFolder javaOutputFolder)
  {
    ConnectorComponentNestedJARLoadStrategyImpl loader = new ConnectorComponentNestedJARLoadStrategyImpl(files, sourceContainer, javaOutputFolder);
    ArchiveOptions options = ((Archive)getContainer()).getOptions().cloneWith(loader);
    String uri = computeUniqueArchiveURI(sourceContainer);
    try
    {
      return getArchiveFactory().primOpenArchive(options, uri);
    }
    catch (OpenFailureException ex)
    {
      throw new ArchiveRuntimeException(ex);
    }
  }
  
  private String computeUniqueArchiveURI(IResource resource)
  {
    int increment = 0;
    String name = resource.getName();
    StringBuffer sb = null;
    do
    {
      sb = new StringBuffer(name.length() + 5);
      sb.append('_');
      sb.append(name);
      if (increment > 0) {
        sb.append(increment);
      }
      sb.append(".jar");
      increment++;
    } while (
    
      filesHolder.contains(sb.toString()));
    return sb.toString();
  }
  
  private boolean belongsInNestedJAR(IFile iFile, boolean isModuleRoot)
  {
    if ((isModuleRoot) && (isDeploymentDescriptor(iFile))) {
      return false;
    }
    for (int i = 0; i < knownLibExtensions.length; i++) {
      if (hasExtension(iFile, knownLibExtensions[i])) {
        return false;
      }
    }
    return true;
  }
  
  protected synchronized ArtifactEdit getArtifactEditForRead()
  {
    if (artifactEdit == null) {
      artifactEdit = ConnectorArtifactEdit.getConnectorArtifactEditForRead(vComponent);
    }
    return artifactEdit;
  }
  
  protected boolean shouldInclude(IVirtualContainer vContainer)
  {
    boolean isDDFolder = vComponent.getRootFolder().getFolder("META-INF").equals(vContainer);
    return (isDDFolder) || (!inJavaSrc(vContainer));
  }
  
  protected boolean shouldInclude(String uri)
  {
    return (!hasExtension(uri, ".class")) && (!hasExtension(uri, ".java"));
  }
  
  private void indexClassesForOutputFolder(IFolder javaOutputFolder)
  {
    if ((javaOutputFolder == null) || (alreadyIndexed.contains(javaOutputFolder))) {
      return;
    }
    alreadyIndexed.add(javaOutputFolder);
    int segmentCount = javaOutputFolder.getProjectRelativePath().segmentCount();
    indexClasses(javaOutputFolder, segmentCount);
  }
  
  private void indexClasses(IResource resource, int javaOutputSegmentCount)
  {
    switch (resource.getType())
    {
    case 1: 
      indexClass((IFile)resource, javaOutputSegmentCount);
      break;
    case 2: 
      try
      {
        IResource[] members = ((IFolder)resource).members();
        for (int i = 0; i < members.length; i++) {
          indexClasses(members[i], javaOutputSegmentCount);
        }
      }
      catch (CoreException e)
      {
        Logger.getLogger().logError(e);
      }
    }
  }
  
  private void indexClass(IFile iFile, int javaOutputSegmentCount)
  {
    if (!isClass(iFile)) {
      return;
    }
    if (classesMap == null) {
      classesMap = new HashMap();
    }
    String name = iFile.getName();
    IPath relPath = iFile.getProjectRelativePath().removeFirstSegments(javaOutputSegmentCount);
    String key = relPath.toString();
    if (name.indexOf('$') != -1) {
      key = key.substring(0, key.indexOf('$'));
    } else {
      key = key.substring(0, key.indexOf('.'));
    }
    List inners = (List)classesMap.get(key);
    if (inners == null)
    {
      inners = new ArrayList(1);
      classesMap.put(key, inners);
    }
    inners.add(iFile);
  }
  
  public List retrieveClasses(String key)
  {
    if (classesMap == null) {
      return null;
    }
    return (List)classesMap.get(key);
  }
  
  public static boolean isJava(IFile iFile)
  {
    return hasExtension(iFile, ".java");
  }
  
  public static boolean isClass(IFile iFile)
  {
    return hasExtension(iFile, ".class");
  }
  
  private static boolean hasExtension(IFile iFile, String ext)
  {
    String name = iFile.getName();
    return hasExtension(name, ext);
  }
  
  private static boolean hasExtension(String name, String ext)
  {
    int offset = ext.length();
    return name.regionMatches(true, name.length() - offset, ext, 0, offset);
  }
  
  private boolean isDeploymentDescriptor(IFile iFile)
  {
    return knownDD.equals(iFile);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.archive.operations.ConnectorComponentLoadStrategyImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.archive.operations;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveRuntimeException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl;

public class ConnectorComponentNestedJARLoadStrategyImpl
  extends LoadStrategyImpl
{
  private List files;
  private int sourceSegmentCount;
  private int outputSegmentCount;
  private Map urisToIFiles;
  
  public ConnectorComponentNestedJARLoadStrategyImpl(List files, IContainer sourceContainer, IFolder javaOutputFolder)
  {
    this.files = files;
    sourceSegmentCount = sourceContainer.getProjectRelativePath().segmentCount();
    outputSegmentCount = javaOutputFolder.getProjectRelativePath().segmentCount();
  }
  
  protected boolean primContains(String uri)
  {
    return true;
  }
  
  public List getFiles()
  {
    urisToIFiles = new HashMap();
    List result = new ArrayList();
    int size = files.size();
    for (int i = 0; i < size; i++)
    {
      IFile iFile = (IFile)files.get(i);
      IPath relPath;
      IPath relPath;
      if (ConnectorComponentLoadStrategyImpl.isClass(iFile)) {
        relPath = getRelativePath(iFile, outputSegmentCount);
      } else {
        relPath = getRelativePath(iFile, sourceSegmentCount);
      }
      addFile(iFile, relPath, result);
    }
    return result;
  }
  
  protected void addFile(IFile iFile, IPath relPath, List result)
  {
    org.eclipse.jst.j2ee.commonarchivecore.internal.File cFile = createFile(iFile, relPath);
    result.add(cFile);
    urisToIFiles.put(cFile.getURI(), iFile);
  }
  
  protected long getLastModified(IResource aResource)
  {
    return aResource.getLocation().toFile().lastModified();
  }
  
  private org.eclipse.jst.j2ee.commonarchivecore.internal.File createFile(IFile iFile, IPath relPath)
  {
    org.eclipse.jst.j2ee.commonarchivecore.internal.File cFile = createFile(relPath.toString());
    cFile.setLastModified(getLastModified(iFile));
    return cFile;
  }
  
  private IPath getRelativePath(IFile file, int parentSegmentCount)
  {
    return file.getProjectRelativePath().removeFirstSegments(parentSegmentCount);
  }
  
  public InputStream getInputStream(String uri)
    throws IOException, FileNotFoundException
  {
    if (urisToIFiles == null) {
      getFiles();
    }
    IFile file = (IFile)urisToIFiles.get(uri);
    if (file != null) {
      try
      {
        return file.getContents();
      }
      catch (CoreException core)
      {
        throw new ArchiveRuntimeException(uri, core);
      }
    }
    throw new FileNotFoundException(uri);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.archive.operations.ConnectorComponentNestedJARLoadStrategyImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.operations;

import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
import org.eclipse.jst.j2ee.internal.archive.operations.JavaEEComponentExportOperation;
import org.eclipse.jst.j2ee.internal.earcreation.EARCreationResourceHandler;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;

public class ConnectorComponentExportDataModelProvider
  extends J2EEComponentExportDataModelProvider
{
  public IDataModelOperation getDefaultOperation()
  {
    return new JavaEEComponentExportOperation(model);
  }
  
  protected String getProjectType()
  {
    return "jst.connector";
  }
  
  protected String getWrongComponentTypeString(String projectName)
  {
    return EARCreationResourceHandler.getString(EARCreationResourceHandler.NOT_A_RAR, new Object[] { projectName });
  }
  
  protected String getModuleExtension()
  {
    return ".rar";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.operations.ConnectorComponentExportDataModelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.operations;

import org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentImportDataModelProvider;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.jca.project.facet.ConnectorFacetProjectCreationDataModelProvider;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties.FacetDataModelMap;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;

public final class ConnectorComponentImportDataModelProvider
  extends J2EEComponentImportDataModelProvider
{
  public void init()
  {
    super.init();
    
    IDataModel componentCreationDM = model.getNestedModel("IJ2EEArtifactImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION");
    IFacetProjectCreationDataModelProperties.FacetDataModelMap map = (IFacetProjectCreationDataModelProperties.FacetDataModelMap)componentCreationDM.getProperty("IFacetProjectCreationDataModelProperties.FACET_DM_MAP");
    IDataModel connectorFacet = map.getFacetDataModel("jst.connector");
    connectorFacet.setBooleanProperty("IJ2EEFacetInstallDataModelProperties.GENERATE_DD", false);
  }
  
  protected int getType()
  {
    return 5;
  }
  
  protected IDataModel createJ2EEComponentCreationDataModel()
  {
    return DataModelFactory.createDataModel(new ConnectorFacetProjectCreationDataModelProvider());
  }
  
  public IDataModelOperation getDefaultOperation()
  {
    return new ConnectorComponentImportOperation(model);
  }
  
  public boolean propertySet(String propertyName, Object propertyValue)
  {
    boolean set = super.propertySet(propertyName, propertyValue);
    if (propertyName.equals("IJ2EEComponentImportDataModelProperties.ARCHIVE_WRAPPER"))
    {
      IDataModel moduleDM = model.getNestedModel("IJ2EEArtifactImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION");
      if (getArchiveWrapper() != null)
      {
        IFacetProjectCreationDataModelProperties.FacetDataModelMap map = (IFacetProjectCreationDataModelProperties.FacetDataModelMap)moduleDM.getProperty("IFacetProjectCreationDataModelProperties.FACET_DM_MAP");
        IDataModel jcaFacetDataModel = map.getFacetDataModel("jst.connector");
        
        int version = getModuleSpecVersion();
        String versionText = J2EEVersionUtil.getJCATextVersion(version);
        jcaFacetDataModel.setStringProperty("IFacetDataModelProperties.FACET_VERSION_STR", versionText);
        model.notifyPropertyChange("IJ2EEComponentImportDataModelProperties.PROJECT_NAME", 4);
        updateWorkingCopyFacetVersion(moduleDM, jcaFacetDataModel);
        updateJavaFacetVersion();
      }
    }
    return set;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.operations.ConnectorComponentImportDataModelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.operations;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.internal.archive.ArchiveWrapper;
import org.eclipse.jst.j2ee.internal.archive.ComponentArchiveSaveAdapter;
import org.eclipse.jst.j2ee.internal.archive.ConnectorComponentArchiveSaveAdapter;
import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactImportOperation;
import org.eclipse.jst.jee.archive.IArchive;
import org.eclipse.jst.jee.archive.IArchiveResource;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;

public class ConnectorComponentImportOperation
  extends J2EEArtifactImportOperation
{
  public ConnectorComponentImportOperation(IDataModel model)
  {
    super(model);
  }
  
  protected void doExecute(IProgressMonitor monitor)
    throws ExecutionException
  {
    super.doExecute(monitor);
    addAssociateArchivesToClassPath();
  }
  
  protected void addAssociateArchivesToClassPath()
  {
    List<IClasspathEntry> extraEntries = new ArrayList();
    
    List<IArchiveResource> archiveResources = ((IArchive)archiveWrapper.getUnderLyingArchive()).getArchiveResources();
    IVirtualFile vFile = null;
    IFile file = null;
    for (IArchiveResource archiveResource : archiveResources) {
      if (archiveResource.getPath().lastSegment().endsWith(".jar"))
      {
        vFile = virtualComponent.getRootFolder().getFile(archiveResource.getPath());
        if (vFile.exists())
        {
          file = vFile.getUnderlyingFile();
          extraEntries.add(JavaCore.newLibraryEntry(file.getFullPath(), file.getFullPath(), null, true));
        }
      }
    }
    try
    {
      addToClasspath(getDataModel(), extraEntries);
    }
    catch (JavaModelException e)
    {
      Logger.getLogger().logError(e);
    }
  }
  
  protected static void addToClasspath(IDataModel importModel, List extraEntries)
    throws JavaModelException
  {
    if (extraEntries.size() > 0)
    {
      IJavaProject javaProject = JavaCore.create(((IVirtualComponent)importModel.getProperty("IJ2EEComponentImportDataModelProperties.COMPONENT")).getProject());
      addToClasspath(extraEntries, javaProject);
    }
  }
  
  protected static void addToClasspath(List extraEntries, IJavaProject javaProject)
    throws JavaModelException
  {
    if (extraEntries.size() > 0)
    {
      IClasspathEntry[] javaClasspath = javaProject.getRawClasspath();
      List nonDuplicateList = new ArrayList();
      for (int i = 0; i < extraEntries.size(); i++)
      {
        IClasspathEntry extraEntry = (IClasspathEntry)extraEntries.get(i);
        boolean include = true;
        for (int j = 0; (include) && (j < javaClasspath.length); j++) {
          if (extraEntry.equals(javaClasspath[j])) {
            include = false;
          }
        }
        if (include) {
          nonDuplicateList.add(extraEntry);
        }
      }
      if (nonDuplicateList.size() > 0)
      {
        IClasspathEntry[] newJavaClasspath = new IClasspathEntry[javaClasspath.length + nonDuplicateList.size()];
        System.arraycopy(javaClasspath, 0, newJavaClasspath, 0, javaClasspath.length);
        for (int j = 0; j < nonDuplicateList.size(); j++) {
          newJavaClasspath[(javaClasspath.length + j)] = ((IClasspathEntry)nonDuplicateList.get(j));
        }
        javaProject.setRawClasspath(newJavaClasspath, new NullProgressMonitor());
      }
    }
  }
  
  protected ComponentArchiveSaveAdapter getArchiveSaveAdapter(IVirtualComponent virtualComponent)
  {
    return new ConnectorComponentArchiveSaveAdapter(virtualComponent);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.operations.ConnectorComponentImportOperation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.operations;

import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;

public abstract interface IConnectorComponentExportDataModelProperties
  extends IJ2EEComponentExportDataModelProperties
{}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.operations.IConnectorComponentExportDataModelProperties
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.operations;

import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEModuleImportDataModelProperties;

public abstract interface IConnectorComponentImportDataModelProperties
  extends IJ2EEModuleImportDataModelProperties
{}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.operations.IConnectorComponentImportDataModelProperties
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.project.facet;

import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.common.project.facet.core.JavaFacetInstallConfig;
import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPreferences;
import org.eclipse.jst.j2ee.jca.project.facet.IConnectorFacetInstallDataModelProperties;
import org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;

public class ConnectorFacetInstallDataModelProvider
  extends J2EEModuleFacetInstallDataModelProvider
  implements IConnectorFacetInstallDataModelProperties
{
  public Object getDefaultProperty(String propertyName)
  {
    if (propertyName.equals("IFacetDataModelProperties.FACET_ID")) {
      return "jst.connector";
    }
    if (propertyName.equals("IJ2EEFacetInstallDataModelProperties.CONFIG_FOLDER"))
    {
      if (model.isPropertySet("IFacetDataModelProperties.FACET_PROJECT_NAME"))
      {
        String projectName = model.getStringProperty("IFacetDataModelProperties.FACET_PROJECT_NAME");
        IProject project = projectName.length() > 0 ? ResourcesPlugin.getWorkspace().getRoot().getProject(projectName) : null;
        if ((project != null) && (project.exists()) && 
          (ModuleCoreNature.isFlexibleProject(project)))
        {
          IVirtualComponent c = ComponentCore.createComponent(project, true);
          IVirtualFolder ejbroot = c.getRootFolder();
          IPath configFolderPath = J2EEModuleVirtualComponent.getDefaultDeploymentDescriptorFolder(ejbroot);
          if ((configFolderPath != null) && (project.getFolder(configFolderPath).exists())) {
            return configFolderPath.toString();
          }
        }
      }
      return J2EEPlugin.getDefault().getJ2EEPreferences().getString("jcaContent");
    }
    if (propertyName.equals("IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI"))
    {
      String projectName = model.getStringProperty("IFacetDataModelProperties.FACET_PROJECT_NAME").replace(' ', '_');
      return projectName + ".rar";
    }
    if (propertyName.equals("IJ2EEFacetInstallDataModelProperties.GENERATE_DD"))
    {
      String facetVersion = getStringProperty("IFacetDataModelProperties.FACET_VERSION_STR");
      if ("1.6".equals(facetVersion)) {
        return Boolean.valueOf(J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean("ee6_connector_generate_dd"));
      }
      return Boolean.TRUE;
    }
    return super.getDefaultProperty(propertyName);
  }
  
  protected int convertFacetVersionToJ2EEVersion(IProjectFacetVersion version)
  {
    return J2EEVersionUtil.convertConnectorVersionStringToJ2EEVersionID(version.getVersionString());
  }
  
  public boolean propertySet(String propertyName, Object propertyValue)
  {
    if (propertyName.equals("IJ2EEFacetInstallDataModelProperties.CONFIG_FOLDER")) {
      if (javaFacetInstallConfig != null)
      {
        IPath sourceFolder = 
          propertyValue == null ? null : new Path((String)propertyValue);
        
        javaFacetInstallConfig.setSourceFolder(sourceFolder);
      }
    }
    return super.propertySet(propertyName, propertyValue);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.project.facet.ConnectorFacetInstallDataModelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.providers;

import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.jst.j2ee.jca.ActivationSpec;
import org.eclipse.jst.j2ee.jca.JcaFactory;
import org.eclipse.jst.j2ee.jca.JcaPackage;
import org.eclipse.jst.j2ee.jca.internal.plugin.JCAResourceHandler;
import org.eclipse.jst.j2ee.jca.internal.plugin.JcaPlugin;

public class ActivationSpecItemProvider
  extends ItemProviderAdapter
  implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
  public ActivationSpecItemProvider(AdapterFactory adapterFactory)
  {
    super(adapterFactory);
  }
  
  public List getPropertyDescriptors(Object object)
  {
    if (itemPropertyDescriptors == null)
    {
      super.getPropertyDescriptors(object);
      
      addActivationSpecClassPropertyDescriptor(object);
    }
    return itemPropertyDescriptors;
  }
  
  protected void addActivationSpecClassPropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_ActivationSpec_activationSpecClass_feature"), 
      getString("_UI_PropertyDescriptor_description", "_UI_ActivationSpec_activationSpecClass_feature", "_UI_ActivationSpec_type"), 
      JcaPackage.eINSTANCE.getActivationSpec_ActivationSpecClass(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
  }
  
  public Collection getChildrenReferences(Object object)
  {
    if (childrenReferences == null)
    {
      super.getChildrenReferences(object);
      childrenReferences.add(JcaPackage.eINSTANCE.getActivationSpec_RequiredConfigProperties());
    }
    return childrenReferences;
  }
  
  public Object getImage(Object object)
  {
    return getResourceLocator().getImage("full/obj16/ActivationSpec");
  }
  
  public String getText(Object object)
  {
    String label = ((ActivationSpec)object).getActivationSpecClass();
    return 
      JCAResourceHandler._UI_ActivationSpec_type + " " + label;
  }
  
  public void notifyChanged(Notification notification)
  {
    switch (notification.getFeatureID(ActivationSpec.class))
    {
    case 0: 
    case 1: 
      fireNotifyChanged(notification);
      return;
    }
    super.notifyChanged(notification);
  }
  
  protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object)
  {
    super.collectNewChildDescriptors(newChildDescriptors, object);
    
    newChildDescriptors.add(createChildParameter(JcaPackage.eINSTANCE.getActivationSpec_RequiredConfigProperties(), JcaFactory.eINSTANCE.createRequiredConfigPropertyType()));
  }
  
  public ResourceLocator getResourceLocator()
  {
    return JcaPlugin.getPlugin();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.providers.ActivationSpecItemProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.providers;

import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.jst.j2ee.jca.AdminObject;
import org.eclipse.jst.j2ee.jca.JcaFactory;
import org.eclipse.jst.j2ee.jca.JcaPackage;
import org.eclipse.jst.j2ee.jca.internal.plugin.JCAResourceHandler;
import org.eclipse.jst.j2ee.jca.internal.plugin.JcaPlugin;

public class AdminObjectItemProvider
  extends ItemProviderAdapter
  implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
  public AdminObjectItemProvider(AdapterFactory adapterFactory)
  {
    super(adapterFactory);
  }
  
  public List getPropertyDescriptors(Object object)
  {
    if (itemPropertyDescriptors == null)
    {
      super.getPropertyDescriptors(object);
      
      addAdminObjectInterfacePropertyDescriptor(object);
      addAdminObjectClassPropertyDescriptor(object);
    }
    return itemPropertyDescriptors;
  }
  
  protected void addAdminObjectInterfacePropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_AdminObject_adminObjectInterface_feature"), 
      getString("_UI_PropertyDescriptor_description", "_UI_AdminObject_adminObjectInterface_feature", "_UI_AdminObject_type"), 
      JcaPackage.eINSTANCE.getAdminObject_AdminObjectInterface(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
  }
  
  protected void addAdminObjectClassPropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_AdminObject_adminObjectClass_feature"), 
      getString("_UI_PropertyDescriptor_description", "_UI_AdminObject_adminObjectClass_feature", "_UI_AdminObject_type"), 
      JcaPackage.eINSTANCE.getAdminObject_AdminObjectClass(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
  }
  
  public Collection getChildrenReferences(Object object)
  {
    if (childrenReferences == null)
    {
      super.getChildrenReferences(object);
      childrenReferences.add(JcaPackage.eINSTANCE.getAdminObject_ConfigProperties());
    }
    return childrenReferences;
  }
  
  public Object getImage(Object object)
  {
    return getResourceLocator().getImage("full/obj16/AdminObject");
  }
  
  public String getText(Object object)
  {
    String label = ((AdminObject)object).getAdminObjectInterface();
    return 
      JCAResourceHandler._UI_AdminObject_type + " " + label;
  }
  
  public void notifyChanged(Notification notification)
  {
    switch (notification.getFeatureID(AdminObject.class))
    {
    case 0: 
    case 1: 
    case 2: 
      fireNotifyChanged(notification);
      return;
    }
    super.notifyChanged(notification);
  }
  
  protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object)
  {
    super.collectNewChildDescriptors(newChildDescriptors, object);
    
    newChildDescriptors.add(createChildParameter(JcaPackage.eINSTANCE.getAdminObject_ConfigProperties(), JcaFactory.eINSTANCE.createConfigProperty()));
  }
  
  public ResourceLocator getResourceLocator()
  {
    return JcaPlugin.getPlugin();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.j2ee.internal.jca.providers.AdminObjectItemProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.j2ee.internal.jca.providers;

import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.jst.j2ee.common.CommonFactory;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
import org.eclipse.jst.j2ee.jca.AuthenticationMechanism;
import org.eclipse.jst.j2ee.jca.JcaPackage;
import org.eclipse.jst.j2ee.webservice.wscommon.WscommonFactory;

public class AuthenticationMechanismItemProvider
  extends JcaItemProviderAdapter
  implements IEditingDomainItemProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
  public AuthenticationMechanismItemProvider(AdapterFactory adapterFactory)
  {
    super(adapterFactory);
  }
  
  public List getPropertyDescriptors(Object object)
  {
    if (itemPropertyDescriptors == null)
    {
      super.getPropertyDescriptors(object);
      
      addDescriptionPropertyDescriptor(object);
      addAuthenticationMechanismPropertyDescriptor(object);
      addAuthenticationMechanismTypePropertyDescriptor(object);
      addCredentialInterfacePropertyDescriptor(object);
      addCustomAuthMechTypePropertyDescriptor(object);
    }
    return itemPropertyDescriptors;
  }
  
  protected void addDescriptionPropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_AuthenticationMechanism_description_feature"), 
      getString("_UI_PropertyDescriptor_description", "_UI_AuthenticationMechanism_description_feature", "_UI_AuthenticationMechanism_type"), 
      JcaPackage.eINSTANCE.getAuthenticationMechanism_Description(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
  }
  
  protected void addAuthenticationMechanismPropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_AuthenticationMechanism_authenticationMechanism_feature"), 
      getString("_UI_PropertyDescriptor_description", "_UI_AuthenticationMechanism_authenticationMechanism_feature", "_UI_AuthenticationMechanism_type"), 
      JcaPackage.eINSTANCE.getAuthenticationMechanism_AuthenticationMechanism(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
  }
  
  protected void addAuthenticationMechanismTypePropertyDescriptor(Object object)
  {
    itemPropertyDescriptors.add(new ItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getString("_UI_Authentication
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd