From 592e9a2d044e73fe0e47715884a59db18cddd766 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Fri, 10 Oct 2008 14:14:14 +0000 Subject: [PATCH] [249544] some backward compatibility issues with old IBM dstore server --- .../dstore/files/DStoreFileService.java | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java index 3558629c3aa..da591dddad4 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java @@ -49,6 +49,7 @@ * David McKnight (IBM) - [236039][dstore][efs] DStoreInputStream can report EOF too early - clean up how it waits for the local temp file to be created * David McKnight (IBM) - [240710] [dstore] DStoreFileService.getFile() fails with NPE for valid root files * David McKnight (IBM) - [249544] Save conflict dialog appears when saving files in the editor + * David McKnight (IBM) - [249544] some backward compatibility issues with old IBM dstore server *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -197,8 +198,31 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer return IUniversalDataStoreConstants.UNIVERSAL_FILESYSTEM_MINER_ID; } - protected String getByteStreamHandlerId() + protected DataElement getMinerElement() { + super.getMinerElement(); + if (_minerElement == null){ + // could be back-level version + _minerElement = getMinerElement("com.ibm.etools.systems.universal.miners.UniversalFileSystemMiner"); //$NON-NLS-1$ + } + return _minerElement; + } + + private boolean isOldIBMMiner() + { + if (_minerElement != null){ + return _minerElement.getSource().equals("com.ibm.etools.systems.universal.miners.UniversalFileSystemMiner"); //$NON-NLS-1$ + } + return false; + } + + protected String getByteStreamHandlerId() + { + if (isOldIBMMiner()) + { + // if so, use the old id + return "com.ibm.etools.systems.universal.miners.UniversalByteStreamHandler"; //$NON-NLS-1$ + } return UniversalByteStreamHandler.class.getName(); } @@ -1138,8 +1162,25 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer de = getElementFor(name); } + // with 207095, it's possible to get here unconnected such that there is no element if (de != null) { + if (isOldIBMMiner()){ + // only accepts filters for file queries + if (!de.getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)){ + StringBuffer buf = new StringBuffer(remoteParent); + String sep = getSeparator(remoteParent); + if (sep.length()>0 && !remoteParent.endsWith(sep)) { + buf.append(sep); + } + buf.append(name); + String fullPath = buf.toString(); + de.setAttribute(DE.A_NAME, fullPath); + de.setAttribute(DE.A_VALUE, fullPath); + de.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); + } + } + dsQueryCommand(de, null, IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT, monitor); //getFile call should also need to convert this DataElement into a HostFile using //convertToHostFile() call. This way, this DataElement will be put into _fileMap. @@ -1160,9 +1201,25 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer // construct default array of commands String[] queryStrings = new String[remoteParents.length]; + boolean oldMiner = isOldIBMMiner(); + for (int i = 0; i < queryStrings.length; i++) { queryStrings[i] = IUniversalDataStoreConstants.C_QUERY_GET_REMOTE_OBJECT; + if (oldMiner){ + if (!subjects[i].getType().equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR)){ + StringBuffer buf = new StringBuffer(remoteParents[i]); + String sep = getSeparator(remoteParents[i]); + if (sep.length()>0 && !remoteParents[i].endsWith(sep)) { + buf.append(sep); + } + buf.append(names[i]); + String fullPath = buf.toString(); + subjects[i].setAttribute(DE.A_NAME, fullPath); + subjects[i].setAttribute(DE.A_VALUE, fullPath); + subjects[i].setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); + } + } } dsQueryCommandMulti(subjects, null, queryStrings, monitor);