Java EE web application architecture possible solutions - jsf

I am starting a new project. This will be a Java EE web application. The application will consist of 3 parts, each one having different functionality, but they all belong to one application. I am thinking of using the following architecture:
There will be 4 separate projects (JSF web applications). The first one will be responsible for communication with database and will expose remote EJBs. Let's call the first project "DataLayerProject". The other 3 applications, which I have mentioned above, will consume the EJBs from the "DataLayerProject" in order to communicate with the database. They will represent the presentation layer of the application.
In my opinion this approach will allow to maintain and develop the 3 parts independently of each other. This will make the project more scalable (in case there will be need to add another sub-projects to the main application).
Is this is a viable solution?
Should I use REST services instead of remote EJBs. (Sorry if I am misunderstanding something here)?
There will be the main page from which I will access the other 3 parts. The question is that I need to have single sign on for every application. Thus, by logging in on the main page user is automatically gets logged in the other 3 applications.
Should I use any portal solutions for making the separate web applications work together?

If all your applications are deployed on a single server, then you can use local interfaces for EJBs instead of remote ones and that would be the fastest implementation.

Related

Legacy VC++, Com based Desktop application to Modern web with microservices

I am in the process of moving my existing desktop application to web. The GUI is developed using MFC/VC++ and the buisness logic is written in COM enabled VC++ DLL. This Dll has various responsibilities. Currently this Dll is loaded as part of the desktop application memory.Now I am in the initial stage of moving this application to modern web application. Below is the thought process for design considered till now,
Converting monolithic business logic to micro services.
Deploy the micro services in a server.
My business logic VC++ Com layer can interface with microservices and get data.
Have a API gateway which can communicate to microservices and it can serve to the web client.
In this process I wanted to reuse VC++ Com business logic layer as much as possible. The current com Dll is not supporting multi threading or multi user sessions. This needs to be supported. The next thing would be reusing existing MFC GUI in web.
What are the technologies can be considered to reuse my buisness logic?
For the most code-reuse I think you're on the right track.
You definitely want to separate out the business logic into it's own service and you can expose that via any communication protocol you prefer. The biggest downside to this is that every time functionality needs to be added, it needs to be added in two places, or in this case three: the business logic server, the MFC server, and the web server.
As others have pointed out, MFC was really intended for desktop applications. A "modern web application" is one that is stateless and communicates via message-passing over http(s) with the web browser being the client. There's really no re-using the MFC GUI in the web. The architectures are just too disconnected.
Having said that, and I haven't looked into it too much, but Blazor is a WASM compiler. It has limited support for the .net framework, even less so around the communication portion of it, but it might be able to compile your project. I'd bet against it, however.
I think you'd be better off just focusing on a decent web experience with a SPA and abandoning the MFC/Desktop portion. Maybe later you can circle back and build a GUI through MAUI or WPF that consumes the web API.

Can web application be considered part of client/server architecture?

