Pro/E Community
  For users of Pro/ENGINEER, Windchill, and other PTC affiliated products
menu
 Welcome, Lawrence
LogoutMy Account

Find Pro/E Jobs Now!
  Search Job Listings
Post Your Resume
Search Resumes
Post Jobs

Making Pro/ENGINEER data accessible via the Web: Using J-Link and Pro/Web.Link as a component of Web applications Pro/ENGINEER models represent a rich storehouse of information such as design intent, annotations, and manufacturing details that could be valuable to your business if you could make it available to employees outside the design team that created the data. There may also be situations where automating frequent or tedious, error-prone tasks for Pro/ENGINEER designers could improve their productivity and your company's bottom line. Both of these problems can be addressed using a customized Java web application, applied using one or both of Pro/ENGINEER's free customization tools: J-Link and Pro/Web.Link. These tools allow deployment of customized Web applications accessing Pro/ENGINEER and Pro/ENGINEER data either from within Pro/ENGINEER or via light-weight, Pro/ENGINEER-independent web clients.

Java Web Applications
Java web applications are structured to perform an operation on a server but interact with one or more clients. Typically Java web applications fall under two categories: Servlet and Java Server Pages (JSP).

Servlets are Java classes constructed specifically to handle client requests and serve responses. These are the most flexible type of Web application, capable of generating virtually any type of output. A Servlet class extends a standard supported Java interface: javax.servlet.Servlet. The servlet Java code executes in the context of a “servlet engine” on the server. Typically, servlets are deployed on a Web Server supporting HTTP (Hyper-Text Transfer Protocol). A HTTP servlet extends the basic servlet class but provides a separate class for users to inherit from: javax.servlet.http.HTTPServlet. Users can provide the following methods :
• doGet() – executes an HTTP GET request
• doPost() – executes an HTTP POST request

Other HTTP request types have their own standard implementation but can be
overridden also.

Web clients viewing HTTP servlets support all standard forms and widgets used in Web pages like input panels, check buttons, radio buttons, text areas, menus and image maps. Client input is passed to the servlet code as “parameters” to the GET or POST request from the data in the forms. Hidden form elements allow nonuser visible data to be passed. The Webmaster can also configure initial parameters (names of databases, resources) so that the same application can be used even when those resources change.

The servlet response is typically a web page that is returned to the client. Pages can be created entirely from Java code. Other formats that can be returned include Excel (csv), Bitmaps/Images, PDF, Binary formats (zip files, Pro/ENGINEER models,...).

Java Server Pages (JSP) are a specialized form of servlet. A JSP application is constructed as a standard HTML (Hyper-Text Markup Language) with embedded JSP code capable of customizing the output. This allows Web developers to maintain and enhance pages by working with HTML while still inserting dynamic server contents into the pages sent to the client. Like servlets, JSP also have access to the same properties like request parameters, context level attributes, and response data.
J-Link
J-Link is a platform independent, object oriented, Java-based programming interface to Pro/ENGINEER. It allows for customization of the Pro/ENGINEER user interface and access to data stored in models and drawings. J-Link is provided free of charge with any Pro/ENGINEER Wildfire installation. J-Link has a wide range of capabilities in the form of API's (Application Programming Interfaces) covering topics such as solid models, assemblies, drawings, data exchange, features, family tables, dimensions, parameters, graphics and interoperability. To get started using J-Link, consult the documentation and examples under the Pro/ENGINEER CD image. These files will be installed under the directory “jlink” and include an interactive browser for viewing details on all of the API’s covered in this project.

Because J-Link features a Java API, it can naturally be implanted in a Java servlet application running on the Web server. This “J-Link servlet” would start Pro/ENGINEER on the server and use the servlet parameters to modify models or generate needed output. The client would require only an Internet connection and a Web browser (Pro/ENGINEER is not required on the client machine). A J-Link servlet could automate various tasks, generate output deliverables, perform basic configuration options, and automate designs based on user input.

One of the possible objectives for deploying a J-Link servlet is to gather information from a Pro/ENGINEER model and display it in a web page to a client who does not have direct access to Pro/ENGINEER. In the following image, a J-Link servlet presents the feature names, ids, and types from the model next to a dynamically generated JPEG image of the model:


Fig.1. A web server runs a J-Link servlet to generate custom web pages featuring model images, parameters and other data


There are some important details that need to be considered in order to setup the J-Link servlet. First, a J-Link servlet must be configured to only load the native library once. This is discussed in a PTC Technical Support Solution document. To access this document, you must be a PTC Support customer. Also, J-Link access is limited to a single thread of the Java process. Because servlets are inherently multi-threaded, the J-Link servlet must perform synchronization to ensure that two clients do not attempt to simultaneously execute J-Link commands.

Source code for this J-Link servlet example is available on the Pro/ENGINEER Wildfire 3.0 CD image and is also available to PTC Support customers from a solution document on PTC Customer Support.

Users should consider a J-Link servlet application like this one when they have needs that are not covered by standard viewer products like ProductView Express. J-Link, as a customization API, gives the user a chance to completely control the type of information extracted, its formatting, and lets the application present options which are not normally presented from a standard viewer product. The servlet page could even be deployed in conjunction with a standard viewer like ProductView Express to give the client even more viewing options for the Pro/ENGINEER model and model data.

Pro/Web.Link
Pro/Web.Link is a JavaScript based programming library with a comprehensive interface to Pro/ENGINEER data and models. Applications are stored in HTML pages and loaded into the embedded browser in Pro/ENGINEER Wildfire. Pro/Web.Link running in the embedded browser of Pro/ENGINEER is provided free of charge with every installation of Pro/ENGINEER Wildfire. Pages using Pro/WebLink code can be served from an internal or external webserver. The type of data accessible via Pro/Web.Link exactly matches the data accessible from J-Link: solid models, assemblies, drawings, data exchange, features, family tables, dimensions, parameters, graphics and interoperability. Users can review the examples and documentation for Web.Link by viewing the contents of the weblink directory under the Pro/ENGINEER installation directory.

Because Web.Link must operate within the Pro/ENGINEER embedded browser on the client side, the deployment scenarios for Pro/Web.Link web applications are quite different from those of J-Link servlets. The client for a Pro/Web.Link application must be running Pro/ENGINEER in order to use the customization. However, the data used by the Web.Link application does not necessarily need to be input by the client; the data can be taken from a database or other server-based resource and embedded into the page sent to the client. This makes Web.Link fit well with JSP pages, where JSP Web applications incorporate Pro/Web.Link code. Typically JSP is used for this purpose because the majority of the code could be written and edited normally but the Web server would embed special parameters to configure the code sent to the client.

This application design allows for a manually-reviewed configuration activity: data available on the server would be applied to the model, and the engineer could review it and try it out in design scenarios. In the image below, a Pro/Web.Link JSP page automatically adds a new family table instance to the model and regenerates it. The engineer is given controls allowing him to accept the new configuration or reject it based upon the model he is analyzing in Pro/ENGINEER.


Fig. 2. Web.Link code from the internal web server injects design data into the cart model


Conclusions
This article discusses two tools offered by Pro/ENGINEER Wildfire that allow deployment of customized Web applications accessing Pro/ENGINEER and Pro/ENGINEER data. These tools are J-Link and Pro/Web.Link. Both of these tools offer a comprehensive interface to solid model and drawing data. As a Java API, J-Link can naturally be installed in a Java servlet application running on the Web server. It allows clients without Pro/ENGINEER to view or modify Pro/ENGINEER data. Pro/Web.Link runs within JavaScript code loaded into the embedded browser in Pro/ENGINEER. Thus the client must have Pro/ENGINEER installed to use this tool, but the data used to drive the models can be obtained from a Web application running on the server.


Note:
For further details on Web applications, the following reading is recommended:

Servlet & web application references:
http://java.sun.com/j2ee/index.jsp
http://java.sun.com/products/servlet/index.jsp
http://java.sun.com/products/jsp/index.jsp
http://java.sun.com/j2ee/javaserverfaces/index.jsp
• Your local or online bookstore has many Java, servlet, and JSP reference books

Tomcat
http://jakarta.apache.org/tomcat/

For further details on J-Link and Pro/Web.Link, consult the Pro/ENGINEER loadpoint for documentation and examples:
• [Pro/ENGINEER Loadpoint]/jlink/jlinkdoc/index.html
• [Pro/ENGINEER Loadpoint]/weblink/weblinkdoc/index.html


Published 11/08/2005 00:00:00 | Print this article | Feedback