Permalink
Browse files

first commit

  • Loading branch information...
1 parent d8cf1df commit d0577d56b91d69e56f3f8d23e52f4f345c45c9d0 @bububa committed Apr 29, 2010
Showing with 28,389 additions and 0 deletions.
  1. +25 −0 AddCollectionController.h
  2. +58 −0 AddCollectionController.m
  3. +47 −0 AddConnectionController.h
  4. +184 −0 AddConnectionController.m
  5. +25 −0 AddDBController.h
  6. +63 −0 AddDBController.m
  7. +12 −0 Configure.h
  8. +37 −0 Connection.h
  9. +27 −0 Connection.m
  10. +2,561 −0 ConnectionWindow.xib
  11. +67 −0 ConnectionWindowController.h
  12. +368 −0 ConnectionWindowController.mm
  13. +16 −0 ConnectionWindowTitleTransformer.h
  14. +29 −0 ConnectionWindowTitleTransformer.m
  15. +19 −0 ConnectionsArrayController.h
  16. +63 −0 ConnectionsArrayController.m
  17. +16 −0 ConnectionsCollectionView/ConnectionsCollectionView.h
  18. +23 −0 ConnectionsCollectionView/ConnectionsCollectionView.m
  19. +18 −0 ConnectionsCollectionView/IconCollectionItem.h
  20. +30 −0 ConnectionsCollectionView/IconCollectionItem.m
  21. +23 −0 ConnectionsCollectionView/IconViewBox.h
  22. +92 −0 ConnectionsCollectionView/IconViewBox.m
  23. +22 −0 Database.h
  24. +19 −0 Database.m
  25. +22 −0 DatabasesArrayController.h
  26. +87 −0 DatabasesArrayController.m
  27. +1,774 −0 EditConnection.xib
  28. +48 −0 EditConnectionController.h
  29. +203 −0 EditConnectionController.m
  30. BIN English.lproj/InfoPlist.strings
  31. +2,867 −0 English.lproj/MainMenu.xib
  32. +83 −0 Importer/GetMetadataForFile.c
  33. +64 −0 Importer/Importer Read Me.txt
  34. +112 −0 Importer/Importer-Info.plist
  35. +28 −0 Importer/MySpotlightImporter.h
  36. +169 −0 Importer/MySpotlightImporter.m
  37. +224 −0 Importer/main.c
  38. +50 −0 JSON/JSON.h
  39. +68 −0 JSON/NSObject+SBJSON.h
  40. +53 −0 JSON/NSObject+SBJSON.m
  41. +58 −0 JSON/NSString+SBJSON.h
  42. +55 −0 JSON/NSString+SBJSON.m
  43. +75 −0 JSON/SBJSON.h
  44. +212 −0 JSON/SBJSON.m
  45. +86 −0 JSON/SBJsonBase.h
  46. +78 −0 JSON/SBJsonBase.m
  47. +87 −0 JSON/SBJsonParser.h
  48. +475 −0 JSON/SBJsonParser.m
  49. +129 −0 JSON/SBJsonWriter.h
  50. +237 −0 JSON/SBJsonWriter.m
  51. +92 −0 MongoDB.h
  52. +749 −0 MongoDB.mm
  53. +55 −0 MongoHub-Info.plist
  54. +874 −0 MongoHub.xcodeproj/project.pbxproj
  55. +1,447 −0 MongoHub.xcodeproj/syd.mode1v3
  56. +1,864 −0 MongoHub.xcodeproj/syd.pbxuser
  57. +51 −0 MongoHub_AppDelegate.h
  58. +379 −0 MongoHub_AppDelegate.m
  59. BIN MongoHub_DataModel.xcdatamodel/elements
  60. BIN MongoHub_DataModel.xcdatamodel/layout
  61. +7 −0 MongoHub_Prefix.pch
  62. +27 −0 NSString+Extras.h
  63. +71 −0 NSString+Extras.m
  64. +899 −0 NewCollection.xib
  65. +1,782 −0 NewConnection.xib
  66. +1,085 −0 NewDB.xib
  67. +4,566 −0 QueryWindow.xib
  68. +85 −0 QueryWindowController.h
  69. +282 −0 QueryWindowController.mm
  70. BIN Resourses/images/Icon.icns
  71. BIN Resourses/images/collectionicon.png
  72. BIN Resourses/images/collectionmenu.png
  73. BIN Resourses/images/connecticon.png
  74. BIN Resourses/images/database.png
  75. BIN Resourses/images/dbicon.png
  76. BIN Resourses/images/dbmenu.png
  77. BIN Resourses/images/editicon.png
  78. BIN Resourses/images/findmenu.png
  79. BIN Resourses/images/indexmenu.png
  80. BIN Resourses/images/insertmenu.png
  81. +1,721 −0 Resourses/images/mongohub.ai
  82. BIN Resourses/images/querymenu.png
  83. BIN Resourses/images/removemenu.png
  84. BIN Resourses/images/runmenu.png
  85. BIN Resourses/images/servermenu.png
  86. BIN Resourses/images/supportmenu.png
  87. BIN Resourses/images/updatemenu.png
  88. +20 −0 ResultsOutlineViewController.h
  89. +140 −0 ResultsOutlineViewController.m
  90. +116 −0 Sidebar/Sidebar.h
  91. +551 −0 Sidebar/Sidebar.m
  92. +24 −0 Sidebar/SidebarBadgeCell.h
  93. +147 −0 Sidebar/SidebarBadgeCell.m
  94. +62 −0 Sidebar/SidebarNode.h
  95. +91 −0 Sidebar/SidebarNode.m
  96. +14 −0 main.m
