Skip to main content
summaryrefslogtreecommitdiffstats
blob: 16ed0846c1c2e5c196145a57c6b139be75a4c5e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/********************************************************************************
 * Copyright (c) 2008 IBM Corporation. All rights reserved.
 * This program and the accompanying materials are made available under the terms
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 *
 * Initial Contributors:
 * The following IBM employees contributed to the Remote System Explorer
 * component that contains this file: David McKnight.
 *
 * Contributors:
 * David McKnight   (IBM)        - [209593] [api] add support for "file permissions" and "owner" properties for unix files
 ********************************************************************************/
package org.eclipse.rse.services.files;

import org.eclipse.core.runtime.IProgressMonitor;

import org.eclipse.rse.services.clientserver.messages.SystemMessageException;

/**
 * Service used to get and set the permissions of a file. The
 * {@link #getCapabilities(IHostFile)} method must be implemented to tell
 * clients what kinds of permission services are actually available on a
 * concrete implementation.
 * 
 * @since 3.0
 */
public interface IFilePermissionsService {

    public static int FS_CAN_GET_OWNER       = 1 << 0;
    public static int FS_CAN_GET_GROUP       = 1 << 1;
    public static int FS_CAN_GET_PERMISSIONS = 1 << 2;
    public static int FS_CAN_SET_OWNER       = 1 << 3;
    public static int FS_CAN_SET_GROUP       = 1 << 4;
    public static int FS_CAN_SET_PERMISSIONS = 1 << 5;

	public static final int FS_CAN_GET_ALL = FS_CAN_GET_OWNER | FS_CAN_GET_GROUP | FS_CAN_GET_PERMISSIONS;
	public static final int FS_CAN_SET_ALL = FS_CAN_SET_OWNER | FS_CAN_SET_GROUP | FS_CAN_SET_PERMISSIONS;


	/**
	 * Gets the permissions for a file including the user and group owner
	 *
	 * @param file the remote file
	 * @param monitor the monitor for this potentially long running operation
	 * @return the host file permissions
	 * @throws SystemMessageException if an error occurs.
	 * Typically this would be one of those in the RemoteFileException family.
	 */
	public IHostFilePermissions getFilePermissions(IHostFile file, IProgressMonitor monitor) throws SystemMessageException;

	/**
	 * Sets the permissions for a file including the user and group owner as specified in the permissions
	 *
	 * @param file the remote file
	 * @param permissions the new permissions for this file
	 * @param monitor the monitor for this potentially long running operation
	 * @throws SystemMessageException if an error occurs.
	 * Typically this would be one of those in the RemoteFileException family.
	 */
	public void setFilePermissions(IHostFile file, IHostFilePermissions permissions, IProgressMonitor monitor) throws SystemMessageException;


	/**
	 * Returns the capabilities of this file permissions service for the corresponding file.  If
	 * null is specified, this returns the general capabilities of this service.
	 *
	 * @param file the remote file
	 * @return the capabilities of this service against this file
	 */
	public int getCapabilities(IHostFile file);

}

Back to the top