Integrating Light Portal with existing Java EE Web Application(Draft)


Introduction

This document describes how to integrate Light Portal with existing Java EE Web Application.

Steps

1 Add lightPortal.jar and all the dependent jar files.

Before integrating Light Portal with existing Java EE Web Application, we need to add lightPortal.jar and all the dependent jar files into existing Java EE Web Application's WEB-INF/lib folder.


2 Add WebContent sub folders to existing Web Application's WebContent folder.

We need to copy all folders except WEB-INF under WebContent in the Light Portal to existing Java EE Web Application's as same level structure.

3 Add portlets folder to existing Web Application's WebContent folder.

The portelts folder under WebContent/WEB-INF in the Light Portal contains all the pre-built portlets' jsp files, such as search, weather bookmark. If we plan to use these pre-built portlets, we need copy the whole foler to existing Java EE Web Application's, as same level as WEB-INF.

4 Add view folder to existing Web Application's WebContent folder.

The view folder under WebContent/WEB-INF in the Light Portal contains all the portlets' cache content, we need copy the whole foler to existing Java EE Web Application's, as same level as WEB-INF.

5 Copy config files to existing Web Application's WEB-INF folder.

All the xml, xsd and tld files under WebContent/WEB-INF foler in the Light Portal contains all the Light Portal's configuration information. We need copy all these files except web.xml to WEB-INF folder and add Light Portal's web.xml information to the existing web.xml file.

6 Copy index.jsp files.

we need to copy index.jsp, m.jsp, group/index.jsp, visitor/index.jsp, visitor/m.jsp also.

7 Authentication and Authorization part

For authentication and authorization part, there are many ways to integrate Light Portal with exsiting application.

6.1 Using existing Application's Authentication and Authorization.

Most existing application already contains authentication and authorization part, user can disable Light Portal's "Sign in" function, just share with existing application's "Sign in" function. For this purpose, user needs do following steps:
      1 In existing application' Sign in function, after user successfully logged in, set userId to Light Portal:
         call org.light.portal.core.PortalUtil.setUser(HttpServletRequest request, String userId) method and pass in 2 parameters.
      2 Configure user's role at portal-security.xml.
      3 Configure portal-security.xml to disable "Sign in" function, set all role's allowSignIn to false.
      4 Configure portal-layout.xml according existing user's role.
      5 See 6.2 for using existing user and user role data

After user logged in, application can redirect to Light Portal page or put a portal turn on link at the main page. When user visit to the Light Portal  page, all the Light Portal's munu ,tab pages and portlets will rendered according to that user's role.

6.2 Using existing user and user role data.

For normal Java EE Web Application, it has its own user and user role data already. If we need using existing user and user role data, we have to reimplement some interface in the org.light.portal.model package or modify existing implementation.

public interface User {
    public long getId();
    public long getOrgId();   
    public String getUserId();
    public String getPassword();   
    public String getEmail();   
    public String getBirth();
    public String getLanguage();
    public String getCountry();
    public String getProvince();
    public String getCity();
    public String getPostalCode();
    public String getName();
    public String getAge();
    public String getAssignedUri();   
    public String getChosedUri();
    public String getUri();
    public Timestamp getLastLoginDate();
    public Date getCreateDate();
    public int getVisitCount();
    public String getPhotoUrl();
    public String getPhotoThumbUrl();
    public String getLastDate();
    public String getGender();
    public String getGenderName();
    public int getPhotoWidth();
    public int getPhotoHeight();
    public String getDisplayName();
    public String getCaption();
    public String getMusicUrl();
    public int getOtherMusucAutoPlay();
    public int getMyMusicAutoPlay();
    public String getRingToneUrl();
    public int getBlogCommentFriendOnly();
    public int getCommentNeedApprove();
    public int getFqNel();
    public int getImprivacy();   
    public int getNewsLetter();
    public int getNoPicForward();
    public int getNotification();
    public int getProfileFriendViewOnly();
    public int getShowBirthToFriend();
    public String getVideoUrl() ;
    public String getRegion();
    public String getBirthY();
    public String getBirthM();
    public String getBirthD();
    public String getTimeZone();
    public int getDefaultFileStatus();
    public int getDefaultPictureStatus();
    public int getDefaultMusicStatus();
    public int getGrowKeyword();
    public int getShowTitleToFriends();
    public String getTitle();
    public int getPhotoSmallWidth();
    public int getPhotoSmallHeight();
   
    public boolean userDisabled();
    public boolean userLocked();
   
    public void setId(long id);
    public void setOrgId(long orgId);
    public void setTitle(String title);
    public void setShowTitleToFriends(int showTitleToFriends);
    public void setGrowKeyword(int growKeyword);
    public void setDefaultFileStatus(int defaultFileStatus);
    public void setDefaultPictureStatus(int defaultPictureStatus);
    public void setDefaultMusicStatus(int defaultMusicStatus);
    public void setDisabled(int disabled);
    public void setLocked(int locked);
    public void setTimeZone(String timeZone);
    public void setRegion(String region);
    public void setBlogCommentFriendOnly(int blogCommentFriendOnly);
    public void setCommentNeedApprove(int commentNeedApprove);
    public void setFqNel(int fqNel);
    public void setImprivacy(int imprivacy);
    public void setNewsLetter(int newsLetter);
    public void setNoPicForward(int noPicForward);
    public void setNotification(int notification);
    public void setProfileFriendViewOnly(int profileFriendViewOnly);   
    public void setShowBirthToFriend(int showBirthToFriend);
    public void setVideoUrl(String videoUrl);
    public void setRingToneUrl(String ringToneUrl);
    public void setMyMusicAutoPlay(int myMusicAutoPlay);
    public void setOtherMusucAutoPlay(int otherMusucAutoPlay);
    public void setMusicUrl(String musicUrl);
    public void setCaption(String caption);
    public void setDisplayName(String displayName);
    public void setPhotoHeight(int photoHeight);   
    public void setPhotoWidth(int photoWidth);
    public void setGender(String gender);
    public void setCreateDate(Date createDate);
    public void setVisitCount(int visitCount);
    public void setPhotoUrl(String photoUrl);
    public void setLastLoginDate(Timestamp lastLoginDate);
    public void setAssignedUri(String givenUri);
    public void setChosedUri(String chosedUri);
    public void setUserId(String userId);
    public void setPassword(String password);   
    public void setEmail(String email);
    public void setBirth(String birth);
    public void setLanguage(String language);
    public void setCountry(String country);
    public void setProvince(String province);
    public void setCity(String city);
    public void setPostalCode(String postalCode);
   
}


public interface UserRole {
    public String getRoleId();
    public String getUserId();
   
    public void setRoleId(String roleId);   
    public void setUserId(String userId) ;
}