J
Julia
Hi
I have a domain model and I am looking for the correct design patterns to
use,
The following is my domain model
Server->[Manager->MessagingService->Processors]
the [] is the thread boundaries,the server create a thread
the Thread create the Manager ,the Manager create the MessagingService and
the MessagingService can create several types of processor, different type
of each message
The messaging service is created using reflection since my server can use
two types:
1. SMTPMessagingService
2. EXChangeMessagingService
my main aim is to be able to exchange the MessagingService without compile
the application
The problem which I faces is that both MessagingService and Processor object
need a different set of properties depend upon the messaging service which
was installed
currently I am passing an IApplicationContext down the model
hierarchy ,the AppContext concrete class contains a collection of
properties to be used by the MessagingService,
the collection is just a hash table and it is not strong type
when I am installed a new MessagingService I add a new set of properties to
the data base
another options that I have is to add to the IApplicationContext abstract
factories which allow sub component to create
a concrete class and set each concrete class's properties
this method will required me to create a concrete ApplicationContext for
each type of
MessagingService(I don't mind to do so)
but I don't know how would I notify a sub component that one of its
property was changed?
I can't see how observer can be used here? and if so
would it be a good idea to use the observer pattern for each layer
in such a way that a processor will observe changes in the
MesagingService only,
the MessagingSerice will observe changes in the manager etc.....
even though the properties are being changed in the server layer the
lowest compoent will not directly observe the server
another question that I have in mind is where is the best place in the
domain hierarchy to implement a concrete factory
for example when the MessagingService want
to create a Processor it can be used a factory which is implemented by the
Manager
or by Server
using a factory from the manager decouple the processor from higher layers
but the Server layer have the greatest knowledge on how to create a
processor..
Thanks in advance
I have a domain model and I am looking for the correct design patterns to
use,
The following is my domain model
Server->[Manager->MessagingService->Processors]
the [] is the thread boundaries,the server create a thread
the Thread create the Manager ,the Manager create the MessagingService and
the MessagingService can create several types of processor, different type
of each message
The messaging service is created using reflection since my server can use
two types:
1. SMTPMessagingService
2. EXChangeMessagingService
my main aim is to be able to exchange the MessagingService without compile
the application
The problem which I faces is that both MessagingService and Processor object
need a different set of properties depend upon the messaging service which
was installed
currently I am passing an IApplicationContext down the model
hierarchy ,the AppContext concrete class contains a collection of
properties to be used by the MessagingService,
the collection is just a hash table and it is not strong type
when I am installed a new MessagingService I add a new set of properties to
the data base
another options that I have is to add to the IApplicationContext abstract
factories which allow sub component to create
a concrete class and set each concrete class's properties
this method will required me to create a concrete ApplicationContext for
each type of
MessagingService(I don't mind to do so)
but I don't know how would I notify a sub component that one of its
property was changed?
I can't see how observer can be used here? and if so
would it be a good idea to use the observer pattern for each layer
in such a way that a processor will observe changes in the
MesagingService only,
the MessagingSerice will observe changes in the manager etc.....
even though the properties are being changed in the server layer the
lowest compoent will not directly observe the server
another question that I have in mind is where is the best place in the
domain hierarchy to implement a concrete factory
for example when the MessagingService want
to create a Processor it can be used a factory which is implemented by the
Manager
or by Server
using a factory from the manager decouple the processor from higher layers
but the Server layer have the greatest knowledge on how to create a
processor..
Thanks in advance