### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.services Index: src/org/eclipse/rse/services/files/IHostFilePermissions.java =================================================================== RCS file: src/org/eclipse/rse/services/files/IHostFilePermissions.java diff -N src/org/eclipse/rse/services/files/IHostFilePermissions.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/services/files/IHostFilePermissions.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,51 @@ +/******************************************************************************** + * Copyright (c) 2007 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: + * {Name} (company) - description of contribution. + ********************************************************************************/ +package org.eclipse.rse.services.files; + +public interface IHostFilePermissions { + + /** + * Set or reset all the permission bits from the given bitmask. + * + * @param bitmask the permission(s) bits to modify + * @param value whether to turn on off of the permission(s) + * + * Example: setPermission(PERM_USER_WRITE | PERM_GROUP_WRITE, true); + */ + public void setPermission(int bitmask, boolean value); + + /** + * Test if any of the permission bits from the bitmask are set. + * + * @param bitmask the permission(s) to check for + * @return true if one of the permission bits is set + * + * Example: getPermission(PERM_USER_WRITE | PERM_GROUP_WRITE) + */ + public boolean getPermission(int bitmask); + + /** + * Get the set of permission bits. + * + * @return set of permission bits + */ + public int getPermissionBits(); + + /** + * Set the permission bits + * @param bits the set of permission bits + */ + public void setPermissionBits(int bits); + +} Index: src/org/eclipse/rse/services/files/AbstractHostFilePermissions.java =================================================================== RCS file: src/org/eclipse/rse/services/files/AbstractHostFilePermissions.java diff -N src/org/eclipse/rse/services/files/AbstractHostFilePermissions.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/services/files/AbstractHostFilePermissions.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,52 @@ +/******************************************************************************** + * Copyright (c) 2007 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: + * {Name} (company) - description of contribution. + ********************************************************************************/ +package org.eclipse.rse.services.files; + +public abstract class AbstractHostFilePermissions implements + IHostFilePermissions { + + protected int _permissions = 0; + + protected boolean isSet(long mask) { + return (_permissions & mask) != 0; + } + + protected void set(int mask) { + _permissions |= mask; + } + + protected void clear(int mask) { + _permissions &= ~mask; + } + + public void setPermission(int permission, boolean value) { + if (value) + set(permission); + else + clear(permission); + } + + public boolean getPermission(int permission) { + return isSet(permission); + } + + public int getPermissionBits() { + return _permissions; + } + + + public void setPermissionBits(int bits) { + _permissions = bits; + } +} Index: src/org/eclipse/rse/services/files/IFileOwnerService.java =================================================================== RCS file: src/org/eclipse/rse/services/files/IFileOwnerService.java diff -N src/org/eclipse/rse/services/files/IFileOwnerService.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/services/files/IFileOwnerService.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,43 @@ +/******************************************************************************** + * Copyright (c) 2007 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: + * {Name} (company) - description of contribution. + ********************************************************************************/ +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 owner of a file. + */ +public interface IFileOwnerService { + /** + * @param remoteParent + * @param name + * @param monitor the monitor for this potentially long running operation + * @return the host file owner + * @throws SystemMessageException if an error occurs. + * Typically this would be one of those in the RemoteFileException family. + */ + public String getFileOwner(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException; + + /** + * @param remoteParent + * @param name + * @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 setFileOwner(String remoteParent, String name, String newOwner, IProgressMonitor monitor) throws SystemMessageException; + +} Index: src/org/eclipse/rse/services/files/IFilePermissionsService.java =================================================================== RCS file: src/org/eclipse/rse/services/files/IFilePermissionsService.java diff -N src/org/eclipse/rse/services/files/IFilePermissionsService.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/rse/services/files/IFilePermissionsService.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,45 @@ +/******************************************************************************** + * Copyright (c) 2007 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: + * {Name} (company) - description of contribution. + ********************************************************************************/ +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. + */ +public interface IFilePermissionsService { + + /** + * @param remoteParent + * @param name + * @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(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException; + + /** + * @param remoteParent + * @param name + * @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(String remoteParent, String name, IHostFilePermissions permissions, IProgressMonitor monitor) throws SystemMessageException; + +}