org.eclipse.jst.j2ee_1.1.503.v201202090300

16:45:47.014 INFO  jd.cli.Main - Decompiling org.eclipse.jst.j2ee_1.1.503.v201202090300.jar
package org.eclipse.jst.j2ee.application.internal.operations;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.j2ee.project.EJBUtilities;
import org.eclipse.jst.j2ee.project.EarUtilities;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;

public class AddComponentToEnterpriseApplicationDataModelProvider
  extends CreateReferenceComponentsDataModelProvider
  implements IAddComponentToEnterpriseApplicationDataModelProperties
{
  public Object getDefaultProperty(String propertyName)
  {
    if ("ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP".equals(propertyName))
    {
      Map map = new HashMap();
      List components = (List)getProperty("ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT");
      for (int i = 0; i < components.size(); i++)
      {
        IVirtualComponent component = (IVirtualComponent)components.get(i);
        IProject project = component.getProject();
        String name = component.getName();
        if (name != null) {
          name = name.replace(' ', '_');
        }
        if (name != null) {
          name = new Path(name).lastSegment();
        }
        if (!component.isBinary()) {
          if (JavaEEProjectUtilities.isDynamicWebProject(project)) {
            name = name + ".war";
          } else if (JavaEEProjectUtilities.isJCAProject(project)) {
            name = name + ".rar";
          } else {
            name = name + ".jar";
          }
        }
        map.put(component, name);
      }
      setProperty(propertyName, map);
      return map;
    }
    if ("ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_DEPLOY_PATH_MAP".equals(propertyName))
    {
      Map map = new HashMap();
      List CompList = (List)getProperty("ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT");
      IVirtualComponent earComp = (IVirtualComponent)getProperty("ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT");
      String libDir = EarUtilities.getEARLibDir(earComp);
      if ((libDir != null) && (libDir.length() > 0))
      {
        String libDirPath = new Path(libDir).makeAbsolute().toString();
        for (int i = 0; i < CompList.size(); i++) {
          if (CompList.get(i) != null)
          {
            IVirtualComponent Comp = (IVirtualComponent)CompList.get(i);
            IProject CompProject = Comp.getProject();
            if ((JavaEEProjectUtilities.isUtilityProject(CompProject)) && (!EJBUtilities.isEJBClientProject(CompProject)) && (JavaEEProjectUtilities.isJEEComponent(earComp))) {
              map.put(Comp, libDirPath);
            }
          }
        }
        setProperty(propertyName, map);
        return map;
      }
      return super.getDefaultProperty(propertyName);
    }
    return super.getDefaultProperty(propertyName);
  }
  
  public IDataModelOperation getDefaultOperation()
  {
    return new AddComponentToEnterpriseApplicationOp(model);
  }
}

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

import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jst.j2ee.internal.ICommonEMFModule;
import org.eclipse.jst.j2ee.model.IEARModelProvider;
import org.eclipse.jst.j2ee.project.EarUtilities;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.jst.jee.application.ICommonApplication;
import org.eclipse.jst.jee.application.ICommonModule;
import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResource;

class AddComponentToEnterpriseApplicationOp$1
  implements Runnable
{
  AddComponentToEnterpriseApplicationOp$1(AddComponentToEnterpriseApplicationOp paramAddComponentToEnterpriseApplicationOp, IEARModelProvider paramIEARModelProvider, Map paramMap1, IVirtualComponent paramIVirtualComponent1, Map paramMap2, IVirtualComponent paramIVirtualComponent2, ReferencedComponent paramReferencedComponent, IProject paramIProject) {}
  
  public void run()
  {
    ICommonApplication application = (ICommonApplication)val$earModel.getModelObject();
    if (application != null)
    {
      String name = (String)val$map.get(val$wc);
      if (val$deployMap.containsKey(val$wc))
      {
        String deployPath = (String)val$deployMap.get(val$wc);
        if ((name != null) && (!deployPath.equals("/"))) {
          name = new Path(deployPath).append(name).toString();
        }
        String libDir = EarUtilities.getEARLibDir(val$ear);
        IPath libDirPath = null;
        if (libDir != null) {
          libDirPath = new Path(libDir).makeRelative();
        }
        if ((libDirPath != null) && (!libDirPath.isEmpty()) && (new Path(deployPath).makeRelative().equals(libDirPath))) {
          return;
        }
      }
      if (name != null) {
        name = new Path(name).makeRelative().toString();
      }
      ICommonModule mod = this$0.addModule(application, val$wc, name);
      if (mod == null) {
        return;
      }
      if (val$ref != null) {
        val$ref.setDependentObject((EObject)mod);
      }
      if ((JavaEEProjectUtilities.isStaticWebProject(val$wc.getProject())) || 
        (JavaEEProjectUtilities.isDynamicWebComponent(val$wc))) {
        AddComponentToEnterpriseApplicationOp.access$0(this$0, val$earpj, val$wc, mod);
      }
      Resource theResource = ((EObject)mod).eResource();
      if (theResource != null)
      {
        String frag = null;
        if ((theResource instanceof CompatibilityXMIResource)) {
          frag = theResource.getURIFragment((EObject)mod);
        }
        ((ICommonEMFModule)mod).setId(frag);
      }
    }
  }
}

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

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jst.j2ee.application.ConnectorModule;
import org.eclipse.jst.j2ee.application.EjbModule;
import org.eclipse.jst.j2ee.application.JavaClientModule;
import org.eclipse.jst.j2ee.application.WebModule;
import org.eclipse.jst.j2ee.internal.ICommonEMFModule;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
import org.eclipse.jst.j2ee.internal.componentcore.JavaEEBinaryComponentHelper;
import org.eclipse.jst.j2ee.model.IEARModelProvider;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.jst.j2ee.project.EarUtilities;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.jst.javaee.application.Module;
import org.eclipse.jst.javaee.application.Web;
import org.eclipse.jst.jee.application.ICommonApplication;
import org.eclipse.jst.jee.application.ICommonModule;
import org.eclipse.wst.common.componentcore.internal.ReferencedComponent;
import org.eclipse.wst.common.componentcore.internal.StructureEdit;
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsOp;
import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.internal.emf.resource.CompatibilityXMIResource;

public class AddComponentToEnterpriseApplicationOp
  extends CreateReferenceComponentsOp
{
  public static final String metaInfFolderDeployPath = "/";
  
  public AddComponentToEnterpriseApplicationOp(IDataModel model)
  {
    super(model);
  }
  
  public IStatus execute(IProgressMonitor monitor, IAdaptable info)
    throws ExecutionException
  {
    if (monitor != null) {
      monitor.beginTask("", 4);
    }
    try
    {
      J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
      IStatus status = validateEditEAR();
      IStatus localIStatus1;
      IStatus status;
      if (status.isOK())
      {
        status = super.execute(submon(monitor, 1), info);
        if (!status.isOK()) {
          return Status.CANCEL_STATUS;
        }
        updateEARDD(submon(monitor, 1));
        updateModuleRuntimes(submon(monitor, 1));
        moduleClasspathForceUpdate(submon(monitor, 1));
      }
      return status;
    }
    finally
    {
      if (monitor != null) {
        monitor.done();
      }
      J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
    }
  }
  
  /* Error */
  protected void updateEARDD(IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aload_0
    //   3: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   6: ldc 4
    //   8: invokeinterface 546 2 0
    //   13: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   16: astore_3
    //   17: aload_3
    //   18: invokeinterface 542 1 0
    //   23: invokestatic 478	org/eclipse/jst/j2ee/model/ModelProviderManager:getModelProvider	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/jst/j2ee/model/IModelProvider;
    //   26: checkcast 250	org/eclipse/jst/j2ee/model/IEARModelProvider
    //   29: astore 4
    //   31: aload_0
    //   32: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   35: ldc 4
    //   37: invokeinterface 546 2 0
    //   42: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   45: astore 5
    //   47: aload 5
    //   49: invokeinterface 542 1 0
    //   54: astore 6
    //   56: aload_3
    //   57: invokeinterface 542 1 0
    //   62: invokestatic 491	org/eclipse/wst/common/componentcore/internal/StructureEdit:getStructureEditForWrite	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/wst/common/componentcore/internal/StructureEdit;
    //   65: astore_2
    //   66: aload 4
    //   68: ifnull +407 -> 475
    //   71: aload_0
    //   72: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   75: ldc 5
    //   77: invokeinterface 546 2 0
    //   82: checkcast 225	java/util/List
    //   85: astore 7
    //   87: aload 7
    //   89: ifnonnull +12 -> 101
    //   92: new 221	java/util/ArrayList
    //   95: dup
    //   96: invokespecial 452	java/util/ArrayList:<init>	()V
    //   99: astore 7
    //   101: aload 7
    //   103: invokeinterface 500 1 0
    //   108: ifeq +65 -> 173
    //   111: aload 5
    //   113: invokestatic 477	org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities:getJ2EEModuleReferences	(Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;)[Lorg/eclipse/wst/common/componentcore/resources/IVirtualReference;
    //   116: astore 8
    //   118: aload 8
    //   120: ifnull +53 -> 173
    //   123: aload 8
    //   125: arraylength
    //   126: ifle +47 -> 173
    //   129: new 221	java/util/ArrayList
    //   132: dup
    //   133: invokespecial 452	java/util/ArrayList:<init>	()V
    //   136: astore 7
    //   138: iconst_0
    //   139: istore 9
    //   141: goto +24 -> 165
    //   144: aload 7
    //   146: aload 8
    //   148: iload 9
    //   150: aaload
    //   151: invokeinterface 545 1 0
    //   156: invokeinterface 502 2 0
    //   161: pop
    //   162: iinc 9 1
    //   165: iload 9
    //   167: aload 8
    //   169: arraylength
    //   170: if_icmplt -26 -> 144
    //   173: aload_0
    //   174: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   177: ldc 6
    //   179: invokeinterface 546 2 0
    //   184: checkcast 226	java/util/Map
    //   187: astore 8
    //   189: aload_0
    //   190: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   193: ldc 7
    //   195: invokeinterface 546 2 0
    //   200: checkcast 226	java/util/Map
    //   203: astore 9
    //   205: aload 7
    //   207: invokeinterface 499 1 0
    //   212: ifle +263 -> 475
    //   215: iconst_0
    //   216: istore 10
    //   218: goto +203 -> 421
    //   221: aload 7
    //   223: iload 10
    //   225: invokeinterface 501 2 0
    //   230: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   233: astore 11
    //   235: iconst_1
    //   236: istore 12
    //   238: aload 11
    //   240: invokeinterface 540 1 0
    //   245: ifeq +22 -> 267
    //   248: aload 11
    //   250: checkcast 244	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent
    //   253: invokevirtual 468	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent:isLinkedToEAR	()Z
    //   256: istore 12
    //   258: aload 11
    //   260: checkcast 244	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent
    //   263: iconst_0
    //   264: invokevirtual 469	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent:setLinkedToEAR	(Z)V
    //   267: aload_2
    //   268: invokevirtual 490	org/eclipse/wst/common/componentcore/internal/StructureEdit:getComponent	()Lorg/eclipse/wst/common/componentcore/internal/WorkbenchComponent;
    //   271: astore 13
    //   273: aconst_null
    //   274: astore 14
    //   276: aload 11
    //   278: invokeinterface 542 1 0
    //   283: invokestatic 491	org/eclipse/wst/common/componentcore/internal/StructureEdit:getStructureEditForWrite	(Lorg/eclipse/core/resources/IProject;)Lorg/eclipse/wst/common/componentcore/internal/StructureEdit;
    //   286: astore 14
    //   288: aload 13
    //   290: aload 11
    //   292: aload_2
    //   293: aload 14
    //   295: invokestatic 466	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:findReferencedComponent	(Lorg/eclipse/wst/common/componentcore/internal/WorkbenchComponent;Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;Lorg/eclipse/wst/common/componentcore/internal/StructureEdit;Lorg/eclipse/wst/common/componentcore/internal/StructureEdit;)Lorg/eclipse/wst/common/componentcore/internal/ReferencedComponent;
    //   298: astore 15
    //   300: aload 4
    //   302: new 243	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp$1
    //   305: dup
    //   306: aload_0
    //   307: aload 4
    //   309: aload 8
    //   311: aload 11
    //   313: aload 9
    //   315: aload 5
    //   317: aload 15
    //   319: aload 6
    //   321: invokespecial 467	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp$1:<init>	(Lorg/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp;Lorg/eclipse/jst/j2ee/model/IEARModelProvider;Ljava/util/Map;Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;Ljava/util/Map;Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;Lorg/eclipse/wst/common/componentcore/internal/ReferencedComponent;Lorg/eclipse/core/resources/IProject;)V
    //   324: aconst_null
    //   325: invokeinterface 524 3 0
    //   330: goto +24 -> 354
    //   333: astore 16
    //   335: aload 14
    //   337: ifnull +14 -> 351
    //   340: aload 14
    //   342: aload_1
    //   343: invokevirtual 489	org/eclipse/wst/common/componentcore/internal/StructureEdit:saveIfNecessary	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   346: aload 14
    //   348: invokevirtual 488	org/eclipse/wst/common/componentcore/internal/StructureEdit:dispose	()V
    //   351: aload 16
    //   353: athrow
    //   354: aload 14
    //   356: ifnull +42 -> 398
    //   359: aload 14
    //   361: aload_1
    //   362: invokevirtual 489	org/eclipse/wst/common/componentcore/internal/StructureEdit:saveIfNecessary	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   365: aload 14
    //   367: invokevirtual 488	org/eclipse/wst/common/componentcore/internal/StructureEdit:dispose	()V
    //   370: goto +28 -> 398
    //   373: astore 17
    //   375: aload 11
    //   377: invokeinterface 540 1 0
    //   382: ifeq +13 -> 395
    //   385: aload 11
    //   387: checkcast 244	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent
    //   390: iload 12
    //   392: invokevirtual 469	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent:setLinkedToEAR	(Z)V
    //   395: aload 17
    //   397: athrow
    //   398: aload 11
    //   400: invokeinterface 540 1 0
    //   405: ifeq +13 -> 418
    //   408: aload 11
    //   410: checkcast 244	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent
    //   413: iload 12
    //   415: invokevirtual 469	org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualArchiveComponent:setLinkedToEAR	(Z)V
    //   418: iinc 10 1
    //   421: iload 10
    //   423: aload 7
    //   425: invokeinterface 499 1 0
    //   430: if_icmplt -209 -> 221
    //   433: goto +42 -> 475
    //   436: astore_3
    //   437: aload_3
    //   438: invokestatic 476	org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin:logError	(Ljava/lang/Throwable;)V
    //   441: aload_2
    //   442: ifnull +46 -> 488
    //   445: aload_2
    //   446: aload_1
    //   447: invokevirtual 489	org/eclipse/wst/common/componentcore/internal/StructureEdit:saveIfNecessary	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   450: aload_2
    //   451: invokevirtual 488	org/eclipse/wst/common/componentcore/internal/StructureEdit:dispose	()V
    //   454: goto +34 -> 488
    //   457: astore 18
    //   459: aload_2
    //   460: ifnull +12 -> 472
    //   463: aload_2
    //   464: aload_1
    //   465: invokevirtual 489	org/eclipse/wst/common/componentcore/internal/StructureEdit:saveIfNecessary	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   468: aload_2
    //   469: invokevirtual 488	org/eclipse/wst/common/componentcore/internal/StructureEdit:dispose	()V
    //   472: aload 18
    //   474: athrow
    //   475: aload_2
    //   476: ifnull +12 -> 488
    //   479: aload_2
    //   480: aload_1
    //   481: invokevirtual 489	org/eclipse/wst/common/componentcore/internal/StructureEdit:saveIfNecessary	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   484: aload_2
    //   485: invokevirtual 488	org/eclipse/wst/common/componentcore/internal/StructureEdit:dispose	()V
    //   488: return
    // Line number table:
    //   Java source line #99	-> byte code offset #0
    //   Java source line #101	-> byte code offset #2
    //   Java source line #102	-> byte code offset #17
    //   Java source line #103	-> byte code offset #31
    //   Java source line #104	-> byte code offset #47
    //   Java source line #105	-> byte code offset #56
    //   Java source line #107	-> byte code offset #66
    //   Java source line #108	-> byte code offset #71
    //   Java source line #109	-> byte code offset #87
    //   Java source line #110	-> byte code offset #92
    //   Java source line #111	-> byte code offset #101
    //   Java source line #112	-> byte code offset #111
    //   Java source line #113	-> byte code offset #118
    //   Java source line #114	-> byte code offset #129
    //   Java source line #115	-> byte code offset #138
    //   Java source line #116	-> byte code offset #144
    //   Java source line #115	-> byte code offset #162
    //   Java source line #121	-> byte code offset #173
    //   Java source line #122	-> byte code offset #189
    //   Java source line #123	-> byte code offset #205
    //   Java source line #124	-> byte code offset #215
    //   Java source line #126	-> byte code offset #221
    //   Java source line #127	-> byte code offset #235
    //   Java source line #129	-> byte code offset #238
    //   Java source line #130	-> byte code offset #248
    //   Java source line #131	-> byte code offset #258
    //   Java source line #133	-> byte code offset #267
    //   Java source line #134	-> byte code offset #273
    //   Java source line #136	-> byte code offset #276
    //   Java source line #137	-> byte code offset #288
    //   Java source line #138	-> byte code offset #300
    //   Java source line #177	-> byte code offset #324
    //   Java source line #138	-> byte code offset #325
    //   Java source line #178	-> byte code offset #333
    //   Java source line #179	-> byte code offset #335
    //   Java source line #180	-> byte code offset #340
    //   Java source line #181	-> byte code offset #346
    //   Java source line #183	-> byte code offset #351
    //   Java source line #179	-> byte code offset #354
    //   Java source line #180	-> byte code offset #359
    //   Java source line #181	-> byte code offset #365
    //   Java source line #184	-> byte code offset #373
    //   Java source line #185	-> byte code offset #375
    //   Java source line #186	-> byte code offset #385
    //   Java source line #188	-> byte code offset #395
    //   Java source line #185	-> byte code offset #398
    //   Java source line #186	-> byte code offset #408
    //   Java source line #124	-> byte code offset #418
    //   Java source line #192	-> byte code offset #436
    //   Java source line #193	-> byte code offset #437
    //   Java source line #195	-> byte code offset #441
    //   Java source line #196	-> byte code offset #445
    //   Java source line #197	-> byte code offset #450
    //   Java source line #194	-> byte code offset #457
    //   Java source line #195	-> byte code offset #459
    //   Java source line #196	-> byte code offset #463
    //   Java source line #197	-> byte code offset #468
    //   Java source line #199	-> byte code offset #472
    //   Java source line #195	-> byte code offset #475
    //   Java source line #196	-> byte code offset #479
    //   Java source line #197	-> byte code offset #484
    //   Java source line #200	-> byte code offset #488
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	489	0	this	AddComponentToEnterpriseApplicationOp
    //   0	489	1	monitor	IProgressMonitor
    //   1	484	2	se	StructureEdit
    //   16	41	3	sourceComp	IVirtualComponent
    //   436	2	3	e	Exception
    //   29	279	4	earModel	IEARModelProvider
    //   45	271	5	ear	IVirtualComponent
    //   54	266	6	earpj	IProject
    //   85	339	7	list	List
    //   116	52	8	refs	org.eclipse.wst.common.componentcore.resources.IVirtualReference[]
    //   187	123	8	map	Map
    //   139	27	9	i	int
    //   203	111	9	deployMap	Map
    //   216	206	10	i	int
    //   233	176	11	wc	IVirtualComponent
    //   236	178	12	linkedToEAR	boolean
    //   271	18	13	earwc	WorkbenchComponent
    //   274	92	14	compse	StructureEdit
    //   298	20	15	ref	ReferencedComponent
    //   333	19	16	localObject1	Object
    //   373	23	17	localObject2	Object
    //   457	16	18	localObject3	Object
    // Exception table:
    //   from	to	target	type
    //   276	333	333	finally
    //   238	373	373	finally
    //   2	433	436	java/lang/Exception
    //   2	441	457	finally
  }
  
  private void updateContextRoot(IProject earpj, IVirtualComponent wc, ICommonModule mod)
  {
    String earDDVersion = JavaEEProjectUtilities.getJ2EEDDProjectVersion(earpj);
    boolean useNewModel = (earDDVersion.equals("5.0")) || (earDDVersion.equals("6.0"));
    String contextroot = null;
    if (wc.isBinary())
    {
      IPath path = (IPath)wc.getAdapter(IPath.class);
      contextroot = path.removeFileExtension().lastSegment();
    }
    else
    {
      contextroot = ComponentUtilities.getServerContextRoot(wc.getProject());
    }
    if (contextroot == null) {
      contextroot = wc.getProject().getName();
    }
    if (useNewModel)
    {
      if ((mod instanceof Module))
      {
        Web web = ((Module)mod).getWeb();
        web.setContextRoot(contextroot);
      }
    }
    else if (((JavaEEProjectUtilities.isStaticWebProject(wc.getProject())) || 
      (JavaEEProjectUtilities.isDynamicWebComponent(wc))) && 
      ((mod instanceof WebModule))) {
      ((WebModule)mod).setContextRoot(contextroot);
    }
  }
  
  protected ICommonModule createNewModule(IVirtualComponent wc, String name)
  {
    ICommonModule newModule = null;
    IVirtualComponent ear = (IVirtualComponent)model.getProperty("ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT");
    IProject earpj = ear.getProject();
    
    String earDDVersion = JavaEEProjectUtilities.getJ2EEDDProjectVersion(earpj);
    boolean useNewModel = (earDDVersion.equals("5.0")) || (earDDVersion.equals("6.0"));
    if (wc.isBinary()) {
      JavaEEBinaryComponentHelper.openArchive(wc, useNewModel);
    }
    if (JavaEEProjectUtilities.isDynamicWebComponent(wc))
    {
      if (useNewModel)
      {
        Web web = org.eclipse.jst.javaee.application.ApplicationFactory.eINSTANCE.createWeb();
        web.setWebUri(name);
        Module webModule = org.eclipse.jst.javaee.application.ApplicationFactory.eINSTANCE.createModule();
        webModule.setWeb(web);
        newModule = (ICommonModule)webModule;
      }
      else
      {
        WebModule webModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createWebModule();
        webModule.setUri(name);
        newModule = (ICommonModule)webModule;
      }
      updateContextRoot(earpj, wc, newModule);
      return newModule;
    }
    if (JavaEEProjectUtilities.isEJBComponent(wc))
    {
      if (useNewModel)
      {
        Module ejbModule = org.eclipse.jst.javaee.application.ApplicationFactory.eINSTANCE.createModule();
        ejbModule.setEjb(name);
        newModule = (ICommonModule)ejbModule;
      }
      else
      {
        EjbModule ejbModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createEjbModule();
        ejbModule.setUri(name);
        newModule = (ICommonModule)ejbModule;
      }
      return newModule;
    }
    if (JavaEEProjectUtilities.isApplicationClientComponent(wc))
    {
      if (useNewModel)
      {
        Module appClientModule = org.eclipse.jst.javaee.application.ApplicationFactory.eINSTANCE.createModule();
        appClientModule.setJava(name);
        newModule = (ICommonModule)appClientModule;
      }
      else
      {
        JavaClientModule appClientModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createJavaClientModule();
        appClientModule.setUri(name);
        newModule = (ICommonModule)appClientModule;
      }
      return newModule;
    }
    if (JavaEEProjectUtilities.isJCAComponent(wc))
    {
      if (useNewModel)
      {
        Module j2cModule = org.eclipse.jst.javaee.application.ApplicationFactory.eINSTANCE.createModule();
        j2cModule.setConnector(name);
        newModule = (ICommonModule)j2cModule;
      }
      else
      {
        ConnectorModule j2cModule = org.eclipse.jst.j2ee.application.ApplicationFactory.eINSTANCE.createConnectorModule();
        j2cModule.setUri(name);
        newModule = (ICommonModule)j2cModule;
      }
      return newModule;
    }
    return null;
  }
  
  protected ICommonModule addModule(ICommonApplication application, IVirtualComponent wc, String name)
  {
    ICommonApplication dd = application;
    ICommonModule existingModule = dd.getFirstEARModule(name);
    if (existingModule == null)
    {
      existingModule = createNewModule(wc, name);
      if (existingModule != null)
      {
        existingModule.setUri(name);
        dd.getEARModules().add(existingModule);
      }
    }
    return existingModule;
  }
  
  /* Error */
  private void updateModuleRuntimes(IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnull +13 -> 14
    //   4: aload_1
    //   5: ldc 1
    //   7: bipush 10
    //   9: invokeinterface 512 3 0
    //   14: aload_0
    //   15: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   18: ldc 4
    //   20: invokeinterface 546 2 0
    //   25: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   28: astore_2
    //   29: aload_2
    //   30: invokeinterface 542 1 0
    //   35: astore_3
    //   36: aload_0
    //   37: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   40: ldc 5
    //   42: invokeinterface 546 2 0
    //   47: checkcast 225	java/util/List
    //   50: astore 4
    //   52: new 223	java/util/HashSet
    //   55: dup
    //   56: invokespecial 453	java/util/HashSet:<init>	()V
    //   59: astore 5
    //   61: aload 4
    //   63: invokeinterface 503 1 0
    //   68: astore 6
    //   70: goto +26 -> 96
    //   73: aload 5
    //   75: aload 6
    //   77: invokeinterface 498 1 0
    //   82: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   85: invokeinterface 542 1 0
    //   90: invokeinterface 504 2 0
    //   95: pop
    //   96: aload 6
    //   98: invokeinterface 497 1 0
    //   103: ifne -30 -> 73
    //   106: aload_1
    //   107: ifnull +10 -> 117
    //   110: aload_1
    //   111: iconst_1
    //   112: invokeinterface 511 2 0
    //   117: aload_3
    //   118: aload 5
    //   120: aload_1
    //   121: bipush 9
    //   123: invokestatic 463	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:submon	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   126: invokestatic 487	org/eclipse/jst/j2ee/project/facet/EarFacetRuntimeHandler:updateModuleProjectRuntime	(Lorg/eclipse/core/resources/IProject;Ljava/util/Set;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   129: goto +36 -> 165
    //   132: astore_2
    //   133: aload_2
    //   134: invokestatic 476	org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin:logError	(Ljava/lang/Throwable;)V
    //   137: aload_1
    //   138: ifnull +37 -> 175
    //   141: aload_1
    //   142: invokeinterface 510 1 0
    //   147: goto +28 -> 175
    //   150: astore 7
    //   152: aload_1
    //   153: ifnull +9 -> 162
    //   156: aload_1
    //   157: invokeinterface 510 1 0
    //   162: aload 7
    //   164: athrow
    //   165: aload_1
    //   166: ifnull +9 -> 175
    //   169: aload_1
    //   170: invokeinterface 510 1 0
    //   175: return
    // Line number table:
    //   Java source line #315	-> byte code offset #0
    //   Java source line #316	-> byte code offset #4
    //   Java source line #320	-> byte code offset #14
    //   Java source line #322	-> byte code offset #29
    //   Java source line #324	-> byte code offset #36
    //   Java source line #326	-> byte code offset #52
    //   Java source line #328	-> byte code offset #61
    //   Java source line #329	-> byte code offset #73
    //   Java source line #328	-> byte code offset #96
    //   Java source line #332	-> byte code offset #106
    //   Java source line #333	-> byte code offset #110
    //   Java source line #336	-> byte code offset #117
    //   Java source line #337	-> byte code offset #132
    //   Java source line #338	-> byte code offset #133
    //   Java source line #340	-> byte code offset #137
    //   Java source line #341	-> byte code offset #141
    //   Java source line #339	-> byte code offset #150
    //   Java source line #340	-> byte code offset #152
    //   Java source line #341	-> byte code offset #156
    //   Java source line #343	-> byte code offset #162
    //   Java source line #340	-> byte code offset #165
    //   Java source line #341	-> byte code offset #169
    //   Java source line #344	-> byte code offset #175
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	176	0	this	AddComponentToEnterpriseApplicationOp
    //   0	176	1	monitor	IProgressMonitor
    //   28	2	2	ear	IVirtualComponent
    //   132	2	2	e	Exception
    //   35	83	3	earpj	IProject
    //   50	12	4	moduleComponents	List
    //   59	60	5	moduleProjects	java.util.Set
    //   68	29	6	itr	Iterator
    //   150	13	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   14	129	132	java/lang/Exception
    //   14	137	150	finally
  }
  
  /* Error */
  private void moduleClasspathForceUpdate(IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnull +12 -> 13
    //   4: aload_1
    //   5: ldc 1
    //   7: iconst_1
    //   8: invokeinterface 512 3 0
    //   13: aload_0
    //   14: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   17: ldc 4
    //   19: invokeinterface 546 2 0
    //   24: checkcast 266	org/eclipse/wst/common/componentcore/resources/IVirtualComponent
    //   27: astore_2
    //   28: aload_2
    //   29: invokeinterface 543 1 0
    //   34: checkcast 245	org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent
    //   37: astore_3
    //   38: aload_3
    //   39: iconst_1
    //   40: invokestatic 485	org/eclipse/jst/j2ee/project/JavaEEProjectUtilities:isJEEComponent	(Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;I)Z
    //   43: ifeq +179 -> 222
    //   46: aload_0
    //   47: getfield 449	org/eclipse/jst/j2ee/application/internal/operations/AddComponentToEnterpriseApplicationOp:model	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   50: ldc_w 218
    //   53: invokeinterface 547 2 0
    //   58: astore 4
    //   60: aload_3
    //   61: invokestatic 479	org/eclipse/jst/j2ee/project/EarUtilities:getEARLibDir	(Lorg/eclipse/wst/common/componentcore/resources/IVirtualComponent;)Ljava/lang/String;
    //   64: astore 5
    //   66: aconst_null
    //   67: astore 6
    //   69: aload 5
    //   71: ifnull +17 -> 88
    //   74: new 232	org/eclipse/core/runtime/Path
    //   77: dup
    //   78: aload 5
    //   80: invokespecial 455	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   83: invokevirtual 456	org/eclipse/core/runtime/Path:makeRelative	()Lorg/eclipse/core/runtime/IPath;
    //   86: astore 6
    //   88: aload 6
    //   90: ifnull +132 -> 222
    //   93: aload 4
    //   95: ifnull +127 -> 222
    //   98: aload 6
    //   100: invokeinterface 506 1 0
    //   105: ifne +117 -> 222
    //   108: aload 6
    //   110: new 232	org/eclipse/core/runtime/Path
    //   113: dup
    //   114: aload 4
    //   116: invokespecial 455	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   119: invokevirtual 456	org/eclipse/core/runtime/Path:makeRelative	()Lorg/eclipse/core/runtime/IPath;
    //   122: invokeinterface 507 2 0
    //   127: ifeq +95 -> 222
    //   130: aload_3
    //   131: invokevirtual 470	org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent:getReferences	()[Lorg/eclipse/wst/common/componentcore/resources/IVirtualReference;
    //   134: astore 7
    //   136: new 223	java/util/HashSet
    //   139: dup
    //   140: invokespecial 453	java/util/HashSet:<init>	()V
    //   143: astore 8
    //   145: aload 7
    //   147: dup
    //   148: astore 12
    //   150: arraylength
    //   151: istore 11
    //   153: iconst_0
    //   154: istore 10
    //   156: goto +33 -> 189
    //   159: aload 12
    //   161: iload 10
    //   163: aaload
    //   164: astore 9
    //   166: aload 8
    //   168: aload 9
    //   170: invokeinterface 545 1 0
    //   175: invokeinterface 542 1 0
    //   180: invokeinterface 496 2 0
    //   185: pop
    //   186: iinc 10 1
    //   189: iload 10
    //   191: iload 11
    //   193: if_icmplt -34 -> 159
    //   196: invokestatic 474	org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater:getInstance	()Lorg/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater;
    //   199: aload 8
    //   201: invokevirtual 473	org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater:forceUpdate	(Ljava/util/Collection;)V
    //   204: goto +18 -> 222
    //   207: astore 13
    //   209: aload_1
    //   210: ifnull +9 -> 219
    //   213: aload_1
    //   214: invokeinterface 510 1 0
    //   219: aload 13
    //   221: athrow
    //   222: aload_1
    //   223: ifnull +9 -> 232
    //   226: aload_1
    //   227: invokeinterface 510 1 0
    //   232: return
    // Line number table:
    //   Java source line #347	-> byte code offset #0
    //   Java source line #348	-> byte code offset #4
    //   Java source line #352	-> byte code offset #13
    //   Java source line #354	-> byte code offset #28
    //   Java source line #355	-> byte code offset #38
    //   Java source line #356	-> byte code offset #46
    //   Java source line #357	-> byte code offset #60
    //   Java source line #358	-> byte code offset #66
    //   Java source line #359	-> byte code offset #69
    //   Java source line #360	-> byte code offset #74
    //   Java source line #361	-> byte code offset #88
    //   Java source line #364	-> byte code offset #130
    //   Java source line #365	-> byte code offset #136
    //   Java source line #366	-> byte code offset #145
    //   Java source line #367	-> byte code offset #166
    //   Java source line #366	-> byte code offset #186
    //   Java source line #369	-> byte code offset #196
    //   Java source line #372	-> byte code offset #207
    //   Java source line #373	-> byte code offset #209
    //   Java source line #374	-> byte code offset #213
    //   Java source line #376	-> byte code offset #219
    //   Java source line #373	-> byte code offset #222
    //   Java source line #374	-> byte code offset #226
    //   Java source line #377	-> byte code offset #232
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	233	0	this	AddComponentToEnterpriseApplicationOp
    //   0	233	1	monitor	IProgressMonitor
    //   27	2	2	component	IVirtualComponent
    //   37	94	3	ear	org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

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