Structure of Enterprise Web Application using JSF - eclipse

I'm developing enterprise web application which is using JSF with Eclipse IDE. But i'n not experienced at JSF web application architect, just not familiar with name classes ,projects,packages,web pages, template pages etc.. , is it possible to name packages like following:
CompanyName.systemName.controller (there would be controllers in it )
CompanyName.systemName.Model (there would be managed beans and other things in it )
even how to choose best structure for my project(mean Architecture of folders,classes,packages,web pages, template pages etc). if anyone has an idea ? i'd be glad if have sample project.
thanks

Those are fine package names. Some people like to group packages by purpose:
org.mycompany.myapp.controller
org.mycompany.myapp.dao
org.mycompany.myapp.service
etc...
For larger applications, I like to group them by feature:
org.mycompany.myapp.billing
org.mycompany.myapp.signup
org.mycompany.myapp.webservices
etc...
As for folder structure, a good Maven archetype can be very helpful. Here's a web page that gives a good walkthrough of setting up a few types of JSF projects using Maven archetypes: http://www.javaserverfaces.org/get-started

If you look from architecture point of view, your JSF application should mirror very much like any other well architected Java-Web application.
For packaging I like to break first by functionality (like core, gui) and then by business unit level.
Something like:
com.comp.core.db.beans
com.comp.extension.ui.extension //If my application is going to give extension point for others to implement, extend the functionality.
com.comp.core.ui.controller
On a similar note pages, config files can be broken into separate logical units.

Related

How to build plugins style web platform with angular2

The idea is not new, like Wordpress, Oxwall : a platform created by some guru guy that allowing other dev guys to add new apps (like forum, blog, market-place, whatever) into the platform easily. By easy, we mean either just install new plugin by upload or less user friendly coding new plugin without changing the core code.
Actually, we have a working solution with angular1 but quite clumsy, that's it, multiple stand-alone ng-app within a website, like:
domain.com/forum-spa
domain.com/dating-app-spa
..etc..
Good thing about it is quite straightforward to implement, not much to worry about lazy-loading. But we are not happy with that approach for many reasons.
Angular2 is really close. We hope it can bring a better solution for building a large web platform
iframe
custom components that are added at build time that are added depending on user data like explained in Angular 2 dynamic tabs with user-click chosen components
This approach is compatible with the offline template compiler
There is also a more flexible way that supports user-provided component templates How to realize website with hundreds of pages in Angular2
This approach is not compatible with the offline template compiler and requires the Angular parser and compiler to be included in the build output.

EPiServer migrate content from home grown CMS

Hopefully someone can help me, I'm new to EPiServer and have been given a data migration task. We are using the latest version 8.5. I need to migrate content from a clients home grown CMS (that luckily is in a tree like structure) to EPiServer. There doesn't seem to be a whole lot of information about this on the web - perhaps I just don't know the right thing to search for.
It looks like using the EPiServer.ServiceApi might be the route to go but again locating useful documentation is proving difficult.
I was thinking of setting up the client CMS in SQL Server and writing a simple console application to call the EPiServer.ServiceApi inserting the content. If anyone has any information on this or better still and example i would be very grateful.
Thanks,
Dan
If you are just importing content from another CMS I would write a scheduled job in EPiServer:
http://world.episerver.com/code/dannymurphy/Stoppable-Scheduled-Job-with-feedback/
That job then uses the standard IContentRepository to create content:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/8/Content/Persisting-IContent-instances/
That way you can run it whenever you want and have access to EPiServers complete API. Also you can see progress of the import through the job status.
In the job you can read the content as a file in any format you like or directly from the source CMS database or some xml or RSS feed perhaps.
I have moved content from PHP, Java and .NET CMS this way. In .NET you could even access the source CMS via WCF or SOAP if available.
The ServiceApi is relatively new and more focused on Commerce products and media assets rather than CMS page and block content so I wouldn't use that.
There is complete documentation below for the ServiceApi by the way, did you not find it?
http://world.episerver.com/documentation/Items/EPiServer-Service-API/
Regarding language management you can read more in the below links:
http://cjsharp.com/blog/2013/04/11/working-with-localization-and-language-branches-in-episerver-7-mvc/
http://tedgustaf.com/blog/2010/5/create-a-new-page-language-branch-programmatically-in-episerver/
Basically you have two options for multiple languages. If the content is just straight translations you should create nine different language versions (branches) of the same page. You can also have multiple sites in an EPiServer installation but that requires 9 separate licenses (and the associated costs).
I've done a lot of EpiServer content migration projects. The easiest way if it's possible is to export your current sites tree in Json and then import that into EpiServer. I've had to do it on a recent project and mixed with Json.net it's pretty easy.
If you want to go that route you can find all the code to do it here: EpiServer Content Migration With Json.Net/

Sitefinity and custom development

We are considering purchasing Sitefinity (or DotNetNuke) on pretty short notice and there are is a question I have that I am having trouble finding a quick answer to. (I have a separate but similar post with DotNetNuke as the focus, if you can answer that better or in addition.)
We are currently not using any CMS at all and we have some custom development that will not go away just because we go with a CMS for some or most of our site.
Our custom development is c# ASPX with Site Master and nested Site Master pages. These custom apps do not own their own top level in our web site, but are part of a branch, typically one or two levels down (for example, http://www.contoso.com/branch/app/default.aspx).
How is Sitefinity typically configured in a CMS/Custom “mixed mode”? For example, is Sitefinity installed at the “top” of the web site, or “where needed” down in the web site.
How does this relate when mixing CMS and custom web applications?
Does the CMS interface allow for adding these custom apps or do you just go to the web server and add them to the structure?
It appears from reading other posts, we can create our own custom c# modules and have CMS editors “drop in” the modules on the pages. Can someone confirm that for me?
If I did not provide enough detail, please feel free to ask for more.
We have Sitefinity installed at the root with plenty of subfolders containing custom pages. We typically build a usercontrol, add it to the sitefinity ToolboxesConfig.config file, then drag/drop it into a sitefinity CMS page. I believe this is what you're talking about regarding having "CMS editors drop in modules on the pages".
We also have master/child pages that are imported as page templates into Sitefinity and they work well. You can also link from any CMS page to a regular .aspx page out in a subfolder of your own and implement code there that uses the sitefinity API, but we personally found this much more tricky and veered away from this approach whenever possible.
So in a nutshell, custom code is relatively easy to integrate into sitefinity as long as you can condense it into a user control or master page.
Disclaimer: This was all done with regular web forms development. I'm not sure how an MVC site would interact with Sitefinity (which I believe is built using an MVC architecture itself anyway).
The part of your question I'm unsure of is regarding the custom webapps in nested branches. I would recommend installing the trial version of sitefinity and trying to get a single branch integrated as a prototype. This might take a day, but it would be worth it to know if the sitefinity route is going to give you heartache.
Full disclaimer: I work on Sitefinity.
First, let me say that throughout the history of Sitefinity, extensibility and developer-friendliness have been our top priorities. We've tried to create a CMS that uses concepts familiar to ASP.NET developers and build on top of them.
Now let me go through each of your points.
You can organize Sitefinity deployment however you like. In your case with sub-apps, you can either create virtual directories in IIS and deploy separate instances of Sitefinity in each of them, or you can use the CMS to do the sub-apps. In the CMS they can be separate branches of pages, have separate templates applied and feel like separate sites. You'll still manage them through one interface. It is up to you to choose an approach.
Sitefinity is a normal ASP.NET web application with the CMS assemblies in the BIN folder. You can open the project in Visual Studio and run it like a normal ASP.NET Web app. From a developer viewpoint, there's no difference between a custom app and a Sitefinity app - they are just ASP.NET web apps.
If you follow an approach of installing Sitefinity in the root and then using the CMS to create sub-apps, you can do it through the UI. If you choose to run separate virtual directories, you have to manually upload the files. Also, Sitefinity has a built-in File explorer, which you can use to manage the files on the server.
The modules you are referring to are called widgets in Sitefinity. For a developer, they are nothing more than custom ASP.NET controls and user controls. The Sitefinity page editor UI allows you to drop widgets in placeholders on a page and configure their properties. The placeholders are defined in a masterpage (a normal ASP.NET masterpage) or through the UI.
It is very easy to create custom widgets. Here's a Quick Start: http://www.sitefinity.com/blogs/gabesumner/posts/11-08-29/ldquo_hello_world_rdquo_guide_to_custom_sitefinity_widgets_amp_controldesigners.aspx
We also have modules, which are a little more complicated concepts. They manage data, have backend and frontend UI. I encourage you to go through our blogs and documentation for further info.
We also have an SDK, containing samples with source code for extensions to the CMS.
You may want to look at Kentico CMS that supports similar scenarios - you can easily mix your own ASPX pages and CMS-controlled ASPX pages, so it's very flexible.

Grails: How to reference a resource located inside an installed plugin?

I have a Grails plugin which I’m using as basically a container for some shared static resources that will be used by various other Grails projects in-house (CSS, JS files, etc). The idea of using a plugin was just to share these things — the plugin doesn’t really do anything else very interesting. What is the best way to directly reference resources inside the plugin? I’d rather not create custom taglibs, since I’m not really adding any functionality here; I just want access to the resources inside the plugin — something like this, e.g., to reference a CSS file from a GSP:
<g:link rel="stylesheet" url="${resource(dir:'css', file:'mycss.css',
plugin:'myplugin')}"/>
Does this idea violate the concept of plugins, where only certain aspects of it should be exposed, and the rest is a black box? Alternative approaches to sharing static resources among related Grails projects are also welcome, in case I’m headed down an insane, wrong-headed path by even trying this. :)
First, in Grails, a plugin is not considered a black box. To the contrary, all the code is exposed; if you really want to make it a black box, then you should use another plugin, Binary Artifacts.
Secondly, your approach is very sensible. To access plugin resources, I would have created a taglib like:
def res = { attrs ->
attrs.dir=pluginContextPath
//Do whatever you want here
out << g.resource(attrs)
}
and call it the same way as <g:resource>. That way, you don’t even have to expose your plugin’s resources path. The Nimble plugin is using this approach.
Also you might have a look at the Grails Resources plugin, which is trying to handle the nightmare of static resource dependencies among Grails plugins and projects. I have never used it, but for sure in my next Grails project, I will integrate it (BTW, it will be included into Grails 1.4).

Web based plugin architecture for simple user interfaces

I have a web based application using Primefaces with a very basic plug-in like architecture. The configuration of these plug-ins was all handled with xml, which is not so user friendly system.
I would now like to allow for each plug-in to be configurable via the web application, what are my options?
I have looked into Portals and Portlets but that seems like a rather big change to my application and my plug-ins do not require such complex user interfaces, a textbox or two of configuration is more than enough.
Does anyone have any suggestions or advice and what would be the best route here?
Create a simple page , per plugin that read the XML file, parse the option that you want to change , present it to the user with a simple interface, and save back the XML file.
Take care of the saving part and password-protect this page!