Partager via


Sample Eclipse plug-in for SQL Server Modeling Services

I have developed a sample Eclipse plug-in that uses one of the utilities in SQL Server Modeling Services (SSMoS). Yes, it is just an experiment and NOT a shipping sample or code as part of SSMoS (not yet anyways – Microsoft has an ongoing initiative to make its products more open and has shipped Eclipse Tools for Silverlight).

Context

As a developer you may not be interested in leaving your favorite IDE to interact with another database. Or if you are an IT manager, you may not be interested in using same tools as developers to perform business intelligence over the software application lifecycle data. With SQL Server Modeling Services, we encourage ISVs to integrate with a SSMoS database from the tools targeted for the end users in software application lifecycle. For example, as an ISV building a Model-Driven Development Toolset or a Business Process Management System, even if you want to leverage the common application lifecycle schemas provided my Microsoft for software assets, you may want to abstract the data access from your end users to give them a seamless experience. ISVs can build application lifecycle tool specific plug-ins so their users interact with the database without having to leave the tool they love to use.

Let’s take a hypothetical scenario in the context of a hypothetical Contoso Bank. The IT development organization in Contoso Bank has a central architecture group that is responsible for defining common data and architectural models for the systems development projects in the enterprise. This group uses IBM Rational Software Architect (RSA) to do their modeling. In particular, many folks in this group like to use Unified Modeling Language (UML) as a software modeling language to design various aspects of a system. At times, they also apply various specific UML Profiles (such as UML Profile for Business Process or UML Profile for Software Service) on the UML models, so certain tools can process these models to transform them to another implementation technology. The software projects in Contoso use a mix of .NET and Java. The java developers use IBM Rational Software Developer (RSD) and the .NET developers use Visual Studio (VS) to develop the software applications for Contoso’s business needs. During the software analysis and design phase, the solution architects can publish the system models from IBM RSA to the SSMoS database for consumption by .NET developers. The following picture depicts the high level use case.

In this scenario there are three plug-ins required:

1) A VS plug-in that allows a VS user to publish a UML model developed in VS to the SSMoS database

2) An IBM RSA plug-in that allows the user to publish a UML model developed in RSA to the SSMoS database

3) A VS plug-in that allows a VS users to browse, search and use a UML model from the SSMoS database

VS Architect Tooling team at Microsoft can choose to develop plug-ins that provide good user experience for publishing and consuming UML artifacts from SSMoS database, if they find the scenario compelling. VS 2010 has 5 UML diagram designers: UML Class Diagram, UML Use Case Diagram, UML Sequence Diagram, UML Activity Diagram and UML Component Diagram. Dave Langer, who is the PM for UML model in SSMoS team, is working closely with VS Architect Tooling team to do next level of planning there. Other tool vendors can also build SSMoS plug-ins for their tools. (Hint: Is anyone interested in creating models for java-based assets and SSMoS plug-ins for Eclipse? J)

My experience building an Eclipse plug-in

So, I developed a bare bone Eclipse plug-in as a sample!! I do not consider myself to be a very strong developer and it’s been many years since I have written any Java code. But last year, after some encouragement by Doug Purdy, I decided to create a simple plug-in to publish a UML model from Eclipse-based tool to SSMoS UML database. Fortunately, this task proved to be simpler than I thought. Those open source Eclipse developers have done a very good job (Kudos!) in providing excellent wizards for creating Eclipse plug-ins. The use of XMI by SSMoS LoadUml.exe utility combined with the Eclipse’s ability to serialize a UML object model as XMI, made it very easy to write this plug-in. You can see this plug-in being used as part of the demo (at 37:10) for PDC 2009 session demo “SQL Server Modeling Services: Using Metadata to Drive Application Design, Development and Management”. I can confidently say that other Eclipse plug-in developers can do a much better job than I did in creating Eclipse plug-ins for much richer scenarios over the SSMoS database. Besides publishing data for a specific model, such as UML, one can imagine creating a new database from an Eclipse .ecore model (under the covers do .ecore -> “M” Schema transformation and then create a new database from the “M” schema). I personally am a big fan of interoperability and tend to favor “better together” philosophy when it comes to software systems.

For those who have created Eclipse plug-ins, here are the extensions I created (captured in plugin.xml) for my plug-in:

1) Custom preference page (“org.eclipse.ui.preferencePages”)

a. Get to it by clicking on Window -> Preferences -> Microsoft SQL Server Modeling Services

b. This is where user can set database connection preferences. User also sets the SSMoS folder name here, which is not ideal, because user would have to come to preferences page to change it for every new load. If I had more time, I would have liked to build another view that allowed users to select an existing folder or create a new folder, before they publish.

2) Custom console view (“org.eclipse.ui.views”)

a. Get to it by clicking on Window -> Show View -> Other … -> Microsoft SQL Server Modeling Services Console View

b. The error messages from LoadUml.exe are piped to this view.

3) Custom popup-menu (“org.eclipse.ui.popupMenus”)

a. Get to it by selecting a file with extension “*.uml” or “*.xmi” in Eclipse workspace and right click Microsoft SQL Server Modeling Services -> Publish

b. Uses couple of object contributions “org.eclipse.core.resources.IFile” and “org.eclipse.core.resources.IProject”.

c. Calls a custom action

4) Custom action “PublishToRepository” (implements “org.eclipse.ui.IObjectActionDelegate)

a. User uses the custom popup-menu to invoke this action

b. Action uses the selected file(s) and values set in custom preference page to invoke the SSMoS LoadUml.exe utility

If you are interested in getting my plug-in source code, contact me and I can give it to you. Just remember, this code is written by a PM (me) and not vetted by any Microsoft developer or tester.

Thanks for reading!

Comments