| java.lang.Object org.netbeans.modules.apisupport.project.CreatedModifiedFiles
CreatedModifiedFiles | final public class CreatedModifiedFiles (Code) | | Provide general infrastructure for performing miscellaneous operations upon
NbModuleProject 's files, such as manifest.mf,
bundle.properties, layer.xml, project.xml easily.
See javadoc to individual methods below. After creating a
CreatedModifiedFiles instance client may create
CreatedModifiedFiles.Operation which then may be added to the
CreatedModifiedFiles instance or just used itself. Both
CreatedModifiedFiles and Operation provide methods
to get sets of relative (to a project's base directory) paths which are
going to be created and/or modified. These sets may be obtained
before added operation are run so they can be e.g. shown by
wizard before any files are actually created.
author: Martin Krauskopf |
Inner Class :public interface Operation | |
Inner Class :public interface LayerOperation | |
Method Summary | |
public void | add(Operation operation) Adds given
Operation to a list of operations that will be run
after calling
CreatedModifiedFiles.run() . | public Operation | addLoaderSection(String dataLoaderClass, String installBefore) Provides
Operation that will create a new section in the
project's manifest registering a given
dataLoaderClass .
Name: org/netbeans/modules/myprops/MyPropsLoader.class
OpenIDE-Module-Class: Loader
Parameters: dataLoaderClass - e.g. | public Operation | addLookupRegistration(String interfaceClass, String implClass, boolean inTests) Provides
Operation that will register an implClass
implementation of interfaceClass interface in the lookup.
If a file representing interfaceClass service already
exists in META-INF/services directory
implClass will be appended to the end of the list of
implementations. | public Operation | addModuleDependency(String codeNameBase, String releaseVersion, SpecificationVersion version, boolean useInCompiler) Add a dependency to a list of module dependencies of this project. | public CreatedModifiedFiles.Operation | addModuleDependency(String codeNameBase) Delegates to
CreatedModifiedFiles.addModuleDependency(String,String,SpecificationVersion,boolean) passing a given code name base,
null as release version, null as version and
true as useInCompiler arguments. | public Operation | bundleKey(String bundlePath, String key, String value) Provides
Operation that will add given value under
a specified key into the custom bundle which is
specified by the bundlePath parameter. | public Operation | bundleKeyDefaultBundle(String key, String value) Provides
Operation that will add given value under
a specified key into the project's default localized
bundle which is specified in the project's manifest. | public Operation | createFile(String path, FileObject content) Returns
Operation for creating custom file in the project file
hierarchy.
Parameters: path - relative to a project directory where a file to be created Parameters: content - content for the file being created. | public Operation | createFileWithSubstitutions(String path, FileObject content, Map<String, String> tokens) Returns an
Operation for creating custom file in the project
file hierarchy with an option to replace tokens from a given
content with custom string. | public CreatedModifiedFiles.Operation | createLayerAttribute(String parentPath, String attrName, Object attrValue) Creates a new arbitrary <attr> element.
Parameters: parentPath - path to a file or a folder in aproject's layer. | public Operation | createLayerEntry(String layerPath, FileObject content, Map<String, String> substitutionTokens, String localizedDisplayName, Map<String, Object> fileAttributes) Creates an entry (file element) in the project's layer. | public String[] | getCreatedPaths() | public String[] | getInvalidPaths() | LayerUtils.LayerHandle | getLayerHandle() | public String[] | getModifiedPaths() | public static FileObject | getTemplate(String name) Convenience method to load a file template from the standard location. | public Operation | layerModifications(LayerOperation op, Set<String> externalFiles) Make structural modifications to the project's XML layer.
The operations may be expressed as filesystem calls.
Parameters: op - a callback for the actual changes to make Parameters: externalFiles - a list of simple filenames of new data files whichare to be created in the layer and which will therefore appearon disk alongside the layer, usually with the same names (unlessthey conflict with existing files); you still need to create themyourself using e.g. | public Operation | manifestModification(String section, Map<String, String> attributes) Adds new attributes into manifest file.
Parameters: section - the name of the section or null for the main section. Parameters: attributes - <String,String> map mapping attributes names and values. | public Operation | orderLayerEntry(String layerPath, String precedingItemName, String newItemName, String followingItemName) Order a new entry in a project layer between two others.
Parameters: layerPath - folder path in a project's layer. | public Operation | propertiesModification(String propertyPath, Map<String, String> properties) Adds new properties into property file.
Parameters: propertyPath - path representing properties file relative to a project directory where allproperties will be put in. | public void | run() Performs in turn
Operation.run on all operations added to this
instance in order in which operations have been added. |
CreatedModifiedFiles | public CreatedModifiedFiles(Project project)(Code) | | Create instance for managing given
NbModuleProject 's files.
Parameters: project - project this instance will operate upon |
addLoaderSection | public Operation addLoaderSection(String dataLoaderClass, String installBefore)(Code) | | Provides
Operation that will create a new section in the
project's manifest registering a given
dataLoaderClass .
Name: org/netbeans/modules/myprops/MyPropsLoader.class
OpenIDE-Module-Class: Loader
Parameters: dataLoaderClass - e.g. org/netbeans/modules/myprops/MyPropsLoader(without .class extension) Parameters: installBefore - content of Install-Before attribute, or null if notspecified |
addLookupRegistration | public Operation addLookupRegistration(String interfaceClass, String implClass, boolean inTests)(Code) | | Provides
Operation that will register an implClass
implementation of interfaceClass interface in the lookup.
If a file representing interfaceClass service already
exists in META-INF/services directory
implClass will be appended to the end of the list of
implementations. If it doesn't exist a new file will be created.
Parameters: interfaceClass - e.g. org.example.spi.somemodule.ProvideMe Parameters: implClass - e.g. org.example.module1.ProvideMeImpl Parameters: inTests - if true, add to test/unit/src/META-INF/services/, else to src/META-INF/services/ |
addModuleDependency | public Operation addModuleDependency(String codeNameBase, String releaseVersion, SpecificationVersion version, boolean useInCompiler)(Code) | | Add a dependency to a list of module dependencies of this project. This
means editing of project's nbproject/project.xml. All
parameters refers to a module this module will depend on. If a project
already has a given dependency it will not be added.
Parameters: codeNameBase - codename base Parameters: releaseVersion - release version, if null will be taken from theentry found in platform Parameters: version - specification version (see SpecificationVersion),if null will be taken from the entry found in platform Parameters: useInCompiler - do this module needs a module beeing added at acompile time? |
bundleKey | public Operation bundleKey(String bundlePath, String key, String value)(Code) | | Provides
Operation that will add given value under
a specified key into the custom bundle which is
specified by the bundlePath parameter.
|
bundleKeyDefaultBundle | public Operation bundleKeyDefaultBundle(String key, String value)(Code) | | Provides
Operation that will add given value under
a specified key into the project's default localized
bundle which is specified in the project's manifest.
|
createFile | public Operation createFile(String path, FileObject content)(Code) | | Returns
Operation for creating custom file in the project file
hierarchy.
Parameters: path - relative to a project directory where a file to be created Parameters: content - content for the file being created. Content may addresseither text or binary data. |
createFileWithSubstitutions | public Operation createFileWithSubstitutions(String path, FileObject content, Map<String, String> tokens)(Code) | | Returns an
Operation for creating custom file in the project
file hierarchy with an option to replace tokens from a given
content with custom string. The result will be stored into
a file representing by a given path .
Parameters: path - relative to a project directory where a file to be created Parameters: content - content for the file being created Parameters: tokens - properties with values to be passed to FreeMarker(in addition to: name, nameAndExt, user, date, time, and project.license) |
createLayerAttribute | public CreatedModifiedFiles.Operation createLayerAttribute(String parentPath, String attrName, Object attrValue)(Code) | | Creates a new arbitrary <attr> element.
Parameters: parentPath - path to a file or a folder in aproject's layer. It must exist. Parameters: attrName - value of the name attribute of the <attr>element. Parameters: attrValue - value of the attribute (may specially be a string prefixed with "newvalue:" or "methodvalue:") see Operation |
createLayerEntry | public Operation createLayerEntry(String layerPath, FileObject content, Map<String, String> substitutionTokens, String localizedDisplayName, Map<String, Object> fileAttributes)(Code) | | Creates an entry (file element) in the project's layer. Also
may create and/or modify other files as it is needed.
Parameters: layerPath - path in a project's layer. Folders which don't existyet will be created. (e.g.Menu/Tools/org-example-module1-BeepAction.instance). Parameters: content - became content of a file, or null Parameters: substitutionTokens - see CreatedModifiedFiles.createFileWithSubstitutions for details;may be null to not use FreeMarker Parameters: localizedDisplayName - if it is not a null SystemFileSystem.localizingBundle attribute will becreated with the stringvalue to a default bundle (from manifest).Also an appropriate entry will be added into the bundle. Parameters: fileAttributes - <String,Object> map. key in the map is thename of the file attribute value is the actual value, currentlysupported types are Boolean and String Generates<attr name="KEY" stringvalue="VALUE"/> or <attr name="KEY" booleanvalue="VALUE"/> see Operation |
getTemplate | public static FileObject getTemplate(String name)(Code) | | Convenience method to load a file template from the standard location.
Parameters: name - a simple filename that file from the Templates/NetBeansModuleDevelopment-files layer folder |
layerModifications | public Operation layerModifications(LayerOperation op, Set<String> externalFiles)(Code) | | Make structural modifications to the project's XML layer.
The operations may be expressed as filesystem calls.
Parameters: op - a callback for the actual changes to make Parameters: externalFiles - a list of simple filenames of new data files whichare to be created in the layer and which will therefore appearon disk alongside the layer, usually with the same names (unlessthey conflict with existing files); you still need to create themyourself using e.g. FileObject.createData and FileObject.getOutputStream the operation handle |
manifestModification | public Operation manifestModification(String section, Map<String, String> attributes)(Code) | | Adds new attributes into manifest file.
Parameters: section - the name of the section or null for the main section. Parameters: attributes - <String,String> map mapping attributes names and values. see Operation |
orderLayerEntry | public Operation orderLayerEntry(String layerPath, String precedingItemName, String newItemName, String followingItemName)(Code) | | Order a new entry in a project layer between two others.
Parameters: layerPath - folder path in a project's layer. (e.g. Loaders/text/x-java/Actions). Parameters: precedingItemName - item to be before newItemName (may be null) Parameters: newItemName - the new item (must already exist!) Parameters: followingItemName - item to be after newItemName (may be null) |
propertiesModification | public Operation propertiesModification(String propertyPath, Map<String, String> properties)(Code) | | Adds new properties into property file.
Parameters: propertyPath - path representing properties file relative to a project directory where allproperties will be put in. If such a file does not exist it is created. Parameters: properties - <String,String> map mapping properties names and values. see Operation |
run | public void run() throws IOException(Code) | | Performs in turn
Operation.run on all operations added to this
instance in order in which operations have been added.
|
|
|