blob: 76f328d367bfc2301b4a33aa28e8afad938e5242 [file] [log] [blame]
Carsten Ziegeler395a7822013-01-28 19:01:22 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.felix.status;
20
21import java.io.IOException;
22import java.util.zip.ZipOutputStream;
23
24/**
25 * This is an optional extension of the {@link StatusPrinter}.
26 * If a status printer implements this interface, the printer
27 * can add additional attachments to the output of the
28 * configuration zip.
29 *
30 * A service implementing this method must still register itself
31 * as a {@link StatusPrinter} but not as a
Carsten Ziegelere21a0472013-01-29 17:42:46 +000032 * {@link ZipAttachmentProvider} service and the provider
33 * should either support {@link PrinterMode.ZIP_FILE_JSON}
Carsten Ziegeler9bfb7242013-01-30 15:37:04 +000034 * or {@link PrinterMode.ZIP_FILE_TEXT}
Carsten Ziegeler395a7822013-01-28 19:01:22 +000035 */
36public interface ZipAttachmentProvider extends StatusPrinter {
37
38 /**
39 * Add attachments to the zip output stream.
40 * The attachment provider can add as many attachments in any format
41 * as it wants. However it should use the namePrefix to create unique
42 * names / paths inside the zip.
43 *
44 * The general pattern is: creating a zip entry by using the name prefix
45 * and a name, adding the entry to the zip output stream, writing
46 * the content of the file to the stream, and finally ending the
47 * zip entry.
48 *
49 * @param namePrefix Name prefix to use for zip entries. Ends with a slash.
50 * @param zos The zip output stream.
51 * @throws IOException
52 */
53 void addAttachments(final String namePrefix, final ZipOutputStream zos)
54 throws IOException;
55}