myblogspace sriram

Wednesday Feb 18, 2009

Directory deployment  using Portal Pack and Netbeans 6.5

Portalpack plugins for Netbeans 6.5 supports directory deployment in addition to deployment using archived formats like .war.With directory deployment, the deployment structure used is same as the one we get after expanding the war file.

With directory deployment enabled ,the IDE need not archieve the files into .war format and also the appserver need not expand the archieved format during deployment.In this case the webapplication application directory is not expanded under (..\glassfish\domains\domain1\applications\j2ee-modules)

JSP files can be modified and the changes done are reflected on the portal server immediately, just by clicking the save option.This enables faster development.

Please follow the below steps to enable directory deployment in Portal Pack

1)Go to Services tab

2)Right click on Webspace10.x(Project Websynergy) and check the "Directory Deployment Enabled" option

Please follow the below steps to try Directory deployment of a portlet application

1)With directory deployment option enabled create a HelloWorld portlet application

2)Right click the application and select deploy

3)Add the HelloWorld application on the portal page

4)Modify the HelloWorld_view.jsp to include some liferay ui tag elements.

5)Now  click save after making changes to the jsp.There is no need to build/package the war and deploy again.

6)Refresh the portal page where the HelloWorld appplication was added.

In directory deployment the directory structure under <application>/build/webs will be used by the server

If you happen to use php,ruby or groovy for developing your portlets then here's the good news.You can also avail directory deployment on these non java portlets.These non java portlets can be used  on WebSpace/Liferay.Any changes made to *.rb,*.groovy ,*.php,*.js,*.html  files is reflected on the deployed application by simply saving the changes. 

Note:If you have deployed an application using directory deployment and if you like to switch to normal deployment then make sure that you have undeployed the application before you use normal deployment. Directory deployment can be used with Visualweb JSF portlets also. The supported run times are Open Source Portlet Container,WebSpace10.x Server,Liferay+Glassfish2.x/Tomcat

Monday Nov 24, 2008

Pre-requirements: .NetFramework 3.0 and above,Windows Installer 4.5 and above,Windows Power Shell.

Installing SQL Server Express 2008 with Management Tools

1)Download SQL Server 2008 Express with Tools or  SQL Server 2008 Express Advanced Series
2)Run the SQLEXPRADV_x86_ENU.exe
3)In the "SQL Server Installation Center" one can Click on System Configurator Checker to see if all the pre requisites are installed.
4)Choose Installtion option and  select "New SQL Server stand-alone installation or add features to an existing installation"
5)The product key setting page appears.Click next
6)Click next on the Licence Terms page
7)Click Install in the Set up Support Files screen and once the setup is over,click next
8)In the features selection screen select
a)Database Engine Services
b)ManagementTools-Basic
9)During Instance configuration enter, "MSSQLSERVER" in the Named instance and Instance Id box.Click Next . To understand why we do this please refer to http://msdn.microsoft.com/en-us/library/ms165614.aspx
10)In the Server Configuration Page
      a)Use "NT AUTHORITY\SYSTEM" as account name of SQL Server Database engine
      b)Change SQL Server Browser startup to Automatic.Other setting remain same.

11)In the Data Base Engine Configuration screen
    a)Select Mixed Node (so that the built in the admin user "sa" can be user for authorisation inaddition to windows authorisation)
    b)Provide password for the account "sa".
    c)Click next and wait for installation to finish


Starting MS SQL Server

1)Run MSSQL Server Configuration Manager
2)In "SQL Server Network Configuration->Protocols for SQL SERVER." Enable TCP/IP and Named Pipes(SQL server used port 1433 by default)
2)Right click  on SQL Server Services->SQL Server and select start.
3)netstat -an|grep 1433 to check Mssql is running.


Setting up JDBC connection Pool

1)Download Microsoft SQL Server 2005 JDBC Driver 1.2 (driver for 2008 is not available now)(http://www.microsoft.com/downloads/details.aspx?FamilyID=c47053eb-3b64-4794-950d-81e1ec91c1ba&displaylang=en)
2)Copy the sqljdbc.jar to domains/domain1/ext/lib
3)Enter localhost:4848 and login as admin/adminadmin
4)Assuming websynergy is already running on glassfish,there would be
    a)jdbc/LiferayPool and jdbc/JIRAPool under CommonTasks->Resources->JDBC->JDBC resources
    b)  LiferayPool and JIRAPool under CommonTasks->Resources->JDBC->Connection Pool
5)Create  new connection pools LiferayPool2 and JIRAPool2
    ResourceType:javax.sql.DataSource
    DataSource Classname:com.microsoft.sqlserver.jdbc.SQLServerDataSource
    Database Vendor:Microsoft SQL server

    In the additional Properties specify the following
    user : sa
    password : <sa_account_password_given_during_installation>
    databaseName : lportal
    serverName : <name of the computer>

6)Map the jdbc/LiferayPool , jdbc/JIRAPool to LiferayPool2 and JIRAPool2 respectively.click save
7)In the connections pools,use  ping to check if its successful.

Refer to blogs.sun.com/JagadishPrasath/entry/jdbc_connection_pool_templates_glassfish  for additional information on connection pools with MS SQL

Connecting to MS SQL using Management Studio tool

