PageRenderTime 37ms CodeModel.GetById 26ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/jboss-as-7.1.1.Final/controller-client/src/main/java/org/jboss/as/controller/client/OperationAttachments.java

#
Java | 70 lines | 22 code | 8 blank | 40 comment | 0 complexity | d59d2341c9abd79ae180658294c1feb8 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
 1/*
 2* JBoss, Home of Professional Open Source.
 3* Copyright 2006, Red Hat Middleware LLC, and individual contributors
 4* as indicated by the @author tags. See the copyright.txt file in the
 5* distribution for a full listing of individual contributors.
 6*
 7* This is free software; you can redistribute it and/or modify it
 8* under the terms of the GNU Lesser General Public License as
 9* published by the Free Software Foundation; either version 2.1 of
10* the License, or (at your option) any later version.
11*
12* This software is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* Lesser General Public License for more details.
16*
17* You should have received a copy of the GNU Lesser General Public
18* License along with this software; if not, write to the Free
19* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21*/
22package org.jboss.as.controller.client;
23
24import java.io.Closeable;
25import java.io.InputStream;
26import java.util.Collections;
27import java.util.List;
28
29/**
30 * The operation attachments. This interface extends {@code Closeable}
31 * which can be used to close all associated input streams with
32 * this attachment.
33 *
34 * @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
35 */
36public interface OperationAttachments extends Closeable {
37
38    /**
39     * Flag indicating whether the streams should be automatically closed
40     * once the operation completed.
41     *
42     * @return {@code true} if the streams are going to be closed, false otherwise
43     */
44    boolean isAutoCloseStreams();
45
46    /**
47     * Input streams associated with the operation
48     *
49     * @return the streams. If there are none an empty list is returned
50     */
51    List<InputStream> getInputStreams();
52
53    OperationAttachments EMPTY = new OperationAttachments() {
54        @Override
55        public boolean isAutoCloseStreams() {
56            return false;
57        }
58
59        @Override
60        public List<InputStream> getInputStreams() {
61            return Collections.emptyList();
62        }
63
64        @Override
65        public void close() {
66            //
67        }
68    };
69
70}