Enterprise Development with JBuilder 3
By Tom Stickle, Strategic Systems Engineer
Executive Overview
Over the past 10 years information technology has developed strategically, allowing organizations to better communicate with customers and deliver better service at a lower cost. IT departments, for the most part, have been able to respond relatively fast without the need for a tremendously efficient development and integration paradigm.
With the exploding growth of the web, organizations in all market segments are coming under tremendous external competitive pressures. Companies like e*trade, yahoo, amazon.com, drugstore.com, and many more, are forcing competitors to offer existing core services more efficiently, and at significantly lower prices.
In order to survive in this highly competitive business environment, organizations must be prepared to move at "Internet speed". The efficient use of a solid, flexible, reusable infrastructure allows organizations to respond quickly to change by reducing the amount of new logic development while maximizing the reuse of existing systems.
Java Technology, with its portable, robust, and scalable server-oriented development capabilities, make it an ideal platform for building a reusable infrastructure in a heterogeneous environment. CORBA, with its cross-platform and language neutral capabilities, provides an open foundation for distributed development that is not at the exclusion of existing systems within the organization. Enterprise Java Bean (EJB) technology provides a server-side component model that allows developers to take a "divide and conquer" approach to building distributed systems. Together, Java, CORBA and EJB provide a mature, robust development platform for building a highly reusable distributed software system.
Enterprise developers are successful with JBuilder because it provides a productive development environment that completely supports open Java standards, it provides seamless integration with CORBA middleware, and it has unmatched support for the development of Enterprise Java Beans.
The newest release of JBuilder Enterprise provides the following innovations for distributed development:
- Complete Java 2 support with the ability to switch JDKs
- Visual development of distributed applications
- VisiBroker CORBA ORB
- Enterprise Java Bean (EJB) support
- Distributed debugging capabilities
- Java servlet support
- Fully DataAware JFC/Swing models
- Transactional JDataStore
- Complete support for Internationalization
The role of Java in the Enterprise
The "write once run anywhere" property of Java Technology has made it an ideal platform for heterogeneous enterprise computing. By maintaining a single code base, development teams save time and money on porting, testing and support costs. The portability of Java allows development teams to easily migrate application components between disparate hardware platforms for unmatched scalability.
Java has been proven to be an efficient, robust, object-oriented programming language over the past 3 years. Some of the unique features of the Java language are as follows:
- Strong Component Model (JavaBeans)
- The use of Garbage Collection not Memory Allocation
- Built-In Multithreading
- Exception Handling
- Complete Internationaliztion support
- Built-In Array Bounds Checking
In addition to the overall benefits of the Java Language, the Java 2 platform provides strong enterprise APIs that provide a unified way for developers to work with the vast number of enterprise services. Here is a listing of a subset of these interfaces:
|
Enterprise Java Beans (EJB) |
Provides a reusable software component model for server-side development that encourages a "divide and conquer" approach to both architecture and implementation. |
|
Java Naming and Directory Interface (JNDI) |
Provides a unified Java interface to the many Directory and Naming services that can be found in the enterprise. |
|
Java Transaction (JTA) |
A specification for an interface between a transaction manager and a distributed transaction system. |
|
Java Database Connectivity (JDBC) |
A standard data-access interface between an application and a wide array of database management systems. |
|
Java Servlet |
Provides web developers with a standard, reliable way to extend their web servers. |
|
RMI/IIOP |
Specifies the Remote Method Invocation API implemented over the Object Management Groups IIOP protocol. This allows multiple languages to have access to the distributed software servers. |
Considerations for Enterprise Development
There are many difficult considerations that development teams face when exploring the architecture of a new enterprise project or infrastructure. Typically the first decision that a team will make is on choosing the right middleware given their environmental constraints and project requirements. The middleware is critical for handling requirements like reuse, connectivity, security, transaction support and legacy integration.
If your environment has more than one platform and is in need of a language neutral infrastructure that is powerful enough for mission critical development, then the usual middleware choice would be CORBA and perhaps Enterprise Java Bean technology. Please note that CORBA is a key component of enterprise scale EJB Servers so the two are not mutually exclusive technologies when in the context of enterprise development.
Common Object Request Broker Architecture (CORBA)
Developed by the Object Management Group (OMG), CORBA is the open industry standard for creating distributed object systems. Several years back, the OMG specified a mapping of its CORBA Interface Definition Language (IDL) to Java. That advancement allows Java based systems to be part of the open industry standard for building distributed heterogeneous system. In addition to being language and platform neutral, CORBA provides a rich set of services that can be incorporated into a Java system using proven products such as VisiBroker for Java. For more details on VisiBroker you can visit the Inprise web site at http://www.borland.com/visibroker/.
The combination of Java and CORBA make a perfect match for distributed systems. Java is an ideal implementation language for CORBA development due to its portability, safety, garbage collection, and multithreading. CORBA is an ideal middleware platform for Java because it allows for the integration of non-Java systems and delivers a mature and robust platform for security, transactions and communications.
Enterprise Java Bean Architecture
The Enterprise Java Bean (EJB) architecture is a server-side component model that allows different people to assume responsibility for the various "roles" in the development of a distributed application. From the viewpoint of a bean developer, also known in the specification as the "Enterprise Bean Provider", the focus is clearly on business logic without the need to be concerned about distributed transactions, security and communications programming. The operations domain experts can then interact with attributes of the enterprise beans to properly partition the application, set access control properties and transaction properties.
The EJB specification gives EJB Server vendors a lot of latitude on how to actually implement the various APIs, but they do make some recommendations. To ensure compatibility between EJB Server implementations, connectivity to non-Java processes and to bridge security and transaction domains, a CORBA mapping to EJB is a standard part of the specification. It would be safe then to say that CORBA and EJB are not competing technologies, but they are actually very complimentary.
When evaluating EJB Server technology it is important to understand that having an official implementation of the EJB specification, and having an open, robust and scalable enterprise solution are not necessarily the same thing. Inprise is committed to delivering the most open, robust and scalable EJB Server support in the industry with our Inprise Application Server 4.0 product. For more detailed information about EJB please visit the Inprise web site at http://www.borland.com/visibroker/papers/ejb/.
On the client side of an enterprise application a decision needs to be made on how to present the client interface to users. Typically your team will need to choose either one or a combination of stand-alone application clients, Servlets or Applets. The toughest decision that developers usually face on the client side is how to implement user interfaces that will be delivered via a web browser. Here is some information of Java Servlets and Java Applets:
Java Servlet Technology
Java Servlets are standard web server extensions that can be used to expand the functionality of a web server. A Servlet runs in a Virtual Machine on the server and once it is loaded into memory, it will usually remain in memory so subsequent requests will not have to reload the process. Separate threads handle multiple requests on the Servlet so they perform extremely well and are highly scalable. Of course, the obvious benefits of Servlets are some of the same benefits of any Java implementation, a highly portable language that can easily shift platforms, coupled with an extremely powerful set of enterprise APIs. Virtually all major Web Servers on the market today support this important technology.
Servlet technology is very appealing because it can be used to create dynamic HTML content, which can be viewed by any standard web browser. By using HTML as the interface in a highly scalable way, it is possible to create extremely portable interfaces that can support a tremendous number of users. If HTML is an appropriate interface for your application then this is a solid, reliable, easy to maintain option for your team.
Java Applet Technology
A Java Applet is a client program that can be included in an HTML page, much in the same way that an image is included. When you use a supported browser to view a page that contains an applet, the applet's code is downloaded to your system and executed by the browser in a secure fashion. Applets are useful because they allow developers to use powerful GUI class libraries such as the JFC to manage more complex GUI requirements within the context of a web browser. The disadvantage of Applets is that different browser versions may have different versions of Java Virtual Machines (JVMs) that can limit the distribution capabilities. For example, an older browser version may not support Applets developed using the Java 2 platform, and many developers find this to be extremely frustrating in the integration testing and deployment phase of the project. The other challenge in deploying Applets is that most browsers enforce network security restrictions that limit communication from the applet, and there are typically firewall restrictions that must be dealt with using products such as the VisiBroker Gatekeeper.
As a general rule, there is no right or wrong choice when choosing between a Servlet and Applet architecture for Web deployment. If it were possible for you to get away with a more rudimentary HTML interface for your application, then Servlets, being a more scalable and easy to maintain choice, would probably make the most sense. If your web interface requires a more advanced user interface that requires all of the power of a GUI class library such as the JFC, then Applets might be a more realistic choice. It is important to remember that these two technologies are not mutually exclusive, and it is completely possible to use Servlet and Applet technology together where each is best suited.
Considerations in Selecting an Enterprise Java Tool
With all of the options to think about in your development effort, it makes sense to select an Integrated Development Environment (IDE) for Java that brings you productivity gains for both server side development and client side development. This table is a summary of features that can be considered important for enterprise development and some of the associated benefits:
|
Feature |
Benefit |
|
Java 2 Platform Support |
This is an extremely important consideration for both server side and client side development. The Java 2 platform brings a complete set of functionality to enterprise developers, and it is therefore imperative that your IDE has complete Java 2 support. |
|
Support for 100% pure Java |
By selecting an IDE that generates pure Java code without proprietary extensions and class libraries, your team can avoid being "locked-in" by the IDE vendor. |
|
JDK Switching |
It is unrealistic in an enterprise environment to expect your team to upgrade production software every time the Java platform is updated.
It is critical that your team can continue to develop and debug in the IDE using the same Java platform version that the target application was developed with even if the Java platform evolves to a new version. By the same token, it is important for new development that your IDE does not hold you to older versions of the Java 2 platform. |
|
Database Access Capabilities |
Capabilities that free your team from spending an inordinate amount of time writing database access code is a necessary requirement for efficient enterprise development. |
|
Distributed Debugging |
There is no question that your development team will want the capability to perform distributed source level debugging. The capability to step line by line through a remote call to a VM on perhaps another machine and platform, is not a luxury its a necessity. |
|
Integrated CORBA Support |
Look for an IDE that has seamless integration with an industry leading CORBA ORB. You should expect syntax highlighting of IDL semantics, integrated IDL compiler and integrated project management capabilities. |
|
Enterprise Java Bean Support |
On the development side of EJB, it is very important for your development tool to assist in the creation of the required Home and Remote Interfaces, and enforce that the Remote Interface is valid for the bean implementation. It is also important that a required deployment descriptor can be generated by the tool, and the components of the bean be packaged into an ejb-jar file. |
|
Servlet Support |
Your IDE should have full support for Servlet development, and include tools to simplify the development and testing of these extensions. |
|
JFC/Swing Support |
On the client side of an enterprise application you will want your IDE to allow you to get the most out of the JFC/Swing component library. The ability to work with these components visually can shave weeks off of the client side development effort. |
|
Data Aware JFC/Swing |
The JFC/Swing components are built on a flexible Model/View/Controller Paradigm. The capability of populating the Swing controls via their models with Data in a visual way brings tremendous productivity gains without compromising this flexible architecture. |
|
Component Development |
One of the most important concepts in enterprise Java development is the need to hide application complexity in reusable components. By building components that perform activities like EJB bootstrapping using JNDI or hiding CORBA client code, developers can "divide and conquer" the development effort on the client side. Your IDE should provide tools to assist in creating properties, property editors and events. |
|
JDBC 2.0 Support |
All major database server vendors have embraced the all Java JDBC API for connectivity to their products. In addition JDBC 2.0 allows you to support the XA protocol for the ability to support distributed transactions. It is important that your Java IDE support any Type 2 or Type 4 vendor supplied JDBC driver. A partial list of drivers can be found at http://java.sun.com/products/jdbc/jdbc.drivers.html. |
|
Extensibility |
It is likely that you will want to have the ability to customize your IDE to create custom wizards and integrate external tools. Having the ability to modify the IDE for your particular needs will likely be an important requirement for any development team. |
|
Cross-platform support |
In a heterogeneous platform environment it is important that your IDE tool can bring the same power to developers on many platforms. |
The JBuilder Enterprise Product
Enterprise developers are successful with JBuilder because it provides a productive development environment that completely supports open Java standards, it provides seamless integration with CORBA middleware, and it has unmatched support for the development of Enterprise Java Beans.
With JBuilder 3 Enterprise, Inprise continues its commitment to make Java technology productive for enterprise development teams. On the server side, JBuilder provides unmatched support for the Java 2 platform, CORBA, Enterprise Java Beans, JDBC and distributed Java 2 debugging. For client development, JBuilder enables developers to create 100% pure Java interfaces by visually manipulating industry standard JFC/Swing components and Data-Aware Swing Models. In addition to these capabilities, JBuilder is also completely extensible and will be available on other platforms such as Solaris and Linux later this year.
DataExpress technology together with JDBC provides tremendous productivity gains for database access. The DataExpress approach to data access and update of data sources is accomplished in three phases
- "Providing" a set of data from a data source such as a SQL Database into a DataSet Component
- The capability to freely navigate the DataSet and make edits.
- "Resolving" data back to the data source with powerful reconciliation technology
For a more detailed explanation of DataExpress technology, you can refer to Steven Shaughnessys whitepaper at http://www.borland.com/jbuilder/papers/dataexpress/.
JBuilders CORBAExpress technology enables developers to automate the creation of CORBA servers, CORBA clients, and HTML front-ends to CORBA servers using Servlet technology. JBuilder enterprise includes VisiBroker 3.4, the industries leading ORB for the Java 2 platform as well as the CORBA Naming and Event services, and the ORB Explorer for managing services. You can easily debug your CORBA servers with complete remote source level debugging capabilities.
EJBExpress technology allows developers to easily create Session or Entity beans, and focus on the core business logic. JBuilder automates the process of building Home and Remote Interfaces for the bean, and guides the developer through the creation of the beans deployment descriptor.
For more details on the new features of JBuilder 3, you can visit the "Whats new in JBuilder 3" white paper at http://www.borland.com/jbuilder/productinfo/prodbrief/.
Perhaps the best way to understand the capabilities of JBuilder Enterprise is to see how it can make developers more productive in several common infrastructure development scenarios. Well begin with the important server-side tasks of building a CORBA application and then developing an Enterprise Java Bean.
Building a CORBA Application with JBuilder Enterprise
The process of creating a CORBA application from scratch can be a rather daunting task. CORBA application developers will typically start from an Interface Declaration Language (IDL) description of the properties of an object. The IDL file is then typically run through a language specific compiler to build the proper high-level language bindings. The developer would then typically create a new class that inherits from one of these generated classes and implement the required business logic. The next step would be to add code that instantiates the object and registers it with some kind of naming or directory service.
JBuilder Enterprise has the capability to take an IDL file and walk the developer through the entire CORBA development process automatically! The result of this feature is that the developer can focus on business logic and avoid the nuances of CORBA systems programming.
- To create a CORBA application in JBuilder 3
- Create a new JBuilder project to work with.
- Create or add a CORBA IDL file. It is very common for architects to use object design tools such as Rational Rose that are capable of generating IDL code from the object model so these can just be added in. In addition, JBuilder Enterprise contains a DataModel IDL wizard which will read a database schema and generate CORBA IDL from it!
- In this particular example, I just typed in a few lines of simple IDL code.
- You would then right click on the IDL file in the top left "navigation pane" and select Generate Application.
- In the Application Generator you can select to build a CORBA server with a GUI monitor, a stand-along application and even a Servlet interface.
- In the CORBA tab you can choose to generate the Naming options for the server and client to use. Again, this is a productivity gain because the Naming code will be generated for us, which means that I can leave my CORBA manual on the bookshelf.
- After completing the options you can choose to generate the infrastructure
- JBuilder will generate all of the CORBA infrastructure code that you will need to get started on the server-side and it will build a test client for you as well. All we have to do now is implement our own business logic where the sample method declarations are declared and test out.
- In any CORBA application some sort of naming option is required which allows the client process to locate and use the server process. In this particular application we told JBuilder to generate code that makes use of a VisiBroker technology called the Smart Agent. So before we run our new application we need to start the Smart Agent by going to the JBuilder tools menu and selecting it.
- We can now run our CORBA server and test client directly from the IDE. The server is a completely functional CORBA server and can easily be executed from a client on another machine.
The Server looks like this when it is running:
The client looks like this when it is running:
When the user presses the incrementProgress button on the test client 3 times the server behaves like:
Building a Servlet Interface for our CORBA Server
Now suppose you wanted the test client to be implemented as a Servlet so you can test it from a standard web browser. You can simply return to the application generator, choose an HTML client and regenerate the client files.
JBuilder will automatically generate the required Servlet code and also generate a ServletServer that can be used to test and debug the new Servlet.
You can simply right click on the ServletServer and choose Debug. This will allow you to easily perform source level debugging on your Servlet code. When the ServletServer is executed the following screen will emerge with a URL that can be pasted into your browser.
You can then open your browser, enter the URL and run the test form from your browser. When you make invocations by pressing the buttons, and break points set in your code will be tripped up to allow you to debug the Servlet.
The source code that is generated by the IDE gives developers a great starting point in the distributed development process while allowing them to focus on the business logic rather than CORBA infrastructure code. Developers can easily copy and paste the code from the test client into their own client Applications, Applets and Servlets. If your team is also interested in transaction support and application management support, you may want to visit the Inprise Application Server web site at: http://www.borland.com/borland/appserver.
Developing an Enterprise Java Bean with JBuilder Enterprise
There are actually 2 major types of Enterprise Beans, and each of those comes in two separate varieties. The clear distinction between the two bean types is that Session beans are typically used by a single client and represent application/business logic. Entity Beans are typically shared by multiple users and are used to represent persistent data. Here is a table that outlines the various types of enterprise beans:
|
Stateless Session Beans |
The bean does not contain conversational state between method invocations - as a consequence any session bean instance can be used for any client. Stateless beans are designed to be pooled. |
|
Stateful Session Beans |
The bean contains conversational state, which is kept across method invocations and transactions. |
|
Bean Managed Entity Beans |
The entity bean implementation is responsible for implementing persistence. The developer actually writes the database access code to access the underlying database or application.
|
|
Container Managed Entity Beans |
The EJB Servers container is responsible for implementing the persistence. Instead of the developer implementing the database access code, the container is responsible for generating the appropriate code and its execution. The fields of the entity bean, which are managed by the Container, are specified in the beans deployment descriptor.
|
- To create an Enterprise Java Bean in JBuilder 3
- You would first create a new JBuilder project
- Select the Enterprise Java Bean Wizard from the Object Gallery under the File|New menu choice.
- In the Enterprise Bean wizard you can specify a name for your new Enterprise Bean implementation class and specify which type of Enterprise Beans you are creating.
- The wizard will create a new class for you and implement all of the required elements of the Session or Entity bean interface.
- You can then easily add your own methods to the new bean class containing custom business logic. In this particular case I added two methods, getAccountBalance and transfer. In a real implementation these methods would likely interact with Entity beans that represent persistent data.
- When you are finished implementing the business logic and interested in packaging your bean up for deployment, you can select the bean tab and push the generate bean interfaces button.
- Using this wizard you can select the methods of the bean that you would like to expose to the outside world through the beans required "Remote Interface" which will be automatically generated.
- In the Deployment Descriptor tab you can enter all of the relevant attributes of the bean to be stored with the bean. It is using this "Deployment Descriptor" that properties such as state management, access control and transactions management can be defined for the bean.
- This wizard will then generate a valid Home and Remote Interface for your Enterprise Bean, along with a valid serialized deployment descriptor.
- The last step in the process is to package up these individual components into a compressed archive that can be added to any EJB server.
Summary
IT Departments are responding to an increasingly competitive business environment by developing Distributed Object Infrastructures. The Java 2 platform, CORBA and EJB are well-suited technologies for implementing a distributed infrastructure in a heterogeneous enterprise environment. Moving to this type of infrastructure can be a complex undertaking for enterprise development teams who need to remain focused on developing reusable business logic.
JBuilder 3 Enterprise eases development of a Distributed Infrastructure by providing complete integration of several enterprise technologies into a single development environment. CORBAExpress and EJBExpress technologies allow developers to leave their middleware manuals on the bookshelves and become immediately productive.
Enterprise developers are successful with JBuilder because it allows them to focus on building business logic rather than system and infrastructure code.
Connect with Us