This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from mark-burnett/remove-command-base
Remove CommandBase
- Loading branch information
Showing
8 changed files
with
37 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
16 changes: 10 additions & 6 deletions
16
ptero_petri/implementation/configuration/inject/initialize.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
from ..configuration.inject.broker import BrokerConfiguration | ||
from ..configuration.inject.redis_conf import RedisConfiguration | ||
from ..configuration.inject.service_locator import ServiceLocatorConfiguration | ||
from .handlers import PetriCreateTokenHandler | ||
from .handlers import PetriNotifyPlaceHandler | ||
from .handlers import PetriNotifyTransitionHandler | ||
from .service_command import ServiceCommand | ||
import logging | ||
from injector import inject | ||
from ptero_petri.implementation import interfaces | ||
from ptero_petri.implementation.orchestrator.handlers import PetriCreateTokenHandler | ||
from ptero_petri.implementation.orchestrator.handlers import PetriNotifyPlaceHandler | ||
from ptero_petri.implementation.orchestrator.handlers import PetriNotifyTransitionHandler | ||
|
||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
class OrchestratorCommand(ServiceCommand): | ||
injector_modules = [ | ||
BrokerConfiguration, | ||
RedisConfiguration, | ||
ServiceLocatorConfiguration, | ||
] | ||
|
||
def _setup(self, *args, **kwargs): | ||
self.handlers = [ | ||
self.injector.get(PetriCreateTokenHandler), | ||
self.injector.get(PetriNotifyPlaceHandler), | ||
self.injector.get(PetriNotifyTransitionHandler) | ||
] | ||
|
||
return ServiceCommand._setup(self, *args, **kwargs) | ||
@inject(storage=interfaces.IStorage, broker=interfaces.IBroker, | ||
create_token_handler=PetriCreateTokenHandler, | ||
notify_place_handler=PetriNotifyPlaceHandler, | ||
notify_transition_handler=PetriNotifyTransitionHandler) | ||
class OrchestratorCommand(object): | ||
def __init__(self): | ||
self.broker.register_handler(self.create_token_handler) | ||
self.broker.register_handler(self.notify_place_handler) | ||
self.broker.register_handler(self.notify_transition_handler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
ptero_petri/implementation/orchestrator/service_command.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters