mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 09:09:28 +00:00
Added more handler stubs
This commit is contained in:
48
MacPass/MPRequestHandlerService.m
Normal file
48
MacPass/MPRequestHandlerService.m
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// MPRequestHandlerService.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 17.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPRequestHandlerService.h"
|
||||
#import "MPServerRequestHandler.h"
|
||||
#import "MPAssociateRequestHandler.h"
|
||||
#import "MPTestAssociateRequestHanlder.h"
|
||||
|
||||
//NSString *const MPRequestTypeAssociate = @"associate";
|
||||
//NSString *const MPRequestTypeTestAssociate = @"test-associate";
|
||||
NSString *const MPRequestTypeGetLogins = @"get-logins";
|
||||
NSString *const MPRequestTypeGetLoginsCount = @"get-logins-count";
|
||||
NSString *const MPRequestTypeGetAllLogins = @"get-all-logins";
|
||||
NSString *const MPRequestTypeSetLogin = @"set-login";
|
||||
NSString *const MPRequestTypeGeneratePassword = @"generate-password";
|
||||
|
||||
@implementation MPRequestHandlerService
|
||||
|
||||
+ (id<MPServerRequestHandler>)requestHandler:(NSString *)identifier {
|
||||
return [self requestHander][identifier];
|
||||
}
|
||||
|
||||
+ (NSDictionary *)requestHander {
|
||||
static NSDictionary *requestHandler;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
requestHandler = [[self _setupHandlerDictionary] retain];
|
||||
});
|
||||
return requestHandler;
|
||||
}
|
||||
|
||||
+ (NSDictionary *)_setupHandlerDictionary {
|
||||
MPAssociateRequestHandler *associateHandler = [[MPAssociateRequestHandler alloc] init];
|
||||
MPTestAssociateRequestHanlder *testAssociateHandler = [[MPTestAssociateRequestHanlder alloc] init];
|
||||
NSDictionary *handlerDict = @{
|
||||
[associateHandler identifier] : associateHandler,
|
||||
[testAssociateHandler identifier] : testAssociateHandler
|
||||
};
|
||||
[associateHandler release];
|
||||
return handlerDict;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user