FRAApplicationAssembly.m revision 6d34df76ea55353d972de9caf3585e04714b2780
0N/A/*
0N/A * The contents of this file are subject to the terms of the Common Development and
0N/A * Distribution License (the License). You may not use this file except in compliance with the
0N/A * License.
0N/A *
0N/A * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
0N/A * specific language governing permission and limitations under the License.
0N/A *
0N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include
0N/A * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
0N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying
0N/A * information: "Portions copyright [year] [name of copyright owner]".
0N/A *
0N/A * Copyright 2016 ForgeRock AS.
0N/A */
0N/A
0N/A#import "FRAAccountsTableViewController.h"
0N/A#import "FRAAccountTableViewController.h"
0N/A#import "FRAApplicationAssembly.h"
0N/A#import "FRADatabaseConfiguration.h"
0N/A#import "FRAFMDatabaseFactory.h"
0N/A#import "FRALAContextFactory.h"
0N/A#import "FRAIdentityDatabase.h"
0N/A#import "FRAIdentityDatabaseSQLiteOperations.h"
0N/A#import "FRAIdentityModel.h"
0N/A#import "FRAMechanismReaderAction.h"
0N/A#import "FRAMessageUtils.h"
0N/A#import "FRANotificationGateway.h"
0N/A#import "FRANotificationHandler.h"
0N/A#import "FRANotificationViewController.h"
0N/A#import "FRAOathMechanismFactory.h"
0N/A#import "FRAPushMechanismFactory.h"
0N/A#import "FRAQRScanViewController.h"
0N/A#import "FRAFMDatabaseConnectionHelper.h"
0N/A#import "FRAUriMechanismReader.h"
0N/A
0N/A@implementation FRAApplicationAssembly
0N/A
0N/A- (FRAAccountsTableViewController *)accountsTableViewController {
0N/A return [TyphoonDefinition withClass:[FRAAccountsTableViewController class] configuration:^(TyphoonDefinition *definition) {
0N/A [definition injectProperty:@selector(identityModel) with:[self identityModel]];
}];
}
- (FRAFMDatabaseConnectionHelper *)databaseConnectionHelper {
return [TyphoonDefinition withClass:[FRAFMDatabaseConnectionHelper class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithConfiguration:databaseFactory:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[[FRADatabaseConfiguration alloc] init]];
[initializer injectParameterWith:[[FRAFMDatabaseFactory alloc] init]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRAIdentityDatabase *)identityDatabase {
return [TyphoonDefinition withClass:[FRAIdentityDatabase class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithSqlOperations:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self identityDatabaseSQLiteOperations]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRAIdentityDatabaseSQLiteOperations *)identityDatabaseSQLiteOperations {
return [TyphoonDefinition withClass:[FRAIdentityDatabaseSQLiteOperations class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithDatabase:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self databaseConnectionHelper]];
}];
}];
}
- (FRAIdentityModel *)identityModel {
return [TyphoonDefinition withClass:[FRAIdentityModel class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithDatabase:sqlDatabase:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self identityDatabase]];
[initializer injectParameterWith:[self databaseConnectionHelper]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRAMechanismReaderAction *)mechanismReaderAction {
return [TyphoonDefinition withClass:[FRAMechanismReaderAction class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithMechanismReader:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self uriMechanismReader]];
}];
}];
}
- (FRANotificationGateway *)notificationGateway {
return [TyphoonDefinition withClass:[FRANotificationGateway class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithHandler:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self notificationHandler]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRANotificationHandler *)notificationHandler {
return [TyphoonDefinition withClass:[FRANotificationHandler class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithDatabase:identityModel:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self identityDatabase]];
[initializer injectParameterWith:[self identityModel]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRANotificationViewController *)notificationViewController {
return [TyphoonDefinition withClass:[FRANotificationViewController class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(authContextFactory) with:[[FRALAContextFactory alloc] init]];
}];
}
- (FRAOathMechanismFactory *)oathMechanismFactory {
return [TyphoonDefinition withClass:[FRAOathMechanismFactory class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(init)];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRAPushMechanismFactory *)pushMechanismFactory {
return [TyphoonDefinition withClass:[FRAPushMechanismFactory class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithGateway:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self notificationGateway]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
- (FRAQRScanViewController *)qrScanViewController {
return [TyphoonDefinition withClass:[FRAQRScanViewController class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(mechanismReaderAction) with:[self mechanismReaderAction]];
}];
}
- (FRAUriMechanismReader *)uriMechanismReader {
return [TyphoonDefinition withClass:[FRAUriMechanismReader class] configuration:^(TyphoonDefinition *definition) {
[definition useInitializer:@selector(initWithDatabase:identityModel:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self identityDatabase]];
[initializer injectParameterWith:[self identityModel]];
}];
[definition injectMethod:@selector(addMechanismFactory:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self oathMechanismFactory]];
}];
[definition injectMethod:@selector(addMechanismFactory:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:[self pushMechanismFactory]];
}];
definition.scope = TyphoonScopeSingleton;
}];
}
@end