简体   繁体   中英

Architecture to develop an application in java that could be used with desktop and web interface too

I'm developing a java application or service for execute remote commands or another applications and receive the results of these commands. And I think about to project this application to be possible his use with a swing interface or a web interface.

I have to take care with the parameters to pass for my businnes classes and how I will deal with the results. I need to use a architecture and project that let me able to use my classes with a desktop application or web application too.

I believe this is related with API and service design. Some popular applications have a web interface or dashboard for control services, and the services are manageable by agents installed for execute some demons, services or applications. To do start or stop commands for database systems, directory services an other tasks

There are some guides to how develop applications and services in java that can I use with web and desktop environments?

I felling a bite confusing about this, because in my mind if I choose to develop this with a swing approach all the thinks turn clear for me. But when I imagining the same project using the web perspective I lose my directives.

Sorry and Ihope that someone could undertand me. :-P

Consider spring and MVC architecture. Neither of them is constrained to Web development only, however they are extensively used as such.

You might look into Naked Objects ,where you develop a domain object model and gets the UI more or less for free (You can get a desktop GUI, and various forms of web UIs). This is probably not a feasible approach if you're developing a public facing application, but more suited towards applications developed for expert users.

I have been in a similar situation recently while I started working on a simple CMS. I wanted my cms engine to be free of what UI/client is used to interact with it and finally I settled for a Web Service oriented approach. As a student of RESTful WS/ROA I usually like to take that approach.

If I understand your problem correctly, I would design it to be, each external program, service, web service I want to provide remote access to would be a 'Application' to my web service, where 'Application' would be a 'Resource'. Performing actions on the 'Application' resource would mean executing GET requests with different query parameters. How the 'Application' infers would depend on the 'Application' resource.

A similar approach I took in the CMS engine is for generating representations for a content. I support Ruby (JRuby), Groovy, JavaScript (Rhino) and Velocity template for generating representation. User creates the template script as a resource and refers then in the content type definition. Clients are provided URI's to the representation from the content generic media formats (Atom XML, JSON) and upon fetching them receives the output generated by the script. I am tempted to take a similar approach for your problem. It would not only separated the UI from the business objects, but also provide flexibility to add new backend services in the long run.

As tools for RESTful WS over Java I would recommend, Jersey , Abdera , Jackson . As an example for how use them together you can have a look at the CMS project I was referring to .

Hi i would suggest you to build your system with a modular approach such that you have all your business logic is exposed as a service which can be accessed by REST, in addition create you can have web application layer and a desktop layer.

schemantically it will look like be at a higher level

weblayer/desktop---------{REST interface} ------- {business logic}-----EIS

and for modularisation you can consider OSGI hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM