Saturday, June 18, 2016

How to configure a porlet inside your application to be installed on Liferay Portal?

I remembered that few years I told a manager to review Liferay Portal before doing an home development, my experience with portals give to suggest that it was going to fix to his solution, after working with Liferay may I say you have to be care and have well-configured, federated, not superpass and overloading the actual functions of the Portal Layer, for example federation is interesting topic where portal layer should be a pass-out and measure how the Authentication, authorization, and accounting (AAA) is doing and where an application should intervene (recovered cookies, tokens or sessions), Liferay as well as an application should live together with other applications in a container installed on a Application Server, you should probably think twice how all applications federated could be live together in a cluster with a server(s) running with Liferay.

Liferay Portal has cool things that you probably you must not codify, configure or manage, for example considerations of being responsive to the client rendering content to the most common devices in the other hand a TUNNING is a priority in development state, the first thing is install the database in DMBS outside of memory fabric configuration (review index, table, partitions, users, columns), clustering is not of free version so you probably develop Security Agents to handle objects of authorization and accounting, review log files to view how you should perform jvm parameters (parallel is recommend) and spread functionality across the server

To configurate a portlet you should the following next steps:

1. Required artifact in your pom file:

2. Configuration in web.xml (tld should be download from liferay distribution)
3. Create portlet file:


There is another consideration to be careful that is well programmed applications using portlets for example, timeout in any request/response in the front-end and in the back-end take care of the cost and duration of transactions for not converting your Application Server in a rock (it happens and is terrible).

So after choosing your portal there is a benefit of using a technology and decisions of taking a path and this is the knowledge and ideas you probably you have experienced, if you are doing a home development is well suited decision to start for your infrastructure or having license for Portals like IBM where front-end should be carried in using and extends provider libraries, or built something from open-source resources which are paths that be well done when there is team up, management with vision and well suited timetables.  

Best regards,



Tuesday, June 14, 2016

How to connect OpenAM and Spring Security to do Single Sign On (SSO)?

There is a list of previous steps for doing SSO between a Web app and OpenAm and the most important things are:
  1.  Start OpenAM and well configurated server.
  2.  Create users and specificate the rol names.
  3.  Install agentapp inside webserver
  4.  Execute agentadmin to create a policy between webapp and openam.
All those steps require some time, in the application context we need to do some configuration in context for conclude AAA, Authentication is taking for OpenAM, Authorization is given by Spring Security and OpenAM interconnection and Accounting is doing for WebApp when it asign the corresponding roles and access to the client (by now we are going to do some federation), so here the short list of configuration for doing with Spring security:

1. First required artifact in the app:

2. Start spring context with spring security:

3. The most import part filters and connection to retry OpenAM config:

4. Create the shared cookie:

5. The amconfig properties to taking url, user and password

For the application is kind of simple for just federate permissions between components.

Important link:

Saturday, June 11, 2016

How to solve 'ISAM error: the file is locked' on Informix after using jdbc?

I have a Teacher/Sensei who teach me a lot the theory and principles of database engine really works his name is ++++++ a consultant and expert on Oracle, we worked together some months ago, my experience at that time was with Oracle Database 11g and Oracle Enterprise Manager, using some past knowledge I have to encourage a relative problem with Informix called "Dirty Reads" he explained to me that is a bad practice of consulting, updating or inserting data.

Informix is more sensible and treats data carefully based on ISAM which are algorithms in database in response a petition of users, so database principles are the same in other database engine, but on the other hand, at Oracle the engine resolves this problem internally and produce a problem or cost when it represents a problem causing interruptions in database, one of those is the best post I have introduced:

http://codefixes.blogspot.mx/2016/05/possible-solution-for-isam-error-key.html

When your process is concurrent and you have multiple users in the background pieces of data have to move on in the engine, if you do not measure and take the cost of queries that you are sending to database eventually you degrade the performance of your application, a problem could be at the next one:

 ISAM error: the file is locked (http://www.oninit.com/errorcode/index.php?pageid=-113)

For solving this kind of problems are two paths, one is correct the application (the better one) or give more time of waiting for the database (mitigating), so please check your query if you are doing an update of a bunch of elements you should go through the primary key o indexed fields, or in it is the case in a select check your where statement and modified to go to indexing field:

update table set column = :column1 where idprimarykey in (:idprimarykey);
select column1, column2, column3 from table where  idprimarykey in (:idprimarykey);

The other method is gained more time in transaction is not an effective way but informix provided:
...
> echo "set isolation to dirty read; select count(*) from customer;" | dbaccess stores_demo
... 
> echo "set lock mode to wait; select count(*) from customer;" | dbaccess stores_demo
...
http://www-01.ibm.com/support/docview.wss?uid=swg21508233

Dirty data are not welcomed to the database and you must carry the access to objects where are you doing transactions and service who are using it. 

Another important configuration when are using Informix is take care of Transaction Isolation and propagations after reading the documentation, Informix does not support readonly=true, and propagation must be in Serializable for betters ways, something like this if you are using spring framework:

@Transactional(value = "XXXXTransaccionManager", readOnly = false, propagation = Propagation.REQUIRED, timeout = 6000,isolation = Isolation.READ_COMMITTED)

And take care of using a version superior of 3 in the driver because it have some problems in the writing.


Best Regards, 

Important links: