org.eclipse.jst.j2ee.componentcore.util
Class EARArtifactEdit

java.lang.Object
  extended byArtifactEdit
      extended byorg.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit
          extended byorg.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit

public class EARArtifactEdit
extends EnterpriseArtifactEdit

EARArtifactEdit obtains an org.eclipse.jst.j2ee.application.Application metamodel. The org.eclipse.jst.j2ee.application.ApplicationResource  which stores the metamodel is retrieved from the org.eclipse.wst.common.modulecore.ArtifactEditModel using a cached constant (@see org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants#APPLICATION_DD_URI). The defined methods extract data or manipulate the contents of the underlying resource.

See Also:
Serialized Form

Field Summary
static java.lang.Class ADAPTER_TYPE
           
static java.lang.String TYPE_ID
           Identifier used to group and query common artifact edits.
 
Constructor Summary
EARArtifactEdit(ArtifactEditModel model)
           Creates an instance facade for the given ArtifactEditModel.
EARArtifactEdit(ComponentHandle aHandle, boolean toAccessAsReadOnly)
           
EARArtifactEdit(ModuleCoreNature aNature, WorkbenchComponent aModule, boolean toAccessAsReadOnly)
           Creates an instance facade for the given ArtifactEditModel
 
Method Summary
 EObject createModelRoot()
           Create an deployment descriptor resource if one does not get and return it.
 EObject createModelRoot(int version)
           Create an deployment descriptor resource if one does not get and return it.
 Application getApplication()
           Obtains the Application Applicationroot object from the ApplicationResource, the root object contains all other resource defined objects.
 ApplicationResource getApplicationXmiResource()
           
 Resource getDeploymentDescriptorResource()
           Retrieves the resource from the ArtifactEditModel
static EARArtifactEdit getEARArtifactEditForRead(ComponentHandle aHandle)
           Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent.
static EARArtifactEdit getEARArtifactEditForWrite(ComponentHandle aHandle)
           Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent.
 int getJ2EEVersion()
           Retrieves J2EE version information from ApplicationResource.
 java.util.List getWorkbenchJ2EEModules(WorkbenchComponent module)
          Note: This method is for internal use only.
 java.util.List getWorkbenchUtilModules(WorkbenchComponent module)
          Note: This method is for internal use only.
static boolean isValidEARModule(WorkbenchComponent aModule)
           
 boolean uriExists(java.lang.String currentURI)
          Checks if the uri mapping already exists.
 
Methods inherited from class org.eclipse.jst.j2ee.componentcore.EnterpriseArtifactEdit
delete, getDeploymentDescriptorRoot, getExistingWorkingCopy, getWorkingCopy, getWorkingCopyManager
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADAPTER_TYPE

public static final java.lang.Class ADAPTER_TYPE

TYPE_ID

public static java.lang.String TYPE_ID

Identifier used to group and query common artifact edits.

Constructor Detail

EARArtifactEdit

public EARArtifactEdit(ComponentHandle aHandle,
                       boolean toAccessAsReadOnly)
                throws java.lang.IllegalArgumentException
Parameters:
aHandle -
toAccessAsReadOnly -
Throws:
java.lang.IllegalArgumentException

EARArtifactEdit

public EARArtifactEdit(ArtifactEditModel model)

Creates an instance facade for the given ArtifactEditModel.


EARArtifactEdit

public EARArtifactEdit(ModuleCoreNature aNature,
                       WorkbenchComponent aModule,
                       boolean toAccessAsReadOnly)

Creates an instance facade for the given ArtifactEditModel

Note: This method is for internal use only. Clients should not call this method.

Parameters:
aNature - A non-null ModuleCoreNaturefor an accessible project
aModule - A non-null WorkbenchComponentpointing to a module from the given ModuleCoreNature
Method Detail

getEARArtifactEditForRead

public static EARArtifactEdit getEARArtifactEditForRead(ComponentHandle aHandle)

Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent. Instances of ArtifactEdit that are returned through this method must be #dispose()ed of when no longer in use.

Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent that will not be used for editing. Invocations of any save*() API on an instance returned from this method will throw exceptions.

The following method may return null.

Returns:
An instance of ArtifactEdit that may only be used to read the underlying content model

getEARArtifactEditForWrite

public static EARArtifactEdit getEARArtifactEditForWrite(ComponentHandle aHandle)

Returns an instance facade to manage the underlying edit model for the given WorkbenchComponent. Instances of ArtifactEdit that are returned through this method must be #dispose()ed of when no longer in use.

Use to acquire an ArtifactEdit facade for a specific WorkbenchComponent that will be used for editing.

The following method may return null.

Returns:
An instance of ArtifactEdit that may be used to modify and persist changes to the underlying content model

isValidEARModule

public static boolean isValidEARModule(WorkbenchComponent aModule)
                                throws UnresolveableURIException
Returns:
True if the supplied module ArtifactEdit#isValidEditableModule(WorkbenchComponent)and the moduleTypeId is a JST module
Throws:
UnresolveableURIException

getJ2EEVersion

public int getJ2EEVersion()

Retrieves J2EE version information from ApplicationResource.

Specified by:
getJ2EEVersion in class EnterpriseArtifactEdit
Returns:
an integer representation of a J2EE Spec version

getApplicationXmiResource

public ApplicationResource getApplicationXmiResource()
Returns:
ApplicationResource from (@link getDeploymentDescriptorResource())

getApplication

public Application getApplication()

Obtains the Application Applicationroot object from the ApplicationResource, the root object contains all other resource defined objects.

Returns:
Application

getDeploymentDescriptorResource

public Resource getDeploymentDescriptorResource()

Retrieves the resource from the ArtifactEditModel

Specified by:
getDeploymentDescriptorResource in class EnterpriseArtifactEdit
Returns:
Resource

uriExists

public boolean uriExists(java.lang.String currentURI)
Checks if the uri mapping already exists.

Returns:
boolean

createModelRoot

public EObject createModelRoot()
Description copied from class: EnterpriseArtifactEdit

Create an deployment descriptor resource if one does not get and return it. Subclasses should overwrite this method to create their own type of deployment descriptor

Specified by:
createModelRoot in class EnterpriseArtifactEdit
Returns:
an EObject

createModelRoot

public EObject createModelRoot(int version)
Description copied from class: EnterpriseArtifactEdit

Create an deployment descriptor resource if one does not get and return it. Subclasses should overwrite this method to create their own type of deployment descriptor

Specified by:
createModelRoot in class EnterpriseArtifactEdit
Returns:
an EObject

getWorkbenchUtilModules

public java.util.List getWorkbenchUtilModules(WorkbenchComponent module)

Note: This method is for internal use only. Clients should not call this method.

Returns:
- a list of util modules referred by a given j2ee module

getWorkbenchJ2EEModules

public java.util.List getWorkbenchJ2EEModules(WorkbenchComponent module)

Note: This method is for internal use only. Clients should not call this method.

Parameters:
module -
Returns:
- a list of J2EE modules referred by a given j2ee module