org.netbeans.api.web.webmodule 1.9

org.netbeans.modules.web.api.webmodule
Class WebModule

java.lang.Object
  extended by org.netbeans.modules.web.api.webmodule.WebModule

public final class WebModule
extends Object

This class encapsulates a web module.

A client may obtain a WebModule instance using method getWebModule(org.openide.filesystems.FileObject), for any FileObject in the web module directory structure.

Use the classpath API to obtain the classpath for the document base (this classpath is used for code completion of JSPs). An example:

     WebModule wm = ...;
     FileObject docRoot = wm.getDocumentBase ();
     ClassPath cp = ClassPath.getClassPath(docRoot, ClassPath.EXECUTE);
 

Note that no particular directory structure for web module is guaranteed by this API.


Field Summary
static String J2EE_13_LEVEL
           
static String J2EE_14_LEVEL
           
static String JAVA_EE_5_LEVEL
           
 
Method Summary
 boolean equals(Object obj)
           
 String getContextPath()
          Returns the context path of the web module.
 org.openide.filesystems.FileObject getDeploymentDescriptor()
          Returns the deployment descriptor (web.xml file) of the web module.
 org.openide.filesystems.FileObject getDocumentBase()
          Returns the folder that contains sources of the static documents for the web module (html, JSPs, etc.).
 String getJ2eePlatformVersion()
          Returns the J2EE platform version of this module.
 org.openide.filesystems.FileObject[] getJavaSources()
          Deprecated. This method is deprecated, because its return values does not contain enough information about the source roots. Source roots are usually implemented by a org.netbeans.api.project.SourceGroup, which is more than just a container for a FileObject.
 org.netbeans.modules.j2ee.metadata.model.api.MetadataModel<org.netbeans.modules.j2ee.dd.api.web.WebAppMetadata> getMetadataModel()
          Returns a model describing the metadata of this web module (servlets, resources, etc.).
 org.openide.filesystems.FileObject getWebInf()
          Returns the WEB-INF folder for the web module.
static WebModule getWebModule(org.openide.filesystems.FileObject file)
          Finds the web module for the given file.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

J2EE_13_LEVEL

public static final String J2EE_13_LEVEL
See Also:
Constant Field Values

J2EE_14_LEVEL

public static final String J2EE_14_LEVEL
See Also:
Constant Field Values

JAVA_EE_5_LEVEL

public static final String JAVA_EE_5_LEVEL
See Also:
Constant Field Values
Method Detail

getWebModule

public static WebModule getWebModule(org.openide.filesystems.FileObject file)
Finds the web module for the given file.

Parameters:
file - the file to find the web module for.
Returns:
the web module this file belongs to or null if the file does not belong to any web module.
Throws:
NullPointerException - if the file parameter is null.

getDocumentBase

public org.openide.filesystems.FileObject getDocumentBase()
Returns the folder that contains sources of the static documents for the web module (html, JSPs, etc.).

Returns:
the static documents folder; can be null.

getWebInf

public org.openide.filesystems.FileObject getWebInf()
Returns the WEB-INF folder for the web module. It may return null for web module that does not have any WEB-INF folder.

The WEB-INF folder would typically be a child of the folder returned by getDocumentBase() but does not need to be.

Returns:
the WEB-INF folder; can be null.

getDeploymentDescriptor

public org.openide.filesystems.FileObject getDeploymentDescriptor()
Returns the deployment descriptor (web.xml file) of the web module.
The web.xml file would typically be a child of the folder returned by getWebInf() but does not need to be.

Returns:
the web.xml file; can be null.

getContextPath

public String getContextPath()
Returns the context path of the web module.

Returns:
the context path; can be null.

getJ2eePlatformVersion

public String getJ2eePlatformVersion()
Returns the J2EE platform version of this module. The returned value is one of the constants J2EE_13_LEVEL, J2EE_14_LEVEL or JAVA_EE_5_LEVEL.

Returns:
J2EE platform version; never null.

getJavaSources

@Deprecated
public org.openide.filesystems.FileObject[] getJavaSources()
Deprecated. This method is deprecated, because its return values does not contain enough information about the source roots. Source roots are usually implemented by a org.netbeans.api.project.SourceGroup, which is more than just a container for a FileObject.

Returns the Java source roots associated with the web module.

Note that not all the java source roots in the project (e.g. in a freeform project) belong to the web module.

Returns:
this web module's Java source roots; never null.

getMetadataModel

public org.netbeans.modules.j2ee.metadata.model.api.MetadataModel<org.netbeans.modules.j2ee.dd.api.web.WebAppMetadata> getMetadataModel()
Returns a model describing the metadata of this web module (servlets, resources, etc.).

Returns:
this web module's metadata model; never null.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

org.netbeans.api.web.webmodule 1.9

Built on September 25 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.