View
25 AddCollectionController.h
@@ -0,0 +1,25 @@
+//
+// AddCollectionController.h
+// MongoHub
+//
+// Created by Syd on 10-4-28.
+// Copyright 2010 ThePeppersStudio.COM. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface AddCollectionController : NSWindowController {
+ IBOutlet NSTextField *collectionname;
+ NSMutableString *dbname;
+ NSMutableDictionary *dbInfo;
+}
+
+@property (nonatomic, retain) NSTextField *collectionname;
+@property (nonatomic, retain) NSString *dbname;
+@property (nonatomic, retain) NSMutableDictionary *dbInfo;
+
+- (IBAction)add:(id)sender;
+- (IBAction)cancel:(id)sender;
+
+@end
View
58 AddCollectionController.m
@@ -0,0 +1,58 @@
+//
+// AddCollectionController.m
+// MongoHub
+//
+// Created by Syd on 10-4-28.
+// Copyright 2010 ThePeppersStudio.COM. All rights reserved.
+//
+
+#import "Configure.h"
+#import "AddCollectionController.h"
+
+
+@implementation AddCollectionController
+
+@synthesize dbname;
+@synthesize collectionname;
+@synthesize dbInfo;
+
+- (id)init {
+ if (![super initWithWindowNibName:@"NewCollection"]) return nil;
+ return self;
+}
+
+- (void)dealloc {
+ [dbname release];
+ [collectionname release];
+ [dbInfo release];
+ [super dealloc];
+}
+
+- (void)windowWillClose:(NSNotification *)notification {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kNewCollectionWindowWillClose object:dbInfo];
+ dbInfo = nil;
+}
+
+- (IBAction)cancel:(id)sender {
+ dbInfo = nil;
+ [self close];
+}
+
+- (IBAction)add:(id)sender {
+ if ([ [collectionname stringValue] length] == 0) {
+ NSRunAlertPanel(@"Error", @"Collection name could not be empty", @"OK", nil, nil);
+ return;
+ }
+ NSArray *keys = [[NSArray alloc] initWithObjects:@"dbname", @"collectionname", nil];
+ NSString *colname = [[NSString alloc] initWithString:[collectionname stringValue]];
+ NSArray *objs = [[NSArray alloc] initWithObjects:dbname, colname, nil];
+ [colname release];
+ if (!dbInfo) {
+ dbInfo = [[NSMutableDictionary alloc] initWithCapacity:2];
+ }
+ dbInfo = [NSMutableDictionary dictionaryWithObjects:objs forKeys:keys];
+ [objs release];
+ [keys release];
+ [self close];
+}
+@end
View
47 AddConnectionController.h
@@ -0,0 +1,47 @@
+//
+// AddConnectionController.h
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+@class ConnectionsArrayController;
+
+@interface AddConnectionController : NSWindowController {
+ IBOutlet NSTextField *hostTextField;
+ IBOutlet NSTextField *hostportTextField;
+ IBOutlet NSTextField *aliasTextField;
+ IBOutlet NSButton *usesshCheckBox;
+ IBOutlet NSTextField *bindaddressTextField;
+ IBOutlet NSTextField *bindportTextField;
+ IBOutlet NSTextField *sshhostTextField;
+ IBOutlet NSTextField *sshportTextField;
+ IBOutlet NSTextField *sshuserTextField;
+ IBOutlet NSSecureTextField *sshpasswordTextField;
+ IBOutlet ConnectionsArrayController *connectionsArrayController;
+ NSDictionary *connectionInfo;
+ NSManagedObjectContext *managedObjectContext;
+}
+
+@property (nonatomic, retain) NSTextField *hostTextField;
+@property (nonatomic, retain) NSTextField *hostportTextField;
+@property (nonatomic, retain) NSTextField *aliasTextField;
+@property (nonatomic, retain) NSButton *usesshCheckBox;
+@property (nonatomic, retain) NSTextField *bindaddressTextField;
+@property (nonatomic, retain) NSTextField *bindportTextField;
+@property (nonatomic, retain) NSTextField *sshhostTextField;
+@property (nonatomic, retain) NSTextField *sshportTextField;
+@property (nonatomic, retain) NSTextField *sshuserTextField;
+@property (nonatomic, retain) NSSecureTextField *sshpasswordTextField;
+@property (nonatomic, retain) NSDictionary *connectionInfo;
+@property (nonatomic, retain) ConnectionsArrayController *connectionsArrayController;
+@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
+
+- (IBAction)cancel:(id)sender;
+- (IBAction)add:(id)sender;
+- (IBAction)enableSSH:(id)sender;
+- (BOOL)validateConnection;
+
+@end
View
184 AddConnectionController.m
@@ -0,0 +1,184 @@
+//
+// AddConnectionController.m
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "Configure.h"
+#import "AddConnectionController.h"
+#import "ConnectionsArrayController.h"
+
+@implementation AddConnectionController
+
+@synthesize hostTextField;
+@synthesize hostportTextField;
+@synthesize aliasTextField;
+@synthesize usesshCheckBox;
+@synthesize bindaddressTextField;
+@synthesize bindportTextField;
+@synthesize sshhostTextField;
+@synthesize sshportTextField;
+@synthesize sshuserTextField;
+@synthesize sshpasswordTextField;
+@synthesize connectionInfo;
+@synthesize connectionsArrayController;
+@synthesize managedObjectContext;
+
+- (id)init {
+ if (![super initWithWindowNibName:@"NewConnection"]) return nil;
+ return self;
+}
+
+- (void)dealloc {
+ [hostTextField release];
+ [hostportTextField release];
+ [aliasTextField release];
+ [usesshCheckBox release];
+ [bindaddressTextField release];
+ [bindportTextField release];
+ [sshhostTextField release];
+ [sshportTextField release];
+ [sshuserTextField release];
+ [sshpasswordTextField release];
+ [connectionInfo release];
+ [connectionsArrayController release];
+ [managedObjectContext release];
+ [super dealloc];
+}
+
+- (void)windowDidLoad {
+ //NSLog(@"New Connection Window Loaded");
+ [super windowDidLoad];
+}
+
+- (void)windowWillClose:(NSNotification *)notification {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kNewConnectionWindowWillClose object:connectionInfo];
+}
+
+- (IBAction)cancel:(id)sender {
+ connectionInfo = nil;
+ [self close];
+}
+
+- (IBAction)add:(id)sender {
+ NSString *host;
+ NSUInteger hostport;
+ NSString *alias;
+ NSUInteger usessh = 0;
+ NSString *bindaddress;
+ NSUInteger bindport;
+ NSString *sshhost;
+ NSUInteger sshport;
+ NSString *sshuser;
+ NSString *sshpassword;
+ if ([ [hostTextField stringValue] length] == 0) {
+ host = [[NSString alloc] initWithString:@"localhost"];
+ }else{
+ host = [[NSString alloc] initWithString:[hostTextField stringValue]];
+ }
+ if ([hostportTextField intValue] == 0) {
+ hostport = 27017;
+ }else{
+ hostport = [hostportTextField intValue];
+ }
+ if ([ [aliasTextField stringValue] length] == 0) {
+ alias = [[NSString alloc] initWithString:@"localhost"];
+ }else{
+ alias = [[NSString alloc] initWithString:[aliasTextField stringValue]];
+ }
+ if ([usesshCheckBox state])
+ {
+ usessh = 1;
+ if ([ [bindaddressTextField stringValue] length] == 0) {
+ bindaddress = [[NSString alloc] initWithString:@"127.0.0.1"];
+ }else{
+ bindaddress = [[NSString alloc] initWithString:[bindaddressTextField stringValue]];
+ }
+ if ([ [bindportTextField stringValue] length] == 0) {
+ bindport = 8888;
+ }else{
+ bindport = [bindportTextField intValue];
+ }
+ sshhost = [[NSString alloc] initWithString:[sshhostTextField stringValue]];
+ if ([[sshportTextField stringValue] length] == 0) {
+ sshport = 22;
+ }else {
+ sshport = [sshportTextField intValue];
+ }
+
+ sshuser = [[NSString alloc] initWithString:[sshuserTextField stringValue]];
+ sshpassword = [[NSString alloc] initWithString:[sshpasswordTextField stringValue]];
+ }else{
+ bindaddress = @"127.0.0.1";
+ bindport = 8888;
+ sshhost = @"";
+ sshport = 22;
+ sshuser = @"";
+ sshpassword = @"";
+ }
+ NSArray *keys = [[NSArray alloc] initWithObjects:@"host", @"hostport", @"alias", @"usessh", @"bindaddress", @"bindport", @"sshhost", @"sshport", @"sshuser", @"sshpassword", nil];
+ NSArray *objs = [[NSArray alloc] initWithObjects:host, [NSNumber numberWithInt:hostport], alias, [NSNumber numberWithInt:usessh], bindaddress, [NSNumber numberWithInt:bindport], sshhost, [NSNumber numberWithInt:sshport], sshuser, sshpassword, nil];
+ if (!connectionInfo) {
+ connectionInfo = [[NSMutableDictionary alloc] initWithCapacity:10];
+ }
+ connectionInfo = [NSMutableDictionary dictionaryWithObjects:objs forKeys:keys];
+ [keys release];
+ [objs release];
+ [host release];
+ [alias release];
+ if (usessh == 1)
+ {
+ [sshhost release];
+ [sshuser release];
+ [sshpassword release];
+ [bindaddress release];
+ }
+ if ([self validateConnection]) {
+ [self close];
+ }
+}
+
+- (BOOL)validateConnection
+{
+ if ([[connectionInfo objectForKey:@"host"] length] == 0) {
+ NSRunAlertPanel(@"Error", @"Connection host should not be empty", @"OK", nil, nil);
+ return NO;
+ }
+ if ([[connectionInfo objectForKey:@"alias"] length]<3) {
+ NSRunAlertPanel(@"Error", @"Connection name should not be less than 3 charaters", @"OK", nil, nil);
+ return NO;
+ }
+ if ([connectionsArrayController checkDuplicate:[connectionInfo objectForKey:@"alias"]]) {
+ NSRunAlertPanel(@"Error", @"Connection alias name has been existed!", @"OK", nil, nil);
+ return NO;
+ }
+ if ([usesshCheckBox state] == 1 && ([[connectionInfo objectForKey:@"bindaddress"] length] == 0 || [[connectionInfo objectForKey:@"sshhost"] length] == 0)) {
+ NSRunAlertPanel(@"Error", @"Please full fill ssh information!", @"OK", nil, nil);
+ return NO;
+ }
+ return YES;
+}
+
+- (IBAction)enableSSH:(id)sender
+{
+ if ([usesshCheckBox state] == 1)
+ {
+ [bindaddressTextField setEnabled:YES];
+ [bindportTextField setEnabled:YES];
+ [sshhostTextField setEnabled:YES];
+ [sshuserTextField setEnabled:YES];
+ [sshpasswordTextField setEnabled:YES];
+ [sshportTextField setEnabled:YES];
+ }else {
+ [bindaddressTextField setEnabled:NO];
+ [bindportTextField setEnabled:NO];
+ [sshhostTextField setEnabled:NO];
+ [sshuserTextField setEnabled:NO];
+ [sshpasswordTextField setEnabled:NO];
+ [sshportTextField setEnabled:NO];
+ }
+
+}
+@end
View
25 AddDBController.h
@@ -0,0 +1,25 @@
+//
+// AddDBController.h
+// MongoHub
+//
+// Created by Syd on 10-4-28.
+// Copyright 2010 ThePeppersStudio.COM. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface AddDBController : NSWindowController {
+ IBOutlet NSTextField *dbname;
+ IBOutlet NSTextField *user;
+ IBOutlet NSSecureTextField *password;
+ NSMutableDictionary *dbInfo;
+}
+
+@property (nonatomic, retain) NSTextField *dbname;
+@property (nonatomic, retain) NSTextField *user;
+@property (nonatomic, retain) NSSecureTextField *password;
+@property (nonatomic, retain) NSMutableDictionary *dbInfo;
+
+- (IBAction)add:(id)sender;
+- (IBAction)cancel:(id)sender;
+@end
View
63 AddDBController.m
@@ -0,0 +1,63 @@
+//
+// AddDBController.m
+// MongoHub
+//
+// Created by Syd on 10-4-28.
+// Copyright 2010 ThePeppersStudio.COM. All rights reserved.
+//
+
+#import "Configure.h"
+#import "AddDBController.h"
+
+@implementation AddDBController
+
+@synthesize dbname;
+@synthesize user;
+@synthesize password;
+@synthesize dbInfo;
+
+- (id)init {
+ if (![super initWithWindowNibName:@"NewDB"]) return nil;
+ return self;
+}
+
+- (void)dealloc {
+ [dbname release];
+ [user release];
+ [password release];
+ [dbInfo release];
+ [super dealloc];
+}
+
+- (void)windowWillClose:(NSNotification *)notification {
+ [[NSNotificationCenter defaultCenter] postNotificationName:kNewDBWindowWillClose object:dbInfo];
+ dbInfo = nil;
+}
+
+- (IBAction)cancel:(id)sender {
+ dbInfo = nil;
+ [self close];
+}
+
+- (IBAction)add:(id)sender {
+ if ([ [dbname stringValue] length] == 0) {
+ NSRunAlertPanel(@"Error", @"Database name could not be empty", @"OK", nil, nil);
+ return;
+ }
+ NSArray *keys = [[NSArray alloc] initWithObjects:@"dbname", @"user", @"password", nil];
+ NSString *dbstr = [[NSString alloc] initWithString:[dbname stringValue]];
+ NSString *userStr = [[NSString alloc] initWithString:[user stringValue]];
+ NSString *passStr = [[NSString alloc] initWithString:[password stringValue]];
+ NSArray *objs = [[NSArray alloc] initWithObjects:dbstr, userStr, passStr, nil];
+ [dbstr release];
+ [userStr release];
+ [passStr release];
+ if (!dbInfo) {
+ dbInfo = [[NSMutableDictionary alloc] initWithCapacity:3];
+ }
+ dbInfo = [NSMutableDictionary dictionaryWithObjects:objs forKeys:keys];
+ [objs release];
+ [keys release];
+ [self close];
+}
+@end
View
12 Configure.h
@@ -0,0 +1,12 @@
+//
+// Configure.h
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#define kNewConnectionWindowWillClose @"NewConnectionWindowWillClose"
+#define kEditConnectionWindowWillClose @"EditConnectionWindowWillClose"
+#define kNewDBWindowWillClose @"NewDBWindowWillClose"
+#define kNewCollectionWindowWillClose @"NewCollectionWindowWillClose"
View
37 Connection.h
@@ -0,0 +1,37 @@
+//
+// Database.h
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "Database.h"
+
+@interface Connection: NSManagedObject {
+ NSString *host;
+ NSNumber *hostport;
+ NSString *alias;
+ NSString *sshhost;
+ NSNumber *sshport;
+ NSString *sshuser;
+ NSString *sshpassword;
+ NSString *bindaddress;
+ NSNumber *bindport;
+ NSSet *databases;
+ NSNumber *usessh;
+}
+
+@property (nonatomic, retain) NSString *host;
+@property (nonatomic, retain) NSNumber *hostport;
+@property (nonatomic, retain) NSString *alias;
+@property (nonatomic, retain) NSSet *databases;
+@property (nonatomic, retain) NSString *sshhost;
+@property (nonatomic, retain) NSNumber *sshport;
+@property (nonatomic, retain) NSString *sshuser;
+@property (nonatomic, retain) NSString *sshpassword;
+@property (nonatomic, retain) NSString *bindaddress;
+@property (nonatomic, retain) NSNumber *bindport;
+@property (nonatomic, retain) NSNumber *usessh;
+
+@end
View
27 Connection.m
@@ -0,0 +1,27 @@
+//
+// Database.m
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "Connection.h"
+
+
+@implementation Connection
+
+@dynamic host;
+@dynamic hostport;
+@dynamic alias;
+@dynamic databases;
+
+@dynamic usessh;
+@dynamic sshhost;
+@dynamic sshport;
+@dynamic sshuser;
+@dynamic sshpassword;
+@dynamic bindaddress;
+@dynamic bindport;
+
+@end
View
2,561 ConnectionWindow.xib
2,561 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
67 ConnectionWindowController.h
@@ -0,0 +1,67 @@
+//
+// ConnectionWindowController.h
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import <SSHTunnel/SSHTunnel.h>
+@class DatabasesArrayController;
+@class AddDBController;
+@class AddCollectionController;
+@class ResultsOutlineViewController;
+@class Connection;
+@class Sidebar;
+@class SidebarNode;
+@class MongoDB;
+
+@interface ConnectionWindowController : NSWindowController {
+ NSManagedObjectContext *managedObjectContext;
+ IBOutlet DatabasesArrayController *databaseArrayController;
+ IBOutlet ResultsOutlineViewController *resultsOutlineViewController;
+ Connection *conn;
+ MongoDB *mongoDB;
+ IBOutlet Sidebar *sidebar;
+ IBOutlet NSTextField *resultsTitle;
+ NSMutableArray *databases;
+ NSMutableArray *collections;
+ SidebarNode *selectedDB;
+ SidebarNode *selectedCollection;
+ SSHTunnel *sshTunnel;
+ AddDBController *addDBController;
+ AddCollectionController *addCollectionController;
+}
+
+@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
+@property (nonatomic, retain) DatabasesArrayController *databaseArrayController;
+@property (nonatomic, retain) ResultsOutlineViewController *resultsOutlineViewController;
+@property (nonatomic, retain) Connection *conn;
+@property (nonatomic, retain) MongoDB *mongoDB;
+@property (nonatomic, retain) Sidebar *sidebar;
+@property (nonatomic, retain) NSMutableArray *databases;
+@property (nonatomic, retain) NSMutableArray *collections;
+@property (nonatomic, retain) SidebarNode *selectedDB;
+@property (nonatomic, retain) SidebarNode *selectedCollection;
+@property (nonatomic, retain) SSHTunnel *sshTunnel;
+@property (nonatomic, retain) NSTextField *resultsTitle;
+@property (nonatomic, retain) AddDBController *addDBController;
+@property (nonatomic, retain) AddCollectionController *addCollectionController;
+
+- (void)reloadSidebar;
+- (void)reloadDBList;
+- (void)useDB:(id)sender;
+- (void)useCollection:(id)sender;
+- (IBAction)showServerStatus:(id)sender;
+- (IBAction)showDBStats:(id)sender;
+- (IBAction)showCollStats:(id)sender;
+- (IBAction)createDBorCollection:(id)sender;
+- (void)dropCollection:(NSString *)collectionname
+ ForDB:(NSString *)dbname;
+- (void)createDB;
+- (void)createCollectionForDB:(NSString *)dbname;
+- (IBAction)dropDBorCollection:(id)sender;
+- (void)dropDB;
+- (IBAction)query:(id)sender;
+@end
View
368 ConnectionWindowController.mm
@@ -0,0 +1,368 @@
+//
+// ConnectionWindowController.m
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "Configure.h"
+#import "NSString+Extras.h"
+#import "ConnectionWindowController.h"
+#import "QueryWindowController.h"
+#import "AddDBController.h";
+#import "AddCollectionController.h"
+#import "ResultsOutlineViewController.h"
+#import "DatabasesArrayController.h"
+#import "Connection.h"
+#import "Sidebar.h"
+#import "SidebarNode.h"
+#import "MongoDB.h"
+#import <SSHTunnel/SSHTunnel.h>
+
+@implementation ConnectionWindowController
+
+@synthesize managedObjectContext;
+@synthesize databaseArrayController;
+@synthesize resultsOutlineViewController;
+@synthesize conn;
+@synthesize mongoDB;
+@synthesize sidebar;
+@synthesize databases;
+@synthesize collections;
+@synthesize selectedDB;
+@synthesize selectedCollection;
+@synthesize sshTunnel;
+@synthesize addDBController;
+@synthesize addCollectionController;
+@synthesize resultsTitle;
+
+- (id)init {
+ if (![super initWithWindowNibName:@"ConnectionWindow"]) return nil;
+ return self;
+}
+
+- (void)windowDidLoad {
+ [super windowDidLoad];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addDB:) name:kNewDBWindowWillClose object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCollection:) name:kNewCollectionWindowWillClose object:nil];
+ NSString *hostaddress;
+ if ([conn.usessh intValue]==1) {
+ sshTunnel = [SSHTunnel sshTunnelWithHostname:conn.sshhost
+ port:[conn.sshport intValue]
+ username:conn.sshpassword
+ password:conn.sshpassword];
+ [sshTunnel addLocalForwardWithBindAddress:conn.bindaddress
+ bindPort:[conn.bindport intValue]
+ host:conn.host
+ hostPort:[conn.hostport intValue]];
+ [sshTunnel launch];
+ hostaddress = [NSString stringWithFormat:@"%@:%@", conn.bindaddress, conn.bindport];
+ }else {
+ hostaddress = [NSString stringWithFormat:@"%@:%@", conn.host, conn.hostport];
+ }
+ mongoDB = [[MongoDB alloc] initWithConn:hostaddress];
+ [self reloadSidebar];
+ [self showServerStatus:nil];
+}
+
+- (void)dealloc {
+ [managedObjectContext release];
+ [databaseArrayController release];
+ [resultsOutlineViewController release];
+ [conn release];
+ [mongoDB release];
+ [sidebar release];
+ [databases release];
+ [collections release];
+ [selectedDB release];
+ [selectedCollection release];
+ [sshTunnel release];
+ [addDBController release];
+ [addCollectionController release];
+ [resultsTitle release];
+ [super dealloc];
+}
+
+- (void)windowWillClose:(NSNotification *)notification {
+ [sshTunnel terminate];
+ [sshTunnel waitUntilExit];
+ selectedDB = nil;
+ selectedCollection = nil;
+ [self release];
+}
+
+- (void)reloadSidebar {
+ [sidebar addSection:@"1" caption:@"DATABASES"];
+ [self reloadDBList];
+ [sidebar reloadData];
+}
+
+- (void)reloadDBList {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ //[selectedDB release];
+ selectedDB = nil;
+ //[selectedCollection release];
+ selectedCollection = nil;
+ [collections release];
+ collections = [[NSMutableArray alloc] init];
+ [databases release];
+ databases = [[NSMutableArray alloc ] initWithArray:[mongoDB listDatabases]];
+ [databaseArrayController clean:conn databases:databases];
+ [sidebar removeItem:@"2"];
+ unsigned int i=1;
+ for (NSString *db in databases) {
+ [sidebar addChild:@"1" key:[NSString stringWithFormat:@"1.%d", i] caption:db icon:[NSImage imageNamed:@"dbicon.png"] action:@selector(useDB:) target:self];
+ i ++ ;
+ }
+ [sidebar reloadData];
+ [sidebar expandItem:@"1"];
+ [pool release];
+}
+
+- (void)useDB:(id)sender {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *dbname = [[NSString alloc] initWithFormat:@"%@", [sender caption]];
+ if (![[selectedDB caption] isEqualToString:dbname]) {
+ //[selectedDB release];
+ selectedDB = (SidebarNode *)sender;
+ }
+ //[selectedCollection release];
+ selectedCollection = nil;
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:dbname];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ [collections release];
+ collections = [[NSMutableArray alloc] initWithArray:[mongoDB listCollections:dbname user:user password:password]];
+ [dbname release];
+
+ [sidebar removeItem:@"2"];
+ [sidebar addSection:@"2" caption:[[selectedDB caption] uppercaseString]];
+ unsigned int i = 1;
+ for (NSString *collection in collections) {
+ [sidebar addChild:@"2" key:[NSString stringWithFormat:@"2.%d", i] caption:collection icon:[NSImage imageNamed:@"collectionicon.png"] action:@selector(useCollection:) target:self];
+ i ++ ;
+ }
+ [sidebar reloadData];
+ [sidebar setBadge:[selectedDB nodeKey] count:[collections count]];
+ [sidebar expandItem:@"2"];
+ [self showDBStats:nil];
+ [pool release];
+}
+
+- (void)useCollection:(id)sender
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *collectionname = [[NSString alloc] initWithFormat:@"%@", [sender caption] ];
+ if ([collectionname isPresent]) {
+ //[selectedCollection release];
+ selectedCollection = (SidebarNode *)sender;
+ [self showCollStats:nil];
+ }
+ [collectionname release];
+ [pool release];
+}
+
+- (IBAction)showServerStatus:(id)sender
+{
+ [resultsTitle setStringValue:[NSString stringWithFormat:@"Server %@:%@ stats", conn.host, conn.hostport]];
+ NSMutableArray *results = [[NSMutableArray alloc] initWithArray:[mongoDB serverStatus]];
+ resultsOutlineViewController.results = results;
+ [resultsOutlineViewController.myOutlineView reloadData];
+ [results release];
+ //NSLog(@"STATUS: %@", results);
+}
+
+- (IBAction)showDBStats:(id)sender
+{
+ if (selectedDB==nil) {
+ NSRunAlertPanel(@"Error", @"Please specify a database!", @"OK", nil, nil);
+ return;
+ }
+ [resultsTitle setStringValue:[NSString stringWithFormat:@"Database %@ stats", [selectedDB caption]]];
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:[selectedDB caption]];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ NSMutableArray *results = [[NSMutableArray alloc] initWithArray:[mongoDB dbStats:[selectedDB caption]
+ user:user
+ password:password]];
+ resultsOutlineViewController.results = results;
+ [resultsOutlineViewController.myOutlineView reloadData];
+ [results release];
+ //NSLog(@"STATUS: %@", results);
+}
+
+- (IBAction)showCollStats:(id)sender
+{
+ if (selectedDB==nil || selectedCollection==nil) {
+ NSRunAlertPanel(@"Error", @"Please specify a collection!", @"OK", nil, nil);
+ return;
+ }
+ [resultsTitle setStringValue:[NSString stringWithFormat:@"Collection %@.%@ stats", [selectedDB caption], [selectedCollection caption]]];
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:[selectedDB caption] ];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ NSMutableArray *results = [[NSMutableArray alloc] initWithArray:[mongoDB collStats:[selectedCollection caption]
+ forDB:[selectedDB caption]
+ user:user
+ password:password] ];
+ //NSLog(@"STATUS: %@", results);
+ resultsOutlineViewController.results = results;
+ [resultsOutlineViewController.myOutlineView reloadData];
+ [results release];
+}
+
+- (IBAction)createDBorCollection:(id)sender
+{
+ if (selectedCollection) {
+ [self createCollectionForDB:[selectedDB caption]];
+ }else {
+ [self createDB];
+ }
+}
+
+- (void)createCollectionForDB:(NSString *)dbname
+{
+ if (!addCollectionController)
+ {
+ addCollectionController = [[AddCollectionController alloc] init];
+ }
+ addCollectionController.dbname = dbname;
+ [addCollectionController showWindow:self];
+}
+
+- (void)createDB
+{
+ if (!addDBController)
+ {
+ addDBController = [[AddDBController alloc] init];
+ }
+ [addDBController showWindow:self];
+}
+
+- (void)addDB:(id)sender
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ if (![sender object]) {
+ return;
+ }
+ NSString *dbname = [[NSString alloc] initWithString:[[sender object] objectForKey:@"dbname"]];
+ NSString *user = [[NSString alloc] initWithString:[[sender object] objectForKey:@"user"]];
+ NSString *password = [[NSString alloc] initWithString:[[sender object] objectForKey:@"password"]];
+ [mongoDB dbStats:dbname
+ user:user
+ password:password];
+ [dbname release];
+ [user release];
+ [password release];
+ [self reloadSidebar];
+ [pool release];
+}
+
+- (void)addCollection:(id)sender
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ if (![sender object]) {
+ return;
+ }
+ NSString *dbname = [[NSString alloc] initWithString:[[sender object] objectForKey:@"dbname"]];
+ NSString *collectionname = [[NSString alloc] initWithString:[[sender object] objectForKey:@"collectionname"]];
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:dbname];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ [mongoDB createCollection:collectionname
+ forDB:dbname
+ user:user
+ password:password];
+ if ([[selectedDB caption] isEqualToString:dbname]) {
+ [sidebar selectItem:[selectedDB nodeKey]];
+ }
+ [dbname release];
+ [collectionname release];
+ [pool release];
+}
+
+- (IBAction)dropDBorCollection:(id)sender
+{
+ if (selectedCollection) {
+ [self dropCollection:[selectedCollection caption] ForDB:[selectedDB caption]];
+ }else {
+ [self dropDB];
+ }
+}
+
+- (void)dropCollection:(NSString *)collectionname ForDB:(NSString *)dbname
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:[selectedDB caption]];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ [mongoDB dropCollection:collectionname
+ forDB:dbname
+ user:user
+ password:password];
+ if ([[selectedDB caption] isEqualToString:dbname]) {
+ [sidebar selectItem:[selectedDB nodeKey]];
+ }
+ [pool release];
+}
+
+- (void)dropDB
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *user=nil;
+ NSString *password=nil;
+ Database *db = [databaseArrayController dbInfo:conn name:[selectedDB caption]];
+ if (db) {
+ user = db.user;
+ password = db.password;
+ }
+ [db release];
+ [mongoDB dropDB:[selectedDB caption]
+ user:user
+ password:password];
+ [self reloadSidebar];
+ [pool release];
+}
+
+- (IBAction)query:(id)sender
+{
+ if (!selectedCollection) {
+ NSRunAlertPanel(@"Error", @"Please choose a collection!", @"OK", nil, nil);
+ return;
+ }
+
+ QueryWindowController *queryWindowController = [[QueryWindowController alloc] init];
+ queryWindowController.managedObjectContext = self.managedObjectContext;
+ queryWindowController.conn = conn;
+ queryWindowController.dbname = [selectedDB caption];
+ queryWindowController.collectionname = [selectedCollection caption];
+ queryWindowController.mongoDB = mongoDB;
+ [queryWindowController showWindow:sender];
+}
+@end
View
16 ConnectionWindowTitleTransformer.h
@@ -0,0 +1,16 @@
+//
+// ConnectionWindowTitleTransformer.h
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface ConnectionWindowTitleTransformer : NSValueTransformer {
+
+}
+
+@end
View
29 ConnectionWindowTitleTransformer.m
@@ -0,0 +1,29 @@
+//
+// ConnectionWindowTitleTransformer.m
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "ConnectionWindowTitleTransformer.h"
+#import "Connection.h"
+
+@implementation ConnectionWindowTitleTransformer
+
++ (Class)transformedValueClass {
+ return [NSString class];
+}
++ (BOOL)allowsReverseTransformation {
+ return NO;
+}
+- (id)transformedValue:(id)value
+{
+ if (value)
+ {
+ return [NSString stringWithFormat:@"%@ [%@:%@]", [value alias], [value host], [value hostport] ];
+ }
+ return nil;
+}
+
+@end
View
19 ConnectionsArrayController.h
@@ -0,0 +1,19 @@
+//
+// DatabasesArrayController.h
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface ConnectionsArrayController : NSArrayController {
+
+}
+
+- (BOOL)checkDuplicate:(NSString *)alias;
+- (NSArray *)itemsUsingFetchPredicate:(NSPredicate *)fetchPredicate;
+
+@end
View
63 ConnectionsArrayController.m
@@ -0,0 +1,63 @@
+//
+// DatabasesArrayController.m
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "ConnectionsArrayController.h"
+
+
+@implementation ConnectionsArrayController
+
+- (void)awakeFromNib
+{
+ if ([NSArrayController instancesRespondToSelector:@selector(awakeFromNib)])
+ {
+ [super awakeFromNib];
+ }
+ [self setClearsFilterPredicateOnInsertion:NO];
+}
+
+- (id)newObject
+{
+ id newObj = [super newObject];
+ //NSDate *now = [NSDate date];
+ //[newObj setValue:now forKey:@"createdDatetime"];
+ return newObj;
+}
+
+- (void)remove:(id)sender
+{
+ if (![self selectedObjects]){
+ return;
+ }
+ [super remove:sender];
+}
+
+- (BOOL)checkDuplicate:(NSString *)alias
+{
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"alias=%@", alias];
+ if ([[self itemsUsingFetchPredicate:predicate] count]>0) {
+ return YES;
+ }else {
+ return NO;
+ }
+}
+
+- (NSArray *)itemsUsingFetchPredicate:(NSPredicate *)fetchPredicate
+{
+ NSError *error = nil;
+ NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
+ [request setEntity:[NSEntityDescription entityForName:[self entityName]
+ inManagedObjectContext:[self managedObjectContext]]];
+ NSArray *objects = [[self managedObjectContext]
+ executeFetchRequest:request error:&error];
+ if (error) {
+ NSLog(@"Fetch error! In AWViewPositionArrayController:itemsUseingFetchPredicate");
+ }
+ return [objects filteredArrayUsingPredicate:fetchPredicate];
+}
+
+@end
View
16 ConnectionsCollectionView/ConnectionsCollectionView.h
@@ -0,0 +1,16 @@
+//
+// ProjectsCollectionView.h
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface ConnectionsCollectionView : NSCollectionView {
+
+}
+-(void)setSubviewSize:(CGFloat)theSubviewSize;
+@end
View
23 ConnectionsCollectionView/ConnectionsCollectionView.m
@@ -0,0 +1,23 @@
+//
+// ProjectsCollectionView.m
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "ConnectionsCollectionView.h"
+
+
+@implementation ConnectionsCollectionView
+
+-(void)setSubviewSize:(CGFloat)theSubviewSize {
+ [self setMaxItemSize:NSMakeSize(theSubviewSize,theSubviewSize)];
+ [self setMinItemSize:NSMakeSize(theSubviewSize,theSubviewSize)];
+}
+
+-(void)drawRect:(NSRect)rect {
+ [[NSColor colorWithCalibratedHue: 0 saturation: 0 brightness: 0.13 alpha: 1.0] set];
+ NSRectFill([self frame]);
+}
+@end
View
18 ConnectionsCollectionView/IconCollectionItem.h
@@ -0,0 +1,18 @@
+//
+// IconCollectionItem.h
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface IconCollectionItem : NSCollectionViewItem {
+
+}
+
+- (void)doubleClick:(id)sender;
+
+@end
View
30 ConnectionsCollectionView/IconCollectionItem.m
@@ -0,0 +1,30 @@
+//
+// IconCollectionItem.m
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "IconCollectionItem.h"
+#import "IconViewBox.h"
+
+@implementation IconCollectionItem
+
+-(void)setSelected:(BOOL)flag {
+ [super setSelected:flag];
+
+ // tell the view that it has been selected
+ IconViewBox* theView = (IconViewBox* )[self view];
+ if([theView isKindOfClass:[IconViewBox class]]) {
+ [theView setSelected:flag];
+ [theView setNeedsDisplay:YES];
+ }
+}
+
+- (void)doubleClick:(id)sender {
+ if([self collectionView] && [[self collectionView] delegate] && [[[self collectionView] delegate] respondsToSelector:@selector(doubleClick:)]) {
+ [[[self collectionView] delegate] performSelector:@selector(doubleClick:) withObject:self];
+ }
+}
+@end
View
23 ConnectionsCollectionView/IconViewBox.h
@@ -0,0 +1,23 @@
+//
+// IconViewBox.h
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface IconViewBox : NSBox
+{
+ BOOL selectedFlag;
+ IBOutlet id delegate;
+}
+
+@property (nonatomic, assign) id delegate;
+@property (nonatomic, assign) BOOL selectedFlag;
+
+-(void)setSelected:(BOOL)flag;
+-(BOOL)selected;
+@end
View
92 ConnectionsCollectionView/IconViewBox.m
@@ -0,0 +1,92 @@
+//
+// IconViewBox.m
+// SEOBox
+//
+// Created by Syd on 10-2-28.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "IconViewBox.h"
+
+
+@implementation IconViewBox
+@synthesize delegate;
+@synthesize selectedFlag;
+
+
+-(void)setSelected:(BOOL)flag {
+ selectedFlag = flag;
+}
+
+-(BOOL)selected {
+ return selectedFlag;
+}
+
+-(void)drawRect:(NSRect)rect {
+ if([self selected]) {
+ NSColor *bgColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.35];
+ NSRect bgRect = rect;
+ int minX = NSMinX(bgRect);
+ int midX = NSMidX(bgRect);
+ int maxX = NSMaxX(bgRect);
+ int minY = NSMinY(bgRect);
+ int midY = NSMidY(bgRect);
+ int maxY = NSMaxY(bgRect);
+ float radius = 25.0; // correct value to duplicate Panther's App Switcher
+ NSBezierPath *bgPath = [NSBezierPath bezierPath];
+
+ // Bottom edge and bottom-right curve
+ [bgPath moveToPoint:NSMakePoint(midX, minY)];
+ [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, minY)
+ toPoint:NSMakePoint(maxX, midY)
+ radius:radius];
+
+ // Right edge and top-right curve
+ [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, maxY)
+ toPoint:NSMakePoint(midX, maxY)
+ radius:radius];
+
+ // Top edge and top-left curve
+ [bgPath appendBezierPathWithArcFromPoint:NSMakePoint(minX, maxY)
+ toPoint:NSMakePoint(minX, midY)
+ radius:radius];
+
+ // Left edge and bottom-left curve
+ [bgPath appendBezierPathWithArcFromPoint:bgRect.origin
+ toPoint:NSMakePoint(midX, minY)
+ radius:radius];
+ [bgPath closePath];
+
+ [bgColor set];
+ [bgPath fill];
+ }else {
+ [self setWantsLayer:NO];
+ }
+
+ [super drawRect:rect];
+}
+
+// -------------------------------------------------------------------------------
+// hitTest:aPoint
+// -------------------------------------------------------------------------------
+- (NSView *)hitTest:(NSPoint)aPoint
+{
+ // don't allow any mouse clicks for subviews in this view
+ if(NSPointInRect(aPoint,[self convertRect:[self bounds] toView:[self superview]])) {
+ return self;
+ } else {
+ return nil;
+ }
+}
+
+-(void)mouseDown:(NSEvent *)theEvent {
+ [super mouseDown:theEvent];
+ // check for click count above one, which we assume means it's a double click
+ if([theEvent clickCount] > 1) {
+ if(delegate && [delegate respondsToSelector:@selector(doubleClick:)]) {
+ [delegate performSelector:@selector(doubleClick:) withObject:self];
+ }
+ }
+}
+
+@end
View
22 Database.h
@@ -0,0 +1,22 @@
+//
+// Database.h
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+@class Connection;
+
+@interface Database : NSManagedObject {
+ NSString *name;
+ NSString *user;
+ NSString *password;
+ Connection *connection;
+}
+@property (nonatomic, retain) NSString *name;
+@property (nonatomic, retain) NSString *user;
+@property (nonatomic, retain) NSString *password;
+@property (nonatomic, retain) Connection *connection;
+
+@end
View
19 Database.m
@@ -0,0 +1,19 @@
+//
+// Database.m
+// MongoHub
+//
+// Created by Syd on 10-4-24.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "Database.h"
+
+
+@implementation Database
+
+@dynamic name;
+@dynamic user;
+@dynamic password;
+@dynamic connection;
+
+@end
View
22 DatabasesArrayController.h
@@ -0,0 +1,22 @@
+//
+// DatabasesArrayCollection.h
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+@class Connection;
+@class Database;
+
+@interface DatabasesArrayController : NSArrayController {
+
+}
+
+- (id)newObjectWithConn:(Connection *)conn name:(NSString *)name user:(NSString *)user password:(NSString *)password;
+- (void)clean:(Connection *)conn databases:(NSArray *)databases;
+- (BOOL)checkDuplicate:(Connection *) conn name:(NSString *)name;
+- (NSArray *)itemsUsingFetchPredicate:(NSPredicate *)fetchPredicate;
+- (Database *)dbInfo:(Connection *) conn name:(NSString *)name;
+@end
View
87 DatabasesArrayController.m
@@ -0,0 +1,87 @@
+//
+// DatabasesArrayCollection.m
+// MongoHub
+//
+// Created by Syd on 10-4-25.
+// Copyright 2010 MusicPeace.ORG. All rights reserved.
+//
+
+#import "DatabasesArrayController.h"
+#import "Connection.h"
+#import "Database.h"
+
+@implementation DatabasesArrayController
+
+- (void)awakeFromNib
+{
+ if ([NSArrayController instancesRespondToSelector:@selector(awakeFromNib)])
+ {
+ [super awakeFromNib];
+ }
+ [self setClearsFilterPredicateOnInsertion:NO];
+}
+
+- (id)newObjectWithConn:(Connection *) conn name:(NSString *)name user:(NSString *)user password:(NSString *)password
+{
+ id newObj = [super newObject];
+ [newObj setValue:conn forKey:@"connection"];
+ [newObj setValue:name forKey:@"name"];
+ [newObj setValue:user forKey:@"user"];
+ [newObj setValue:password forKey:@"password"];
+ //NSDate *now = [NSDate date];
+ //[newObj setValue:now forKey:@"createdDatetime"];
+ return newObj;
+}
+
+- (void)clean:(Connection *)conn databases:(NSArray *)databases
+{
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"connection=%@", conn];
+ NSArray *dblist = [self itemsUsingFetchPredicate:predicate];
+ for (Database *db in dblist) {
+ bool exist = false;
+ for (NSString *d in databases) {
+ if (db.name == d) {
+ exist = true;
+ break;
+ }
+ }
+ if (!exist) {
+ [super remove:db];
+ }
+ }
+}
+
+- (Database *)dbInfo:(Connection *) conn name:(NSString *)name
+{
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"connection=%@ AND name=%@", conn, name];
+ if ([[self itemsUsingFetchPredicate:predicate] count]>0) {
+ return [[self itemsUsingFetchPredicate:predicate] objectAtIndex:0];
+ }
+ return nil;
+}
+
+- (BOOL)checkDuplicate:(Connection *) conn name:(NSString *)name
+{
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"connection=%@ AND name=%@", conn, name];
+ if ([[self itemsUsingFetchPredicate:predicate] count]>0) {
+ return YES;
+ }else {
+ return NO;
+ }
+}
+
+- (NSArray *)itemsUsingFetchPredicate:(NSPredicate *)fetchPredicate
+{
+ NSError *error = nil;
+ NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
+ [request setEntity:[NSEntityDescription entityForName:[self entityName]
+ inManagedObjectContext:[self managedObjectContext]]];
+ NSArray *objects = [[self managedObjectContext]
+ executeFetchRequest:request error:&error];
+ if (error) {
+ NSLog(@"Fetch error! In AWViewPositionArrayController:itemsUseingFetchPredicate");
+ }
+ return [objects filteredArrayUsingPredicate:fetchPredicate];
+}
+
+@end
View
1,774 EditConnection.xib
@@ -0,0 +1,1774 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">1060</int>
+ <string key="IBDocument.SystemVersion">10D573</string>
+ <string key="IBDocument.InterfaceBuilderVersion">762</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="NS.object.0">762</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="1001">
+ <string key="NSClassName">EditConnectionController</string>
+ </object>
+ <object class="NSCustomObject" id="1003">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="1004">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSWindowTemplate" id="1005">
+ <int key="NSWindowStyleMask">15</int>
+ <int key="NSWindowBacking">2</int>
+ <string key="NSWindowRect">{{196, 240}, {353, 347}}</string>
+ <int key="NSWTFlags">544735232</int>
+ <string key="NSWindowTitle">Edit Connection</string>
+ <string key="NSWindowClass">NSWindow</string>
+ <nil key="NSViewClass"/>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ <object class="NSView" key="NSWindowView" id="1006">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextField" id="67757933">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{65, 267}, {166, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="439898299">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <object class="NSFont" key="NSSupport" id="331414289">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <string key="NSPlaceholderString">localhost</string>
+ <reference key="NSControlView" ref="67757933"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <object class="NSColor" key="NSBackgroundColor" id="20197699">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">textBackgroundColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="1027850759">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">textColor</string>
+ <object class="NSColor" key="NSColor" id="320782014">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="192239309">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 272}, {61, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="978724357">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Host</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="192239309"/>
+ <object class="NSColor" key="NSBackgroundColor" id="837390586">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="872321760">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <reference key="NSColor" ref="320782014"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="687256447">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 311}, {38, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="235274533">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Alias</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="687256447"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSButton" id="535974254">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{272, 19}, {66, 25}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="510279649">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Save</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="535974254"/>
+ <int key="NSButtonFlags">-2038152961</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSButton" id="317947487">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{190, 19}, {67, 25}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="373002755">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Cancel</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="317947487"/>
+ <int key="NSButtonFlags">-2038152961</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="728551703">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{65, 306}, {273, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="899217921">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <string key="NSPlaceholderString">localhost</string>
+ <reference key="NSControlView" ref="728551703"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="439810179">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{236, 272}, {38, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="473250053">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Port</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="439810179"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="397828869">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{279, 267}, {59, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="15862352">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <string key="NSPlaceholderString">27017</string>
+ <reference key="NSControlView" ref="397828869"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSButton" id="192380983">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{23, 227}, {128, 18}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="39264354">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Use SSH Tunnel</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="192380983"/>
+ <int key="NSButtonFlags">-936623617</int>
+ <int key="NSButtonFlags2">2</int>
+ <object class="NSCustomResource" key="NSNormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSSwitch</string>
+ </object>
+ <object class="NSButtonImageSource" key="NSAlternateImage">
+ <string key="NSImageName">NSSwitch</string>
+ </object>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSBox" id="974486977">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">12</int>
+ <string key="NSFrame">{{25, 218}, {313, 5}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <string key="NSOffsets">{0, 0}</string>
+ <object class="NSTextFieldCell" key="NSTitleCell">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Box</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <object class="NSColor" key="NSTextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
+ </object>
+ </object>
+ <int key="NSBorderType">3</int>
+ <int key="NSBoxType">2</int>
+ <int key="NSTitlePosition">0</int>
+ <bool key="NSTransparent">NO</bool>
+ </object>
+ <object class="NSTextField" id="323049007">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 195}, {92, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="744042504">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Bind Address</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="323049007"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="536100685">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{119, 190}, {112, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="83619286">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <string key="NSPlaceholderString">127.0.0.1</string>
+ <reference key="NSControlView" ref="536100685"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="257684037">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{236, 195}, {38, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="231502663">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Port</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="257684037"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="636345969">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{279, 190}, {59, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="357557126">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <string key="NSPlaceholderString">8888</string>
+ <reference key="NSControlView" ref="636345969"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="1021737732">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 150}, {92, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="619592540">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">SSH Host</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="1021737732"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="95969265">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{119, 148}, {112, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="549449150">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="95969265"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="340020746">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 114}, {92, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="12365007">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">SSH Username</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="340020746"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="837364992">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{119, 109}, {219, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="1059399721">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="837364992"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="324050016">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{22, 74}, {92, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="947277020">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">SSH Password</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="324050016"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSSecureTextField" id="468408808">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{119, 69}, {219, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSSecureTextFieldCell" key="NSCell" id="659565223">
+ <int key="NSCellFlags">343014976</int>
+ <int key="NSCellFlags2">272630848</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="468408808"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ <object class="NSArray" key="NSAllowedInputLocales">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="349183617">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{236, 150}, {38, 17}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="590184183">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Port</string>
+ <reference key="NSSupport" ref="331414289"/>
+ <reference key="NSControlView" ref="349183617"/>
+ <reference key="NSBackgroundColor" ref="837390586"/>
+ <reference key="NSTextColor" ref="872321760"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="615991638">
+ <reference key="NSNextResponder" ref="1006"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{279, 148}, {59, 22}}</string>
+ <reference key="NSSuperview" ref="1006"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="58763885">
+ <int key="NSCellFlags">-1804468671</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="331414289"/>
+ <string key="NSPlaceholderString">22</string>
+ <reference key="NSControlView" ref="615991638"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="20197699"/>
+ <reference key="NSTextColor" ref="1027850759"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{353, 347}</string>
+ <reference key="NSSuperview"/>
+ </object>
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
+ </object>
+ <object class="NSArrayController" id="112453544">
+ <bool key="NSEditable">YES</bool>
+ <bool key="NSAutomaticallyPreparesContent">YES</bool>
+ <object class="_NSManagedProxy" key="_NSManagedProxy">
+ <string key="NSEntityName">Connection</string>
+ </object>
+ <bool key="_NSIsUsingManagedProxy">YES</bool>
+ <bool key="_NSUsesLazyFetching">YES</bool>
+ <bool key="NSAvoidsEmptySelection">YES</bool>
+ <bool key="NSPreservesSelection">YES</bool>
+ <bool key="NSSelectsInsertedObjects">YES</bool>
+ <bool key="NSFilterRestrictsInsertion">YES</bool>
+ <bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">managedObjectContext: managedObjectContext</string>
+ <reference key="source" ref="112453544"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="112453544"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">managedObjectContext: managedObjectContext</string>
+ <string key="NSBinding">managedObjectContext</string>
+ <string key="NSKeyPath">managedObjectContext</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">connectionsArrayController</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="112453544"/>
+ </object>
+ <int key="connectionID">22</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1005"/>
+ </object>
+ <int key="connectionID">23</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="1005"/>
+ <reference key="destination" ref="1001"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">aliasTextField</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="728551703"/>
+ </object>
+ <int key="connectionID">64</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">hostTextField</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="67757933"/>
+ </object>
+ <int key="connectionID">65</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">hostportTextField</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="397828869"/>
+ </object>
+ <int key=