MEF for dynamic load of process definitions

MEF for dynamic load of process definitions

We have an application comprised of several parts:

  • ModelBuilder: domain model that allows the building of ProcessDefinitions (Activities, gateways, events, etc.) and Tasks.
  • Concrete ProcessDefinitions: collections of ProcessDefinitions that solve certain business. Each assembly contains a collection of concrete ProcessDefinitions, Tasks, etc.
  • Runtime: we would like it to load dynamically the assemblies containing Concrete ProcessDefinitions and be able to find them through a simple service, FindProcessDefinition(proceedingId,versionPolicy), which would look in all the Concrete ProcessDefinition parts. ProcessDefinition must be cached/singleton.

Do you think MEF could be the way to go with this problem? I have seen examples of MEF but they are used to implement interfaces, not for this "build" pattern.

Any hint of how to do it? Any other alternative? Thanks.

Answers


If your concrete processdefinitions and the builders that instantiate those classes do not have a common interface then MEF doesn't seem the correct tool (imo).

Perhaps you could have the builders each implement a common interface. But then each concrete process definition would also need a common interface. That does not seem to be the case. In your code you don't do:

new ConcreteProcessDefinition1.run() 

and

new ConcreteProcessDefinition2.run(), 

In your code you do something like

ConcreteProcessDefinition1.doXYZ(input1, input2)

and

ConcreteProcessDefinition2.doSomethingTotallyDifferent(input3)

Why do you need to dynamically load the process definitions? Will your clients (who don't have access to your source code) create process definitions?


Need Your Help

Creating 3 level subquery Propel

php mysql symfony propel

Hi guys I would like to ask if anyone of you know how to create a select statement in propel using a 3 level subquery... Initially I have this query and it works fine but I want it to be more like ...

How to write a robust, customizable app for executing tasks on files?

java dependency-injection robustness

I want to write a program that will run recursively through a given input directory and will execute pre-defined tasks on what it encounters into.