1)Run SQL Server Management Studio
2)File->Connect Object Explorer
3)Use the below Setting
      Server Type:Database Engine
      Server Name:<name of the computer>
      Authentication : SQL Server Authentication (To use SQL Server authentication we should have selected Mixed Mode(Windows authentication +SQL Server             authentication) option during Installation
   Login : sa  
   Password : MSSQL administrator password given during installation

4)Click connect
5)Select New Query in the Management Studio tool
6)Write create database lportal; and click execute.You should see "Query succesfully executed " message














Thursday Nov 20, 2008

Here is a brief up about the visit to UVCE(University Visvesvaraya College of Engineering)  where SUN MICROSYSTEMS was invited to give a tech talk.Siddesh,I ,Ramesh and Sanjay represented SUN Microsystems for this event.


Inspiron is an annual tech fest conducted by UVCE,Bangalore.It was very pleasing to see Sun Microsystems logo all around in the banners.The atmosphere was highly electric,we all felt nostalgia for our own college days.

Siddesh in his icebreaker session spoke of SUN's open source initiative.He talked about the importance of WIN-WIN paradigm that SUN has adopted by encouraging students to participate with open source products(especially glassfish).He also demoed a live installation process.(Most of them weren't exposed to application server,except few).To put it a nut shell he ran through all the important slides covering simple and  practical uses cases of LB,Clustering and HA.We didn't stress too much on the word quality though we mentioned about the success stories of FISHCAT program that was adopted of Glassfish V3 testing .We invited the students to become contributors by asking them to work on glassfish projects and get their names up there on the glassfish site as the project contributors.This session on glassfish lasted for 30 mins.


We also took this opportunity to introduce WebSynergy to the student community.Webynergy running on Glassfish was an icing on the cake .We showed few simple ,practical use cases, covering university requirements where websynergy can be of help.
We introduced portlets and talked about its similarity to servlets.We also gave a demo on creating portlets,inter portlet communication using Netbeans and PortalPack plugins.

We threw few questions to the students and gave away goodies for correct answers.
We were quite pleased and taken aback to see the student coordinators(Prajwal,Vinith,Ranjitha) distributing  CD's  containing glassfish and Netbeans to those who were present.It was a well managed event.

We shared with students few project ideas for websynergy portal. We distributed those project summaries along with glassfish projects.

Few students are interested to work on Metro based projects and are in touch with Sudhir in this regard.We thank Sudhir and Padma for making this possible.We plan to be in touch with the UVCE students through UVCE OSUM(open source university meetup) club http://osum.sun.com/group/uvceosumclubbangalore

Sunday Jun 01, 2008

1)Creating a JDBC Connection Pool and JNDI Resource
a)login http://localhost:4848
b)Configuration->JDBC->Connection Pool->New
c)Enter, Name:test/Liferay, ResourceType=javax.sql.Datasource
d)Navigate to additional properties and specify the following
User:lportal Password:abc123
Url:"jdbc:mysql://localhost:3306/lportal"
Port:3306
Note(lportal database and user lportal are already created in mysql,see step 2 to know how they are created)

e)Configuration->JDBC->Resources->New Here use the above created connection pool
f)Navigate to the coonection pool and click Ping to check if is succesfull

2)Mysql preconfiguration

a)Login as root: mysql -u root -p or mysql -u root
b)Create a database lportal:create database lportal;
c)Create user lportal :create user lportal@localhost identified by 'pass';
d)Provide Admin rights for the lportal user: grant all privileges on lportal.* to lportal@'localhost' identified by 'pass'
Note:When liferay starts up it automatically creates as necessary tables under lportal databases This can be seen using following commands after loggin in as lportal

a)use database lportal; b)select * from lportal

Tuesday May 27, 2008

Here we'll breifly discuss abput creating roles in Glassfish-v2 and using those roles in a portlet. This portlet will be deployed on portlet container

Creating user and role in Glassfish-v2

=============================

1)Login to admin console at http://localhost:8080/portletdriver/dt

2)Goto Configuration->security->admin-realms->Manage users

3)Provide a user name and Group/role eg user name:ed group:role1 eg user name:mary group:role2

4)click save

Now we have sucessfully created an user and grouped him or given him a role.Out task now is to create a portlet that will use these roles . All portlets that make use of roles needs to supllied with a roles file. We'll now make the roles file

Create a roles.txt file with the following name value pair 

role1=EMPLOYEE role2=MANAGER

Creating a portlet .xml and web.xml that has the role informations 

Portlet.xml 

<security-role-ref>

<role-name>employee</role-name>
<role-link>EMPLOYEE</role-link>
</security-role-ref>
<security-role-ref>
<role-name>manager</role-name>
<role-link>MANAGER</role-link>
</security-role-ref>

Web.xml

<security-role>

<role-name>EMPLOYEE</role-name>
</security-role>
<security-role>
<role-name>MANAGER</role-name>
</security-role>

Create a portlet that uses the role info 

1)You can create a simple portlet through netbeans and portal pack 2)In the doView() of the portlet created paste the following

writer.prinln("Employee"+req.isUserInRole(employee)); writer.println("Manager"+req.isUserInRole(manager));

Login in as mary or ed

1)Deploy the portlet.war in portlet container along with the roles.txt

You can either use the admin tab in portlet container to specify the war file and roles files or You can use the following CLI

ant deploy-portlet -Dportlet-war= -Droles-file=

2)Now when used "ed" logs in to the OSPC(open source portlet container) he'll see the follwoing output for the portlet

Employee:true Manager:false