I am doing a research on client/server architecture and web applications. I've been reading different thoughts and suggestions around the web. Some saying that web applications are not considered client/server architecture apps while others are saying the exact opposite. I was wondering what is actually the right thing and if someone can provide in depth explanation that would be highly appreciated?
It depends on the architecture/design of your web application(s). The rule of thumb would be: The client application has to be another piece of software than the (resource) server. There is no "one right way" to design a client/server architecture.
The most common implementations for web based applications are MVC (Model View Controller and SPAs (Single Page Applications).
MVC applications (like ASP.NET or ZendFramework) are applications that are booth rendering the client and handling the business logic in the backend and are not based on a client/server model. (An action in a controller handles a request, loads some data and renders an HTML view as the response).
But: If your MVC Application is acting as a proxy calling a "remote" web service internally (via SOAP or whatever), it should be considered a client application.
As an example: A CRM system is running in an intranet network and provides a data-services for desktop clients. You could write a web application that displays data from those services which is then another client application.
The SPA architecture requires the separation of the server from the frontend, the SPA being the frontend, which in turn is the client application. With this requirement you are basically already implementing a client/server architecture. Let's say an AngularJS frontend and the backend could be a REST service (like ASP.NET WebAPI or Lumen).
The choice of where you host the client application does not affect the client/server architecture, since the applications are still separated on execution: the browser executes the JavaScript SPA on the device of the visitor and calls the service in some data center.
Web application is a part of client-server architecture. Any implementations have always two or more tiers, so two or more process communicate each other.
You may take a look on my old presentation "Architecture of enterprise (automated) information system - Layers and levels" that shows different client-server architectures including web application case (the slide "Tiers are physical layers (examples)" shows examples).

Using hawtio to host multiple applicatoins

Is it recommended to use hawtio as a host for several small user interfaces? What we have are a lot of discreet services performing fairly focused tasks each with it's own (angularjs) UI for configuration and management. A thought I had was that we might deploy each of these UIs so that they could be incorporated into hawtio where they would live on individual tabs.
Additionally we would want to have some kind of authentication/authorization to limit which tabs users could see. For example we would not want everyone to see the JBoss or Camel tabs but we would want them to see the UIs that we created for the individual services (and probably levels of authorization within them).
Is this even a reasonable use for hawtio?
You can build your custom distribution of hawtio, or turn off various plugins etc by providing a html file where you can turn off them in the various perspectives.
There is some examples how to do that at
https://github.com/hawtio/hawtio/tree/master/hawtio-plugin-examples/custom-perspective
You can build 3rd party plugins for your own apps and have them integrated as first-class in hawtio.
hawtio is designed as a pluggable web console.

How to organize different Node.js services?

This question does not necessarily pertain to the organization of Node project structure, and more of how to represent separate, logical services. Within our team, we have requirements to create and support several services (i.e., a set of API endpoints). These services aren't directly related, so my initial reaction is they should be separate projects with separate code bases running in separate Node (or Express) servers. I'm wondering if this approach would complicate deployment and management. The alternative would be to have a single "entry point" (i.e., a single Node server) that delegates to the respective services depending on which context root or URL is seen. I'm curious which approach seems more logical and how people are handling these "microservices" in the wild now?
These services aren't directly related
These services should be separate projects/repos with distinct entry points.
I'm wondering if this approach would complicate deployment and management.
Yes, absolutely. I have several NodeJS JSON APIs in production and for each, I have 2-3 environments (canary, staging, production). When you get to about 3 production services in the wild, things can get unwieldy without some discipline.
You can manage this with documentation (via wiki or in repo) about each service and their environments as well as any other dependencies (services that this service depends on).
This also helps with emergencies where a service is slow or not responding. Sometimes, the service itself is fine but a service's dependency could be down. For example, the github API may be a dependency...it goes down.
The alternative would be to have a single "entry point" (i.e., a single Node server) that delegates to the respective services depending on which context root or URL is seen.
In some cases, you may have to also build a "gateway" service which consumes your other single-purpose services. One reason to do this is to support authentication and authorization (i.e. OAuth).
In other words, you may need multiple micro-services and a gateway service.

What are the best development tools to use in this project?

I am currently devising 3 database desktop applications for different users in a manufacturing company (one for the accounting department, sales department, production department). All applications have different functions but they should be able to access the data of the other department to reflect business transactions. What is the best programming language and database to use for this kind project? The three computers are not physically connected so I was thinking of having them to access a remote database. The language I am most familiar with is Java but I am very open to learning others if it would be more beneficial to the company. I was also thinking of having to use Adobe Air as I am adept with web programming but could still run as a desktop app but I can't seem to find sufficient resources of distributed systems using Adobe air. Any ideas would be very much appreciated. Thanks!
Lots of languages will do this just fine, including Java. You're familiar with that so my advice is stick to it with one caveat: depending on your requirements I would seriously suggest examining the possibility of making it a Web app instead. Desktop database apps are somewhat... old-fashioned. More to the point they'll create a bunch of headaches for you such as installation, Swing is annoying and tedious, etc.
As for what database, barring requirements you haven't specified, anything will do so pick something free like MySQL.
So for a desktop Java app I would:
Put the database on a remote server;
Put an application server or Web container on that same server;
Create a Webapp on the app server for handling RPC;
Pick a method of RPC, be it Web services or whatever, and use Spring to implement it;
Create a desktop Java app in Swing and distribute it to clients from the app server via Webstart (JNLP).
If it's a Web app:
Put the database and appserver or Web container on one server;
Pick a Java Web framework and create a bunch of Web pages that do what you want.
In all cases, have it be the same app but just act differently on the user type. This is much better than maintaining three different apps.
Also if you do a Web app, you might want to consider using PHP as it's a fast and proven way of knocking up Web pages and probably sufficient for the kind of internal application that you're doing.

Resources