|
JFacets /
HomeWelcome to JFacets : the profile-based frameworkJFacets is an Open-Source (Apache v2.0) lightweight framework that deeply integrates the concept of user profile, and allows easy and consistent developement of profile-based software, by implementing kind of profile-based Inversion of Control. A different approach to user profiling...A little code snippet often tells more than a long speech... here under is a "profiled code comparison", between old "if" blocks, and the facet approach. The idea is to show a The ugly "if ... then ... else" way : // The product Product product = ... ; // the current user... MyUser user = ... ; // a dirty, non maintainable "if" block for // handling the roles problem :-/ if (user.isInRole(Role.ADMIN)) { showProductForAdmin(product); } else if (user.isInRole(Role.STANDARD)) { showProductForStandard(product); } ... Doin' it clean : the facet way : // the product Product product = ... ; // the current user... MyUser user = ... ; // get hold of the JFacets bean JFacets jf = JFacets.get(); // retrieve the facet with name 'show' for current user and the product object ShowProductFacet facet = (ShowProductFacet)jf.getFacet("show", user.getUsername(), product); // invoke facet method to perform the profiled work ! facet.showProduct(); As you can see, the facets simply encapsulate the code that has to be used for a given user profile (and target object type : here, the Learn more in the concepts. Features
History...JFacets has been initiated in Y2K, and has been constantly improving since then. It is mainly used in the GUI field, allowing to create personalized User Interfaces (Web & Swing) easily. |