Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86959 Details for
Bug 209593
[api] Add support for "file permissions" and "owner" properties for unix files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch with further evolution of the enhancement
patch.txt (text/plain), 85.29 KB, created by
David McKnight
on 2008-01-15 12:52:45 EST
(
hide
)
Description:
patch with further evolution of the enhancement
Filename:
MIME Type:
Creator:
David McKnight
Created:
2008-01-15 12:52:45 EST
Size:
85.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services >Index: src/org/eclipse/rse/services/files/HostFilePermissions.java >=================================================================== >RCS file: src/org/eclipse/rse/services/files/HostFilePermissions.java >diff -N src/org/eclipse/rse/services/files/HostFilePermissions.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/services/files/HostFilePermissions.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,86 @@ >+/******************************************************************************** >+ * 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; >+ >+/** >+ * Implementation of IHostFilePermissions. >+ * >+ */ >+public class HostFilePermissions implements >+ IHostFilePermissions { >+ >+ private int _permissions = 0; >+ >+ /** >+ * Constructor that take the initial permissions as a bitmask >+ * @param initialPermissions the intial permissions bitmask >+ */ >+ public HostFilePermissions(int initialPermissions){ >+ _permissions = initialPermissions; >+ } >+ >+ 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; >+ } >+ >+ public String toString(){ >+ return "" + _permissions; >+ } >+ >+ >+ private boolean isSet(long mask) { >+ return (_permissions & mask) != 0; >+ } >+ >+ private void set(int mask) { >+ _permissions |= mask; >+ } >+ >+ private void clear(int mask) { >+ _permissions &= ~mask; >+ } >+ >+ /** >+ * return permissions in rwxrwxrwx form >+ */ >+ public String toUserString(){ >+ StringBuffer buf = new StringBuffer(); >+ >+ buf.append(getPermission(IHostFilePermissions.PERM_USER_READ) ? 'r' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_USER_WRITE) ? 'w' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_USER_EXECUTE) ? 'x' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_GROUP_READ) ? 'r' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_GROUP_WRITE) ? 'w' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE) ? 'x' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_OTHER_READ) ? 'r' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_OTHER_WRITE) ? 'w' : '-'); >+ buf.append(getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE) ? 'x' : '-'); >+ return buf.toString(); >+ } >+} >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,122 @@ >+/******************************************************************************** >+ * 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; >+ >+ >+public interface IHostFilePermissions { >+ >+ /** >+ * Permission constant indicating that >+ * the user can read this file >+ */ >+ public static final int PERM_USER_READ = 1 << 8; >+ >+ /** >+ * Permission constant indicating that >+ * the user can write to this file >+ */ >+ public static final int PERM_USER_WRITE = 1 << 7; >+ >+ /** >+ * Permission constant indicating that >+ * the user can execute this file >+ */ >+ public static final int PERM_USER_EXECUTE = 1 << 6; >+ >+ /** >+ * Permission constant indicating that >+ * the group can read this file >+ */ >+ public static final int PERM_GROUP_READ = 1 << 5; >+ >+ /** >+ * Permission constant indicating that >+ * the group can write to this file >+ * >+ */ >+ public static final int PERM_GROUP_WRITE = 1 << 4; >+ >+ /** >+ * Permission constant indicating that >+ * the group can execute this file >+ * >+ */ >+ public static final int PERM_GROUP_EXECUTE = 1 << 3; >+ >+ /** >+ * Permission constant indicating that >+ * other users can read this file >+ * >+ */ >+ public static final int PERM_OTHER_READ = 1 << 2; >+ >+ /** >+ * Permission constant indicating that >+ * other users can write to this file >+ * >+ */ >+ public static final int PERM_OTHER_WRITE = 1 << 1; >+ >+ /** >+ * Permission constant indicating that >+ * other users can execute to this file >+ * >+ */ >+ public static final int PERM_OTHER_EXECUTE = 1 << 0; >+ >+ >+ // support masks >+ public static final int PERM_ANY_READ = PERM_USER_READ | PERM_GROUP_READ | PERM_OTHER_READ; >+ public static final int PERM_ANY_WRITE = PERM_USER_WRITE | PERM_GROUP_WRITE | PERM_OTHER_WRITE; >+ public static final int PERM_ANY_EXECUTE = PERM_USER_EXECUTE | PERM_GROUP_EXECUTE | PERM_OTHER_EXECUTE; >+ >+ /** >+ * 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); >+ >+ >+ /** >+ * return permissions in rwxrwxrwx form >+ */ >+ public String toUserString(); >+} >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,83 @@ >+/******************************************************************************** >+ * 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 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 getFileUserOwner(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 setFileUserOwner(String remoteParent, String name, String newOwner, IProgressMonitor monitor) throws SystemMessageException; >+ >+ /** >+ * @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 getFileGroupOwner(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 setFileGroupOwner(String remoteParent, String name, String newGroupOwner, IProgressMonitor monitor) throws SystemMessageException; >+ >+ >+ >+ /** >+ * Indicates whether the file owner can be retrieved for the specified file >+ * In some cases the service will need to determine whether it supports ownership >+ * depending on the current server. >+ * >+ * @param remoteParent the >+ * @param name >+ * @return whether the file owner can be retrieved >+ */ >+ public boolean canGetFileOwner(String remoteParent, String name); >+ >+ /** >+ * Indicates whether the file owner can be set for the specified file >+ * >+ * @param remoteParent the >+ * @param name >+ * @return whether the file owner can be set >+ */ >+ public boolean canSetFileOwner(String remoteParent, String name); >+} >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,64 @@ >+/******************************************************************************** >+ * 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. >+ */ >+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; >+ >+ /** >+ * Indicates whether the file permissions can be retrieved for the specified file. >+ * In some cases the service will need to determine whether it supports permissions >+ * depending on the current server. >+ * >+ * @param remoteParent >+ * @param name >+ * @return whether the file permissions can be retrieved >+ */ >+ public boolean canGetFilePermissions(String remoteParent, String name); >+ >+ /** >+ * Indicates whether the file permissions can be set for the specified file >+ * >+ * @param remoteParent >+ * @param name >+ * @return whether the file permissions can be set >+ */ >+ public boolean canSetFilePermissions(String remoteParent, String name); >+} >#P org.eclipse.rse.ui >Index: UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java,v >retrieving revision 1.3 >diff -u -r1.3 ISystemPropertyConstants.java >--- UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java 2 Nov 2007 15:10:26 -0000 1.3 >+++ UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java 15 Jan 2008 17:47:38 -0000 >@@ -61,6 +61,13 @@ > public static final String P_FILE_WRITABLE = P_PREFIX+"file.writable"; //$NON-NLS-1$ > public static final String P_FILE_HIDDEN = P_PREFIX+"file.hidden"; //$NON-NLS-1$ > >+ public static final String P_FILE_PERMISSIONS = P_PREFIX+"file.permissions"; //$NON-NLS-1$ >+ public static final String P_FILE_OWNER = P_PREFIX+"file.owner"; //$NON-NLS-1$ >+ public static final String P_FILE_GROUP = P_PREFIX+"file.group"; //$NON-NLS-1$ >+ >+ >+ >+ > // SEARCH LOCATION PROPERTIES > public static final String P_SEARCH_LINE = P_PREFIX+"search.line"; //$NON-NLS-1$ > //public static final String P_SEARCH_CHAR_END = P_PREFIX+"search.char.end"; >Index: UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties,v >retrieving revision 1.3 >diff -u -r1.3 SystemViewResources.properties >--- UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties 2 Nov 2007 15:10:27 -0000 1.3 >+++ UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties 15 Jan 2008 17:47:38 -0000 >@@ -137,6 +137,13 @@ > RESID_PROPERTY_FILE_EXTENSION_LABEL=Extension > RESID_PROPERTY_FILE_EXTENSION_TOOLTIP=Extension of this file > >+RESID_PROPERTY_FILE_PERMISSIONS_LABEL=Permissions >+RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP=The user, group and other permissions of this file >+RESID_PROPERTY_FILE_OWNER_LABEL=Owner >+RESID_PROPERTY_FILE_OWNER_TOOLTIP=The owner of this file >+RESID_PROPERTY_FILE_GROUP_LABEL=Group >+RESID_PROPERTY_FILE_GROUP_TOOLTIP=The group of this file >+ > > #SEARCH RESULT PROPERTIES > RESID_PROPERTY_SEARCH_LINE_LABEL=Line >Index: UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java,v >retrieving revision 1.3 >diff -u -r1.3 SystemViewResources.java >--- UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java 2 Nov 2007 15:10:27 -0000 1.3 >+++ UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java 15 Jan 2008 17:47:38 -0000 >@@ -171,6 +171,15 @@ > public static String RESID_PROPERTY_FILE_EXTENSION_LABEL; > public static String RESID_PROPERTY_FILE_EXTENSION_TOOLTIP; > >+ public static String RESID_PROPERTY_FILE_PERMISSIONS_LABEL; >+ public static String RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP; >+ >+ public static String RESID_PROPERTY_FILE_OWNER_LABEL; >+ public static String RESID_PROPERTY_FILE_OWNER_TOOLTIP; >+ >+ public static String RESID_PROPERTY_FILE_GROUP_LABEL; >+ public static String RESID_PROPERTY_FILE_GROUP_TOOLTIP; >+ > public static String RESID_PROPERTY_FILE_CLASSIFICATION_LABEL; > public static String RESID_PROPERTY_FILE_CLASSIFICATION_TOOLTIP; > >#P org.eclipse.rse.subsystems.files.core >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/plugin.xml,v >retrieving revision 1.2 >diff -u -r1.2 plugin.xml >--- plugin.xml 14 Nov 2007 18:54:21 -0000 1.2 >+++ plugin.xml 15 Jan 2008 17:47:41 -0000 >@@ -46,4 +46,18 @@ > > </extension> > >+<!-- ================================================================= --> >+<!-- Adapter factory for permissions services --> >+<!-- ================================================================= --> >+ <extension point="org.eclipse.core.runtime.adapters"> >+ <!-- Remote Files --> >+ <factory >+ class="org.eclipse.rse.internal.subsystems.files.core.RemoteFilePermissionsAdapterFactory" >+ adaptableType="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"> >+ >+ <adapter type="org.eclipse.rse.services.files.IFilePermissionsService"/> >+ <adapter type="org.eclipse.rse.services.files.IFileOwnerService"/> >+ </factory> >+ </extension> >+ > </plugin> >\ No newline at end of file >Index: src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java,v >retrieving revision 1.9 >diff -u -r1.9 IRemoteFile.java >--- src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java 10 Aug 2007 11:18:33 -0000 1.9 >+++ src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFile.java 15 Jan 2008 17:47:41 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.rse.core.subsystems.IRemoteContainer; > import org.eclipse.rse.core.subsystems.IRemotePropertyHolder; > import org.eclipse.rse.services.files.IHostFile; >+import org.eclipse.rse.services.files.IHostFilePermissions; > import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; > > /** >@@ -334,4 +335,23 @@ > * @since 2.0 > */ > public String getEncoding(); >+ >+ /** >+ * Returns the permissions for this file if they exist >+ * @return the permissions >+ */ >+ public IHostFilePermissions getPermissions(); >+ >+ /** >+ * Returns the owner for this file if it exists >+ * @return the owner >+ */ >+ public String getOwner(); >+ >+ /** >+ * Returns the group for this file if it exists >+ * @return the group >+ */ >+ public String getGroup(); >+ > } >Index: src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java,v >retrieving revision 1.30 >diff -u -r1.30 RemoteFile.java >--- src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java 13 Nov 2007 17:25:15 -0000 1.30 >+++ src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFile.java 15 Jan 2008 17:47:41 -0000 >@@ -43,6 +43,7 @@ > import org.eclipse.rse.services.clientserver.StringComparePatternMatcher; > import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; > import org.eclipse.rse.services.clientserver.messages.SystemMessageException; >+import org.eclipse.rse.services.files.IHostFilePermissions; > import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; > import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry; > import org.eclipse.rse.ui.SystemBasePlugin; >@@ -75,7 +76,8 @@ > { > > >- protected IRemoteFileContext _context; >+ >+ protected IRemoteFileContext _context; > protected String fullyQualifiedName; > > protected String _label; >@@ -96,6 +98,11 @@ > // properties > protected HashMap properties = new HashMap(); > protected HashMap propertyStates = new HashMap(); >+ >+ // permissions >+ protected IHostFilePermissions _permissions; >+ protected String _owner; >+ protected String _group; > > /** > * Constructor that takes a context object containing important information. >@@ -899,6 +906,9 @@ > public void markStale(boolean isStale, boolean clearCache) > { > _isStale = isStale; >+ _owner = null; >+ _group = null; >+ _permissions = null; > > if (isStale && clearCache) > { >@@ -1196,4 +1206,32 @@ > public void setEncoding(String encoding) { > RemoteFileEncodingManager.getInstance().setEncoding(getHostName(), getAbsolutePath(), encoding); > } >+ >+ public void setGroup(String group) { >+ _group = group; >+ } >+ >+ public void setOwner(String owner) { >+ _owner = owner; >+ } >+ >+ public void setPermissions(IHostFilePermissions permissions) { >+ _permissions = permissions; >+ } >+ >+ >+ public String getGroup() { >+ return _group; >+ } >+ >+ >+ public String getOwner() { >+ return _owner; >+ } >+ >+ >+ public IHostFilePermissions getPermissions() { >+ return _permissions; >+ } >+ > } >Index: src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java >diff -N src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/internal/subsystems/files/core/RemoteFilePermissionsAdapterFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,65 @@ >+/******************************************************************************** >+ * 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: >+ * {Name} (company) - description of contribution. >+ ********************************************************************************/ >+package org.eclipse.rse.internal.subsystems.files.core; >+ >+import org.eclipse.rse.services.files.IFileOwnerService; >+import org.eclipse.rse.services.files.IFilePermissionsService; >+import org.eclipse.rse.services.files.IFileService; >+import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; >+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; >+import org.eclipse.rse.ui.view.AbstractSystemRemoteAdapterFactory; >+ >+public class RemoteFilePermissionsAdapterFactory extends >+ AbstractSystemRemoteAdapterFactory { >+ >+ >+ >+ public Object getAdapter(Object adaptableObject, Class adapterType) { >+ >+ IFileService fileService = null; >+ if (adaptableObject instanceof IFileService){ >+ fileService = (IFileService)adaptableObject; >+ } >+ else if (adaptableObject instanceof IRemoteFile){ >+ FileServiceSubSystem ss = (FileServiceSubSystem)((IRemoteFile)adaptableObject).getParentRemoteFileSubSystem(); >+ if (ss != null){ >+ fileService = ss.getFileService(); >+ } >+ } >+ >+ if (fileService != null){ >+ if (adapterType == IFilePermissionsService.class){ >+ if (fileService instanceof IFilePermissionsService){ >+ return fileService; >+ } >+ } >+ else if (adapterType == IFileOwnerService.class){ >+ if (fileService instanceof IFileOwnerService){ >+ return fileService; >+ } >+ } >+ >+ } >+ >+ return null; >+ } >+ >+ /** >+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() >+ */ >+ public Class[] getAdapterList() >+ { >+ return new Class[] {IFilePermissionsService.class, IFileOwnerService.class}; >+ } >+} >#P org.eclipse.rse.services.dstore >Index: miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java,v >retrieving revision 1.28 >diff -u -r1.28 UniversalFileSystemMiner.java >--- miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 7 Jan 2008 22:04:15 -0000 1.28 >+++ miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java 15 Jan 2008 17:47:43 -0000 >@@ -28,11 +28,14 @@ > * David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup > * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations > * Xuan Chen (IBM) - [194481] [dstore][Archive] Save Conflict After Renaming a File that is Open >+ * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files > *******************************************************************************/ > > package org.eclipse.rse.dstore.universal.miners; >+import java.io.BufferedReader; > import java.io.File; > import java.io.IOException; >+import java.io.InputStreamReader; > import java.net.ServerSocket; > import java.util.HashMap; > import java.util.Iterator; >@@ -57,6 +60,7 @@ > import org.eclipse.rse.internal.dstore.universal.miners.filesystem.UniversalSearchHandler; > import org.eclipse.rse.services.clientserver.IClientServerConstants; > import org.eclipse.rse.services.clientserver.IServiceConstants; >+import org.eclipse.rse.services.clientserver.PathUtility; > import org.eclipse.rse.services.clientserver.SystemFileClassifier; > import org.eclipse.rse.services.clientserver.SystemSearchString; > import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath; >@@ -206,6 +210,21 @@ > return handleQueryClassName(subject, status); > } else if (IUniversalDataStoreConstants.C_QUERY_QUALIFIED_CLASSNAME.equals(name)) { > return handleQueryQualifiedClassName(subject, status); >+ } else if (IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS.equals(name)) { >+ return handleQueryFilePermissions(subject, status); >+ } else if (IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS.equals(name)) { >+ DataElement newPermissions = getCommandArgument(theElement, 1); >+ return handleSetFilePermissions(subject, newPermissions, status); >+ } else if (IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER.equals(name)) { >+ return handleQueryFileOwner(subject, status); >+ } else if (IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER.equals(name)) { >+ DataElement newOwner = getCommandArgument(theElement, 1); >+ return handleSetFileOwner(subject, newOwner, status); >+ } else if (IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER.equals(name)) { >+ return handleQueryFileGroupOwner(subject, status); >+ } else if (IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER.equals(name)) { >+ DataElement newOwner = getCommandArgument(theElement, 1); >+ return handleSetFileGroupOwner(subject, newOwner, status); > } else { > UniversalServerUtilities.logError(CLASSNAME, > "Invalid query to handlecommand", null); //$NON-NLS-1$ >@@ -1554,7 +1573,58 @@ > // command descriptor to retrieve qualified class name for class file > createCommandDescriptor(FileDescriptors._deUniversalFileObject, "GetFullClassName", //$NON-NLS-1$ > IUniversalDataStoreConstants.C_QUERY_QUALIFIED_CLASSNAME); >+ >+ >+ // permissions and ownership not supported on windows >+ if (!_isWindows) { >+ // descriptors for permissions >+ createCommandDescriptor(UniversalFilter, "GetPermissions", IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "GetPermissions", IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "GetPermissions", IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "GetPermissions",IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "GetPermissions", IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "GetPermissions", IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); //$NON-NLS-1$ >+ >+ createCommandDescriptor(UniversalFilter, "SetPermissions", IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "SetPermissions", IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "SetPermissions", IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "SetPermissions",IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "SetPermissions", IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "SetPermissions", IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS); //$NON-NLS-1$ >+ >+ >+ // descriptors for ownership >+ createCommandDescriptor(UniversalFilter, "GetOwner", IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "GetOwner", IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "GetOwner", IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "GetOwner",IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "GetOwner", IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "GetOwner", IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); //$NON-NLS-1$ >+ >+ createCommandDescriptor(UniversalFilter, "SetOwner", IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "SetOwner", IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "SetOwner", IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "SetOwner",IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "SetOwner", IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "SetOwner", IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER); //$NON-NLS-1$ >+ >+ createCommandDescriptor(UniversalFilter, "GetGroupOwner", IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "GetGroupOwner", IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "GetGroupOwner", IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "GetGroupOwner",IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "GetGroupOwner", IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "GetGroupOwner", IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ >+ createCommandDescriptor(UniversalFilter, "SetGroupOwner", IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFolderObject, "SetGroupOwner", IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalFileObject, "SetGroupOwner", IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalArchiveFileObject, "SetGroupOwner",IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFileObject, "SetGroupOwner", IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ createCommandDescriptor(FileDescriptors._deUniversalVirtualFolderObject, "SetGroupOwner", IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER); //$NON-NLS-1$ >+ >+ } > } >+ > > public AbsoluteVirtualPath getAbsoluteVirtualPath(DataElement subject) { > StringBuffer path = new StringBuffer(subject.getAttribute(DE.A_VALUE)); >@@ -1706,4 +1776,144 @@ > { > return "7.0.0"; //$NON-NLS-1$ > } >+ >+ private File getFileFor(DataElement subject) >+ { >+ File fileobj = null; >+ boolean isVirtual = false; >+ boolean isFilter = false; >+ String fullName = subject.getValue(); >+ String queryType = subject.getType(); >+ if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)) >+ { >+ isFilter = true; >+ isVirtual = ArchiveHandlerManager.isVirtual(fullName); >+ String filterValue = subject.getValue(); >+ // . translates to home dir >+ if (filterValue.equals(".")) //$NON-NLS-1$ >+ { >+ filterValue = System.getProperty("user.home"); //$NON-NLS-1$ >+ subject.setAttribute(DE.A_VALUE, filterValue); >+ } >+ if (!isVirtual) >+ fileobj = new File(filterValue); >+ } >+ else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR)) >+ { >+ String name = subject.getName(); >+ String path = subject.getValue(); >+ fileobj = new File(path, name); >+ } >+ else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)) >+ { >+ String name = subject.getName(); >+ String path = subject.getValue(); >+ if (name.length() == 0) >+ { >+ fileobj = new File(path); >+ } >+ else >+ { >+ fileobj = new File(path, name); >+ } >+ } >+ else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) >+ { >+ isVirtual = true; >+ } >+ return fileobj; >+ } >+ >+ >+ >+ private String simpleShellCommand(String cmd, File file) >+ { >+ String result = null; >+ String args[] = new String[3]; >+ args[0] = "sh"; //$NON-NLS-1$ >+ args[1] = "-c"; //$NON-NLS-1$ >+ args[2] = cmd + " " + PathUtility.enQuoteUnix(file.getAbsolutePath()); //$NON-NLS-1$ >+ >+ BufferedReader childReader = null; >+ try { >+ Process childProcess = Runtime.getRuntime().exec(args); >+ >+ childReader = new BufferedReader(new InputStreamReader(childProcess.getInputStream())); >+ >+ result = childReader.readLine().trim(); >+ childReader.close(); >+ } >+ catch (Exception e){ >+ try { >+ childReader.close(); >+ } >+ catch (IOException ex){} >+ } >+ return result; >+ >+ } >+ >+ private DataElement handleQueryFilePermissions(DataElement subject, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("stat -c%a", file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ >+ return status; >+ } >+ >+ private DataElement handleSetFilePermissions(DataElement subject, DataElement newPermissions, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("chmod " + newPermissions.getName(), file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ >+ return status; >+ } >+ >+ private DataElement handleQueryFileOwner(DataElement subject, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("stat -c%U", file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ >+ return status; >+ } >+ >+ private DataElement handleSetFileOwner(DataElement subject, DataElement newOwner, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("chown " + newOwner.getName(), file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ return status; >+ } >+ >+ private DataElement handleQueryFileGroupOwner(DataElement subject, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("stat -c%G", file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ >+ return status; >+ } >+ >+ private DataElement handleSetFileGroupOwner(DataElement subject, DataElement newGroup, DataElement status) >+ { >+ File file = getFileFor(subject); >+ String result = simpleShellCommand("chown :" + newGroup.getName(), file); //$NON-NLS-1$ >+ >+ status.setAttribute(DE.A_SOURCE, result); >+ statusDone(status); >+ return status; >+ } > } >Index: miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java,v >retrieving revision 1.6 >diff -u -r1.6 IUniversalDataStoreConstants.java >--- miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java 3 Dec 2007 17:06:01 -0000 1.6 >+++ miners/org/eclipse/rse/dstore/universal/miners/IUniversalDataStoreConstants.java 15 Jan 2008 17:47:42 -0000 >@@ -96,8 +96,16 @@ > public static final String C_QUERY_QUALIFIED_CLASSNAME = "C_QUERY_QUALIFIED_CLASSNAME"; //$NON-NLS-1$ > public static final String TYPE_QUALIFIED_CLASSNAME = "fullClassName"; //$NON-NLS-1$ > >- >- >+ // permissions commands >+ public static final String C_QUERY_FILE_PERMISSIONS = "C_QUERY_FILE_PERMISSIONS"; >+ public static final String C_SET_FILE_PERMISSIONS = "C_SET_FILE_PERMISSIONS"; >+ >+ // ownership commands >+ public static final String C_QUERY_FILE_USER_OWNER = "C_QUERY_FILE_USER_OWNER"; >+ public static final String C_SET_FILE_USER_OWNER = "C_SET_FILE_USER_OWNER"; >+ public static final String C_QUERY_FILE_GROUP_OWNER = "C_QUERY_FILE_GROUP_OWNER"; >+ public static final String C_SET_FILE_GROUP_OWNER = "C_SET_FILE_GROUP_OWNER"; >+ > // Mode of transfer: text or binary > public static final int TEXT_MODE = -1; > public static final int BINARY_MODE = -2; >Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v >retrieving revision 1.42 >diff -u -r1.42 DStoreFileService.java >--- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 7 Jan 2008 14:53:53 -0000 1.42 >+++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 15 Jan 2008 17:47:45 -0000 >@@ -31,7 +31,8 @@ > * Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND > * David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup > * David McKnight (IBM) - [209704] added supportsEncodingConversion() >- * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations >+ * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations >+ * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files > ********************************************************************************/ > > package org.eclipse.rse.internal.services.dstore.files; >@@ -74,12 +75,16 @@ > import org.eclipse.rse.services.dstore.util.DownloadListener; > import org.eclipse.rse.services.dstore.util.FileSystemMessageUtil; > import org.eclipse.rse.services.files.CodePageConverterManager; >+import org.eclipse.rse.services.files.HostFilePermissions; >+import org.eclipse.rse.services.files.IFileOwnerService; >+import org.eclipse.rse.services.files.IFilePermissionsService; > import org.eclipse.rse.services.files.IFileService; > import org.eclipse.rse.services.files.IFileServiceCodePageConverter; > import org.eclipse.rse.services.files.IHostFile; >+import org.eclipse.rse.services.files.IHostFilePermissions; > import org.eclipse.rse.services.files.RemoteFileSecurityException; > >-public class DStoreFileService extends AbstractDStoreService implements IFileService >+public class DStoreFileService extends AbstractDStoreService implements IFileService, IFilePermissionsService, IFileOwnerService > { > > protected org.eclipse.dstore.core.model.DataElement _uploadLogElement = null; >@@ -1217,7 +1222,7 @@ > } > else > { >- file = new DStoreHostFile(element); >+ file = new DStoreHostFile(element); > } > String path = file.getAbsolutePath(); > _fileElementMap.put(path, element); >@@ -2067,4 +2072,165 @@ > public boolean supportsEncodingConversion(){ > return true; > } >+ >+ >+ >+ >+ public boolean canGetFilePermissions(String remoteParent, String name) { >+ >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ DataElement queryCmd = getCommandDescriptor(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS); >+ if (queryCmd != null){ >+ return true; >+ } >+ return false; >+ } >+ >+ public boolean canGetFileOwner(String remoteParent, String name) { >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ DataElement queryCmd = getCommandDescriptor(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER); >+ if (queryCmd != null){ >+ return true; >+ } >+ return false; >+ } >+ >+ public boolean canSetFilePermissions(String remoteParent, String name) { >+ // for now just falling back to the same as get >+ return canGetFilePermissions(remoteParent, name); >+ } >+ >+ public boolean canSetFileOwner(String remoteParent, String name) { >+ // for now just falling back to the same as get >+ return canGetFileOwner(remoteParent, name); >+ } >+ >+ >+ public IHostFilePermissions getFilePermissions(String remoteParent, >+ String name, IProgressMonitor monitor) >+ throws SystemMessageException { >+ >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ DataElement status = dsStatusCommand(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_PERMISSIONS, monitor); >+ if (status != null) { >+ int permissionsInt = 0; >+ String accessString = status.getSource(); // access string in octal >+ if (accessString != null && accessString.length() > 0) { >+ try >+ { >+ int accessInt = Integer.parseInt(accessString, 8); >+ permissionsInt = accessInt; // leave permissions in decimal >+ } >+ catch (Exception e){ >+ >+ } >+ HostFilePermissions permissions = new HostFilePermissions(permissionsInt); >+ return permissions; >+ } >+ } >+ >+ // nothing - server may not be up-to-date - missing permissions and owner support >+ return null; >+ } >+ >+ public void setFilePermissions(String remoteParent, String name, >+ IHostFilePermissions permissions, IProgressMonitor monitor) >+ throws SystemMessageException { >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ ArrayList args = new ArrayList(); >+ int bits = permissions.getPermissionBits(); >+ String permissionsInOctal = Integer.toOctalString(bits); // from decimal to octal >+ >+ DataElement newPermissionsElement = getDataStore().createObject(null, "permissions", permissionsInOctal); //$NON-NLS-1$ >+ args.add(newPermissionsElement); >+ >+ DataElement status = dsStatusCommand(remoteFile, args, IUniversalDataStoreConstants.C_SET_FILE_PERMISSIONS, monitor); >+ if (status != null) >+ { >+ // check status to make sure the file really changed >+ } >+ } >+ >+ >+ public String getFileUserOwner(String remoteParent, String name, >+ IProgressMonitor monitor) throws SystemMessageException { >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ DataElement status = dsStatusCommand(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_USER_OWNER, monitor); >+ if (status != null) >+ { >+ String ownerString = status.getSource(); >+ if (ownerString != null && ownerString.length() > 0){ >+ return ownerString; >+ } >+ } >+ >+ // nothing - server may not be up-to-date - missing permissions and owner support >+ return null; >+ } >+ >+ public void setFileUserOwner(String remoteParent, String name, String newOwner, >+ IProgressMonitor monitor) throws SystemMessageException { >+ >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ ArrayList args = new ArrayList(); >+ DataElement newOwnerElement = getDataStore().createObject(null, "owner", newOwner); //$NON-NLS-1$ >+ args.add(newOwnerElement); >+ >+ DataElement status = dsStatusCommand(remoteFile, args, IUniversalDataStoreConstants.C_SET_FILE_USER_OWNER, monitor); >+ if (status != null) >+ { >+ // check status to make sure the file really changed >+ } >+ } >+ >+ public String getFileGroupOwner(String remoteParent, String name, >+ IProgressMonitor monitor) throws SystemMessageException { >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ DataElement status = dsStatusCommand(remoteFile, IUniversalDataStoreConstants.C_QUERY_FILE_GROUP_OWNER, monitor); >+ if (status != null) >+ { >+ String ownerString = status.getSource(); >+ if (ownerString != null && ownerString.length() > 0){ >+ return ownerString; >+ } >+ } >+ >+ // nothing - server may not be up-to-date - missing permissions and owner support >+ return null; >+ } >+ >+ public void setFileGroupOwner(String remoteParent, String name, String newOwner, >+ IProgressMonitor monitor) throws SystemMessageException { >+ >+ String remotePath = remoteParent + getSeparator(remoteParent) + name; >+ DataElement remoteFile = getElementFor(remotePath); >+ >+ ArrayList args = new ArrayList(); >+ DataElement newOwnerElement = getDataStore().createObject(null, "group", newOwner); //$NON-NLS-1$ >+ args.add(newOwnerElement); >+ >+ DataElement status = dsStatusCommand(remoteFile, args, IUniversalDataStoreConstants.C_SET_FILE_GROUP_OWNER, monitor); >+ if (status != null) >+ { >+ // check status to make sure the file really changed >+ } >+ } >+ >+ >+ >+ > } >\ No newline at end of file >Index: miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java,v >retrieving revision 1.16 >diff -u -r1.16 CommandMinerThread.java >--- miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java 3 Dec 2007 17:07:04 -0000 1.16 >+++ miners/org/eclipse/rse/internal/dstore/universal/miners/command/CommandMinerThread.java 15 Jan 2008 17:47:44 -0000 >@@ -177,6 +177,9 @@ > else > { > isBash = true; >+ // no bash! >+ theShell = "sh"; >+ > } > } > else if (theShell.endsWith("sh") && isZ)//$NON-NLS-1$ >#P org.eclipse.rse.files.ui >Index: src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java,v >retrieving revision 1.60 >diff -u -r1.60 SystemViewRemoteFileAdapter.java >--- src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 7 Jan 2008 21:09:58 -0000 1.60 >+++ src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 15 Jan 2008 17:47:49 -0000 >@@ -58,9 +58,12 @@ > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.SubProgressMonitor; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.action.Separator; > import org.eclipse.jface.resource.ImageDescriptor; >@@ -68,6 +71,8 @@ > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.rse.core.RSECorePlugin; >+import org.eclipse.rse.core.events.ISystemResourceChangeEvents; >+import org.eclipse.rse.core.events.SystemResourceChangeEvent; > import org.eclipse.rse.core.filters.ISystemFilter; > import org.eclipse.rse.core.filters.ISystemFilterReference; > import org.eclipse.rse.core.filters.SystemFilterReference; >@@ -110,6 +115,10 @@ > import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; > import org.eclipse.rse.services.clientserver.messages.SystemMessage; > import org.eclipse.rse.services.clientserver.messages.SystemMessageException; >+import org.eclipse.rse.services.files.IFileOwnerService; >+import org.eclipse.rse.services.files.IFilePermissionsService; >+import org.eclipse.rse.services.files.IFileService; >+import org.eclipse.rse.services.files.IHostFilePermissions; > import org.eclipse.rse.services.search.HostSearchResultSet; > import org.eclipse.rse.services.search.IHostSearchConstants; > import org.eclipse.rse.services.search.IHostSearchResultConfiguration; >@@ -118,6 +127,7 @@ > import org.eclipse.rse.subsystems.files.core.model.ISystemFileRemoteTypes; > import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; > import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; >+import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; > import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; > import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; > import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConfiguration; >@@ -885,7 +895,7 @@ > > int nbrOfArchiveProperties = 2; > int nbrOfVirtualProperties = 4; >- int nbrOfProperties = 5; >+ int nbrOfProperties = 8; > if (isVirtual) nbrOfProperties += nbrOfVirtualProperties; > else if (isArchive) nbrOfProperties += nbrOfArchiveProperties; > >@@ -924,7 +934,22 @@ > else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP); > else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP); > >- >+ // file permissions >+ if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ >+ // file owner >+ if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ >+ // file group >+ if (isRegular) uniquePropertyDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ else if (isVirtual) uniqueVirtualDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ else if (isArchive) uniqueArchiveDescriptorArray[++i] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ >+ > if (isVirtual) > { > // add virtual property descriptors... >@@ -988,7 +1013,7 @@ > { > int nbrOfArchiveProperties = 2; > int nbrOfVirtualProperties = 4; >- int nbrOfProperties = 9; >+ int nbrOfProperties = 12; > int nbrOfBriefProperties = 2; > if (debug) > nbrOfProperties += 7; >@@ -1050,7 +1075,22 @@ > if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP); > else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP); > else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_EXTENSION, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_LABEL, SystemViewResources.RESID_PROPERTY_FILE_EXTENSION_TOOLTIP); >- >+ >+ // file permissions >+ if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_PERMISSIONS, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_LABEL, SystemViewResources.RESID_PROPERTY_FILE_PERMISSIONS_TOOLTIP); >+ >+ // file owner >+ if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_OWNER, SystemViewResources.RESID_PROPERTY_FILE_OWNER_LABEL, SystemViewResources.RESID_PROPERTY_FILE_OWNER_TOOLTIP); >+ >+ // file group >+ if (isRegular) propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ else if (isVirtual) virtualDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ else if (isArchive) archiveDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILE_GROUP, SystemViewResources.RESID_PROPERTY_FILE_GROUP_LABEL, SystemViewResources.RESID_PROPERTY_FILE_GROUP_TOOLTIP); >+ > > if (debug) > { >@@ -1266,10 +1306,127 @@ > { > if(!file.isDirectory()) { > String ext = file.getExtension(); >- return ext == null?"":ext; >+ return ext == null?"":ext; //$NON-NLS-1$ > } > else >+ return ""; //$NON-NLS-1$ >+ } >+ else if (name.equals(ISystemPropertyConstants.P_FILE_PERMISSIONS)) >+ { >+ IHostFilePermissions permissions = file.getPermissions(); >+ if (permissions == null){ >+ >+ if (file instanceof IAdaptable){ >+ final IFilePermissionsService service = (IFilePermissionsService)((IAdaptable)file).getAdapter(IFilePermissionsService.class); >+ if (service != null){ >+ final IRemoteFile rFile = file; >+ >+ >+ Job deferredFetch = new Job("Get Permissions") >+ { >+ public IStatus run(IProgressMonitor monitor){ >+ try >+ { >+ String remoteParent = rFile.getParentPath(); >+ String fname = rFile.getName(); >+ IHostFilePermissions perm = service.getFilePermissions(remoteParent, fname, new NullProgressMonitor()); >+ if (perm != null && rFile instanceof RemoteFile){ >+ ((RemoteFile)rFile).setPermissions(perm); >+ // notify change to property sheet >+ >+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); >+ registry.fireEvent(new SystemResourceChangeEvent(rFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, rFile)); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ deferredFetch.schedule(); >+ >+ } >+ } > return ""; >+ } >+ return permissions.toUserString(); >+ } >+ else if (name.equals(ISystemPropertyConstants.P_FILE_OWNER)) >+ { >+ String owner = file.getOwner(); >+ if (owner == null){ >+ if (file instanceof IAdaptable){ >+ >+ final IFileOwnerService service = (IFileOwnerService)((IAdaptable)file).getAdapter(IFileOwnerService.class); >+ if (service != null){ >+ >+ final IRemoteFile rFile = file; >+ >+ Job deferredFetch = new Job("Get Owner") >+ { >+ public IStatus run(IProgressMonitor monitor){ >+ try >+ { >+ String remoteParent = rFile.getParentPath(); >+ String fname = rFile.getName(); >+ String uowner = service.getFileUserOwner(remoteParent, fname, monitor); >+ if (uowner != null && rFile instanceof RemoteFile){ >+ ((RemoteFile)rFile).setOwner(uowner); >+ // notify change to property sheet >+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); >+ registry.fireEvent(new SystemResourceChangeEvent(rFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, rFile)); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ deferredFetch.schedule(); >+ } >+ } >+ return ""; //$NON-NLS-1$ >+ } >+ return owner; >+ } >+ else if (name.equals(ISystemPropertyConstants.P_FILE_GROUP)) >+ { >+ String group = file.getGroup(); >+ if (group == null){ >+ if (file instanceof IAdaptable){ >+ final IFileOwnerService service = (IFileOwnerService)((IAdaptable)file).getAdapter(IFileOwnerService.class); >+ if (service != null){ >+ final IRemoteFile rFile = file; >+ >+ Job deferredFetch = new Job("Get Group") >+ { >+ public IStatus run(IProgressMonitor monitor){ >+ try >+ { >+ String remoteParent = rFile.getParentPath(); >+ String fname = rFile.getName(); >+ String ugroup = service.getFileGroupOwner(remoteParent, fname, monitor); >+ if (ugroup != null && rFile instanceof RemoteFile){ >+ ((RemoteFile)rFile).setGroup(ugroup); >+ // notify change to property sheet >+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); >+ registry.fireEvent(new SystemResourceChangeEvent(rFile, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, rFile)); >+ } >+ } >+ catch (Exception e) >+ { >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ deferredFetch.schedule(); >+ } >+ } >+ return ""; //$NON-NLS-1$ >+ } >+ return group; > } > else if (name.equals(ISystemPropertyConstants.P_FILE_CLASSIFICATION)) > { >@@ -1665,6 +1822,13 @@ > if (submonitor != null) > submonitor.worked(1); > Object[] results = config.getResults(); >+ if (results == null || results.length == 0){ >+ // make sure search is really done >+ System.out.println("waiting for results"); //$NON-NLS-1$ >+ >+ } >+ >+ > for (int m = 0; m < results.length; m++) > { > Object result = results[m]; >@@ -1867,7 +2031,7 @@ > { > if (thisObject instanceof IRemoteFile) > { >- copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); >+ copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); //$NON-NLS-1$ > } > } > } >@@ -2052,7 +2216,7 @@ > { > if (thisObject instanceof IRemoteFile) > { >- copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); >+ copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); //$NON-NLS-1$ > } > } > } >@@ -3371,6 +3535,21 @@ > return tgt.isLink() && value.equals("true") || //$NON-NLS-1$ > !tgt.isLink() && value.equals("false"); //$NON-NLS-1$ > } >+ else if (inName.equals("supportsPermissions")) //$NON-NLS-1$ >+ { >+ if (value.equals("true")){ //$NON-NLS-1$ >+ // check service >+ IRemoteFileSubSystem ss = (IRemoteFileSubSystem)getSubSystem(tgt); >+ if (ss instanceof IFileServiceSubSystem){ >+ IFileServiceSubSystem fss = (IFileServiceSubSystem)ss; >+ IFileService fs = fss.getFileService(); >+ if (fs instanceof IFilePermissionsService){ >+ return ((IFilePermissionsService)fs).canGetFilePermissions(tgt.getParentPath(), tgt.getName()); >+ } >+ } >+ } >+ return false; >+ } > else if (inName.equals("iscommandsubsystemexists")) { //$NON-NLS-1$ > > boolean test = value.equals("true"); //$NON-NLS-1$ >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/plugin.properties,v >retrieving revision 1.13 >diff -u -r1.13 plugin.properties >--- plugin.properties 2 Jan 2008 19:28:00 -0000 1.13 >+++ plugin.properties 15 Jan 2008 17:47:47 -0000 >@@ -27,6 +27,8 @@ > > RemotePropertyPage.File.Info = Info > >+RemotePropertyPage.File.Permissions = Permissions >+ > PropertyPage.ServerLauncherSettings = Server Launcher Settings > PropertyPage.Service = Service > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/plugin.xml,v >retrieving revision 1.21 >diff -u -r1.21 plugin.xml >--- plugin.xml 3 Jan 2008 20:48:51 -0000 1.21 >+++ plugin.xml 15 Jan 2008 17:47:47 -0000 >@@ -109,9 +109,8 @@ > <!-- ============================================ --> > <!-- Define Remote Object Properties Pages --> > <!-- ============================================ --> >- >- <extension >- point="org.eclipse.ui.propertyPages"> >+ <extension >+ point="org.eclipse.ui.propertyPages"> > <page > name="%RemotePropertyPage.File.Info" > class="org.eclipse.rse.internal.files.ui.propertypages.SystemFilePropertyPage" >@@ -120,6 +119,19 @@ > <instanceof value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/> > </enabledWhen> > </page> >+ <page >+ name="%RemotePropertyPage.File.Permissions" >+ class="org.eclipse.rse.internal.files.ui.propertypages.SystemFilePermissionsPropertyPage" >+ id="org.eclipse.rse.files.AdvancedPropertyPage"> >+ <enabledWhen> >+ <instanceof value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/> >+ </enabledWhen> >+ <test >+ property="supportsPermissions" value="true"> >+ </test> >+ >+ >+ </page> > </extension> > > <!-- ============================================ --> >Index: src/org/eclipse/rse/internal/files/ui/FileResources.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java,v >retrieving revision 1.9 >diff -u -r1.9 FileResources.java >--- src/org/eclipse/rse/internal/files/ui/FileResources.java 3 Jan 2008 18:41:57 -0000 1.9 >+++ src/org/eclipse/rse/internal/files/ui/FileResources.java 15 Jan 2008 17:47:47 -0000 >@@ -265,6 +265,17 @@ > public static String MESSAGE_EXPANDING_FILTER; > public static String MESSSAGE_QUERYING_FILE; > >+ // file permisssions property page >+ public static String MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED; >+ public static String RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL; >+ public static String RESID_PREF_PERMISSIONS_TYPE_LABEL; >+ public static String RESID_PREF_PERMISSIONS_READ_LABEL; >+ public static String RESID_PREF_PERMISSIONS_WRITE_LABEL; >+ public static String RESID_PREF_PERMISSIONS_EXECUTE_LABEL; >+ public static String RESID_PREF_PERMISSIONS_USER_LABEL; >+ public static String RESID_PREF_PERMISSIONS_GROUP_LABEL; >+ public static String RESID_PREF_PERMISSIONS_OTHERS_LABEL; >+ public static String RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL; > > > static >Index: src/org/eclipse/rse/internal/files/ui/FileResources.properties >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties,v >retrieving revision 1.11 >diff -u -r1.11 FileResources.properties >--- src/org/eclipse/rse/internal/files/ui/FileResources.properties 3 Jan 2008 18:41:57 -0000 1.11 >+++ src/org/eclipse/rse/internal/files/ui/FileResources.properties 15 Jan 2008 17:47:47 -0000 >@@ -262,3 +262,17 @@ > MESSAGE_EXPANDING_FILTER=Expanding Filter... > MESSSAGE_QUERYING_FILE=Querying File... > >+#============================================================= >+# File Permissions Property Page... >+#============================================================= >+MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED=Permissions and ownership not supported >+RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL=Permissions >+RESID_PREF_PERMISSIONS_TYPE_LABEL=Type >+RESID_PREF_PERMISSIONS_READ_LABEL=Read >+RESID_PREF_PERMISSIONS_WRITE_LABEL=Write >+RESID_PREF_PERMISSIONS_EXECUTE_LABEL=Execute >+RESID_PREF_PERMISSIONS_USER_LABEL=User >+RESID_PREF_PERMISSIONS_GROUP_LABEL=Group >+RESID_PREF_PERMISSIONS_OTHERS_LABEL=Others >+RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL=Ownership >+ >Index: src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java >=================================================================== >RCS file: src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java >diff -N src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePermissionsPropertyPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,410 @@ >+/******************************************************************************** >+ * 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.internal.files.ui.propertypages; >+ >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.rse.internal.files.ui.FileResources; >+import org.eclipse.rse.services.files.IFileOwnerService; >+import org.eclipse.rse.services.files.IFilePermissionsService; >+import org.eclipse.rse.services.files.IHostFilePermissions; >+import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; >+import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile; >+import org.eclipse.rse.ui.SystemWidgetHelpers; >+import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+ >+public class SystemFilePermissionsPropertyPage extends SystemBasePropertyPage { >+ >+ private Button _userRead; >+ private Button _userWrite; >+ private Button _userExecute; >+ private Button _groupRead; >+ private Button _groupWrite; >+ private Button _groupExecute; >+ private Button _otherRead; >+ private Button _otherWrite; >+ private Button _otherExecute; >+ >+ private Text _userEntry; >+ private Text _groupEntry; >+ >+ private IHostFilePermissions _permissions; >+ private String _owner; >+ private String _group; >+ >+ /** >+ * Get the input remote file object >+ */ >+ protected IRemoteFile getRemoteFile() >+ { >+ Object element = getElement(); >+ return ((IRemoteFile)element); >+ } >+ >+ protected Control createContentArea(Composite parent) { >+ >+ >+ // Inner composite >+ Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1); >+ >+ IRemoteFile file = getRemoteFile(); >+ IFilePermissionsService service = getPermissionsService(file); >+ if (service == null || !service.canGetFilePermissions(file.getParentPath(), file.getName())){ >+ // not supported >+ SystemWidgetHelpers.createLabel(parent, FileResources.MESSAGE_FILE_PERMISSIONS_NOT_SUPPORTED); >+ } >+ else >+ { >+ Group permissionsGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts,4, FileResources.RESID_PREF_PERMISSIONS_PERMISSIONS_LABEL); >+ GridData data = new GridData(); >+ data.horizontalSpan = 5; >+ data.horizontalAlignment = SWT.FILL; >+ data.grabExcessHorizontalSpace = false; >+ data.verticalAlignment = SWT.BEGINNING; >+ data.grabExcessVerticalSpace = false; >+ permissionsGroup.setLayoutData(data); >+ >+ Label userTypeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_TYPE_LABEL); >+ >+ Label readLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_READ_LABEL); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ readLabel.setLayoutData(data); >+ >+ Label writeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_WRITE_LABEL); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ writeLabel.setLayoutData(data); >+ >+ Label executeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_EXECUTE_LABEL); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ executeLabel.setLayoutData(data); >+ >+ >+ Label userLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_USER_LABEL); >+ _userRead = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _userRead.setLayoutData(data); >+ >+ _userWrite = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _userWrite.setLayoutData(data); >+ >+ _userExecute = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _userExecute.setLayoutData(data); >+ >+ Label groupLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_GROUP_LABEL); >+ >+ _groupRead = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _groupRead.setLayoutData(data); >+ >+ _groupWrite = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _groupWrite.setLayoutData(data); >+ >+ _groupExecute = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _groupExecute.setLayoutData(data); >+ >+ Label otherLabel = SystemWidgetHelpers.createLabel(permissionsGroup, FileResources.RESID_PREF_PERMISSIONS_OTHERS_LABEL); >+ _otherRead = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _otherRead.setLayoutData(data); >+ >+ _otherWrite = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _otherWrite.setLayoutData(data); >+ >+ _otherExecute = new Button(permissionsGroup, SWT.CHECK); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ _otherExecute.setLayoutData(data); >+ >+ Group ownerGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts, 2, FileResources.RESID_PREF_PERMISSIONS_OWNERSHIP_LABEL); >+ data = new GridData(); >+ data.horizontalSpan = 1; >+ data.verticalSpan = 5; >+ data.horizontalAlignment = SWT.FILL; >+ data.grabExcessHorizontalSpace = false; >+ data.verticalAlignment = SWT.BEGINNING; >+ data.grabExcessVerticalSpace = false; >+ ownerGroup.setLayoutData(data); >+ >+ Label userOwnerLabel = SystemWidgetHelpers.createLabel(ownerGroup, FileResources.RESID_PREF_PERMISSIONS_USER_LABEL); >+ _userEntry = new Text(ownerGroup, SWT.BORDER); >+ data = new GridData(); >+ data.widthHint = 100; >+ _userEntry.setLayoutData(data); >+ >+ Label groupOwnerLabel = SystemWidgetHelpers.createLabel(ownerGroup, FileResources.RESID_PREF_PERMISSIONS_GROUP_LABEL); >+ _groupEntry = new Text(ownerGroup, SWT.BORDER); >+ data = new GridData(); >+ data.widthHint = 100; >+ _groupEntry.setLayoutData(data); >+ >+ >+ initFields(); >+ } >+ >+ return composite_prompts; >+ } >+ >+ protected boolean verifyPageContents() { >+ return true; >+ } >+ >+ private void enableOwnershipFields(boolean enabled) { >+ >+ _userEntry.setEnabled(enabled); >+ _groupEntry.setEnabled(enabled); >+ } >+ >+ private void enablePermissionFields(boolean enabled){ >+ >+ _groupExecute.setEnabled(enabled); >+ _groupRead.setEnabled(enabled); >+ _groupWrite.setEnabled(enabled); >+ >+ _userExecute.setEnabled(enabled); >+ _userRead.setEnabled(enabled); >+ _userWrite.setEnabled(enabled); >+ >+ _otherExecute.setEnabled(enabled); >+ _otherRead.setEnabled(enabled); >+ _otherWrite.setEnabled(enabled); >+ } >+ >+ private IFilePermissionsService getPermissionsService(IRemoteFile remoteFile){ >+ >+ if (remoteFile instanceof IAdaptable){ >+ return (IFilePermissionsService)((IAdaptable)remoteFile).getAdapter(IFilePermissionsService.class); >+ } >+ >+ return null; >+ } >+ >+ >+ private IFileOwnerService getOwnerService(IRemoteFile remoteFile){ >+ >+ if (remoteFile instanceof IAdaptable){ >+ return (IFileOwnerService)((IAdaptable)remoteFile).getAdapter(IFileOwnerService.class); >+ } >+ >+ return null; >+ } >+ >+ >+ private void initFields() { >+ IRemoteFile remoteFile = getRemoteFile(); >+ >+ IFilePermissionsService ps = getPermissionsService(remoteFile); >+ if (ps == null){ >+ enablePermissionFields(false); >+ } >+ else { >+ initPermissionFields(remoteFile, ps); >+ } >+ >+ IFileOwnerService os = getOwnerService(remoteFile); >+ if (ps == null){ >+ enableOwnershipFields(false); >+ } >+ else { >+ initOwnershipFields(remoteFile, os); >+ } >+ } >+ >+ private void initPermissionFields(IRemoteFile file, IFilePermissionsService service){ >+ _permissions = null; // null set so that we make sure we're getting fresh permissions >+ >+ String remoteParent = file.getParentPath(); >+ String name = file.getName(); >+ >+ if (service.canGetFilePermissions(remoteParent, name)){ >+ enablePermissionFields(true); >+ try >+ { >+ _permissions = file.getPermissions(); >+ if (_permissions == null){ >+ _permissions = service.getFilePermissions(remoteParent, name, new NullProgressMonitor()); >+ if (file instanceof RemoteFile){ >+ ((RemoteFile)file).setPermissions(_permissions); >+ } >+ } >+ >+ _userRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_READ)); >+ _userWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_WRITE)); >+ _userExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_USER_EXECUTE)); >+ _groupRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_READ)); >+ _groupWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_WRITE)); >+ _groupExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE)); >+ _otherRead.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_READ)); >+ _otherWrite.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_WRITE)); >+ _otherExecute.setSelection(_permissions.getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE)); >+ } >+ catch (Exception e){ >+ >+ } >+ } >+ else { >+ enablePermissionFields(false); >+ } >+ } >+ >+ >+ private void initOwnershipFields(IRemoteFile file, IFileOwnerService service){ >+ _owner = null; >+ _group = null; >+ >+ String remoteParent = file.getParentPath(); >+ String name = file.getName(); >+ >+ if (service.canGetFileOwner(remoteParent, name)){ >+ enableOwnershipFields(true); >+ try >+ { >+ _owner = file.getOwner(); >+ if (_owner == null){ >+ _owner = service.getFileUserOwner(remoteParent, name, new NullProgressMonitor()); >+ if (file instanceof RemoteFile){ >+ ((RemoteFile)file).setOwner(_owner); >+ } >+ } >+ _userEntry.setText(_owner); >+ >+ _group = file.getGroup(); >+ if (_group == null){ >+ _group = service.getFileGroupOwner(remoteParent, name, new NullProgressMonitor()); >+ if (file instanceof RemoteFile){ >+ ((RemoteFile)file).setGroup(_group); >+ } >+ } >+ _groupEntry.setText(_group); >+ } >+ catch (Exception e){ >+ >+ } >+ } >+ else { >+ enableOwnershipFields(false); >+ } >+ } >+ >+ public boolean performOk() { >+ IRemoteFile remoteFile = getRemoteFile(); >+ >+ // permission changes >+ if (_permissions != null){ >+ IFilePermissionsService service = getPermissionsService(remoteFile); >+ >+ String remoteParent = remoteFile.getParentPath(); >+ String name = remoteFile.getName(); >+ >+ if (service.canSetFilePermissions(remoteParent, name)){ >+ try >+ { >+ boolean changed = false; >+ >+ if (_permissions.getPermission(IHostFilePermissions.PERM_USER_READ) != _userRead.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_USER_READ, _userRead.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_USER_WRITE) != _userWrite.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_USER_WRITE, _userWrite.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_USER_EXECUTE) != _userExecute.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_USER_EXECUTE, _userExecute.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_READ) != _groupRead.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_GROUP_READ, _groupRead.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_WRITE) != _groupWrite.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_GROUP_WRITE, _groupWrite.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_GROUP_EXECUTE) != _groupExecute.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_GROUP_EXECUTE, _groupExecute.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_READ) != _otherRead.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_OTHER_READ, _otherRead.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_WRITE) != _otherWrite.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_OTHER_WRITE, _otherWrite.getSelection()); >+ } >+ if (_permissions.getPermission(IHostFilePermissions.PERM_OTHER_EXECUTE) != _otherExecute.getSelection()){ >+ changed = true; >+ _permissions.setPermission(IHostFilePermissions.PERM_OTHER_EXECUTE, _otherExecute.getSelection()); >+ } >+ >+ if (changed){ >+ service.setFilePermissions(remoteParent, name, _permissions, new NullProgressMonitor()); >+ } >+ } >+ catch (Exception e){ >+ >+ } >+ } >+ } >+ if (_owner != null){ >+ IFileOwnerService service = getOwnerService(remoteFile); >+ >+ String remoteParent = remoteFile.getParentPath(); >+ String name = remoteFile.getName(); >+ >+ if (service.canSetFileOwner(remoteParent, name)){ >+ try >+ { >+ if (_owner != _userEntry.getText()){ >+ service.setFileUserOwner(remoteParent, name, _userEntry.getText(), new NullProgressMonitor()); >+ } >+ if (_group != _groupEntry.getText()){ >+ service.setFileGroupOwner(remoteParent, name, _groupEntry.getText(), new NullProgressMonitor()); >+ } >+ } >+ catch (Exception e){ >+ >+ } >+ } >+ >+ } >+ >+ return super.performOk(); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209593
:
86557
|
86578
|
86584
|
86601
|
86697
|
86714
|
86959
|
87427
|
87539