What is CUBA?
CUBA is a small framework for the development of component-based
systems which can be run as EJB applications, AXIS WebServices or
programs. The component and programming model is based on and
the EJB 3 session beans model. CUBA was originally built to allow the
reuse of components in different runtime environments without
CUBA speeds up the development of client-server applications by
most packaging and deployment actions and allowing ordinary local
and debugging of components.
Does CUBA also provide an equivalent to JPA?
In fact CUBA does not only provide an equivalent but direct JPA
support. In EJB environments this is based on the JPA providers
integrated in the application server. CUBA's embedded container which
is used in all other supported runtime environments allows to integrate
independent JPA providers like Hibernate. Examples for JPA and the use
of other non-standardized persistence managers are included in the CUBA
Why does CUBA not just follow the EJB standard?
CUBA actually follows the principles of the EJB 3 session beans
model and provides equivalent functionality. However, it makes some
important simplifications and generalizations making the model also
applicable to more primitive environments without causing
too much overhead. It was a design decision to define an
API which can be mapped straight-forward to both EJB 3 and EJB 2
environment as well as
to any other one. Especially, the CUBA API hides a few nasty
of EJB 2, which is also one of the supported platforms.
What is the difference to OpenEJB?
In fact CUBA and OpenEJB follow the same basic idea of providing a
common model for both distributed and single-process applications.
approach is different: OpenEJB is basically itself an EJB container,
which can be plugged into various environments allowing to host
Enterprise JavaBeans in these. As a consequence, any problems and
from the EJB philosophy and programming model remain as they are. On
the other side,
an existing EJB application can be ported to OpenEJB with a minimum
CUBA's approach is to work with a simplified and more convenient model,
in a much smaller footprint of the framework itself. The CUBA model is
equivalent to EJB 3 SessionBeans and designed to suit both JEE and
non-JEE environments. In a managed environment, CUBA components
EJBs and require a JEE application server to run in. The runtime
library for EJB mode provides only an ultra-thin compatibility
layer to host the components in both EJB 2 and EJB 3 containers. For
non-managed environments, CUBA provides a very small enbedded container
of less than 100k size.
Why AXIS instead of EJBs
Sure: as CUBA follows an EJB-equivalent model, it is an option to run
the components as EJBs in a JEE application server and provide SOAP
appropriate WebService endpoints. This is part of the EJB standard
2.1 and there is no additional help from CUBA needed. However, the AXIS
is a much smarter solution than a full-fledged JEE environment. It is
simpler to deploy and maintain an AXIS WebService in a Tomcat servlet
than an EJB in an application server. Of course an AXIS environment is
not that powerful and has a number of drawbacks e.g. concerning
and distributed transactions. But in many applications it is
a reasonable platform. CUBA gives you the option to choose the
runtime environment end even change it later on without having to
any code. This is an important option which keeps people from bothering
much wether AXIS is powerful enough or not. You could just try it and
to an application server if actually required.
Since CUBA 3 there is also another important reason. The webservice
tunneling mode allows to provide any CUBA component as a WebService
without limitation to stateless components and. This allows to make up
the world's smallest application server from just a servlet engine,
AXIS and CUBA's embedded container using SOAP as communication protocol
an eliminating firewall problems you usally experience with protocolls
like IIOP or JNP.
Do I actually need CUBA for testing EJBs?
One of the major goals of the EJB 3 standard is to simplify unit
testing of EJBs outside an application server. That's a good idea and
it is actually not new - especially not for CUBA users because this was
an intention of the CUBA framework from the very beginning of the
project. From the first sight it may look like that something like CUBA
is no longer needed in EJB 3 because unit tests can easily be
hand-written by tying all required parts together through the newly
introduced dependency injection approach. But that won't work out very
good because you will quickly find out that in this case nobody is
providing all the container services any more which make EJBs so easy
to code, e.g. container-managed transactions, call-chain-management,
resource management etc. You will soon realize that serious testing
requires at least a minimal container for the infrastructural issues
which at the end leads exactly to what CUBA's wired container provides.