Class ObrCleanRepo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.felix.obrplugin.ObrCleanRepo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="clean",
requiresProject=false,
defaultPhase=CLEAN)
public class ObrCleanRepo
extends org.apache.maven.plugin.AbstractMojo
Clean an OBR repository by finding and removing missing resources.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.artifact.repository.ArtifactRepositoryLocal Repository.private StringOBR Repository.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ElementcleanDocument(Element elem) Analyze the given XML tree (DOM of the repository file) and remove missing resources.voidexecute()private DocumentBuilderInitialize the document builder from Xerces.private DocumentparseFile(File file, DocumentBuilder constructor) Open an XML file.private voidwriteToFile(URI outputFilename, Node treeToBeWrite) write a Node in a xml file.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
obrRepository
OBR Repository. -
localRepository
@Parameter(defaultValue="${localRepository}", readonly=true, required=true) private org.apache.maven.artifact.repository.ArtifactRepository localRepositoryLocal Repository.
-
-
Constructor Details
-
ObrCleanRepo
public ObrCleanRepo()
-
-
Method Details
-
execute
public void execute() -
cleanDocument
-
initConstructor
Initialize the document builder from Xerces.- Returns:
- DocumentBuilder ready to create new document
- Throws:
org.apache.maven.plugin.MojoExecutionException- : occurs when the instantiation of the document builder fails
-
parseFile
private Document parseFile(File file, DocumentBuilder constructor) throws org.apache.maven.plugin.MojoExecutionException Open an XML file.- Parameters:
file- : XML file pathconstructor- DocumentBuilder get from xerces- Returns:
- Document which describes this file
- Throws:
org.apache.maven.plugin.MojoExecutionException- occurs when the given file cannot be opened or is a valid XML file.
-
writeToFile
private void writeToFile(URI outputFilename, Node treeToBeWrite) throws org.apache.maven.plugin.MojoExecutionException write a Node in a xml file.- Parameters:
outputFilename- URI to the output filetreeToBeWrite- Node root of the tree to be write in file- Throws:
org.apache.maven.plugin.MojoExecutionException- if the plugin failed
-