1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-19 14:15:50 +02:00

[releng][cleanup] Fix @since tags according to API Tooling

This commit is contained in:
Martin Oberhuber 2008-06-04 08:55:01 +00:00
parent 8c6050dbe2
commit ab9d7e283b
8 changed files with 186 additions and 133 deletions

View file

@ -76,6 +76,10 @@ public abstract class AbstractFileService extends AbstractService implements IFi
protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException; protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* {@inheritDoc}
* @since 3.0
*/
public void getFileMultiple(String remoteParents[], String names[], List hostFiles, IProgressMonitor monitor) public void getFileMultiple(String remoteParents[], String names[], List hostFiles, IProgressMonitor monitor)
throws SystemMessageException throws SystemMessageException
{ {
@ -89,12 +93,20 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
} }
/**
* {@inheritDoc}
* @since 3.0 using int fileTYpe
*/
public IHostFile[] list(String remoteParent, String fileFilter, public IHostFile[] list(String remoteParent, String fileFilter,
int fileType, IProgressMonitor monitor) throws SystemMessageException int fileType, IProgressMonitor monitor) throws SystemMessageException
{ {
return internalFetch(remoteParent, fileFilter, fileType, monitor); return internalFetch(remoteParent, fileFilter, fileType, monitor);
} }
/**
* {@inheritDoc}
* @since 3.0
*/
public void listMultiple(String[] remoteParents, public void listMultiple(String[] remoteParents,
String[] fileFilters, int fileTypes[], List hostFiles, IProgressMonitor monitor) String[] fileFilters, int fileTypes[], List hostFiles, IProgressMonitor monitor)
throws SystemMessageException { throws SystemMessageException {
@ -114,6 +126,10 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/**
* {@inheritDoc}
* @since 3.0
*/
public void listMultiple(String[] remoteParents, public void listMultiple(String[] remoteParents,
String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor) String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor)
throws SystemMessageException { throws SystemMessageException {
@ -163,6 +179,10 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/**
* {@inheritDoc}
* @since 3.0 returning void
*/
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
{ {
if (monitor != null) if (monitor != null)
@ -176,7 +196,8 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/** /**
* Default implementation - just iterate through each file * {@inheritDoc} Default implementation - just iterate through each file
* @since 3.0 returning void
*/ */
public void downloadMultiple(String[] remoteParents, String[] remoteFiles, public void downloadMultiple(String[] remoteParents, String[] remoteFiles,
File[] localFiles, boolean[] isBinaries, String[] hostEncodings, File[] localFiles, boolean[] isBinaries, String[] hostEncodings,
@ -198,7 +219,8 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/** /**
* Default implementation - just iterate through each file * {@inheritDoc} Default implementation - just iterate through each file
* @since 3.0
*/ */
public void uploadMultiple(File[] localFiles, String[] remoteParents, public void uploadMultiple(File[] localFiles, String[] remoteParents,
String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings, String[] remoteFiles, boolean[] isBinaries, String[] srcEncodings,
@ -253,10 +275,13 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/** /**
* Gets the output stream to write/append to a remote file. * Gets the output stream to write/append to a remote file. The default
* The default implementation returns <code>null</code>. * implementation returns <code>null</code>. Clients can override to return
* Clients can override to return an output stream to the file. * an output stream to the file.
* @see org.eclipse.rse.services.files.IFileService#getOutputStream(String, String, int, IProgressMonitor) *
* @see org.eclipse.rse.services.files.IFileService#getOutputStream(String,
* String, int, IProgressMonitor)
* @since 3.0 using int options
*/ */
public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException { public OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException {
if ((options & IFileService.APPEND) == 0) { if ((options & IFileService.APPEND) == 0) {
@ -268,8 +293,10 @@ public abstract class AbstractFileService extends AbstractService implements IFi
} }
/** /**
* The default implementation returns false. Clients should override this method if they make use * The default implementation returns false. Clients should override this
* of IFileServiceCodePageConverter to do conversion during download and upload. * method if they make use of IFileServiceCodePageConverter to do conversion
* during download and upload.
* @since 3.0
*/ */
public boolean supportsEncodingConversion(){ public boolean supportsEncodingConversion(){
return false; return false;

View file

@ -8,7 +8,7 @@
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* David McKnight (IBM) - [209704] [api] Ability to override default encoding conversion needed. * David McKnight (IBM) - [209704] [api] Ability to override default encoding conversion needed.
@ -19,19 +19,22 @@ package org.eclipse.rse.services.files;
import java.util.Vector; import java.util.Vector;
/** /**
* Utility class for getting a file service code page converter for a given server encoding and file service * Utility class for getting a file service code page converter for a given
* server encoding and file service
*
* @since 3.0
*/ */
public class CodePageConverterManager { public class CodePageConverterManager {
private static IFileServiceCodePageConverter _defaultCodePageConverter; private static IFileServiceCodePageConverter _defaultCodePageConverter;
protected static Vector _codePageConverters = new Vector(); protected static Vector _codePageConverters = new Vector();
public static void registerCodePageConverter(IFileServiceCodePageConverter converter) public static void registerCodePageConverter(IFileServiceCodePageConverter converter)
{ {
_codePageConverters.add(converter); _codePageConverters.add(converter);
} }
public static IFileServiceCodePageConverter getDefaultCodePageConverter() public static IFileServiceCodePageConverter getDefaultCodePageConverter()
{ {
if (_defaultCodePageConverter == null){ if (_defaultCodePageConverter == null){
@ -39,11 +42,11 @@ public class CodePageConverterManager {
} }
return _defaultCodePageConverter; return _defaultCodePageConverter;
} }
/** /**
* Retrieves the first codepage converter provided via the codePageConverter extension point for the specified * Retrieves the first codepage converter provided via the codePageConverter extension point for the specified
* encoding * encoding
* @param serverEncoding The server encoding for which to retrieve a code page converter * @param serverEncoding The server encoding for which to retrieve a code page converter
* @return A code page converter for the specified encoding, or null if no converter was found for that encoding. * @return A code page converter for the specified encoding, or null if no converter was found for that encoding.
*/ */
public static IFileServiceCodePageConverter getCodePageConverter(String serverEncoding, IFileService fileService) { public static IFileServiceCodePageConverter getCodePageConverter(String serverEncoding, IFileService fileService) {
@ -51,11 +54,11 @@ public class CodePageConverterManager {
IFileServiceCodePageConverter matchingCodePageConverter = null; IFileServiceCodePageConverter matchingCodePageConverter = null;
if (_codePageConverters != null) if (_codePageConverters != null)
{ {
//scan through the available converters and return the first valid one for the specified encoding for this //scan through the available converters and return the first valid one for the specified encoding for this
// subsystem implementation // subsystem implementation
for (int i=0; i<_codePageConverters.size(); i++) { for (int i=0; i<_codePageConverters.size(); i++) {
IFileServiceCodePageConverter codePageConverter = (IFileServiceCodePageConverter)_codePageConverters.elementAt(i); IFileServiceCodePageConverter codePageConverter = (IFileServiceCodePageConverter)_codePageConverters.elementAt(i);
if (codePageConverter.isServerEncodingSupported(serverEncoding, fileService)) if (codePageConverter.isServerEncodingSupported(serverEncoding, fileService))
{ {
if (matchingCodePageConverter != null){ if (matchingCodePageConverter != null){
@ -71,14 +74,14 @@ public class CodePageConverterManager {
} }
} }
} }
if (matchingCodePageConverter == null) if (matchingCodePageConverter == null)
{ {
matchingCodePageConverter = getDefaultCodePageConverter(); matchingCodePageConverter = getDefaultCodePageConverter();
} }
return matchingCodePageConverter; return matchingCodePageConverter;
} }
} }

View file

@ -1,13 +1,13 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2007, 2008 IBM Corporation. All rights reserved. * Copyright (c) 2007, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* David McKnight (IBM) -[209704] [api][dstore] Ability to override default encoding conversion needed. * David McKnight (IBM) -[209704] [api][dstore] Ability to override default encoding conversion needed.
* David McKnight (IBM) -[220379] [api] Provide a means for contributing custom BIDI encodings * David McKnight (IBM) -[220379] [api] Provide a means for contributing custom BIDI encodings
@ -19,9 +19,12 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
/**
* @since 3.0
*/
public class DefaultFileServiceCodePageConverter implements public class DefaultFileServiceCodePageConverter implements
IFileServiceCodePageConverter { IFileServiceCodePageConverter {
public byte[] convertClientStringToRemoteBytes(String remotePath, String clientString, public byte[] convertClientStringToRemoteBytes(String remotePath, String clientString,
String remoteEncoding, IFileService fs) { String remoteEncoding, IFileService fs) {
try try
@ -29,14 +32,14 @@ public class DefaultFileServiceCodePageConverter implements
return clientString.getBytes(remoteEncoding); return clientString.getBytes(remoteEncoding);
} }
catch (Exception e) catch (Exception e)
{ {
} }
return clientString.getBytes(); return clientString.getBytes();
} }
public void convertFileFromRemoteEncoding(String remotePath, File file, String remoteEncoding, public void convertFileFromRemoteEncoding(String remotePath, File file, String remoteEncoding,
String localEncoding, IFileService fs) { String localEncoding, IFileService fs) {
// read in the file // read in the file
try try
{ {
@ -47,16 +50,16 @@ public class DefaultFileServiceCodePageConverter implements
int bytesRead = bufInputStream.read(buffer, 0, fileLength); int bytesRead = bufInputStream.read(buffer, 0, fileLength);
bufInputStream.close(); bufInputStream.close();
inputStream.close(); inputStream.close();
byte[] localBuffer = new String(buffer, 0, bytesRead, remoteEncoding).getBytes(localEncoding); byte[] localBuffer = new String(buffer, 0, bytesRead, remoteEncoding).getBytes(localEncoding);
FileOutputStream outStream = new FileOutputStream(file); FileOutputStream outStream = new FileOutputStream(file);
outStream.write(localBuffer, 0, localBuffer.length); outStream.write(localBuffer, 0, localBuffer.length);
outStream.close(); outStream.close();
} }
catch (Exception e) catch (Exception e)
{ {
} }
} }
@ -64,9 +67,9 @@ public class DefaultFileServiceCodePageConverter implements
IFileService fs) { IFileService fs) {
return true; return true;
} }
/** /**
* to make another converter take precedence over this, supply a * to make another converter take precedence over this, supply a
* code page converter returning a lower number (i.e. higher priority) * code page converter returning a lower number (i.e. higher priority)
*/ */
public int getPriority(String remoteEString, IFileService fs){ public int getPriority(String remoteEString, IFileService fs){

View file

@ -1,37 +1,37 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation. All rights reserved. * Copyright (c) 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.files; package org.eclipse.rse.services.files;
/** /**
* Implementation of IHostFilePermissions. * Default implementation of "Universal" UNIX kind of IHostFilePermissions.
* * @since 3.0
*/ */
public class HostFilePermissions implements public class HostFilePermissions implements
IHostFilePermissions, Cloneable { IHostFilePermissions, Cloneable {
private int _permissions = 0; private int _permissions = 0;
private String _user; private String _user;
private String _group; private String _group;
/** /**
* Constructor without any intial values. Users of this * Constructor without any initial values. Users of this need to set fields
* need to set fields as appropriate * as appropriate
*/ */
public HostFilePermissions(){ public HostFilePermissions(){
} }
/** /**
* Constructor that takes the initial permissions in rwxrwxrwx form * Constructor that takes the initial permissions in rwxrwxrwx form
* @param alphaPermissions the initial permissions in alpha form * @param alphaPermissions the initial permissions in alpha form
@ -42,7 +42,7 @@ public class HostFilePermissions implements
_user = user; _user = user;
_group = group; _group = group;
} }
/** /**
* Constructor that takes the initial permissions as a bitmask * Constructor that takes the initial permissions as a bitmask
* @param initialPermissions the initial permissions bitmask * @param initialPermissions the initial permissions bitmask
@ -52,7 +52,7 @@ public class HostFilePermissions implements
_user = user; _user = user;
_group = group; _group = group;
} }
/** /**
* Convert permissions in rwxrwxrwx form to octal * Convert permissions in rwxrwxrwx form to octal
* @param userPermissions * @param userPermissions
@ -66,11 +66,11 @@ public class HostFilePermissions implements
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
// permissions // permissions
char[] chars = alphaPermissions.toCharArray(); char[] chars = alphaPermissions.toCharArray();
int offset = -1; int offset = -1;
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
int value = 0; int value = 0;
if (chars[++offset] == 'r'){ if (chars[++offset] == 'r'){
value = 4; value = 4;
} }
@ -79,36 +79,36 @@ public class HostFilePermissions implements
} }
if (chars[++offset] == 'x'){ if (chars[++offset] == 'x'){
value += 1; value += 1;
} }
buf.append(value); buf.append(value);
} }
return buf.toString(); return buf.toString();
} }
public void setPermission(int permission, boolean value) { public void setPermission(int permission, boolean value) {
if (value) if (value)
set(permission); set(permission);
else else
clear(permission); clear(permission);
} }
public boolean getPermission(int permission) { public boolean getPermission(int permission) {
return isSet(permission); return isSet(permission);
} }
public int getPermissionBits() { public int getPermissionBits() {
return _permissions; return _permissions;
} }
public void setPermissionBits(int bits) { public void setPermissionBits(int bits) {
_permissions = bits; _permissions = bits;
} }
public String toString(){ public String toString(){
return "" + _permissions; //$NON-NLS-1$ return "" + _permissions; //$NON-NLS-1$
} }
private boolean isSet(long mask) { private boolean isSet(long mask) {
return (_permissions & mask) != 0; return (_permissions & mask) != 0;
} }
@ -116,17 +116,17 @@ public class HostFilePermissions implements
private void set(int mask) { private void set(int mask) {
_permissions |= mask; _permissions |= mask;
} }
private void clear(int mask) { private void clear(int mask) {
_permissions &= ~mask; _permissions &= ~mask;
} }
/** /**
* return permissions in rwxrwxrwx form * return permissions in rwxrwxrwx form
*/ */
public String toAlphaString(){ public String toAlphaString(){
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append(getPermission(IHostFilePermissions.PERM_USER_READ) ? 'r' : '-'); buf.append(getPermission(IHostFilePermissions.PERM_USER_READ) ? 'r' : '-');
buf.append(getPermission(IHostFilePermissions.PERM_USER_WRITE) ? 'w' : '-'); buf.append(getPermission(IHostFilePermissions.PERM_USER_WRITE) ? 'w' : '-');
buf.append(getPermission(IHostFilePermissions.PERM_USER_EXECUTE) ? 'x' : '-'); buf.append(getPermission(IHostFilePermissions.PERM_USER_EXECUTE) ? 'x' : '-');
@ -148,7 +148,7 @@ public class HostFilePermissions implements
} }
public void setGroupOwner(String group) { public void setGroupOwner(String group) {
_group = group; _group = group;
} }
public void setUserOwner(String user) { public void setUserOwner(String user) {
@ -158,6 +158,6 @@ public class HostFilePermissions implements
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();
} }
} }

View file

@ -1,13 +1,13 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation. All rights reserved. * Copyright (c) 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
********************************************************************************/ ********************************************************************************/
@ -18,7 +18,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
/** /**
* Service used to get and set the permissions of a file. * 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 interface IFilePermissionsService {
@ -28,41 +33,41 @@ public interface IFilePermissionsService {
public static int FS_CAN_SET_OWNER = 1 << 3; public static int FS_CAN_SET_OWNER = 1 << 3;
public static int FS_CAN_SET_GROUP = 1 << 4; public static int FS_CAN_SET_GROUP = 1 << 4;
public static int FS_CAN_SET_PERMISSIONS = 1 << 5; 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_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; 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 * Gets the permissions for a file including the user and group owner
* *
* @param file the remote file * @param file the remote file
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @return the host file permissions * @return the host file permissions
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family. * Typically this would be one of those in the RemoteFileException family.
*/ */
public IHostFilePermissions getFilePermissions(IHostFile file, IProgressMonitor monitor) throws SystemMessageException; 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 * Sets the permissions for a file including the user and group owner as specified in the permissions
* *
* @param file the remote file * @param file the remote file
* @param permissions the new permissions for this file * @param permissions the new permissions for this file
* @param monitor the monitor for this potentially long running operation * @param monitor the monitor for this potentially long running operation
* @throws SystemMessageException if an error occurs. * @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family. * Typically this would be one of those in the RemoteFileException family.
*/ */
public void setFilePermissions(IHostFile file, IHostFilePermissions permissions, IProgressMonitor monitor) throws SystemMessageException; public void setFilePermissions(IHostFile file, IHostFilePermissions permissions, IProgressMonitor monitor) throws SystemMessageException;
/** /**
* Returns the capabilities of this file permissions service for the corresponding file. If * Returns the capabilities of this file permissions service for the corresponding file. If
* null is specified, this returns the general capabilities of this service. * null is specified, this returns the general capabilities of this service.
* *
* @param file the remote file * @param file the remote file
* @return the capabilities of this service against this file * @return the capabilities of this service against this file
*/ */
public int getCapabilities(IHostFile file); public int getCapabilities(IHostFile file);
} }

View file

@ -1,80 +1,87 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation. All rights reserved. * Copyright (c) 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.files; package org.eclipse.rse.services.files;
/**
* Interface for file permission and ownership support in RSE
* IFileService. An implementation of an IHostFilePermissions
* object is expected to be a data storage for permission and
* ownership information.
* @since 3.0
*/
public interface IHostFilePermissions { public interface IHostFilePermissions {
/** /**
* Permission constant indicating that * Permission constant indicating that
* the user can read this file * the user can read this file
*/ */
public static final int PERM_USER_READ = 1 << 8; public static final int PERM_USER_READ = 1 << 8;
/** /**
* Permission constant indicating that * Permission constant indicating that
* the user can write to this file * the user can write to this file
*/ */
public static final int PERM_USER_WRITE = 1 << 7; public static final int PERM_USER_WRITE = 1 << 7;
/** /**
* Permission constant indicating that * Permission constant indicating that
* the user can execute this file * the user can execute this file
*/ */
public static final int PERM_USER_EXECUTE = 1 << 6; public static final int PERM_USER_EXECUTE = 1 << 6;
/** /**
* Permission constant indicating that * Permission constant indicating that
* the group can read this file * the group can read this file
*/ */
public static final int PERM_GROUP_READ = 1 << 5; public static final int PERM_GROUP_READ = 1 << 5;
/** /**
* Permission constant indicating that * Permission constant indicating that
* the group can write to this file * the group can write to this file
* *
*/ */
public static final int PERM_GROUP_WRITE = 1 << 4; public static final int PERM_GROUP_WRITE = 1 << 4;
/** /**
* Permission constant indicating that * Permission constant indicating that
* the group can execute this file * the group can execute this file
* *
*/ */
public static final int PERM_GROUP_EXECUTE = 1 << 3; public static final int PERM_GROUP_EXECUTE = 1 << 3;
/** /**
* Permission constant indicating that * Permission constant indicating that
* other users can read this file * other users can read this file
* *
*/ */
public static final int PERM_OTHER_READ = 1 << 2; public static final int PERM_OTHER_READ = 1 << 2;
/** /**
* Permission constant indicating that * Permission constant indicating that
* other users can write to this file * other users can write to this file
* *
*/ */
public static final int PERM_OTHER_WRITE = 1 << 1; public static final int PERM_OTHER_WRITE = 1 << 1;
/** /**
* Permission constant indicating that * Permission constant indicating that
* other users can execute to this file * other users can execute to this file
* *
*/ */
public static final int PERM_OTHER_EXECUTE = 1 << 0; public static final int PERM_OTHER_EXECUTE = 1 << 0;
// support masks // support masks
public static final int PERM_ANY_READ = PERM_USER_READ | PERM_GROUP_READ | PERM_OTHER_READ; public static final int PERM_ANY_READ = PERM_USER_READ | PERM_GROUP_READ | PERM_OTHER_READ;
@ -83,31 +90,31 @@ public interface IHostFilePermissions {
/** /**
* Set or reset all the permission bits from the given bitmask. * Set or reset all the permission bits from the given bitmask.
* *
* @param bitmask the permission(s) bits to modify * @param bitmask the permission(s) bits to modify
* @param value whether to turn on off of the permission(s) * @param value whether to turn on off of the permission(s)
* *
* Example: setPermission(PERM_USER_WRITE | PERM_GROUP_WRITE, true); * Example: setPermission(PERM_USER_WRITE | PERM_GROUP_WRITE, true);
*/ */
public void setPermission(int bitmask, boolean value); public void setPermission(int bitmask, boolean value);
/** /**
* Test if any of the permission bits from the bitmask are set. * Test if any of the permission bits from the bitmask are set.
* *
* @param bitmask the permission(s) to check for * @param bitmask the permission(s) to check for
* @return true if one of the permission bits is set * @return true if one of the permission bits is set
* *
* Example: getPermission(PERM_USER_WRITE | PERM_GROUP_WRITE) * Example: getPermission(PERM_USER_WRITE | PERM_GROUP_WRITE)
*/ */
public boolean getPermission(int bitmask); public boolean getPermission(int bitmask);
/** /**
* Get the set of permission bits. * Get the set of permission bits.
* *
* @return set of permission bits * @return set of permission bits
*/ */
public int getPermissionBits(); public int getPermissionBits();
/** /**
* Set the permission bits * Set the permission bits
* @param bits the set of permission bits * @param bits the set of permission bits
@ -119,35 +126,35 @@ public interface IHostFilePermissions {
* return permissions in rwxrwxrwx form * return permissions in rwxrwxrwx form
*/ */
public String toAlphaString(); public String toAlphaString();
/** /**
* returns the user owner of the file * returns the user owner of the file
* @return the user owner * @return the user owner
*/ */
public String getUserOwner(); public String getUserOwner();
/** /**
* returns the group owner of the file * returns the group owner of the file
* @return the group owner * @return the group owner
*/ */
public String getGroupOwner(); public String getGroupOwner();
/** /**
* Sets the user owner attribute * Sets the user owner attribute
* @param user the user owner attribute * @param user the user owner attribute
*/ */
public void setUserOwner(String user); public void setUserOwner(String user);
/** /**
* Sets the group owner attribute * Sets the group owner attribute
* @param group the group owner attribute * @param group the group owner attribute
*/ */
public void setGroupOwner(String group); public void setGroupOwner(String group);
/** /**
* Creates and returns a copy of this object, as specified * Creates and returns a copy of this object, as specified
* by the {@link Object#clone()} contract. * by the {@link Object#clone()} contract.
* *
* Each implementer of the IHostFilePermission API must properly implement * Each implementer of the IHostFilePermission API must properly implement
* this method and implement the {@link Cloneable} interface. * this method and implement the {@link Cloneable} interface.
* @return the cloned object * @return the cloned object

View file

@ -1,22 +1,22 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation. All rights reserved. * Copyright (c) 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.files; package org.eclipse.rse.services.files;
/** /**
* A container of permissions. Implementations of IHostFile that support * A container of permissions. Implementations of IHostFile that support
* IHostFilePermissions should implement this too * IHostFilePermissions should implement this too
* * @since 3.0
*/ */
public interface IHostFilePermissionsContainer { public interface IHostFilePermissionsContainer {
@ -25,15 +25,15 @@ public interface IHostFilePermissionsContainer {
* @return the host file permissions * @return the host file permissions
*/ */
public IHostFilePermissions getPermissions(); public IHostFilePermissions getPermissions();
/** /**
* TODO remove this API - here for now because we want to prevent duplicate * TODO remove this API - here for now because we want to prevent duplicate
* query jobs from being triggered from SystemViewRemoteFileAdapter.getPropertyValue() * query jobs from being triggered from SystemViewRemoteFileAdapter.getPropertyValue()
* *
* Sets the permissions attributes for this file. Right now, using this * Sets the permissions attributes for this file. Right now, using this
* to set a dummy "Pending" set of permissions from UI when doing asynchronous queries * to set a dummy "Pending" set of permissions from UI when doing asynchronous queries
* from property sheet or table view * from property sheet or table view
*/ */
public void setPermissions(IHostFilePermissions permissions); public void setPermissions(IHostFilePermissions permissions);
} }

View file

@ -1,23 +1,31 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation. All rights reserved. * Copyright (c) 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Initial Contributors: * Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer * The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight. * component that contains this file: David McKnight.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.services.files; package org.eclipse.rse.services.files;
/**
* A dummy HostFilePermissions node that can be used for deferred
* query of permissions. Clients who want to read permissions but
* see this pending node need to wait until the real permissions
* get available.
*
* @since 3.0
*/
public class PendingHostFilePermissions extends HostFilePermissions { public class PendingHostFilePermissions extends HostFilePermissions {
public PendingHostFilePermissions() public PendingHostFilePermissions()
{ {
super(0, "Pending", "Pending"); //$NON-NLS-2$ super(0, "Pending", "Pending"); //$NON-NLS-2$
} }
} }