OpenXava does not include a complete security and navigation system, although you can easily add security and navigation in an OpenXava application if you use a Java portal, such as Liferay. Also, you can use the official solution that OpenXava team offers: XavaPro. Even though these solutions may be valid for new projects, for legacy projects you may need apply other ones. In this post we are going to customize our own solution for navigation and security starting from the standard OpenXava solution: NaviOX.
5 posts tagged with "java"
View All TagsMain JSPs in OpenXava
OpenXava is an AJAX Java Framework for rapid development of enterprise web applications. In OpenXava you only have to write the domain classes in plain Java to get a web application ready for production. Under the hood, there are a lot of JSPs that, magically, build all the pages on the fly. In spite of being an extensible and customizable framework, if you want to change the default behaviour of OpenXava projects, you will have to know how different JSPs are related each other. In this post we are going to use OpenXava 5.3.2. Basically, we can distinguish two types of pages:
- SignIn page
- Regular pages where data can be edited (detail page) or listed (list page) (or both)
Reverse Engineering and Code Generation
The goal of this post is to explain how to model a database into java pojo classes with EJB or JPA annotations using reverse engineering. We can use several tools such as MinuteProject or Mogwai ERDesignerNG. In this post we are going to use JBoss Tools plugins for Eclipse (Hibernate Tools). With this tool not only can you configure files using JPA and EJB annotations, but also other annotations such as OpenXava.
Streams in Java 8
Streams are the key abstraction in Java 8 for processing collections of values and specifying what you want to have done, leaving the scheduling of operations to the implementation. Furthermore, streams can leverage multi-core architectures without you having to write a single line of multithread code, and simplify the description of aggregate computations, exponing opportunities for optimisation. Streams basically allow us to write collections-processing code at a higher level of abstraction. You can think about stream as a pipeline where we are processing data, what we call the source, and we put it into zero or more intermediate operations; each operation takes an input stream and generates an output stream. That way we can take the output of one intermediate operation and feed it to the following intermedite operation. Once we have done all the intermediate processing that we want, we need to terminate that stream and we do that with a terminal operation; terminal operation takes an input stream and does not generate a stream as an output, but what it produces is either explicit results, such as a value, collections and so on, or a side effect, that is, for example a simple message. This pipeline is depicted in the following image:
Timer versus ScheduledThreadExecutor
According to Java Concurrency in Practice and other sources of information main differences between Timer and ScheduledThreadExecutor are:
- Timer can be sensitive to changes in the system clock, ScheduledThreadPoolExecutor isn't
- Timer has only one execution thread, so long-running task can delay other tasks. ScheduledThreadPoolExecutor can be configured with any number of threads. Furthermore, you have full control over created threads, if you want (by providing ThreadFactory)
- Runtime exceptions thrown in TimerTask kill that one thread, thus making Timer dead :-( ... i.e. scheduled tasks will not run anymore. ScheduledThreadExecutor not only catches runtime exceptions, but it lets you handle them if you want (by overriding afterExecute method from ThreadPoolExecutor). Task which threw exception will be canceled, but other tasks will continue to run.