Introduction to Vault Programming Doug Redmond Software Engineer, Autodesk Inc. © 2011 Autodesk About the Speaker Doug Redmond has been a software engineer for Autodesk for almost 12 years. In that time, he has worked on three separate product lines: Streamline, Vault and Productstream Professional. He has worked on Vault for over 7 years, developing features and overseeing the APIs. Doug has put together every version of the Vault SDK and written most of the sample applications. Doug is the author of “It’s All Just Ones and Zeros” which is a blog on Vault API development. Check it out at http://justonesandzeros.typepad.com/ © 2011 Autodesk Class Overview Overview of the Vault Architecture Examples Customization Areas Server Communication Vault Explorer Customization Job Server Customization Business Logic Customization Development Rules Further Information © 2011 Autodesk About the Video The class contains 90 minutes of content, broken up into two 45 minute videos. Part 1 ends after 45 minutes and Part 2 will pick up right where Part 1 left off. Feel free to follow along in your own development environment if you want. The video is recorded at 1280x720. View at full resolution in order to see the source code samples properly. © 2011 Autodesk Learning Objectives At the end of this class, you will be able to: Describe the areas that can be customized in Vault. Describe the basic architecture of the Vault Create simple Vault customizations. Locate information on more advanced Vault customization topics. © 2011 Autodesk Class Requirements You should have some programming background. You should be familiar with the Vault 2012 product line. © 2011 Autodesk Overview © 2011 Autodesk Vault Architecture © 2011 Autodesk Areas of Customization Vault consists of many pieces. Some can be customized, some cannot. Here are the things you can do at a high level. Server Communication: Open your own connection to the server for getting data, setting data and running server operations. Vault Explorer Customization: Add your own commands and tab views to Vault Explorer. Job Server Customization: Add your own job types and custom job handlers. Business Logic Customization: Extend existing commands via pre and post events. © 2011 Autodesk Examples © 2011 Autodesk Example – SharePoint 2010 Integration Provides view of live Vault data with a SharePoint front end. Data is not replicated in SharePoint. Instead the Vault data is pulled down on-demand. Vault data is translated to native SharePoint objects. These objects can be manipulated via standard SharePoint mechanisms, such as XSL and web parts. This integration is available through the Autodesk reseller channel. © 2011 Autodesk Example – Middleware Connects Vault and another system, such as SAP, SharePoint, or a proprietary system. Common features include: Push data to external system based on a Vault operation. For example, a file has been moved into the Released state. Push/pull data from external system into Vault. Synchronization of data between the two systems. Bulk loading of data from another system. Middleware is usually highly customized and tailored to a specific customer. Services available from Autodesk Consulting and resellers. © 2011 Autodesk Example – Drawing Compare Compares two versions of a drawing in Vault or two separate drawings entirely. Uses a custom command to launch the task. The two files are then downloaded from Vault and compared using Design Review. This app is available as free download: http://JustOnesAndZeros.typepad.com/ © 2011 Autodesk Example – Effective Folder Permissions Provides a summary view detailing each user’s permission for a given folder. Uses a custom command to launch the UI. Gathers server data to provide an alternate view. Can display multiple folders in a single view. The folders in the view is configurable. Provides a list of all the administrators on the system. This app is available as free download: http://JustOnesAndZeros.typepad.com/ © 2011 Autodesk Example – Middleware Middleware is a broad term for software that connects together 2 or more systems. Common features include: Push data to external system based on a Vault operation. For example, a file has been moved into the Released state. Push/pull data from external system into Vault. Synchronization of data between the two systems. Bulk loading of data from another system. Middleware is usually highly customized and tailored to a specific customer. Services are available from Autodesk Consulting and resellers. © 2011 Autodesk Server Communication © 2011 Autodesk Server Communication All server communication is handled by a series of web services. Web Services: A cross-platform standard for making server requests. Data is transferred as XML data over HTTP. Recommended entry point are the .NET DLLs in the Vault SDK. © 2011 Autodesk Server Communication Aspects of the Vault web services: Everything is done by calling a function. Functions are grouped into separate collections based on functionality and product level. Each collection is a service. Each function call is autonomous and transacted. Authentication is required for most function calls. Objects contain structured data only, no methods. So this is not a true Object Oriented environment. © 2011 Autodesk Server Communication There are 17 total web services over the 4 products • Vault • • • • • • • • • • Admin Service Behavior Service Category Service Document Service Information Service Knowledge Vault Service Property Service Replication Service Revision Service Security Service • Vault Workgroup • Document Service Extensions • Job Service • Vault Collaboration • • Win Auth Service Vault Professional • Change Order Service • Forum Service • Item Service • Package Service © 2011 Autodesk Server Communication Requirements for writing a customization: Vault Server 2012 Vault 2012 SDK Visual Studio Microsoft Web Service Extensions (WSE) 3.0 http://download.microsoft.com/ © 2011 Autodesk Demo – SDK Tour © 2011 Autodesk Demo – Vault List © 2011 Autodesk Vault Explorer Customization © 2011 Autodesk Vault Explorer Customization © 2011 Autodesk Vault Explorer Customization • Available in all Vault products except base Vault. • Add-ons are .NET DLLs. • Custom content can do anything that .NET DLLs can do. For example: • • • • • • Custom UI, dialogs, etc. Connect to external database Make use of other APIs (ex. Inventor Apprentice) Loading COM controls (via Interop) WPF Supports any .NET language (C#, VB.NET) © 2011 Autodesk Vault Explorer Customization • Custom commands and tabs have access to… • The security context • The selected object(s) in each view pane • Events • • • • • • • • OnStartup OnShutdown OnLogOn OnLogOff CommandBegin CommandEnd Execute (for custom commands) SelectionChanged (for custom tab views) © 2011 Autodesk Vault Explorer Customization You can determine which menus, context-menus and toolbars your commands are deployed to. You can create sub-menus. You determine the context where your commands are visible. (ex. Files, Items, Change Orders) You have the option of running a refresh when your custom command completes. Existing commands can be hidden allowing you to re-write the default behavior. © 2011 Autodesk Vault Explorer Customization Your customizations are isolated from other Vault Explorer commands/views/features. No way to modify other commands, other than to hide them or add pre and post operations. No way to launch other commands. No way to select items, change views, etc. © 2011 Autodesk Vault Explorer Customization Writing a customization Requirements: Vault Workgroup/Collaboration/Professional 2012 Client Vault SDK Visual Studio © 2011 Autodesk Demo – Hello World © 2011 Autodesk Job Server Customization © 2011 Autodesk Job Server Customization Allows you to create your own job types and the handlers for those job types. © 2011 Autodesk Job Server Customization Job Server feature: Vault Workgroup/Collaboration/Professional has the ability to distribute work through the use of a centralized queue. A Job is an item in the queue, and it represents a well-defined unit of work. The queue is maintained by the Vault server. Interaction with the queue is through the web services. JobProcessor.exe is an application for hosting Job Handlers. © 2011 Autodesk Job Server Customization What does a job look like? class IJob { Long Id; { get; } String VaultName; { get; } String JobType; { get; } String Description; { get; } System.Collections.Generic.Dictionary<String, String> Params; { get; } } JobType is a string indicating what task needs to be handled. A Job Handler is configured to handle certain Job Types, which allows JobProcessor to route the jobs to the correct handlers. There is no enforced structure of the string, but it’s recommended to prefix your company name to any job types. © 2011 Autodesk Job Server Customization What does a job look like? class IJob { Long Id; { get; } String VaultName; { get; } String JobType; { get; } String Description; { get; } System.Collections.Generic.Dictionary<String, String> Params; { get; } } Params is a collection of Name=Value pairs that provide extra information about the task. There is no fixed set of parameters; it’s dependant on the Job Type. In other words, interpretation is the responsibility of the queuing and processing clients © 2011 Autodesk Job Server Customization Creating an add-in to JobProcessor.exe via the API is the recommended way of handling custom jobs. • • • Add-ons are .NET DLLs. Custom content can do anything that .NET DLLs can do. However there should be no UI. Supports any .NET language (C#, VB.NET). © 2011 Autodesk Demo – Job Sample © 2011 Autodesk Job Server Customization Job Server aspects The Vault server will allow you to add a job to the queue even if there are no handlers for that type. It’s up to the Vault administrator to insure that Job Providers match Job Handlers. Otherwise the queue will fill up with Jobs that can’t be handled. There is no guarantee when or where a Job will get handled. Order is not guaranteed either. If job A goes on the queue before B, that doesn’t mean A will get handled first. If you want to guarantee order, you can program the A handler to add the B job. © 2011 Autodesk Job Server Customization Technically Job Server is really a client from the point of view of ADMS. Conceptually, job handling is considered a server-side task. © 2011 Autodesk Business Logic Customization © 2011 Autodesk Business Logic Customization Special web service calls will fire events that custom code can hook into. Features: Ability to do operations before and after a web service call Ability to block web service calls before they get sent to the server Hook into all Vault clients on a given machine © 2011 Autodesk Business Logic Customization Event types: GetRestrictions – Allows custom code to block the web service call. Pre – Allows custom code to run before the web service call. Post – Allows custom code to run after the web service call. GetRestrictions Pre Web Service call Post © 2011 Autodesk Business Logic Customization Here is a table of all the web service commands. Command Files Folders Items Add Delete Reserve for Update Commit Update Yes Yes Yes Yes Yes N/A Yes Yes Yes Change Orders Yes Yes Yes Yes N/A Yes Yes Change Lifecycle Yes N/A Yes Yes Additionally you can respond to File Download events and Item Promote events. © 2011 Autodesk Business Logic Customization • Available in all Vault products except base Vault. • Event handlers are .NET DLLs. • Custom content can do anything that .NET DLLs can do. However, UI is discouraged since you don’t know what context you are running in. • Supports any .NET language (C#, VB.NET) © 2011 Autodesk Demo – Business Logic Customization © 2011 Autodesk Development Rules © 2011 Autodesk Licensing for “free” Vault Vault is not free. Vault licenses are client based. The client must be licensed in order to connect to the Vault Server. A qualifying CAD product must be installed on the same computer as a Vault client. See readme for a list of qualifying products. The API should not be used to give Vault access to users without a Vault license. © 2011 Autodesk Licensing for Vault pay products Vault Workgroup, Collaboration and Professional use network licensing. No CAD requirement. Anyone can use as long as there are free licenses. The server manages the licenses. Licenses are homogeneous. For example, signing in to a Vault Collaboration server will always consume a Collaboration license. A license is always consumed on a regular sign in, even if the client is just doing “base Vault” operations. © 2011 Autodesk Licensing for Vault pay products A license is consumed as soon as you sign in. The license is freed when you sign out. After 30 minutes of no API calls, the server automatically logs out. If you have multiple connections with the same user name on the same computer (ex. Inventor and Vault Explorer running at the same time), only 1 license is consumed. If you have multiple connections with different user names, each connection consumes a separate license. There is an option to sign in as read only. This will not consume a license. Base Vault still requires a qualifying CAD app, even for a read only sign in. © 2011 Autodesk Off-Limits Areas Modification of the following areas will result in the install being considered corrupt by Autodesk. Both ADN and Autodesk Support will provide NO ASSISTANCE to an install with these types of modifications. Off Limits Areas: • Database • File Store © 2011 Autodesk Further Information © 2011 Autodesk Further Information Vault SDK: [Vault client/server install]\SDK Vault customization blog: http://justonesandzeros.typepad.com/ Autodesk Developer Network: http://www.autodesk.com/adn Vault API discussion group: http://forums.autodesk.com/t5/Autodesk-Vault-Customization/bd-p/301 © 2011 Autodesk Shameless Plug It’s All Just Ones and Zeros is the best thing in the history of ever! http://JustOnesAndZeros.typepad.com/ In-depth API articles A new sample app each month (with source code) Videos Webcasts Weekly updates Announcements © 2011 Autodesk Autodesk, AutoCAD* [*if/when mentioned in the pertinent material, followed by an alphabetical list of all other trademarks mentioned in the material] are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2011 Autodesk, Inc. All rights reserved. © 2011 Autodesk