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 86714 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]
updated patch with property page for exercising this
patch.txt (text/plain), 55.38 KB, created by
David McKnight
on 2008-01-11 15:10:05 EST
(
hide
)
Description:
updated patch with property page for exercising this
Filename:
MIME Type:
Creator:
David McKnight
Created:
2008-01-11 15:10:05 EST
Size:
55.38 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 11 Jan 2008 20:07:04 -0000 >@@ -1665,6 +1665,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"); >+ >+ } >+ >+ > for (int m = 0; m < results.length; m++) > { > Object result = results[m]; >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 11 Jan 2008 20:07:02 -0000 >@@ -27,6 +27,8 @@ > > RemotePropertyPage.File.Info = Info > >+RemotePropertyPage.Advanced.File.Info = 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 11 Jan 2008 20:07:02 -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,14 @@ > <instanceof value="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"/> > </enabledWhen> > </page> >+ <page >+ name="%RemotePropertyPage.Advanced.File.Info" >+ 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> >+ </page> > </extension> > > <!-- ============================================ --> >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,394 @@ >+/******************************************************************************** >+ * 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.files.ui.propertypages; >+ >+import org.eclipse.core.runtime.NullProgressMonitor; >+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.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.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); >+ >+ Group permissionsGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts,4, "Permissions"); >+ 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, "Type"); >+ >+ Label readLabel = SystemWidgetHelpers.createLabel(permissionsGroup, "Read"); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ readLabel.setLayoutData(data); >+ >+ Label writeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, "Write"); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ writeLabel.setLayoutData(data); >+ >+ Label executeLabel = SystemWidgetHelpers.createLabel(permissionsGroup, "Execute"); >+ data = new GridData(); >+ data.horizontalIndent = 20; >+ executeLabel.setLayoutData(data); >+ >+ >+ Label userLabel = SystemWidgetHelpers.createLabel(permissionsGroup, "User"); >+ _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, "Group"); >+ >+ _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, "Others"); >+ _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, "Ownership"); >+ 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, "User"); >+ _userEntry = new Text(ownerGroup, SWT.BORDER); >+ data = new GridData(); >+ data.widthHint = 100; >+ _userEntry.setLayoutData(data); >+ >+ Label groupOwnerLabel = SystemWidgetHelpers.createLabel(ownerGroup, "Group"); >+ _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){ >+ >+ IRemoteFileSubSystem ss = remoteFile.getParentRemoteFileSubSystem(); >+ if (ss instanceof IFileServiceSubSystem){ >+ IFileServiceSubSystem fss = (IFileServiceSubSystem)ss; >+ IFileService fs = fss.getFileService(); >+ >+ // permissions service >+ if (fs instanceof IFilePermissionsService){ >+ IFilePermissionsService service = (IFilePermissionsService)fs; >+ return service; >+ } >+ } >+ return null; >+ } >+ >+ >+ private IFileOwnerService getOwnerService(IRemoteFile remoteFile){ >+ IRemoteFileSubSystem ss = remoteFile.getParentRemoteFileSubSystem(); >+ if (ss instanceof IFileServiceSubSystem){ >+ IFileServiceSubSystem fss = (IFileServiceSubSystem)ss; >+ IFileService fs = fss.getFileService(); >+ >+ // service >+ if (fs instanceof IFileOwnerService){ >+ IFileOwnerService service = (IFileOwnerService)fs; >+ return service; >+ } >+ } >+ 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 = service.getFilePermissions(remoteParent, name, new NullProgressMonitor()); >+ _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 = service.getFileUserOwner(remoteParent, name, new NullProgressMonitor()); >+ _userEntry.setText(_owner); >+ >+ _group = service.getFileGroupOwner(remoteParent, name, new NullProgressMonitor()); >+ _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(); >+ } >+ >+} >#P org.eclipse.rse.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/plugin.xml,v >retrieving revision 1.51 >diff -u -r1.51 plugin.xml >--- plugin.xml 6 Dec 2007 12:15:26 -0000 1.51 >+++ plugin.xml 11 Jan 2008 20:07:06 -0000 >@@ -491,4 +491,14 @@ > </viewerContentBinding> > </extension> > >+ >+ >+ <extension id="defaultPreferences" point="org.eclipse.core.runtime.products"> >+ <product name="org.eclipse.platform.ide" application="org.eclipse.ui.ide.workbench" description="my description"> >+ <property >+ name="preferenceCustomization2" >+ value="plugin_customization.ini"/> >+ </product> >+ </extension> >+ > </plugin> >Index: plugin_customization.ini >=================================================================== >RCS file: plugin_customization.ini >diff -N plugin_customization.ini >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ plugin_customization.ini 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+ >+org.eclipse.rse.ui/shownewconnectionprompt=true >+org.eclipse.rse.core/org.eclipse.rse.examples.daytime.systemtype.systemType.enabled=false >+org.eclipse.rse.core/org.eclipse.rse.systemtype.telnet.systemType.enabled=false >+org.eclipse.rse.core/SYSTEMTYPE=org.eclipse.rse.systemtype.linux >+org.eclipse.rse.systemtype.telnet.systemType.enabled=false >#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 11 Jan 2008 20:07:08 -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 11 Jan 2008 20:07:07 -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 11 Jan 2008 20:07:09 -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 >#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,68 @@ >+/******************************************************************************** >+ * 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; >+ } >+} >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,117 @@ >+/******************************************************************************** >+ * 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); >+ >+} >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); >+}
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