| java.lang.Object org.netbeans.modules.visualweb.project.jsf.api.JsfProjectUtils
JsfProjectUtils | public class JsfProjectUtils (Code) | | author: Po-Ting Wu |
Method Summary | |
public static void | addJsfFrameworkChangeListener(Project project, PropertyChangeListener listener) | public static boolean | addLibraryReferences(Project project, Library[] libraries) | public static boolean | addLibraryReferences(Project project, Library[] libraries, String type) Add an array of library references to a project, qualified by the type parameter. | public static void | addLocalizedRoots(Project project, String[] jarName) | public static void | addLocalizedRoots(Project project, String[] jarName, String type) | public static void | addLocalizedRoots(Project project, URL[] roots, String type) | public static void | addLocalizedTheme(Project project, String themeName) | public static void | addProjectPropertyListener(Project project, PropertyChangeListener listener) | public static String | addResource(FileObject webForm, URL resourceURL, boolean copy) Add a new resource to the project
Parameters: webForm - the webform object that will be referencing this resource.Used to determine the relative path name to the resource Parameters: resourceURL - resource to be added Parameters: copy - if true, resource will be copied to the project a source path for the resource in the project. | public static boolean | addRootReferences(Project project, URL[] rootFiles) | public static boolean | addRootReferences(Project project, URL[] rootFiles, String type) Add an root reference to a project qualified by the type parameter. | public static String | addWebAppBean(Project project, String beanName, String[] propertyNames, Object[] propertyValues, String keyProperty) | public static Library | createComponentLibrary(String name, String description, String localizingBundle, List<URL> classPaths, List<URL> sources, List<URL> javadocs, List<URL> designtimes) | public static void | createFile(FileObject target, String content, String encoding) | public static Library | createJ2SELibrary(String name, String description, String localizingBundle, List<URL> classPaths, List<URL> sources, List<URL> javadocs) | public static void | createProjectProperty(Project project, String propName, String value) | public static String | deriveSafeName(String sourceName) | public static boolean | fileContains(FileObject fo, String str) | public static String | getBackwardsKitMesg(boolean addJSF11, boolean addJAXRPC, boolean addRowset) | public static String | getBasePathForJava(FileObject javaFile) | public static String | getBasePathForJsp(FileObject jspFile) | public static String | getDefaultEncoding(Project project) | public static String | getDefaultLocale(Project project) | public static FileObject | getDocumentRoot(Project project) Convenience method to obtain the document root folder. | public static String | getFacesURLPattern(WebApp ddRoot) Get the Faces Servlet URL pattern. | public static String | getJ2eePlatformVersion(Project project) J2EE platform version - one of the constants
JsfProjectUtils.J2EE_13_LEVEL ,
JsfProjectUtils.J2EE_14_LEVEL . | public static JFileChooser | getJFileChooser() This does a special instantiation of JFileChooser
to workaround floppy access bug 5037322. | public static JFileChooser | getJFileChooser(String currentDirectoryPath) | public static JFileChooser | getJFileChooser(File currentDirectory) | public static FileObject | getJavaFolderForJsp(FileObject jspFileObject) Gets corresponding java folder for specified jsp file object if exists. | public static FileObject | getJavaForJsp(FileObject jspFileObject) Gets corresponding java file object for specified jsp file object if exists. | public static FileObject | getJspFolderForJava(FileObject javaFileObject) Gets corresponding jsp folder for specified java file object if exists. | public static FileObject | getJspForJava(FileObject javaFileObject) Gets corresponding jsp file object for specified java file object if exists. | public static FileObject | getNavigationFile(Project project) | public static FileObject | getPageBeanRoot(Project project) | public static JsfPortletSupport | getPortletSupport(Project project) | public static FileObject | getProjectLibraryDirectory(Project project) Returns a directory under the project root where library jar files can be added as project-private resources
Parameters: project - Target project FileObject of the library directory. | public static LibraryManager | getProjectLibraryManager(Project project) | public static String | getProjectProperty(Project project, String propName) | public static String | getProjectVersion(Project project) | public static FileObject | getResourcesDirectory(Project project) Returns a directory under the project root where resource files can be added
Parameters: project - Target project FileObject of the resources directory. | public static String | getSourceEncoding(Project project) | public static String | getSourceLevel(Project project) | public static FileObject | getSourceRoot(Project project) Convenience method to obtain the source root folder. | public static FileObject | getWebInf(Project project) Convenience method to obtain the WEB-INF folder. | public static WebModule | getWebModule(Project project) | public static boolean | hasLibraryReference(Project project, Library library) | public static boolean | hasLibraryReference(Project project, Library library, String type) Check if a project has a library reference to the named library qualified by the type parameter. | public static boolean | hasRootReference(Project project, URL rootFile) | public static boolean | hasRootReference(Project project, URL rootFile, String type) Check if a project has an root reference to the named root qualified by the type parameter. | public static void | importFile(Project project, File file) | public static boolean | isDesigntimeLib(String name) | public static boolean | isJavaEE5Project(Project project) | public static boolean | isJsfFramework(WebFrameworkProvider framework) | public static boolean | isJsfProject(Project project) | public static Boolean | isJsfProjectDir(FileObject projDir) | public static boolean | isJsfProjectFile(FileObject fo) Check for Creator project file. | public static boolean | isStartPage(FileObject webPage) | public static boolean | isValidJavaFileName(String name) Reports whether the given name is a valid Java file name. | public static boolean | isValidJavaPackageName(String pkgName) Reports whether the given name is a valid Java package name. | public static boolean | isWebProject(Project project) | public static void | putProjectProperty(Project project, String propName, String value) | public static String | readResource(InputStream is, String encoding) | public static void | removeJsfFrameworkChangeListener(Project project, PropertyChangeListener listener) | public static void | removeLibrary(String name) | public static boolean | removeLibraryReferences(Project project, Library[] libraries) | public static boolean | removeLibraryReferences(Project project, Library[] libraries, String type) Remove an array of library references from a project, qualified by the type parameter. | public static void | removeLocalizedTheme(Project project, String themeName) | public static void | removeProjectPropertyListener(Project project, PropertyChangeListener listener) | public static boolean | removeRootReferences(Project project, URL[] rootFiles) | public static boolean | removeRootReferences(Project project, URL[] rootFiles, String type) Remove an array of root references from a project qualified by the type parameter. | public static void | removeWelcomeFile(WebApp ddRoot, String facesMapping, String pageName) | public static void | selectResourceInWindow(FileObject resourceFO) | public static String | setDataSourceReference(Project project, String resourceName) | public static String | setEjbReference(Project project, RequestedEjbResource ejbResource) | public static void | setJsfProjectDir(FileObject projDir, Boolean set) | public static void | setJsfProjectDir(ArrayList<FileObject> projDirs, Boolean set) | public static void | setProjectVersion(Project project, String version) | public static String | setStartPage(FileObject webPage) Sets the start page for the application
Parameters: startPage - the path to the JSP or HTML file relative to the document root. | public static String | setStartPage(Project project, String newStartPage) Sets the start page for the application
We need to the ability to specify the actual value for the new start page, since refactoring does not guarantee
the order in which refactoring elements are processed. | public static void | setWelcomeFile(WebModule webModule, WebApp ddRoot, String facesMapping, String pageName) | public static boolean | supportProjectProperty(Project project) | public static void | updateLocalizedRoots(Project project) | public static void | updateXml(FileObject prjLoc, String path, String nameSpace, String key, String value) |
PATH_IN_WAR_LIB | final public static String PATH_IN_WAR_LIB(Code) | | |
SUN_WEB_XML_PATH | final public static String SUN_WEB_XML_PATH(Code) | | |
addLibraryReferences | public static boolean addLibraryReferences(Project project, Library[] libraries) throws IOException(Code) | | Add an array of library references to a project, qualified for both the design-time classpath or deployed with the application
Parameters: project - Project to which the library is to be added Parameters: library - Library object from the LibraryManager registry Returns true if the library reference was successfully added throws: an - IOException if there was a problem adding the reference |
addLibraryReferences | public static boolean addLibraryReferences(Project project, Library[] libraries, String type) throws IOException(Code) | | Add an array of library references to a project, qualified by the type parameter.
Parameters: project - Project to which the library is to be added Parameters: library - Library object from the LibraryManager registry Parameters: type - Determines whether the library is to be added to the design-time classpath or deployedwith the application Returns true if the library reference was successfully added throws: an - IOException if there was a problem adding the reference |
addResource | public static String addResource(FileObject webForm, URL resourceURL, boolean copy) throws IOException(Code) | | Add a new resource to the project
Parameters: webForm - the webform object that will be referencing this resource.Used to determine the relative path name to the resource Parameters: resourceURL - resource to be added Parameters: copy - if true, resource will be copied to the project a source path for the resource in the project. If copy is true,this will be a relative path name to the resource file. If copyis false, addResource will return resourceURL->toString() throws: IOException - if an error occurs when accessing the URL or copyingthe resource |
addRootReferences | public static boolean addRootReferences(Project project, URL[] rootFiles) throws IOException(Code) | | Add an root reference to a project qualified for both the design-time classpath or deployed with the application
Parameters: project - Project to which the root is to be added Parameters: rootFile - file object of the root Returns true if the root was successfully added throws: an - IOException if there was a problem adding the reference |
addRootReferences | public static boolean addRootReferences(Project project, URL[] rootFiles, String type) throws IOException(Code) | | Add an root reference to a project qualified by the type parameter.
Parameters: project - Project to which the root is to be added Parameters: rootFile - file object of the root Parameters: type - Determines whether the root is to be added to the design-time classpath or deployedwith the application Returns true if the root was successfully added throws: an - IOException if there was a problem adding the reference |
createProjectProperty | public static void createProjectProperty(Project project, String propName, String value)(Code) | | |
deriveSafeName | public static String deriveSafeName(String sourceName)(Code) | | Derive an identifier suitable for a java package name or context path
Parameters: sourceName - Original name from which to derive the name An identifier suitable for a java package name or context path |
fileContains | public static boolean fileContains(FileObject fo, String str)(Code) | | |
getBackwardsKitMesg | public static String getBackwardsKitMesg(boolean addJSF11, boolean addJAXRPC, boolean addRowset)(Code) | | |
getBasePathForJava | public static String getBasePathForJava(FileObject javaFile)(Code) | | |
getBasePathForJsp | public static String getBasePathForJsp(FileObject jspFile)(Code) | | |
getDefaultEncoding | public static String getDefaultEncoding(Project project)(Code) | | Parameters: project - |
getDefaultLocale | public static String getDefaultLocale(Project project)(Code) | | Parameters: project - |
getDocumentRoot | public static FileObject getDocumentRoot(Project project)(Code) | | Convenience method to obtain the document root folder.
Parameters: project - the Project object the FileObject of the document root folder |
getFacesURLPattern | public static String getFacesURLPattern(WebApp ddRoot)(Code) | | Get the Faces Servlet URL pattern.
Parameters: ddRoot - the Web Application If successful, returns the URL pattern, null if unsuccessful. |
getJFileChooser | public static JFileChooser getJFileChooser()(Code) | | This does a special instantiation of JFileChooser
to workaround floppy access bug 5037322.
Using privileged code block.
|
getJavaFolderForJsp | public static FileObject getJavaFolderForJsp(FileObject jspFileObject)(Code) | | Gets corresponding java folder for specified jsp file object if exists.
corresponding java file object or null |
getJavaForJsp | public static FileObject getJavaForJsp(FileObject jspFileObject)(Code) | | Gets corresponding java file object for specified jsp file object if exists.
corresponding java file object or null |
getJspFolderForJava | public static FileObject getJspFolderForJava(FileObject javaFileObject)(Code) | | Gets corresponding jsp folder for specified java file object if exists.
corresponding jsp file object or null |
getJspForJava | public static FileObject getJspForJava(FileObject javaFileObject)(Code) | | Gets corresponding jsp file object for specified java file object if exists.
corresponding jsp file object or null |
getNavigationFile | public static FileObject getNavigationFile(Project project)(Code) | | Convenience method to obtain the project's navigation file
Parameters: project - the Project object the FileObject of the navigtion file |
getPageBeanRoot | public static FileObject getPageBeanRoot(Project project)(Code) | | Convenience method to obtain the root folder for page beans
Parameters: project - the Project object the FileObject of the page bean root folder |
getPortletSupport | public static JsfPortletSupport getPortletSupport(Project project)(Code) | | Obtain the portlet support helper object from the project
Parameters: project - the Project object the portlet support object or null if the project is notcapable of supporting portlets |
getProjectLibraryDirectory | public static FileObject getProjectLibraryDirectory(Project project) throws IOException(Code) | | Returns a directory under the project root where library jar files can be added as project-private resources
Parameters: project - Target project FileObject of the library directory. If it does not exist, it will be created. throws: IOException - if the directory cannot be created |
getProjectLibraryManager | public static LibraryManager getProjectLibraryManager(Project project)(Code) | | |
getProjectProperty | public static String getProjectProperty(Project project, String propName)(Code) | | |
getProjectVersion | public static String getProjectVersion(Project project)(Code) | | |
getResourcesDirectory | public static FileObject getResourcesDirectory(Project project) throws IOException(Code) | | Returns a directory under the project root where resource files can be added
Parameters: project - Target project FileObject of the resources directory. If it does not exist, it will be created. throws: IOException - if the directory cannot be created |
getSourceEncoding | public static String getSourceEncoding(Project project)(Code) | | Convenience method to obtain the project's source encoding
Parameters: project - the Project object string representation of the project's source encoding |
getSourceLevel | public static String getSourceLevel(Project project)(Code) | | |
getSourceRoot | public static FileObject getSourceRoot(Project project)(Code) | | Convenience method to obtain the source root folder.
Parameters: project - the Project object the FileObject of the source root folder |
getWebInf | public static FileObject getWebInf(Project project)(Code) | | Convenience method to obtain the WEB-INF folder.
Parameters: project - the Project object the FileObject of the WEB-INF folder |
getWebModule | public static WebModule getWebModule(Project project)(Code) | | |
hasLibraryReference | public static boolean hasLibraryReference(Project project, Library library)(Code) | | Check if a project has a library reference to the named library qualified for both the design-time classpath or deployed with the application
Parameters: project - Target project Parameters: library - Library object Returns true if the library is already referenced by the project, false otherwise |
hasLibraryReference | public static boolean hasLibraryReference(Project project, Library library, String type)(Code) | | Check if a project has a library reference to the named library qualified by the type parameter.
Parameters: project - Target project Parameters: library - Library object Parameters: type - Determines whether the library is to be referenced from the design-time classpath or deploytime classpath Returns true if the library is already referenced by the project, false otherwise |
hasRootReference | public static boolean hasRootReference(Project project, URL rootFile)(Code) | | Check if a project has an root reference to the named root qualified for both the design-time classpath or deployed with the application
Parameters: project - Target project Parameters: rootFile - file object of the root Returns true if the root is already referenced by the project, false otherwise |
hasRootReference | public static boolean hasRootReference(Project project, URL rootFile, String type)(Code) | | Check if a project has an root reference to the named root qualified by the type parameter.
Parameters: project - Target project Parameters: rootFile - file object of the root Parameters: type - Determines whether the root is to be referenced from the design-time classpath or deploytime classpath Returns true if the root is already referenced by the project, false otherwise |
importFile | public static void importFile(Project project, File file)(Code) | | |
isDesigntimeLib | public static boolean isDesigntimeLib(String name)(Code) | | |
isJavaEE5Project | public static boolean isJavaEE5Project(Project project)(Code) | | |
isJsfFramework | public static boolean isJsfFramework(WebFrameworkProvider framework)(Code) | | |
isJsfProject | public static boolean isJsfProject(Project project)(Code) | | Check for Creator project
Parameters: project - Project to be checked |
isJsfProjectDir | public static Boolean isJsfProjectDir(FileObject projDir)(Code) | | |
isJsfProjectFile | public static boolean isJsfProjectFile(FileObject fo)(Code) | | Check for Creator project file. Note: For DataLoader only when 'Project' is not available.
Parameters: fo - FileObject to be checked |
isStartPage | public static boolean isStartPage(FileObject webPage)(Code) | | Check for start page
Parameters: webPage - JSP file |
isValidJavaFileName | public static boolean isValidJavaFileName(String name)(Code) | | Reports whether the given name is a valid Java file name.
Parameters: name - The Java file name to be checked true iff the name parameter is a valid Java file name |
isValidJavaPackageName | public static boolean isValidJavaPackageName(String pkgName)(Code) | | Reports whether the given name is a valid Java package name.
Parameters: name - The Java package name to be checked true iff the name parameter is a valid Java package name |
isWebProject | public static boolean isWebProject(Project project)(Code) | | |
putProjectProperty | public static void putProjectProperty(Project project, String propName, String value)(Code) | | |
removeLibraryReferences | public static boolean removeLibraryReferences(Project project, Library[] libraries) throws IOException(Code) | | Remove an array of library references from a project, qualified for both the design-time classpath or deployed with the application
Parameters: project - Project from which the library references are to be removed Parameters: library - Array of Library objects from the LibraryManager registry Returns true if at least one of the library references were successfully removed throws: an - IOException if there was a problem removing the reference |
removeLibraryReferences | public static boolean removeLibraryReferences(Project project, Library[] libraries, String type) throws IOException(Code) | | Remove an array of library references from a project, qualified by the type parameter.
Parameters: project - Project from which the library references are to be removed Parameters: library - Array of Library objects from the LibraryManager registry Parameters: type - Determines whether the library is to be removed from the design-time classpath or deployedwith the application Returns true if at least one of the library references were successfully removed throws: an - IOException if there was a problem removing the reference |
removeLocalizedTheme | public static void removeLocalizedTheme(Project project, String themeName) throws IOException(Code) | | |
removeRootReferences | public static boolean removeRootReferences(Project project, URL[] rootFiles) throws IOException(Code) | | Remove an array of root references from a project qualified for both the design-time classpath or deployed with the application
Parameters: project - Project from which the root references is to be removed Parameters: rootFile - file object of the root Returns true if at least one of the roots was successfully removed throws: an - IOException if there was a problem removing the references |
removeRootReferences | public static boolean removeRootReferences(Project project, URL[] rootFiles, String type) throws IOException(Code) | | Remove an array of root references from a project qualified by the type parameter.
Parameters: project - Project from which the root references is to be removed Parameters: rootFile - file object of the root Parameters: type - Determines whether the root is to be removed from the design-time classpath or deploytime classpath Returns true if at least one of the roots was successfully removed throws: an - IOException if there was a problem removing the references |
removeWelcomeFile | public static void removeWelcomeFile(WebApp ddRoot, String facesMapping, String pageName)(Code) | | |
selectResourceInWindow | public static void selectResourceInWindow(FileObject resourceFO)(Code) | | |
setDataSourceReference | public static String setDataSourceReference(Project project, String resourceName)(Code) | | |
setJsfProjectDir | public static void setJsfProjectDir(FileObject projDir, Boolean set)(Code) | | |
setProjectVersion | public static void setProjectVersion(Project project, String version)(Code) | | |
setStartPage | public static String setStartPage(FileObject webPage)(Code) | | Sets the start page for the application
Parameters: startPage - the path to the JSP or HTML file relative to the document root. If successful, returns the path of the new start page relative to the document root, null if unsuccessful. |
setStartPage | public static String setStartPage(Project project, String newStartPage)(Code) | | Sets the start page for the application
We need to the ability to specify the actual value for the new start page, since refactoring does not guarantee
the order in which refactoring elements are processed. Since the rename of the file object and the setting of the
start page are separate refactoring elements, the setting of the start page can occur prior to the rename of the
file object.
We use the webPage file object to identify the appro
Parameters: project - the project to set the start page on Parameters: newStartPage - the web folder relative path to the new start page If successful, returns the path of the new start page relative to the document root, null if unsuccessful. |
setWelcomeFile | public static void setWelcomeFile(WebModule webModule, WebApp ddRoot, String facesMapping, String pageName)(Code) | | |
supportProjectProperty | public static boolean supportProjectProperty(Project project)(Code) | | |
updateLocalizedRoots | public static void updateLocalizedRoots(Project project)(Code) | | |
|
|