
This article is such a hack that I created a new category to mark the occasion. It goes without saying (but I’m going to say it anyway) that Autodesk isn’t going to provide support for what I’m about to say.
In talking with people about various Vault customizations, I find that sometimes it would be useful to get at functionality provided by a job handler. For example, you want to create a DWF. Theoretically, it should be possible to call directly into the DWF create job handler, so I decided to play around a bit and see if I could get it working for real.
Before I go into the details, let’s get abstract. Plug-in architectures usually follow the same pattern. There is the the hosting app, the plug-in and an interface connecting the two. Each side is not supposed to care about what’s on the other side of the interface.
My test app takes advantage of that abstraction. The DWF handler, for example shouldn’t care if it’s running inside Job Processor or not. The handler just processes jobs. So all I need to do is pretend to be the job processor. I load the handler, create the DWF create job, pass it to the handler, and get a DWF file as a result.... in theory.
My test app
The first step is to figure out which DLL to load. Looking at JobProcessor.exe.config, I see a bunch of <jobHandler> elements, which tell me which job types are handled by which classes. For this example, I decided to create DWF files. The .config file tells me that they are all handled by the class “Connectivity.Explorer.JobHandlerDwfPublish.InventorDwfJobHandler” in the assembly “Connectivity.Explorer.JobHandlerDwfPublish”. So let’s load Connectivity.Explorer.JobHandlerDwfPublish.dll using the System.Reflection libraries.
// load the assembly
Assembly assembly = Assembly.LoadFile(
System.IO.Path.Combine(EXPLORER_FOLDER,
"Connectivity.Explorer.JobHandlerDwfPublish.dll"));
// create a new handler object
IJobHandler handler = assembly.CreateInstance(
"Connectivity.Explorer.JobHandlerDwfPublish.InventorDwfJobHandler",
true, BindingFlags.CreateInstance, null, null, null, null)
as IJobHandler;
|
Now I have the IJobHandler object, I need to pass in an IJob (which tells the handler which operation to run on which file) and an IJobProcessorServices (which provides context information). The IJobProcessorServices class was pretty easy to implement just by looking at the interface. For the IJob implementation, I needed to figure out what the parameter list was. I found this out by queuing up a DWF job from the Vault client. Then I used the API to see what the parameters were on the job.
// create the context
IJobProcessorServices context = new JobContext(
vaultName, mgr.SecurityService.SecurityHeader.UserId,
mgr.SecurityService.SecurityHeader.Ticket,
uri);
// create the job
IJob job = new DwfJob(vaultName, partFile.Id);
// run the job
handler.Execute(context, job);
|
Click here to download the entire project
Results
So did the app actually work? Yes and no. At first, my app was a stand-alone EXE. The app would always fail when running the Execute command. Remember how, in theory, the handler shouldn’t care about the hosting app? That’s not true for the DWF handler. It definitely cares about the app context and refuses to run if the environment hasn’t been initialized properly.
My next attempt was to run it as a custom Vault Explorer command. The idea is that Vault Explorer will perform whatever operation is needed to make the job handler happy. My command actually worked. There is brief dialog that pops up and disappears during the Execute. But otherwise, it runs as expected.
I have no idea if SyncProperties or UpdateRevisionBlock handlers will work with this hack.

An Introvert’s Guide to AU
I’m pretty much what you expect from a professional programmer. I have all 7 seasons of Star Trek: TNG on DVD. I play computer games long into the night. And when it comes to people, my official policy is “no thanks”. I can write code for 8 hours solid without any problems. But put me in a group of people and ask me to mingle, and I’m burnt out within an hour.
In a few weeks, I’ll be going to my 5th Autodesk University conference. Here are some of the techniques I’ve picked up over the years to cope. Don’t get me wrong, I love AU. I just don’t ease through the conference like my extrovert co-workers.
Be a Wallflower
If you are a regular attendee, you can quietly slip into the background. Attend the classes you care about, visit the exhibit hall, watch a few sales pitches, and you’re done. Despite the crowds of people, you can remain fairly anonymous. The only thing is to make sure that you don’t miss out on anything important. If you have a question about something, make sure to hunt down the right people and get the answers you need.
For my first AU, I was able to mostly get away with this technique, but those days are over. This year I’m presenting two lectures, co-presenting one lecture, presenting at ADN DevDays, providing support for ADN DevLab, and manning both the Vault and PLM 360 booths. Also there are about a dozen contacts, inside and outside of Autodesk, that I need to hook up with while I’m there. There is no way for me to slip into the background. So, I’ve had to come up with some new techniques.
Alcohol
Just about every AU event has a generous supply of alcohol. I find that one or two beers really takes the edge off. Of course, you must know and respect your limits. There is nothing more pathetic than getting bombed and making a fool of yourself at a software convention.
I have to represent Autodesk, so my limit is pretty low. I also make sure to balance things out with food, of which there is also a generous supply at AU. Remember, this is a marathon. Pacing is everything.
Tablets and Smartphones
For us introverts, mobile devices are probably the best inventions of all time. If you are at a table full of people, you can just pull out your phone and start playing away. You are not being rude; you are working! Also, about half the people at the table will also be busy on devices too, so you won’t even look out of place. These devices are turning everyone into introverts. I guess we really will be inheriting the Earth.
Get Enough Sleep and Food
Social situations are exhausting enough, you don’t need to make it worse by being hungry or tired. The goal here is to make everything as confortable as possible to counter-balance any social discomfort. If I know I’m in for a busy day, I usually pay for the full breakfast at the hotel restaurant instead of the free conference breakfast. It’s worth the money to insure that I can perform better.
Posted at 09:51 AM in Commentary | Permalink | Comments (2) | TrackBack (0)
Tweet This! |