Permalink
Browse files

SSHFS subclassing

  • Loading branch information...
1 parent 9b352f6 commit 31bd05c01edb078b9d7ace9c408a61c4d70eee55 Michael Gorbach committed Nov 30, 2007
Showing with 114 additions and 2 deletions.
  1. +20 −1 MFFilesystem.m
  2. +0 −1 MFPluginController.h
  3. +12 −0 MacFusion2.xcodeproj/project.pbxproj
  4. +16 −0 SSHFS/SSHFilesystem.h
  5. +32 −0 SSHFS/SSHFilesystem.m
  6. +16 −0 SSHFS/SSHPlugin.h
  7. +14 −0 SSHFS/SSHPlugin.m
  8. +4 −0 SSHFS/sshfs.plist
View
@@ -50,10 +50,16 @@ - (NSMutableDictionary*)fullParametersWithDictionary:(NSDictionary*)fsParams
for(NSString* parameterKey in [defaultParams keyEnumerator])
{
- if ([fsParams objectForKey:parameterKey] != nil)
+ id value;
+ if ((value = [fsParams objectForKey:parameterKey]) != nil)
{
// The fs specifies a value for this parameter, take it.
// Validation per-value goes here
+ if (! [self validateValue: value forParameterNamed:parameterKey])
+ {
+ MFLog("Parameter validation failed for parameter %@, plugin %@",
+ parameterKey
+ }
[params setObject: [fsParams objectForKey:parameterKey]
forKey: parameterKey];
}
@@ -70,8 +76,16 @@ - (NSMutableDictionary*)fullParametersWithDictionary:(NSDictionary*)fsParams
return params;
}
+- (NSDictionary*)taskEnvironment
+{
+ // No modifications here
+ return [[NSProcessInfo processInfo] environment];
+}
+
- (NSArray*)taskArgumentList
{
+ // Default implementation will try to construct an argument list based
+ // on the options dictionary and input format string
NSMutableString* formatString = [[[self plugin] inputFormatString] mutableCopy];
NSArray* argParameters;
NSString* token;
@@ -111,6 +125,11 @@ - (NSArray*)taskArgumentList
return argParameters;
}
+- (BOOL)validateValue:(id)value forParameterNamed:(NSString*)param
+{
+ return YES;
+}
+
- (NSTask*)taskForLaunch
{
return nil;
View
@@ -18,7 +18,6 @@
- (MFPlugin*)pluginWithID:(NSString*)ID;
- (void)loadPlugins;
-- (MFPlugin*)pluginWithID:(NSString*)id;
@property(readonly) NSMutableDictionary* plugins;
@@ -37,6 +37,8 @@
/* Begin PBXBuildFile section */
8DD76F9A0486AA7600D96B5E /* macfusionAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* macfusionAgent.m */; settings = {ATTRIBUTES = (); }; };
8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
+ D40B79B40CF8B99500EB3137 /* SSHFilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = D40B79B30CF8B99500EB3137 /* SSHFilesystem.m */; };
+ D40B79B70CF8B9A200EB3137 /* SSHPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = D40B79B60CF8B9A200EB3137 /* SSHPlugin.m */; };
D44152720CE2E344001EEF36 /* MFMainController.m in Sources */ = {isa = PBXBuildFile; fileRef = D42E13E50CDFC69500C81814 /* MFMainController.m */; };
D44152730CE2E344001EEF36 /* MFPluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4B14C850CE0455A003195A3 /* MFPluginController.m */; };
D4B14BC90CE03D25003195A3 /* sshnodelay.so in Resources */ = {isa = PBXBuildFile; fileRef = D4B14BAA0CE03C84003195A3 /* sshnodelay.so */; };
@@ -134,6 +136,10 @@
08FB7796FE84155DC02AAC07 /* macfusionAgent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = macfusionAgent.m; sourceTree = "<group>"; };
08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32A70AAB03705E1F00C91783 /* macfusiond_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macfusiond_Prefix.pch; sourceTree = "<group>"; };
+ D40B79B20CF8B99500EB3137 /* SSHFilesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSHFilesystem.h; sourceTree = "<group>"; };
+ D40B79B30CF8B99500EB3137 /* SSHFilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSHFilesystem.m; sourceTree = "<group>"; };
+ D40B79B50CF8B9A200EB3137 /* SSHPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSHPlugin.h; sourceTree = "<group>"; };
+ D40B79B60CF8B9A200EB3137 /* SSHPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSHPlugin.m; sourceTree = "<group>"; };
D42E13E40CDFC69500C81814 /* MFMainController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFMainController.h; sourceTree = "<group>"; };
D42E13E50CDFC69500C81814 /* MFMainController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFMainController.m; sourceTree = "<group>"; };
D42E141B0CDFC99A00C81814 /* MFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFPlugin.h; sourceTree = "<group>"; };
@@ -293,6 +299,10 @@
D4B14BAA0CE03C84003195A3 /* sshnodelay.so */,
D4B14BAB0CE03C84003195A3 /* sshfs.plist */,
D4B14BAC0CE03C84003195A3 /* sshfs-static */,
+ D40B79B20CF8B99500EB3137 /* SSHFilesystem.h */,
+ D40B79B30CF8B99500EB3137 /* SSHFilesystem.m */,
+ D40B79B50CF8B9A200EB3137 /* SSHPlugin.h */,
+ D40B79B60CF8B9A200EB3137 /* SSHPlugin.m */,
);
path = SSHFS;
sourceTree = "<group>";
@@ -454,6 +464,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ D40B79B40CF8B99500EB3137 /* SSHFilesystem.m in Sources */,
+ D40B79B70CF8B9A200EB3137 /* SSHPlugin.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -0,0 +1,16 @@
+//
+// SSHFilesystem.h
+// MacFusion2
+//
+// Created by Michael Gorbach on 11/24/07.
+// Copyright 2007 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SSHFilesystem : MFFilesystem {
+
+}
+
+@end
View
@@ -0,0 +1,32 @@
+//
+// SSHFilesystem.m
+// MacFusion2
+//
+// Created by Michael Gorbach on 11/24/07.
+// Copyright 2007 __MyCompanyName__. All rights reserved.
+//
+
+#import "SSHFilesystem.h"
+
+
+@implementation SSHFilesystem
+- (NSArray*)taskArgumentList
+{
+ NSMutableArray* arguments;
+ [arguments addObject: [NSString stringWithFormat:@"%@@%@:%@",
+ [parameters objectForKey:@"User"],
+ [parameters objectForKey:@"Host"],
+ [parameters objectForKey:@"Directory"]]];
+
+ [arguments addObject: [parameters objectForKey: @"Mount Path"]];
+ [arguments addObject: [parameters objectForKey: @"Port"]];
+
+ [arguments addObject: @"-oCheckHostIP=no"];
+ [arguments addObject: @"-oStrictHostKeyChecking=no"];
+ [arguments addObject: @"-oNumberOfPasswordPrompts=1"];
+ [arguments addObject: @"-ofollow_symlinks"];
+ [arguments addObject: @"-f"];
+}
+
+
+@end
View
@@ -0,0 +1,16 @@
+//
+// SSHPlugin.h
+// MacFusion2
+//
+// Created by Michael Gorbach on 11/24/07.
+// Copyright 2007 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SSHPlugin : MFPlugin {
+
+}
+
+@end
View
@@ -0,0 +1,14 @@
+//
+// SSHPlugin.m
+// MacFusion2
+//
+// Created by Michael Gorbach on 11/24/07.
+// Copyright 2007 __MyCompanyName__. All rights reserved.
+//
+
+#import "SSHPlugin.h"
+
+
+@implementation SSHPlugin
+
+@end
View
@@ -17,6 +17,8 @@
<key>Short Name</key>
<string>sshfs</string>
</dict>
+ <key>Filesystem Class</key>
+ <string>SSHFilesystem</string>
<key>Input Format</key>
<string>[user]@[host]:[dir] [mountpoint] [options]</string>
<key>Parameters</key>
@@ -62,5 +64,7 @@
<string>String</string>
</dict>
</dict>
+ <key>Plugin Class</key>
+ <string>SSHPlugin</string>
</dict>
</plist>

0 comments on commit 31bd05c

Please sign in to comment.