FileTransferManager.java 2.98 KB
Newer Older
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision: 1217 $
 * $Date: 2005-04-11 18:11:06 -0300 (Mon, 11 Apr 2005) $
 *
6
 * Copyright (C) 1999-2008 Jive Software. All rights reserved.
7
 *
8 9 10 11 12 13 14 15 16 17 18
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
19
 */
20
package org.jivesoftware.openfire.filetransfer;
21

22 23 24
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.container.Module;
import org.jivesoftware.openfire.filetransfer.proxy.ProxyTransfer;
25 26

/**
27 28
 * Manages all file transfer currently happening originating from and/or ending at users of the
 * server. From here, file transfers can be administered and stats can be tracked.
29 30 31
 *
 * @author Alexander Wenckus
 */
32 33
public interface FileTransferManager extends Module {
    /**
34
     * The Stream Initiation, SI, namespace.
35
     */
36
    static final String NAMESPACE_SI = "http://jabber.org/protocol/si";
37 38

    /**
39
     * Namespace for the file transfer profile of Stream Initiation.
40
     */
41 42
    static final String NAMESPACE_SI_FILETRANSFER =
            "http://jabber.org/protocol/si/profile/file-transfer";
43 44 45 46

    /**
     * Bytestreams namespace
     */
47
    static final String NAMESPACE_BYTESTREAMS = "http://jabber.org/protocol/bytestreams";
48

49 50 51 52
    /**
     * Checks an incoming file transfer request to see if it should be accepted or rejected.
     * If it is accepted true will be returned and if it is rejected false will be returned.
     *
53
     * @param transfer the transfer to test for acceptance
54
     * @return true if it should be accepted false if it should not.
55
     */
56
    boolean acceptIncomingFileTransferRequest(FileTransfer transfer) throws FileTransferRejectedException;
57 58 59 60

    /**
     * Registers that a transfer has begun through the proxy connected to the server.
     *
61 62 63 64 65 66
     * @param transferDigest the digest of the initiator + target + sessionID that uniquely
     * identifies a file transfer
     * @param proxyTransfer the related proxy transfer.
     * @throws UnauthorizedException when in the current server configuration this transfer
     * should not be permitted.
     */
67
    void registerProxyTransfer(String transferDigest, ProxyTransfer proxyTransfer)
68 69
            throws UnauthorizedException;

70 71 72 73
    void addFileTransferInterceptor(FileTransferInterceptor interceptor);

    void removeFileTransferInterceptor(FileTransferInterceptor interceptor);

74 75
    void fireFileTransferIntercept(FileTransferProgress transfer, boolean isReady)
            throws FileTransferRejectedException;
76
}