Class ArchiveWriter
- java.lang.Object
-
- org.apache.sling.feature.io.archive.ArchiveWriter
-
public class ArchiveWriter extends Object
The feature archive writer can be used to create an archive based on a feature model. The archive contains the feature model file and all artifacts using a maven repository layout.
-
-
Field Summary
Fields Modifier and Type Field Description static intARCHIVE_VERSIONCurrent support version of the feature model archive.static StringCONTENTS_HEADERThe manifest header listing the features in this archive.static StringVERSION_HEADERThe manifest header marking an archive as a feature archive.
-
Constructor Summary
Constructors Constructor Description ArchiveWriter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JarOutputStreamwrite(OutputStream out, Manifest baseManifest, ArtifactProvider provider, Feature... features)Create a feature model archive.
-
-
-
Field Detail
-
VERSION_HEADER
public static final String VERSION_HEADER
The manifest header marking an archive as a feature archive.- See Also:
- Constant Field Values
-
CONTENTS_HEADER
public static final String CONTENTS_HEADER
The manifest header listing the features in this archive.- See Also:
- Constant Field Values
-
ARCHIVE_VERSION
public static final int ARCHIVE_VERSION
Current support version of the feature model archive.- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public static JarOutputStream write(OutputStream out, Manifest baseManifest, ArtifactProvider provider, Feature... features) throws IOException
Create a feature model archive. The output stream will not be closed by this method. The caller must callZipOutputStream.close()on the return output stream. The caller can add additional files through the return stream. However, the files should not be compressed (which is the default for the output stream). A feature model can be in different states: it might be a partial feature model, a complete feature model or an assembled feature model. This method takes the feature model as provided and only writes the listed bundles and artifacts of this feature model into the archive. In general, the best approach for sharing features is to archivecompletefeatures.- Parameters:
out- The output stream to write tobaseManifest- Optional base manifest used for creating the manifest.provider- The artifact providerfeatures- The features model to archive- Returns:
- The jar output stream.
- Throws:
IOException- If anything goes wrong
-
-