The following is a description of how the Job Processor loads Job Handlers (both Autodesk's and Third Party's) on start-up:
Third Party Job Handler Extensions
Each third party extension should exist in its own folder in the Extension Directory:
%allusersprofile%\Autodesk\Vault 2012\Extensions\
So, for example, if we had a job handler extension called "JobHandlerSample", it could reside in the directory %allusersprofile%\Autodesk\Vault 2014\Extensions\JobHandlerSample.
For each folder within Extension Directory, the Job Processor checks for a configuration file. The configuration file is a plain text file that can be named anything, but must end with the extension .vcet.config. If the configuration file does not exist, the extension will fail to load. Here are the contents of a sample config file, JobHandlerSample.vcet.config:
<configuration> <connectivity.ExtensionSettings2> <assembly>JobHandlerSample</assembly> <extensionType>JobProcessor</extensionType> </connectivity.ExtensionSettings2> </configuration>
The assembly element specifies the name of the extension dll. So, in our sample above, the extension dll is named JobHandlerSample.dll. The extension type of JobProcessor indicates that this is an extension for the job processor (other extension types can also live in this directory: WebService and VaultClient).
The extension assembly (in our sample, JobHandlerSample.dll) is now loaded. Upon loading the following checks are done:
namespace JobHandlerSample { public class JobHandlerSample : IJobHandler { public bool CanProcess(string strJobType) { return strJobType.Equals("jobhandlersample"); } public JobOutcome Execute(IJobProcessorServices context, IJob job) { return JobOutcome.Success; } } }
There must be exactly one public type in the assembly that implements IJobHandler. If this is not the case, then the extension will fail to load. An instance of this type is instantiated.
Job Handler Configuration
The Job Handler configuration file is an xml file containing configuration information for the Job Processor. It is located in the same directory as the JobProcessor.exe (usually C:\Program Files\Autodesk\Vault Professional [year]\Explorer) and is named JobProcessor.exe.config. The relevant section for configuration of Job Handlers is under configuration\connectivityExplorer\jobHandlers. In this xml section, each jobHandler element represents one Job Handler. The jobHandler xml elements are of the following form:
<jobHandler class="jobType" handler="NameOfTypeImplementingIJobHandler"/>
Where:
Thus, a valid jobHandler elment for our sample extension would be:
<jobHandler class="jobhandlersample" handler="JobHandlerSample.JobHandlerSample, JobHandlerSample"/>
In the JobProcessor.exe.config file, you'll notice that there is already a jobHandler entry for each of Autodesk's built-in Job Handlers. The built-in Job Handlers only get loaded in if there is an jobHandler entry existing for them. The built-in Job Handler dlls are located in the same directory as the JobProcessor.exe.
Check if Job Handlers are enabled
The configuration information above is used to associate a Job Type with a specific Job Handler. Once that is done, each Job Handler is asked if it can process it's specific Job Type. The Job Handler answers this question by implementing the interface method IJobHandler.CanProcess. It is at this time that the Job Handler should check if it has everything it needs to be able to process Jobs of its type (for example, some of the dwf creation job handlers check if Inventor is installed).
When you check which Job Types are currently processed by a Job Processor (by using the menu Administation->Job Types...), each entry listed means that a Job Handler for that Job Type loaded successfully. If the entry is checked, it indicates that the Job Handler is enabled (that is, it returned "true" from its IJobHandler.CanProcess implementation). In order to have the Job Processor re-ask a Job Handler if it "can process", the user would need to exit the Job Processor and start it up again.
Once all the Job Handlers have been loaded and queried, the Job Processor is ready to begin pulling jobs of the queue and processing them.
Sample Job Handler
Attached (below) is a sample Job Handler written in C#. It doesn't do anything useful (it pops up dialogs when the CanProcess and Execute methods are called), but can be used as a template for creating Job Handlers.