mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
bug 149472 - moved the RemoteFileException hierarchy to org.eclipse.rse.services.files package.
Here it can be exploited directly by the services. Hardcoded the SystemMessage creation for now. This will be changed when the message file DTD is moved and message file utilities are created. Fixed javadoc where appropriate.
This commit is contained in:
parent
5d4a23fa3b
commit
7f3551e958
23 changed files with 573 additions and 476 deletions
|
@ -28,10 +28,10 @@ import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
|||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
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.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
|
|
|
@ -20,11 +20,11 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.subsystems.files.core.SystemFileResources;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||
|
|
|
@ -45,10 +45,10 @@ import org.eclipse.rse.model.ISystemRegistry;
|
|||
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
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.IVirtualRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.eclipse.rse.files.ui.actions.SystemUploadConflictAction;
|
|||
import org.eclipse.rse.model.ISystemRegistry;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
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.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.actions.DisplaySystemMessageAction;
|
||||
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
|
||||
|
|
|
@ -43,15 +43,15 @@ import org.eclipse.rse.services.clientserver.archiveutils.ISystemArchiveHandler;
|
|||
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
|
||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
|
||||
import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry;
|
||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
|
||||
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.IVirtualRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFolderNotEmptyException;
|
||||
import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
|
|
|
@ -78,6 +78,8 @@ import org.eclipse.rse.services.clientserver.SystemSearchString;
|
|||
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.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.services.search.HostSearchResultSet;
|
||||
import org.eclipse.rse.services.search.IHostSearchConstants;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
|
||||
|
@ -92,9 +94,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystemConf
|
|||
import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileEmpty;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileRoot;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteSearchResultsContentsType;
|
||||
import org.eclipse.rse.subsystems.files.core.util.ValidatorFileUniqueName;
|
||||
import org.eclipse.rse.ui.ISystemContextMenuConstants;
|
||||
|
|
|
@ -33,13 +33,13 @@ import org.eclipse.rse.model.SystemResourceChangeEvent;
|
|||
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.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
|
||||
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;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
|
|
@ -23,10 +23,10 @@ import org.eclipse.rse.filters.ISystemFilter;
|
|||
import org.eclipse.rse.filters.ISystemFilterReference;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
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.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.ui.ISystemIconConstants;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
|
|
@ -16,107 +16,90 @@
|
|||
|
||||
package org.eclipse.rse.services.clientserver.messages;
|
||||
|
||||
// To dos:
|
||||
// 1) can remove the following import when deprecated stuff is removed....
|
||||
// 2) remove deprecated classes....
|
||||
// ... done. Phil.
|
||||
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
|
||||
/**
|
||||
* Error message window class.
|
||||
* SystemMessage is used to supply detailed status when an error or other significant event occurs that should
|
||||
* be presented to the user or logged. It is structured to capture information from a variety of remote systems.
|
||||
*/
|
||||
public class SystemMessage
|
||||
//implements ISystemMessages
|
||||
{
|
||||
|
||||
// start of the new stuff!!! Violaine Batthish
|
||||
// Indicators
|
||||
|
||||
/**
|
||||
* Completion message indicator
|
||||
*/
|
||||
public static final char COMPLETION='C';
|
||||
public static final char COMPLETION = 'C';
|
||||
/**
|
||||
* Inquiry message indicator
|
||||
*/
|
||||
public static final char INQUIRY='Q';
|
||||
public static final char INQUIRY = 'Q';
|
||||
/**
|
||||
* Information message indicator
|
||||
*/
|
||||
public static final char INFORMATION='I';
|
||||
public static final char INFORMATION = 'I';
|
||||
/**
|
||||
* Error message indicator
|
||||
*/
|
||||
public static final char ERROR='E';
|
||||
public static final char ERROR = 'E';
|
||||
/**
|
||||
* Warning message indicator
|
||||
*/
|
||||
public static final char WARNING='W';
|
||||
public static final char WARNING = 'W';
|
||||
/**
|
||||
* Unexpected message indicator (same as warning but will log exception & stack in message log)
|
||||
*/
|
||||
public static final char UNEXPECTED='U';
|
||||
|
||||
public static final char UNEXPECTED = 'U';
|
||||
|
||||
// Private variables
|
||||
private char subPrefix='%';
|
||||
private char subPrefix = '%';
|
||||
private char indicator;
|
||||
private String level1NS, level2NS; // level 1 & 2 with NO substitution made
|
||||
private String level1WS, level2WS; // level 1 & 2 with substitutions made.
|
||||
private String level1NS, level2NS; // level 1 & 2 with NO substitution made
|
||||
private String level1WS, level2WS; // level 1 & 2 with substitutions made.
|
||||
private String component, subComponent;
|
||||
private String messageNumber;
|
||||
private int numSubs=-1;
|
||||
private Object[] subs=null;
|
||||
private int numSubs = -1;
|
||||
private Object[] subs = null;
|
||||
|
||||
protected static final String NESTING_INDENT = " "; //$NON-NLS-1$
|
||||
|
||||
|
||||
/** SystemMesssage constructor
|
||||
* <p>Throws:
|
||||
* <li>IndicatorException: the indicator specified is not a valid indicator
|
||||
* @param comp: Component
|
||||
* @param sub: Subcomponent
|
||||
* @param ind: Indicator
|
||||
* @param number: message number
|
||||
* @param l1: Level 1 text
|
||||
* @param l2: Level 2 text
|
||||
* @param comp Component code. Usually a 3 letter component code like "RSE".
|
||||
* @param sub Subcomponent code. Usually a 1 letter subcomponent such as "F" for files
|
||||
* @param ind Message type indicator. See constants for values.
|
||||
* @param number a string that gives the 4 digit message number
|
||||
* @param l1 Level 1 text that describes the error
|
||||
* @param l2 Level 2 text that describes any recovery actions or further details
|
||||
* @throws IndicatorException if a message is attempted to be constructed with an invalid indicator.
|
||||
*/
|
||||
public SystemMessage(String comp, String sub, String number, char ind, String l1, String l2) throws IndicatorException {
|
||||
component=comp.toUpperCase();
|
||||
subComponent=sub.toUpperCase();
|
||||
messageNumber=number.toUpperCase();
|
||||
component = comp.toUpperCase();
|
||||
subComponent = sub.toUpperCase();
|
||||
messageNumber = number.toUpperCase();
|
||||
setIndicator(ind);
|
||||
level1NS=l1.trim();
|
||||
level2NS=l2.trim();
|
||||
level1WS=l1.trim();
|
||||
level2WS=l2.trim();
|
||||
|
||||
level1NS = l1.trim();
|
||||
level2NS = l2.trim();
|
||||
level1WS = l1.trim();
|
||||
level2WS = l2.trim();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to override the default severity of a message
|
||||
* Throws SeverityException if the severity is not valid
|
||||
* Use this method to override the default indicator of the message
|
||||
* @param ind the new indicator. See constants for values.
|
||||
* @throws IndicatorException if the indicator is not valid
|
||||
*/
|
||||
public void setIndicator(char ind) throws IndicatorException {
|
||||
// check that a valid indicator was specified
|
||||
if (ind != INQUIRY &&
|
||||
ind != INFORMATION &&
|
||||
ind != ERROR &&
|
||||
ind != WARNING &&
|
||||
ind != UNEXPECTED &&
|
||||
ind != COMPLETION)
|
||||
throw(new IndicatorException("Indicator specified not valid. Unable to set Indicator."));
|
||||
|
||||
// to do: decide if there are other indicator change violations....
|
||||
|
||||
// set indicator
|
||||
indicator=ind;
|
||||
if (ind != INQUIRY && ind != INFORMATION && ind != ERROR && ind != WARNING && ind != UNEXPECTED && ind != COMPLETION)
|
||||
throw (new IndicatorException("Indicator specified not valid. Unable to set Indicator."));
|
||||
indicator = ind;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to get the severity. Will be one of:
|
||||
* Use this method to get the message type indicator. Will be one of:
|
||||
* <ul>
|
||||
* <li>{@link #INQUIRY} for a question message.
|
||||
* <li>{@link #COMPLETION} for a completion message.
|
||||
|
@ -125,6 +108,7 @@ public class SystemMessage
|
|||
* <li>{@link #WARNING} for a warning message.
|
||||
* <li>{@link #UNEXPECTED} for an unexpected-situation-encountered message.
|
||||
* </ul>
|
||||
* @return the indicator for this message.
|
||||
**/
|
||||
public char getIndicator() {
|
||||
return indicator;
|
||||
|
@ -136,21 +120,21 @@ public class SystemMessage
|
|||
public String getMessageNumber() {
|
||||
return messageNumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the component of this message.
|
||||
*/
|
||||
public String getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the subcomponent of this message.
|
||||
*/
|
||||
public String getSubComponent() {
|
||||
return subComponent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to retrieve the unique number of substitution variables
|
||||
* in this message (this would include level 1 and 2 text
|
||||
|
@ -158,32 +142,28 @@ public class SystemMessage
|
|||
**/
|
||||
public int getNumSubstitutionVariables() {
|
||||
// see if we already have this information stored
|
||||
if (numSubs>=0)
|
||||
if (numSubs >= 0)
|
||||
return numSubs;
|
||||
// otherwise we need to count the substitution variables.
|
||||
else {
|
||||
numSubs=0; // initial value
|
||||
String allText=level1NS+" "+level2NS;
|
||||
String subVar=subPrefix+new Integer(numSubs+1).toString();
|
||||
int subLoc=allText.indexOf(subVar);
|
||||
while (subLoc>=0) {
|
||||
// in first position
|
||||
if ((subLoc==0 &&
|
||||
!Character.isDigit(allText.substring(subVar.length()).toCharArray()[0])) ||
|
||||
// in last position
|
||||
(subLoc==allText.length()-subVar.length() &&
|
||||
allText.substring(subLoc-1).toCharArray()[0]!=subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(allText.substring(subLoc+subVar.length()).toCharArray()[0]) &&
|
||||
allText.substring(subLoc-1).toCharArray()[0]!=subPrefix))
|
||||
numSubs++;
|
||||
subVar=subPrefix+new Integer(numSubs+1).toString();
|
||||
subLoc=allText.indexOf(subVar);
|
||||
numSubs = 0; // initial value
|
||||
String allText = level1NS + " " + level2NS;
|
||||
String subVar = subPrefix + new Integer(numSubs + 1).toString();
|
||||
int subLoc = allText.indexOf(subVar);
|
||||
while (subLoc >= 0) {
|
||||
// in first position
|
||||
if ((subLoc == 0 && !Character.isDigit(allText.substring(subVar.length()).toCharArray()[0])) ||
|
||||
// in last position
|
||||
(subLoc == allText.length() - subVar.length() && allText.substring(subLoc - 1).toCharArray()[0] != subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(allText.substring(subLoc + subVar.length()).toCharArray()[0]) && allText.substring(subLoc - 1).toCharArray()[0] != subPrefix)) numSubs++;
|
||||
subVar = subPrefix + new Integer(numSubs + 1).toString();
|
||||
subLoc = allText.indexOf(subVar);
|
||||
}
|
||||
return numSubs;
|
||||
return numSubs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to retrieve level one text
|
||||
* @return String - level one text with subsitutions made.
|
||||
|
@ -191,7 +171,7 @@ public class SystemMessage
|
|||
public String getLevelOneText() {
|
||||
return level1WS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to retrieve level two text
|
||||
* @return String - level two text with subsitutions made.
|
||||
|
@ -199,17 +179,16 @@ public class SystemMessage
|
|||
public String getLevelTwoText() {
|
||||
return level2WS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to retrieve the full message ID:
|
||||
* Component + SubComponent + Number + indicator
|
||||
* @return String - the full message ID
|
||||
**/
|
||||
public String getFullMessageID() {
|
||||
return component+subComponent+messageNumber+indicator;
|
||||
return component + subComponent + messageNumber + indicator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to retrieve 'long' message ID format:
|
||||
* Component + SubComponent + Number.
|
||||
|
@ -218,8 +197,8 @@ public class SystemMessage
|
|||
**/
|
||||
public String getLongMessageID() {
|
||||
return component + subComponent + messageNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to retrieve 'standard' message ID format:
|
||||
* Component + Number
|
||||
|
@ -227,8 +206,8 @@ public class SystemMessage
|
|||
**/
|
||||
public String getMessageID() {
|
||||
return component + messageNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if this message has a long id equal to the one supplied in the argument.
|
||||
* @param messageId the long message id to compare against.
|
||||
|
@ -241,90 +220,107 @@ public class SystemMessage
|
|||
/**
|
||||
* Use this method to set substitution value %1.
|
||||
* <br>Generally toString() is used on the substitution objects, but there is
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* @param sub1 the substitution object for the first value.
|
||||
* @return the SystemMessage being operated on.
|
||||
*/
|
||||
public SystemMessage makeSubstitution(Object sub1) {
|
||||
level1WS=level1NS;
|
||||
level2WS=level2NS;
|
||||
level1WS = level1NS;
|
||||
level2WS = level2NS;
|
||||
makeSub(1, sub1);
|
||||
// save subs
|
||||
subs=new Object[1];
|
||||
subs[0]=sub1;
|
||||
subs = new Object[1];
|
||||
subs[0] = sub1;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to set substitution value %1 %2
|
||||
* <br>Generally toString() is used on the substitution objects, but there is
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* @param sub1 the substitution object for the first value.
|
||||
* @param sub2 the substitution object for the second value.
|
||||
* @return the SystemMessage being operated on.
|
||||
*/
|
||||
public SystemMessage makeSubstitution(Object sub1, Object sub2) {
|
||||
level1WS=level1NS;
|
||||
level2WS=level2NS;
|
||||
level1WS = level1NS;
|
||||
level2WS = level2NS;
|
||||
makeSub(1, sub1);
|
||||
makeSub(2, sub2);
|
||||
// save subs
|
||||
subs=new Object[2];
|
||||
subs[0]=sub1;
|
||||
subs[1]=sub2;
|
||||
subs = new Object[2];
|
||||
subs[0] = sub1;
|
||||
subs[1] = sub2;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to set substitution value %1 %2 %3
|
||||
* <br>Generally toString() is used on the substitution objects, but there is
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* @param sub1 the substitution object for the first value.
|
||||
* @param sub2 the substitution object for the second value.
|
||||
* @param sub3 the substitution object for the third value.
|
||||
* @return the SystemMessage being operated on.
|
||||
*/
|
||||
public SystemMessage makeSubstitution(Object sub1, Object sub2, Object sub3) {
|
||||
level1WS=level1NS;
|
||||
level2WS=level2NS;
|
||||
level1WS = level1NS;
|
||||
level2WS = level2NS;
|
||||
makeSub(1, sub1);
|
||||
makeSub(2, sub2);
|
||||
makeSub(3, sub3);
|
||||
// save subs
|
||||
subs=new Object[3];
|
||||
subs[0]=sub1;
|
||||
subs[1]=sub2;
|
||||
subs[2]=sub3;
|
||||
subs = new Object[3];
|
||||
subs[0] = sub1;
|
||||
subs[1] = sub2;
|
||||
subs[2] = sub3;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to set substitution value %1 %2 %3 %4
|
||||
* <br>Generally toString() is used on the substitution objects, but there is
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* @param sub1 the substitution object for the first value.
|
||||
* @param sub2 the substitution object for the second value.
|
||||
* @param sub3 the substitution object for the third value.
|
||||
* @param sub4 the substitution object for the fourth value.
|
||||
* @return the SystemMessage being operated on.
|
||||
*/
|
||||
public SystemMessage makeSubstitution(Object sub1, Object sub2, Object sub3, Object sub4) {
|
||||
level1WS=level1NS;
|
||||
level2WS=level2NS;
|
||||
level1WS = level1NS;
|
||||
level2WS = level2NS;
|
||||
makeSub(1, sub1);
|
||||
makeSub(2, sub2);
|
||||
makeSub(3, sub3);
|
||||
makeSub(4, sub4);
|
||||
// save subs
|
||||
subs=new Object[4];
|
||||
subs[0]=sub1;
|
||||
subs[1]=sub2;
|
||||
subs[2]=sub3;
|
||||
subs[3]=sub4;
|
||||
subs = new Object[4];
|
||||
subs[0] = sub1;
|
||||
subs[1] = sub2;
|
||||
subs[2] = sub3;
|
||||
subs[3] = sub4;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use this method to set substitution values
|
||||
* <br>Generally toString() is used on the substitution objects, but there is
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* special case handling for exception objects and IStatus objects.
|
||||
* @param subsList the array of substitution objects
|
||||
* @return the SystemMessage being operated on.
|
||||
*/
|
||||
public SystemMessage makeSubstitution(Object [] subsList)
|
||||
{
|
||||
level1WS=level1NS;
|
||||
level2WS=level2NS;
|
||||
|
||||
if ((subsList!=null) && (subsList.length>0))
|
||||
for (int i=0; i<subsList.length; i++)
|
||||
makeSub(i+1, subsList[i]);
|
||||
public SystemMessage makeSubstitution(Object[] subsList) {
|
||||
level1WS = level1NS;
|
||||
level2WS = level2NS;
|
||||
|
||||
if ((subsList != null) && (subsList.length > 0)) for (int i = 0; i < subsList.length; i++)
|
||||
makeSub(i + 1, subsList[i]);
|
||||
// save subs
|
||||
subs=subsList;
|
||||
subs = subsList;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* retrieves an array of substitution variables
|
||||
* @return Object[] array of substitution variables used
|
||||
|
@ -332,130 +328,107 @@ public class SystemMessage
|
|||
public Object[] getSubVariables() {
|
||||
return subs;
|
||||
}
|
||||
|
||||
/**
|
||||
* private method to make a substitution
|
||||
*/
|
||||
private void makeSub(int subNumber, Object sub)
|
||||
{
|
||||
if (sub == null)
|
||||
return;
|
||||
private void makeSub(int subNumber, Object sub) {
|
||||
if (sub == null) return;
|
||||
|
||||
String subValue = getSubValue(sub);
|
||||
|
||||
// check that substitution is needed
|
||||
if (subNumber>getNumSubstitutionVariables())
|
||||
return;
|
||||
|
||||
String subVar=subPrefix+new Integer(subNumber).toString();
|
||||
// check that substitution is needed
|
||||
if (subNumber > getNumSubstitutionVariables()) return;
|
||||
|
||||
String subVar = subPrefix + new Integer(subNumber).toString();
|
||||
int subLoc = -1;
|
||||
|
||||
|
||||
// set level 1
|
||||
// - quick test added by Phil
|
||||
if (level1WS.equals(subVar))
|
||||
level1WS = subValue;
|
||||
else
|
||||
{
|
||||
subLoc=level1WS.indexOf(subVar);
|
||||
|
||||
// FIXES BY PHIL
|
||||
// 1.
|
||||
// in the following code we were doing toCharArray only to index and get the first char.
|
||||
// this is not required! there is a charAt method in String for this. Phil. EG:
|
||||
//!Character.isDigit(level1WS.substring(subVar.length()).toCharArray()[0])) ||
|
||||
|
||||
// 2. compared subLoc to gt zero, vs gte zero
|
||||
// 3. fixing that exposed a bug for the case when level one or two is only '%1'
|
||||
//
|
||||
// This code is hard to read and maintain and should be fixed up someday.
|
||||
// -- why do we check if the next or previous char is a digit? For double digit sub vars like %11?
|
||||
|
||||
//while (subLoc>0) fixed. phil
|
||||
while (subLoc>=0)
|
||||
{
|
||||
// in first position
|
||||
if ((subLoc==0 &&
|
||||
!Character.isDigit(level1WS.substring(subVar.length()).charAt(0))) ||
|
||||
// in last position
|
||||
(subLoc==level1WS.length()-subVar.length() &&
|
||||
level1WS.substring(subLoc-1).charAt(0)!=subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(level1WS.substring(subLoc+subVar.length()).charAt(0)) &&
|
||||
level1WS.substring(subLoc-1).charAt(0)!=subPrefix))
|
||||
level1WS=level1WS.substring(0,subLoc)+subValue+level1WS.substring(subLoc+subVar.length());
|
||||
subLoc=level1WS.indexOf(subVar, subLoc + subValue.length() );
|
||||
}
|
||||
level1WS = subValue;
|
||||
else {
|
||||
subLoc = level1WS.indexOf(subVar);
|
||||
|
||||
// FIXES BY PHIL
|
||||
// 1.
|
||||
// in the following code we were doing toCharArray only to index and get the first char.
|
||||
// this is not required! there is a charAt method in String for this. Phil. EG:
|
||||
//!Character.isDigit(level1WS.substring(subVar.length()).toCharArray()[0])) ||
|
||||
|
||||
// 2. compared subLoc to gt zero, vs gte zero
|
||||
// 3. fixing that exposed a bug for the case when level one or two is only '%1'
|
||||
//
|
||||
// This code is hard to read and maintain and should be fixed up someday.
|
||||
// -- why do we check if the next or previous char is a digit? For double digit sub vars like %11?
|
||||
|
||||
//while (subLoc>0) fixed. phil
|
||||
while (subLoc >= 0) {
|
||||
// in first position
|
||||
if ((subLoc == 0 && !Character.isDigit(level1WS.substring(subVar.length()).charAt(0))) ||
|
||||
// in last position
|
||||
(subLoc == level1WS.length() - subVar.length() && level1WS.substring(subLoc - 1).charAt(0) != subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(level1WS.substring(subLoc + subVar.length()).charAt(0)) && level1WS.substring(subLoc - 1).charAt(0) != subPrefix))
|
||||
level1WS = level1WS.substring(0, subLoc) + subValue + level1WS.substring(subLoc + subVar.length());
|
||||
subLoc = level1WS.indexOf(subVar, subLoc + subValue.length());
|
||||
}
|
||||
}
|
||||
// set level 2
|
||||
// - quick test added by Phil
|
||||
if (level2WS.equals(subVar))
|
||||
level2WS = subValue;
|
||||
else
|
||||
{
|
||||
subLoc=level2WS.indexOf(subVar);
|
||||
//while (subLoc>0) fixed. phil
|
||||
while (subLoc>=0)
|
||||
{
|
||||
// in first position
|
||||
if ((subLoc==0 &&
|
||||
//!Character.isDigit(level2WS.substring(subVar.length()).charAt(0))) ||
|
||||
!Character.isDigit(level2WS.charAt(subVar.length()))) ||
|
||||
// in last position
|
||||
(subLoc==level2WS.length()-subVar.length() &&
|
||||
level2WS.substring(subLoc-1).charAt(0)!=subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(level2WS.substring(subLoc+subVar.length()).charAt(0)) &&
|
||||
level2WS.substring(subLoc-1).charAt(0)!=subPrefix))
|
||||
level2WS=level2WS.substring(0,subLoc)+subValue+level2WS.substring(subLoc+subVar.length());
|
||||
subLoc=level2WS.indexOf(subVar, subLoc + subValue.length() );
|
||||
}
|
||||
level2WS = subValue;
|
||||
else {
|
||||
subLoc = level2WS.indexOf(subVar);
|
||||
//while (subLoc>0) fixed. phil
|
||||
while (subLoc >= 0) {
|
||||
// in first position
|
||||
if ((subLoc == 0 &&
|
||||
//!Character.isDigit(level2WS.substring(subVar.length()).charAt(0))) ||
|
||||
!Character.isDigit(level2WS.charAt(subVar.length())))
|
||||
||
|
||||
// in last position
|
||||
(subLoc == level2WS.length() - subVar.length() && level2WS.substring(subLoc - 1).charAt(0) != subPrefix) ||
|
||||
// somewhere in the middle
|
||||
(!Character.isDigit(level2WS.substring(subLoc + subVar.length()).charAt(0)) && level2WS.substring(subLoc - 1).charAt(0) != subPrefix))
|
||||
level2WS = level2WS.substring(0, subLoc) + subValue + level2WS.substring(subLoc + subVar.length());
|
||||
subLoc = level2WS.indexOf(subVar, subLoc + subValue.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setPrefixChar(char prefixChar) {
|
||||
}
|
||||
|
||||
public void setPrefixChar(char prefixChar) {
|
||||
subPrefix = prefixChar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Do message variable substitution. Using you are replacing &1 (say) with
|
||||
* a string.
|
||||
* Still need this for non-message substitution capability. Phil.
|
||||
* @param string - string containing substring to be substituted.
|
||||
* Replace a string with another string throughout a target string.
|
||||
* @param target - string containing substring to be substituted.
|
||||
* @param subOld - substitution variable. Eg "%1"
|
||||
* @param subNew - substitution data. Eg "001"
|
||||
* @return message with all occurrences of subOld substituted with subNew.
|
||||
*/
|
||||
public static String sub(String msg, String subOld, String subNew)
|
||||
{
|
||||
public static String sub(String target, String subOld, String subNew) {
|
||||
StringBuffer temp = new StringBuffer();
|
||||
int lastHit = 0;
|
||||
int newHit = 0;
|
||||
for (newHit = msg.indexOf(subOld,lastHit); newHit != -1;
|
||||
lastHit = newHit, newHit = msg.indexOf(subOld,lastHit))
|
||||
{
|
||||
if (newHit >= 0)
|
||||
temp.append(msg.substring(lastHit,newHit));
|
||||
temp.append(subNew);
|
||||
newHit += subOld.length();
|
||||
}
|
||||
if (lastHit >= 0)
|
||||
temp.append(msg.substring(lastHit));
|
||||
for (newHit = target.indexOf(subOld, lastHit); newHit != -1; lastHit = newHit, newHit = target.indexOf(subOld, lastHit)) {
|
||||
if (newHit >= 0) temp.append(target.substring(lastHit, newHit));
|
||||
temp.append(subNew);
|
||||
newHit += subOld.length();
|
||||
}
|
||||
if (lastHit >= 0) temp.append(target.substring(lastHit));
|
||||
return temp.toString();
|
||||
}
|
||||
|
||||
// Housekeeping...
|
||||
|
||||
/**
|
||||
* Convert this message to a string.
|
||||
* Returns string of the form: msgId + severity + ":" + first-level-text
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return getFullMessageID() + ": " + getLevelOneText();
|
||||
public String toString() {
|
||||
return getFullMessageID() + ": " + getLevelOneText();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* used to determine the string value of the object
|
||||
* it calls toString for all object types except for Exceptions
|
||||
|
@ -463,48 +436,42 @@ public class SystemMessage
|
|||
* @param sub the substitution object
|
||||
* @return the string value for the object
|
||||
*/
|
||||
public String getSubValue(Object sub)
|
||||
{
|
||||
|
||||
public String getSubValue(Object sub) {
|
||||
|
||||
// the following code caused a crash so I changed it. Phil.
|
||||
/*
|
||||
Class subClass=sub.getClass();
|
||||
// loop through all the classes for the object
|
||||
try {
|
||||
while (subClass!=null) {
|
||||
if (subClass.equals(Class.forName("Exception"))) {
|
||||
Exception exc=(Exception)sub;
|
||||
StringWriter excWriter = new StringWriter();
|
||||
exc.printStackTrace(new PrintWriter(excWriter));
|
||||
return exc.toString()+"\n"+ excWriter.toString();
|
||||
}
|
||||
subClass=subClass.getSuperclass();
|
||||
}
|
||||
Class subClass=sub.getClass();
|
||||
// loop through all the classes for the object
|
||||
try {
|
||||
while (subClass!=null) {
|
||||
if (subClass.equals(Class.forName("Exception"))) {
|
||||
Exception exc=(Exception)sub;
|
||||
StringWriter excWriter = new StringWriter();
|
||||
exc.printStackTrace(new PrintWriter(excWriter));
|
||||
return exc.toString()+"\n"+ excWriter.toString();
|
||||
}
|
||||
subClass=subClass.getSuperclass();
|
||||
}
|
||||
}
|
||||
catch(ClassNotFoundException e) {
|
||||
// class was not found
|
||||
SystemBasePlugin.logError("SystemMessge: getSubValue (Class not found) "+e.toString(), e);
|
||||
}
|
||||
*/
|
||||
|
||||
if (sub == null) return "";
|
||||
|
||||
if (sub instanceof Exception) {
|
||||
Exception exc = (Exception) sub;
|
||||
StringWriter excWriter = new StringWriter();
|
||||
exc.printStackTrace(new PrintWriter(excWriter));
|
||||
String msg = exc.toString();
|
||||
//String msg = exc.getMessage();
|
||||
if ((msg == null) || (exc instanceof ClassCastException)) msg = exc.getClass().getName();
|
||||
return msg + "\n" + excWriter.toString();
|
||||
}
|
||||
catch(ClassNotFoundException e) {
|
||||
// class was not found
|
||||
SystemBasePlugin.logError("SystemMessge: getSubValue (Class not found) "+e.toString(), e);
|
||||
}
|
||||
*/
|
||||
|
||||
if (sub == null)
|
||||
return "";
|
||||
|
||||
if (sub instanceof Exception)
|
||||
{
|
||||
Exception exc=(Exception)sub;
|
||||
StringWriter excWriter = new StringWriter();
|
||||
exc.printStackTrace(new PrintWriter(excWriter));
|
||||
String msg = exc.toString();
|
||||
//String msg = exc.getMessage();
|
||||
if ((msg == null) || (exc instanceof ClassCastException))
|
||||
msg = exc.getClass().getName();
|
||||
return msg+"\n"+ excWriter.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return sub.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,10 +20,13 @@ package org.eclipse.rse.services.clientserver.messages;
|
|||
*/
|
||||
public class SystemMessageException extends Exception
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 6695260563678942200L;
|
||||
private static final long serialVersionUID = 6695260563678942200L;
|
||||
private SystemMessage msg;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +49,7 @@ public class SystemMessageException extends Exception
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the SystemMessage we wrap
|
||||
* @return the SystemMessage wrapped by this SystemMessageException
|
||||
*/
|
||||
public SystemMessage getSystemMessage()
|
||||
{
|
||||
|
@ -65,6 +68,7 @@ public class SystemMessageException extends Exception
|
|||
|
||||
/**
|
||||
* Set the SystemMessage being wrapped
|
||||
* @param msg the SystemMessage wrapped by this SystemMessageException
|
||||
*/
|
||||
public void setSystemMessage(SystemMessage msg)
|
||||
{
|
||||
|
|
|
@ -109,7 +109,10 @@ public class SystemMessageFile implements ErrorHandler
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param messageFileName - name of xml file which will contain the messages
|
||||
* @param messageFileName - a key used to determine if a message file has already been loaded.
|
||||
* Usually the name of the xml file containing the message file.
|
||||
* @param messageFile the stream containing the message file.
|
||||
* @param dtdStream the stream containing the dtd for this message file.
|
||||
*/
|
||||
public SystemMessageFile (String messageFileName, InputStream messageFile, InputStream dtdStream)
|
||||
{
|
||||
|
@ -131,7 +134,7 @@ public class SystemMessageFile implements ErrorHandler
|
|||
* If the named message file has already been loaded return its
|
||||
* MessageFileInfo
|
||||
* @param messageFileName
|
||||
* @return
|
||||
* @return the MessageFileInfo for this message file
|
||||
*/
|
||||
protected MessageFileInfo getFromCache(String messageFileName)
|
||||
{
|
||||
|
@ -305,14 +308,15 @@ public class SystemMessageFile implements ErrorHandler
|
|||
|
||||
/**
|
||||
* Override this to provide different extended SystemMessage implementation
|
||||
* @param componentAbbr
|
||||
* @param subComponentAbbr
|
||||
* @param msgNumber
|
||||
* @param msgIndicator
|
||||
* @param msgL1
|
||||
* @param msgL2
|
||||
* @return
|
||||
* @throws IndicatorException
|
||||
* @param componentAbbr a three letter component name
|
||||
* @param subComponentAbbr a one letter subcomponent name
|
||||
* @param msgNumber a four digit message number
|
||||
* @param msgIndicator a single character message type indicator
|
||||
* @param msgL1 the first level text that describes the error
|
||||
* @param msgL2 the second level text that provides details about the error and possible recovery
|
||||
* @return the SystemMessage
|
||||
* @throws IndicatorException if the message type indicator is invalid.
|
||||
* @see SystemMessage for message type indicator constants
|
||||
*/
|
||||
protected SystemMessage loadSystemMessage(String componentAbbr, String subComponentAbbr, String msgNumber, char msgIndicator,
|
||||
String msgL1, String msgL2) throws IndicatorException
|
||||
|
@ -406,7 +410,7 @@ public class SystemMessageFile implements ErrorHandler
|
|||
/**
|
||||
* Use this method to generate html documentation for the messages in the message file.
|
||||
* This is useful for reference information, or to give to Level 2 for service support.
|
||||
* @param htmlFile - the fully qualified name of the file to write to. Overwrites current contents.
|
||||
* @param fullFileName - the fully qualified name of the file to write to. Overwrites current contents.
|
||||
* @return true if it went well, false if it failed for some reason, such as given a bad file name. Errors written to standard out.
|
||||
*/
|
||||
public boolean printHTML(String fullFileName)
|
||||
|
@ -566,51 +570,6 @@ public class SystemMessageFile implements ErrorHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* loadAndParseXMLFile:
|
||||
* tries to load and parse the specified XML file.
|
||||
* @param String messageFileName: name of xml file which will contain the messages
|
||||
*/
|
||||
private Document loadAndParseXMLFile (String messageFileName)
|
||||
{
|
||||
DocumentBuilder parser = createXmlParser();
|
||||
|
||||
try
|
||||
{
|
||||
Document document = parser.parse(messageFileName);
|
||||
return document;
|
||||
}
|
||||
catch (SAXException e)
|
||||
{
|
||||
// the parser was unable to parse the file.
|
||||
/** TODO - DKM move this somewhere else since system message now needs to be eclipse independent
|
||||
SystemBasePlugin.logError("SystemMessageFile: loadAndParseXMLFile "+e.toString(), e);
|
||||
|
||||
MessageBox mb = new MessageBox(SystemPlugin.getActiveWorkbenchShell());
|
||||
mb.setText("Unexpected Error");
|
||||
mb.setMessage("Unable to load message file " + messageFileName );
|
||||
mb.open();
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
/** TODO - DKM move this somewhere else since system message now needs to be eclipse independent
|
||||
// there was an error reading the file
|
||||
SystemBasePlugin.logError("SystemMessageFile: loadAndParseXMLFile "+e.toString(), e);
|
||||
|
||||
MessageBox mb = new MessageBox(SystemPlugin.getActiveWorkbenchShell());
|
||||
mb.setText("Unexpected Error");
|
||||
mb.setMessage("Unable to load message file " + messageFileName );
|
||||
mb.open();
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
// the file was successfully opened and parsed
|
||||
// return parser.getDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the XML parser
|
||||
* Set its entity resolver and error handler.
|
||||
|
|
|
@ -43,18 +43,22 @@ public interface IFileService extends IService
|
|||
/**
|
||||
* Copy a file to the remote file system. The remote target is denoted by a
|
||||
* string representing the parent and a string representing the file.
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param stream input stream to transfer
|
||||
* @param remoteParent - a string designating the parent folder of the target for this file.
|
||||
* @param remoteFile - a string designating the name of the file to be written on the remote system.
|
||||
* @param isBinary - indicates whether the file is text or binary
|
||||
* @param hostEncoding - the tgt encoding of the file (if text)
|
||||
* @return true if the file was uploaded
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean upload(IProgressMonitor monitor, InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy a file to the remote file system. The remote target is denoted by a
|
||||
* string representing the parent and a string representing the file.
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param localFile - a real file in the local file system.
|
||||
* @param remoteParent - a string designating the parent folder of the target for this file.
|
||||
* @param remoteFile - a string designating the name of the file to be written on the remote system.
|
||||
|
@ -62,11 +66,14 @@ public interface IFileService extends IService
|
|||
* @param srcEncoding - the src encoding of the file (if text)
|
||||
* @param hostEncoding - the tgt encoding of the file (if text)
|
||||
* @return true if the file was uploaded
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean upload(IProgressMonitor monitor, File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Copy a file from the remote file system to the local system.
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent - a String designating the remote parent.
|
||||
* @param remoteFile - a String designating the remote file residing in the parent.
|
||||
* @param localFile - The file that is to be written. If the file exists it is
|
||||
|
@ -74,51 +81,66 @@ public interface IFileService extends IService
|
|||
* @param isBinary - indicates whether the file is text on binary
|
||||
* @param hostEncoding - the encoding on the host (if text)
|
||||
* @return true if the file was copied from the remote system.
|
||||
* @throws SystemMessageException
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean download(IProgressMonitor monitor, String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Return the host file given the parent path and file name
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent
|
||||
* @param name
|
||||
* @return
|
||||
* @return the host file given the parent path and file name
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile getFile(IProgressMonitor monitor, String remoteParent, String name) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent - the name of the parent directory on the remote file
|
||||
* system from which to retrieve the child list.
|
||||
* @param fileFilter - a string that can be used to filter the children. Only
|
||||
* those files matching the filter make it into the list. The interface
|
||||
* does not dictate where the filtering occurs.
|
||||
* @return the list of host files.
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile[] getFilesAndFolders(IProgressMonitor monitor, String remoteParent, String fileFilter) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent - the name of the parent directory on the remote file
|
||||
* system from which to retrieve the child list.
|
||||
* @param fileFilter - a string that can be used to filter the children. Only
|
||||
* those files matching the filter make it into the list. The interface
|
||||
* does not dictate where the filtering occurs.
|
||||
* @return the list of host files.
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile[] getFiles(IProgressMonitor monitor, String remoteParent, String fileFilter) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent - the name of the parent directory on the remote file
|
||||
* system from which to retrieve the child list.
|
||||
* @param fileFilter - a string that can be used to filter the children. Only
|
||||
* those files matching the filter make it into the list. The interface
|
||||
* does not dictate where the filtering occurs.
|
||||
* @return the list of host files.
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile[] getFolders(IProgressMonitor monitor, String remoteParent, String fileFilter) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* Return the list of roots for this system
|
||||
* @return the list of host files.
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException;
|
||||
|
||||
|
@ -130,10 +152,12 @@ public interface IFileService extends IService
|
|||
|
||||
/**
|
||||
* Create a file on the host
|
||||
* @param monitor the progress monitor
|
||||
* @param monitor the monitor for this potentially long running operation
|
||||
* @param remoteParent the parent directory
|
||||
* @param fileName the name of the new file
|
||||
* @return the newly created file
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile createFile(IProgressMonitor monitor, String remoteParent, String fileName) throws SystemMessageException;
|
||||
|
||||
|
@ -143,6 +167,8 @@ public interface IFileService extends IService
|
|||
* @param remoteParent the parent directory
|
||||
* @param folderName the name of the new folder
|
||||
* @return the newly created folder
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public IHostFile createFolder(IProgressMonitor monitor, String remoteParent, String folderName) throws SystemMessageException;
|
||||
|
||||
|
@ -152,6 +178,8 @@ public interface IFileService extends IService
|
|||
* @param remoteParent the folder containing the file to delete
|
||||
* @param fileName the name of the file or folder to delete
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean delete(IProgressMonitor monitor, String remoteParent, String fileName) throws SystemMessageException;
|
||||
|
||||
|
@ -161,6 +189,8 @@ public interface IFileService extends IService
|
|||
* @param remoteParents the array of folders containing the files to delete
|
||||
* @param fileNames the names of the files or folders to delete
|
||||
* @return true iff all deletes are successful
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean deleteBatch(IProgressMonitor monitor, String[] remoteParents, String[] fileNames) throws SystemMessageException;
|
||||
|
||||
|
@ -171,6 +201,8 @@ public interface IFileService extends IService
|
|||
* @param oldName the old name of the file or folder to rename
|
||||
* @param newName the new name for the file
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName) throws SystemMessageException;
|
||||
|
||||
|
@ -182,6 +214,8 @@ public interface IFileService extends IService
|
|||
* @param newName the new name for the file
|
||||
* @param oldFile the file to update with the change
|
||||
* @return true if successful
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean rename(IProgressMonitor monitor, String remoteParent, String oldName, String newName, IHostFile oldFile) throws SystemMessageException;
|
||||
|
||||
|
@ -192,7 +226,9 @@ public interface IFileService extends IService
|
|||
* @param srcName the new of the file or folder to move
|
||||
* @param tgtParent the destination folder for the move
|
||||
* @param tgtName the name of the moved file or folder
|
||||
* @return
|
||||
* @return true if the file was moved
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean move(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName) throws SystemMessageException;
|
||||
|
||||
|
@ -203,7 +239,9 @@ public interface IFileService extends IService
|
|||
* @param srcName the new of the file or folder to copy
|
||||
* @param tgtParent the destination folder for the copy
|
||||
* @param tgtName the name of the copied file or folder
|
||||
* @return
|
||||
* @return true if the file was copied successfully
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean copy(IProgressMonitor monitor, String srcParent, String srcName, String tgtParent, String tgtName) throws SystemMessageException;
|
||||
|
||||
|
@ -213,13 +251,15 @@ public interface IFileService extends IService
|
|||
* @param srcParents the folders containing each file or folder to copy
|
||||
* @param srcNames the names of the files or folders to copy
|
||||
* @param tgtParent the destination folder for the copy
|
||||
* @return
|
||||
* @return true if all files were copied
|
||||
* @throws SystemMessageException if an error occurs.
|
||||
* Typically this would be one of those in the RemoteFileException family.
|
||||
*/
|
||||
public boolean copyBatch(IProgressMonitor monitor, String[] srcParents, String[] srcNames, String tgtParent) throws SystemMessageException;
|
||||
|
||||
/**
|
||||
* Indicates whether the file system is case sensitive
|
||||
* @return
|
||||
* @return true if the file system has case sensitive file names
|
||||
*/
|
||||
public boolean isCaseSensitive();
|
||||
}
|
|
@ -14,11 +14,11 @@
|
|||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.core.subsystems;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
package org.eclipse.rse.services.files;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.IndicatorException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting an operation and it fails for IO reasons, such as
|
||||
|
@ -27,14 +27,40 @@ import org.eclipse.rse.ui.RSEUIPlugin;
|
|||
* The original remote system's io message is always embedded and retrievable
|
||||
* via getRemoteException().
|
||||
*/
|
||||
public class RemoteFileCancelledException extends RemoteFileIOException
|
||||
{
|
||||
public class RemoteFileCancelledException extends RemoteFileIOException {
|
||||
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static SystemMessage myMessage = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public RemoteFileCancelledException()
|
||||
{
|
||||
super(new SystemMessageException(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED)));
|
||||
public RemoteFileCancelledException() {
|
||||
super(new SystemMessageException(getMyMessage()));
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO dwd update this to retrieve the new messages when those are created
|
||||
* myMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED);
|
||||
* public static final String MSG_OPERATION_CANCELLED = "RSEG1067";
|
||||
* <Message ID="1067" Indicator="E">
|
||||
* <LevelOne>Operation cancelled.</LevelOne>
|
||||
* <LevelTwo></LevelTwo>
|
||||
* </Message>
|
||||
*/
|
||||
private static SystemMessage getMyMessage() {
|
||||
String l1 = "Operation cancelled.";
|
||||
String l2 = "";
|
||||
try {
|
||||
myMessage = new SystemMessage("RSE", "G", "1067", SystemMessage.ERROR, l1, l2);
|
||||
} catch (IndicatorException e) {
|
||||
}
|
||||
return myMessage;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.core.subsystems;
|
||||
package org.eclipse.rse.services.files;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
@ -34,6 +34,12 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
|||
*/
|
||||
public class RemoteFileException extends SystemMessageException
|
||||
{
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Exception wrappedException = null;
|
||||
|
||||
/**
|
||||
|
@ -96,7 +102,7 @@ public class RemoteFileException extends SystemMessageException
|
|||
wrappedException = remoteException;
|
||||
}
|
||||
/**
|
||||
* Return the wrapped exception
|
||||
* @return the original remote exception
|
||||
*/
|
||||
public Exception getRemoteException()
|
||||
{
|
|
@ -0,0 +1,71 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.files;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.IndicatorException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting an operation and it fails for IO reasons, such as
|
||||
* the file is read-only.
|
||||
* <p>
|
||||
* The original remote system's io message is always embedded and retrievable
|
||||
* via getRemoteException().
|
||||
*/
|
||||
public class RemoteFileIOException extends RemoteFileException {
|
||||
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static SystemMessage myMessage = null;
|
||||
|
||||
/**
|
||||
* Constructor for RemoteFileIOException
|
||||
* @param remoteException the initial cause of this exception
|
||||
*/
|
||||
public RemoteFileIOException(Exception remoteException) {
|
||||
super(getMyMessage(), remoteException);
|
||||
String secondLevel = remoteException.getMessage();
|
||||
if (secondLevel == null) {
|
||||
secondLevel = remoteException.getClass().getName();
|
||||
}
|
||||
getSystemMessage().makeSubstitution(secondLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO dwd update this to retrieve the new messages when those are created
|
||||
* myMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_IO_ERROR);
|
||||
* public static final String FILEMSG_IO_ERROR = "RSEF1002";
|
||||
* <Message ID="1002" Indicator="E">
|
||||
* <LevelOne>Operation failed. File system input or output error</LevelOne>
|
||||
* <LevelTwo>Message reported from file system: %1</LevelTwo>
|
||||
* </Message>
|
||||
*/
|
||||
private static SystemMessage getMyMessage() {
|
||||
String l1 = "Operation failed. File system input or output error";
|
||||
String l2 = "Message reported from file system: %1";
|
||||
try {
|
||||
myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2);
|
||||
} catch (IndicatorException e) {
|
||||
}
|
||||
return myMessage;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.files;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.IndicatorException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting an operation and it fails for security reasons.
|
||||
* The original remote system's security message is always embedded and retrievable
|
||||
* via getRemoteException().
|
||||
*/
|
||||
public class RemoteFileSecurityException extends RemoteFileException {
|
||||
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static SystemMessage myMessage = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param remoteException the original cause of this exception.
|
||||
*/
|
||||
public RemoteFileSecurityException(Exception remoteException) {
|
||||
super(getMyMessage(), remoteException);
|
||||
String secondLevel = remoteException.getMessage();
|
||||
if (secondLevel == null) {
|
||||
secondLevel = remoteException.getClass().getName();
|
||||
}
|
||||
getSystemMessage().makeSubstitution(secondLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO dwd update this to retrieve the new messages when those are created
|
||||
* super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_SECURITY_ERROR), remoteException);
|
||||
* public static final String FILEMSG_SECURITY_ERROR = "RSEF1001";
|
||||
* <Message ID="1001" Indicator="E">
|
||||
* <LevelOne>Operation failed. Security violation</LevelOne>
|
||||
* <LevelTwo>Message reported from file system: %1</LevelTwo>
|
||||
* </Message>
|
||||
*/
|
||||
private static SystemMessage getMyMessage() {
|
||||
if (myMessage == null) {
|
||||
String l1 = "Operation failed. File system input or output error";
|
||||
String l2 = "Message reported from file system: %1";
|
||||
try {
|
||||
myMessage = new SystemMessage("RSE", "F", "1002", SystemMessage.ERROR, l1, l2);
|
||||
} catch (IndicatorException e) {
|
||||
}
|
||||
}
|
||||
return myMessage;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.services.files;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.IndicatorException;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting to delete a folder, and the folder is not empty.
|
||||
*/
|
||||
public class RemoteFolderNotEmptyException extends RemoteFileException {
|
||||
|
||||
/**
|
||||
* A serialVersionUID is recommended for all serializable classes.
|
||||
* This trait is inherited from Throwable.
|
||||
* This should be updated if there is a schema change for this class.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static SystemMessage myMessage = null;
|
||||
|
||||
/**
|
||||
* Constructor for RemoteFolderNotEmptyException when there is no remote exception to wrap
|
||||
*/
|
||||
public RemoteFolderNotEmptyException() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for RemoteFolderNotEmptyException when there is a remote exception to wrap
|
||||
* @param remoteException the exception that caused this one to be constructed.
|
||||
*/
|
||||
public RemoteFolderNotEmptyException(Exception remoteException) {
|
||||
super(getMyMessage(), remoteException);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO dwd update this to retrieve the new messages when those are created
|
||||
* super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTEMPTY), remoteException);
|
||||
* public static final String FILEMSG_FOLDER_NOTEMPTY = "RSEF1003";
|
||||
* <Message ID="1003" Indicator="E">
|
||||
* <LevelOne>Folder is not empty. Cannot delete</LevelOne>
|
||||
* <LevelTwo>The operation failed. One possible reason is that the folder is not empty</LevelTwo>
|
||||
* </Message>
|
||||
*/
|
||||
private static SystemMessage getMyMessage() {
|
||||
if (myMessage == null) {
|
||||
String l1 = "Folder is not empty. Cannot delete";
|
||||
String l2 = "The operation failed. One possible reason is that the folder is not empty";
|
||||
try {
|
||||
myMessage = new SystemMessage("RSE", "F", "1003", SystemMessage.ERROR, l1, l2);
|
||||
} catch (IndicatorException e) {
|
||||
}
|
||||
}
|
||||
return myMessage;
|
||||
}
|
||||
|
||||
}
|
|
@ -35,6 +35,9 @@ import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
|||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.IFileService;
|
||||
import org.eclipse.rse.services.files.IHostFile;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultSet;
|
||||
import org.eclipse.rse.services.search.ISearchService;
|
||||
|
@ -42,10 +45,7 @@ import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistr
|
|||
import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileIOException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFolderNotEmptyException;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
|||
import org.eclipse.rse.internal.subsystems.files.core.ILanguageUtilityFactory;
|
||||
import org.eclipse.rse.model.SystemRemoteResourceSet;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
|
||||
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.core.subsystems;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting an operation and it fails for IO reasons, such as
|
||||
* the file is read-only.
|
||||
* <p>
|
||||
* The original remote system's io message is always embedded and retrievable
|
||||
* via getRemoteException().
|
||||
*/
|
||||
public class RemoteFileIOException extends RemoteFileException
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public RemoteFileIOException(Exception remoteException)
|
||||
{
|
||||
super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_IO_ERROR), remoteException);
|
||||
String secondLevel = remoteException.getMessage();
|
||||
if (secondLevel == null)
|
||||
secondLevel = remoteException.getClass().getName();
|
||||
getSystemMessage().makeSubstitution(secondLevel);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.core.subsystems;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting an operation and it fails for security reasons.
|
||||
* The original remote system's security message is always embedded and retrievable
|
||||
* via getRemoteException().
|
||||
*/
|
||||
public class RemoteFileSecurityException extends RemoteFileException
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public RemoteFileSecurityException(Exception remoteException)
|
||||
{
|
||||
super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_SECURITY_ERROR), remoteException);
|
||||
String secondLevel = remoteException.getMessage();
|
||||
if (secondLevel == null)
|
||||
secondLevel = remoteException.getClass().getName();
|
||||
getSystemMessage().makeSubstitution(secondLevel);
|
||||
}
|
||||
}
|
|
@ -56,6 +56,9 @@ import org.eclipse.rse.services.clientserver.NamePatternMatcher;
|
|||
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.files.RemoteFileIOException;
|
||||
import org.eclipse.rse.services.files.RemoteFileSecurityException;
|
||||
import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
|
||||
import org.eclipse.rse.services.search.IHostSearchResult;
|
||||
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
|
||||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2000, 2006 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, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.files.core.subsystems;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting to delete a folder, and the folder is not empty.
|
||||
*/
|
||||
public class RemoteFolderNotEmptyException extends RemoteFileException
|
||||
{
|
||||
/**
|
||||
* Constructor for RemoteFolderNotEmptyException when there is no remote exception to wrap
|
||||
*/
|
||||
public RemoteFolderNotEmptyException()
|
||||
{
|
||||
this(null);
|
||||
}
|
||||
/**
|
||||
* Constructor for RemoteFolderNotEmptyException when there is a remote exception to wrap
|
||||
*/
|
||||
public RemoteFolderNotEmptyException(Exception remoteException)
|
||||
{
|
||||
super(RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_FOLDER_NOTEMPTY), remoteException);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue