This commit is contained in:
crusader 2017-08-03 20:29:24 +09:00
parent 7c45f214ff
commit 4f5f937901
30 changed files with 185 additions and 84 deletions

View File

@ -1,4 +1,4 @@
interface ApplicationStater { export interface ApplicationStater {
start(): void; start(): void;
} }

View File

@ -15,16 +15,16 @@ import {
ConfigurationAnnotation, ConfigurationAnnotation,
} from '@loafer/context/decorator/Configuration'; } from '@loafer/context/decorator/Configuration';
export class AppAnnotation extends ConfigurationAnnotation implements DecoratorHandler { export class ApplicationAnnotation extends ConfigurationAnnotation implements DecoratorHandler {
public constructor(qualifier?: PropertyType) { public constructor(qualifier?: PropertyType) {
super(qualifier); super(qualifier);
} }
public onClassDecorator = <TFunction extends Function>(clazz: Class, target: TFunction): TFunction | void => { public onClassDecorator = <TFunction extends Function>(clazz: Class, target: TFunction): TFunction | void => {
console.log('App'); console.log('Application');
} }
} }
export const App = Decorator.create(AppAnnotation); export const Application = Decorator.create(ApplicationAnnotation);
export default App; export default Application;

View File

@ -6,13 +6,6 @@ import ApplicationContext from '@loafer/context/ApplicationContext';
import Lifecycle from '@loafer/context/Lifecycle'; import Lifecycle from '@loafer/context/Lifecycle';
export interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle { export interface ConfigurableApplicationContext extends ApplicationContext, Lifecycle {
setId(id: PropertyType): void;
setEnvironment(environment: ConfigurableEnvironment): void;
getEnvironment(): ConfigurableEnvironment;
addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor): void;
addApplicationListener(ApplicationListener< ? > listener ): void;
refresh(): void;
getBeanFactory(): ConfigurableListablePouchFactory;
} }
export default ConfigurableApplicationContext; export default ConfigurableApplicationContext;

View File

@ -1,6 +1,9 @@
import AbstractApplicationContext from '@loafer/context/support/AbstractApplicationContext'; import AbstractApplicationContext from '@loafer/context/support/AbstractApplicationContext';
import PouchDefinitionRegistry from '@loafer/pouches/factory/support/PouchDefinitionRegistry';
export class GenericApplicationContext extends AbstractApplicationContext {
export class GenericApplicationContext extends AbstractApplicationContext implements PouchDefinitionRegistry {
} }

View File

@ -0,0 +1,8 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
export interface AliasRegistry {
}
export default AliasRegistry;

View File

@ -0,0 +1,15 @@
import {
ClassType,
PropertyType,
} from '@loafer/core/constants/types';
import Executable from '@loafer/core/reflect/Executable';
import Parameter from '@loafer/core/reflect/Parameter';
import Method from '@loafer/core/reflect/Method';
import Constructor from '@loafer/core/reflect/Constructor';
import Annotation from '@loafer/core/annotation/Annotation';
export class MethodParameter {
}
export default MethodParameter;

View File

@ -0,0 +1,11 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import AliasRegistry from '@loafer/core/AliasRegistry';
export class SimpleAliasRegistry implements AliasRegistry {
}
export default SimpleAliasRegistry;

View File

@ -1,11 +1,10 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import Environment from '@loafer/core/env/Environment'; import Environment from '@loafer/core/env/Environment';
export interface ConfigurableEnvironment extends Environment { export interface ConfigurableEnvironment extends Environment {
setActiveProfiles(...profiles: string[]): void;
addActiveProfiles(profile: string): void;
setDefaultProfiles(...profiles: string[]): void;
getSystemEnvironment(): Map<string, any>;
getSystemProperties(): Map<string, any>;
} }
export default Environment; export default Environment;

View File

@ -1,9 +1,10 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import PropertyResolver from '@loafer/core/env/PropertyResolver'; import PropertyResolver from '@loafer/core/env/PropertyResolver';
export interface Environment extends PropertyResolver { export interface Environment extends PropertyResolver {
getActiveProfiles(): string[];
getDefaultProfiles(): string[];
acceptsProfiles(...profiles: string[]): boolean;
} }
export default Environment; export default Environment;

View File

@ -1,7 +1,6 @@
import Environment from '@loafer/core/env/Environment'; import Environment from '@loafer/core/env/Environment';
export interface EnvironmentCapable { export interface EnvironmentCapable {
getEnvironment(): Environment;
} }
export default EnvironmentCapable; export default EnvironmentCapable;

View File

@ -1,6 +1,8 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
export interface PropertyResolver { export interface PropertyResolver {
containsProperty(key: string): boolean;
getProperty(key: string, defaultValue?: string): string;
} }
export default PropertyResolver; export default PropertyResolver;

View File

@ -0,0 +1,4 @@
export interface DisposablePouch {
}
export default DisposablePouch;

View File

@ -0,0 +1,8 @@
import {
ClassType,
} from '@loafer/core/constants/types';
export interface FactoryPouch<T> {
}
export default FactoryPouch;

View File

@ -1,7 +1,6 @@
import PouchFactory from '@loafer/pouches/factory/PouchFactory'; import PouchFactory from '@loafer/pouches/factory/PouchFactory';
export interface HierarchicalPouchFactory extends PouchFactory { export interface HierarchicalPouchFactory extends PouchFactory {
getParentBeanFactory(): PouchFactory;
} }
export default HierarchicalPouchFactory; export default HierarchicalPouchFactory;

View File

@ -1,9 +1,10 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import PouchFactory from '@loafer/pouches/factory/PouchFactory'; import PouchFactory from '@loafer/pouches/factory/PouchFactory';
export interface ListablePouchFactory extends PouchFactory { export interface ListablePouchFactory extends PouchFactory {
containsPouchDefinition(pouchName: string): boolean;
getPouchDefinitionCount(): number;
getPouchDefinitionNames(): string[];
} }
export default ListablePouchFactory; export default ListablePouchFactory;

View File

@ -0,0 +1,4 @@
export interface ObjectFactory<T> {
}
export default ObjectFactory;

View File

@ -7,26 +7,8 @@ import {
Class, Class,
} from '@loafer/core/reflect'; } from '@loafer/core/reflect';
interface PouchFactory { export interface PouchFactory {
/**
* @param name is identity of pouch
* @param type is type of pouch (if type is not specified, set the undefined)
* @param args are argument of target constructor
* @returns an instance of pouch
*/
getPouch(name: PropertyType, type: ClassType, ...args: any[]): any;
/**
* @param type is type of pouch
* @param qualifier is identity of pouch (if qualifier is not specified, set the undefined)
* @param args are argument of target constructor
* @returns an instance of pouch
*/
getPouchByType(type: ClassType, ...args: any[]): any;
containsPouch(name: string): boolean;
isSingleton(name: string): boolean;
isTransient(name: string): boolean;
getClass(name: string): Class;
} }
export default PouchFactory; export default PouchFactory;

View File

@ -0,0 +1,16 @@
import {
ClassType,
PropertyType,
} from '@loafer/core/constants/types';
import PouchFactory from '@loafer/pouches/factory/PouchFactory';
import HierarchicalPouchFactory from '@loafer/pouches/factory/HierarchicalPouchFactory';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
import SingletonPouchRegistry from '@loafer/pouches/factory/config/SingletonPouchRegistry';
import PouchExpressionResolver from '@loafer/pouches/factory/config/PouchExpressionResolver';
export interface ConfigurablePouchFactory extends HierarchicalPouchFactory, SingletonPouchRegistry {
}
export default ConfigurablePouchFactory;

View File

@ -5,16 +5,6 @@ import {
import PouchFactory from '@loafer/pouches/factory/PouchFactory'; import PouchFactory from '@loafer/pouches/factory/PouchFactory';
export interface InjectCapablePouchFactory extends PouchFactory { export interface InjectCapablePouchFactory extends PouchFactory {
createPouch(type: ClassType, injectMode?: number, dependencyCheck?: boolean): any;
injectPouch(existingPouch: any): void;
configureBean(existingBean: any, pouchName: PropertyType): any;
inject(type: ClassType, injectMode: number, dependencyCheck: boolean): any;
injectPouchProperties(existingPouch: any, injectMode: number, dependencyCheck: boolean): void;
applyPouchPropertyValues(existingPouch: any, pouchName: PropertyType): void;
initializePouch?(existingPouch: any, pouchName: PropertyType): any;
applyPouchPostProcessorsBeforeInitialization?(existingPouch: any, pouchName: PropertyType): any;
applyPouchPostProcessorsAfterInitialization?(existingPouch: any, pouchName: PropertyType): any;
destroyPouch(existingPouch: any): void;
} }
export default InjectCapablePouchFactory; export default InjectCapablePouchFactory;

View File

@ -0,0 +1,11 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import ConfigurablePouchFactory from '@loafer/pouches/factory/config/ConfigurablePouchFactory';
import Scope from '@loafer/pouches/factory/config/Scope';
export class PouchExpressionContext {
}
export default PouchExpressionContext;

View File

@ -0,0 +1,11 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import PouchExpressionContext from '@loafer/pouches/factory/config/PouchExpressionContext';
export interface PouchExpressionResolver {
}
export default PouchExpressionResolver;

View File

@ -0,0 +1,11 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import ObjectFactory from '@loafer/pouches/factory/ObjectFactory';
export interface Scope {
}
export default Scope;

View File

@ -1,14 +1,8 @@
import { import {
ClassType,
PropertyType, PropertyType,
} from '@loafer/core/constants/types'; } from '@loafer/core/constants/types';
interface SingletonPouchRegistry { export interface SingletonPouchRegistry {
registerSingleton(pouch: any, qualifier?: PropertyType): void;
getSingleton(qualifier: PropertyType, clazz?: ClassType): any;
getSingletonByClass(clazz: ClassType, qualifier?: PropertyType): any;
hasSingleton(qualifier: PropertyType, clazz?: ClassType): boolean;
hasSingletonByClass(clazz: ClassType, qualifier?: PropertyType): boolean;
} }
export default SingletonPouchRegistry; export default SingletonPouchRegistry;

View File

@ -1,20 +0,0 @@
import {
ClassType,
PropertyType,
} from '@loafer/core/constants/types';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
interface PouchDefinitionRegistry {
registerPouchDefinition(pouchDefinition: PouchDefinition): void;
removePouchDefinition(qualifier: PropertyType, clazz?: ClassType): void;
getPouchDefinition(qualifier: PropertyType, clazz?: ClassType): PouchDefinition;
hasPouchDefinition(qualifier: PropertyType, clazz?: ClassType): boolean;
removePouchDefinitionByClass(clazz: ClassType, qualifier?: PropertyType): void;
getPouchDefinitionByClass(clazz: ClassType, qualifier?: PropertyType): PouchDefinition;
hasPouchDefinitionByClass(clazz: ClassType, qualifier?: PropertyType): boolean;
}
export default PouchDefinitionRegistry;

View File

@ -0,0 +1,7 @@
import AliasRegistry from '@loafer/core/AliasRegistry';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
export abstract class AbstractInjectCapablePouchFactory extends AliasRegistry {
}
export default AbstractInjectCapablePouchFactory;

View File

@ -0,0 +1,7 @@
import AliasRegistry from '@loafer/core/AliasRegistry';
import FactoryPouchRegistrySupport from '@loafer/pouches/factory/support/FactoryPouchRegistrySupport';
export abstract class AbstractPouchFactory extends FactoryPouchRegistrySupport {
}
export default AbstractPouchFactory;

View File

@ -0,0 +1,7 @@
import AliasRegistry from '@loafer/core/AliasRegistry';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
export class DefaultListablePouchFactory extends AliasRegistry {
}
export default DefaultListablePouchFactory;

View File

@ -0,0 +1,14 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import SimpleAliasRegistry from '@loafer/core/SimpleAliasRegistry';
import ObjectFactory from '@loafer/pouches/factory/ObjectFactory';
import DisposablePouch from '@loafer/pouches/factory/DisposablePouch';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
import SingletonPouchRegistry from '@loafer/pouches/factory/config/SingletonPouchRegistry';
export class DefaultSingletonPouchRegistry extends SimpleAliasRegistry implements SingletonPouchRegistry {
}
export default DefaultSingletonPouchRegistry;

View File

@ -0,0 +1,14 @@
import {
ClassType,
PropertyType,
} from '@loafer/core/constants/types';
import AliasRegistry from '@loafer/core/AliasRegistry';
import FactoryPouch from '@loafer/pouches/factory/FactoryPouch';
import DefaultSingletonPouchRegistry from '@loafer/pouches/factory/support/DefaultSingletonPouchRegistry';
export abstract class FactoryPouchRegistrySupport extends DefaultSingletonPouchRegistry {
}
export default FactoryPouchRegistrySupport;

View File

@ -0,0 +1,10 @@
import {
PropertyType,
} from '@loafer/core/constants/types';
import AliasRegistry from '@loafer/core/AliasRegistry';
import PouchDefinition from '@loafer/pouches/factory/config/PouchDefinition';
export interface PouchDefinitionRegistry extends AliasRegistry {
}
export default AliasRegistry;