Make your portlet development use maven in no-time

Posted by:

Background

I started using maven some time back and I have found many advantages. One in particular was the ease to run unit tests. This made me want to be able to unit test portlets. The portlets I create nowadays are all based on the JSR286 standard. I did not find any examples of that, but with some help from what I found I was able to do unit testing. First things first though. Before we can use unit testing for portlets, we need to have a portlet where we also use maven. This blog entry will show you have you as simple as possible get your portlet sources mavenized. 

I will not cover the topic of why you should use portlets or maven. There are so many good resources out there already and a simple search should be easy enough to find them.

 

Basic portlet

First of all I have a really minimalistic portlet. There is only what I need to have inb order for the portlet to work. The point was to give a basic example of what you need to do to start using maven to build your portlet. In this I had the portlet class, a jsp file, the portlet.xml, the web.xml and some resource bundle property files.

 

Preparations

In order to use maven you need to have some software installed. You need to have a jdk (I used the latest available from Oracle) and maven. Make sure you have your maven binaries set in your path and your JAVA_HOME environment variable set to the directory where you installed the JDK. Note! It must be the jdk, a jre will not be sufficient in the long run.

If you just want to use the central maven repository and have direct access to Internet you don't need to do any other configuration, but if your network setup is different you may need to look at additional steps to configure maven, such as using a proxy with maven.

 

Moving files

Maven use a standard layout for its directories. You are in no way obliged to follow this standard and I am not going to even get into a discussion about what is best, I will simply leave that up to you. In this example though, I am using the standard directory layout as it makes the maven configuration easier. 

A portlet is packed in a web application archive, a war file. While maven has no direct portlet packaging available, it is not really required either as we use the war packaging, which effectively does the job. With this in mind there in particular three directories which we will use from the maven standard.

src/main/java
src/main/resources
src/main/webapp

At this step you should move all of your portlet files into these three directories.

src/main/java should contain all your java sources. It is the root directory of your java sources so if you have your classes in packages, that structure must still be intact. The compiled classes will end up in your WEB-INF/classes directory. src/main/resources contains non-java files which should end up together with your compiled classes. In this case the portlet ResourceBundle property files will be here. Again, if you are using a package structure for your resources, that structure must be intact. The resources files will be copied as is (depending on your maven configuration) to your WEB-INF/classes directory. Finally the src/main/webapp directory contains all the files which should end up in the root directory of your web application. This includes any jsps you may have as well as your META-INF and WEB-INF directories (and all the files there in such as WEB-INF/portlet.xml and WEB-INF/web.xml). 

After all of this is completed I ended up with the following file structure:

src\main\java\com\mycompany\myportlet\MyPortlet.java
src\main\resources\com\mycompany\myportlet\nl\MyPortletResource.properties
src\main\resources\com\mycompany\myportlet\nl\MyPortletResource_en.properties
src\main\webapp\view.jsp
src\main\webapp\META-INF\MANIFEST.MF
src\main\webapp\WEB-INF\portlet.xml
src\main\webapp\WEB-INF\web.xml

Maven configuration

The heart of maven configuration is the pom. It is in xml format and its name is pom.xml. This file was created in the root directory. First there was the basic stuff. I won't go into details of any of this. Some of it is fairly self explanatory, but for the rest I suggest you look at the pom reference.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.myportlet</groupId>
    <artifactId>MyPortlet</artifactId>
    <version>0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>My Portlet</name>
    <description>A basic portlet mavenized</description>
    <!-- The dependencies will be added here.-->
</project>

Finally the portlet apis need to be added in order for the portlet class to be compiled. For this we add a dependency. A dependency is really what the name implies. In order to compile and build our portlet we have a dependency on another library (apart from standard java) in this case the portlet api. For this portlet to work only the portlet api is needed, but there may be many dependencies. Note the scope in this dependency. With the scope of provided we are telling maven that this dependency will be provided later on, we only need to use it now at compile time. This is true because the portlet libraries are provided by the portlet container when we run the portlet. The libraries should not be included in our war file.

<dependencies>
    <groupId>javax.portlet</groupId>
    <artifactId>portlet-api</artifactId>
    <version>2.0</version>
    <scope>provided</scope>
    </dependency>
</dependencies>

Building

Now we are done and we are ready to build. The command to build, package and verify as much as possible without adding our built war to the local or remote repository is mvn verify. If all has been done right you should get a BUILD SUCCESSFUL message in the end.

 

References

Cross-post

http://danielsdeveloperblog.blogspot.se/2014/08/make-your-portlet-development-use-maven.html

0

Presentations from our sessions at Social Connections VI in Prague

Posted by:

Home after a fabulous event in Prague, we are more than happy to share with you presentations from our sessions:

 

Electrolux: 4 deep dives in our social journey – Rafael Braz & Ulf Stider

In this session Electrolux and Infoware will share their experiences on urgent subjects for any social agenda. The presentation will primarily be a live demo where Ulf and Rafael discuss each topic from both a business and technical perspective.

 

Launching a social intranet: a true customer story – Ulf Stider & Per Ejnar Thomsen

TINE SA is Norway’s largest producer, distributor and exporter of dairy products.

Spring 2014, TINE launches a new, social intranet for all their employees, with IBM Connections as one of the core components. Learn about TINE’s project with focus on experiences with launching a social intranet; the strategy, the deployment, the technology, the success and the pitfalls, and if all goes well, a live demo of the brand new intranet.

 

 

0

5 minutes of effort = 1600% increase in performance

Posted by:

So, the other day I was humming along for one of our larger clients – putting the finishing touches on one of their applications. The app in question handles matching of vacancies against applications. The administrator needs to quickly have the ability to browse what vacancies have what status. 

One vacancy can have one of three different statuses:

  1. View – Show the selected application for this vacancy.
  2. List – Lists all matching applications for this particular vacancy.
  3. Missing – No current applications exists that match the criteria for this vacancy.

Don't worry too much about the business logic, I only provide a quick background to give you some idea of what I was trying to achieve.

 

Oh, I nearly forgot! Of course this is an IBM Domino solution as we are a "True Blue" IBM Premium Business partner. Unfortunately this client was stuck with a fairly old IBM Domino server: 8.5.2, so I wasn't too keen on using an XPages solution. Why? Because in my humble opinion XPages just hadn't matured enough yet. (Missing HTML5 features, no SSJS debugger, old DOJO release, loooong "first hit" boot times and so on – Yes, all of this can be mended, worked around, patched etc. But sometimes you can just say enough is enough and go with old school Domino development.)

Anywho, my first inclination was to create a WebQuerySave agent that did the matching ServerSide before presenting the result to the user, a very common approach. But the performance was really bad – The WQS agent took around 4000ms although the workload was light and number of documents fairly low (in the hundreds anyway). The page itself took around a second to load with an empty cache, so we we're looking at a total page load time here in the neighborhood of five seconds – not acceptable.

So I used an approach that's known as perceived performance. Let's take a clock as example – If you use a clock that doesn't show seconds, time seems to move slower. If there's a lot of stuff going on, the general experience is that things are happening quicker. So I extracted my LotusScript code and placed it in an agent that get's called thru AJAX. This way the page loads quickly, the user can start to interact with it immediately and the state of each vacancy trickles in as the server sees fit.

Below is a screenshot of the application, waiting for the AJAX request to comeback with the data. (The only vacancies that know its state are the ones that are booked, they're marked with "Visa" in the column to the right, the rest are pending).

 

Finally, here we have the first icarnation of the code:

Nothing too odd about the above, I would even dare to say a fairly common approach. I do what I can to speed up the process by using NotesViewEntryCollections and the ColumnValue-property. Using one view as the source, that has a column that combines the particular criteria for that vacancy. The key can look something like this:

2015-05-27DSurgeon (Date + Slot + Role)

We use this key to find any matching requests, if none is found it's added to the string that's returned to the AJAX request. We only need the ones that doesn't have a match (Missing) as the first state (View) is stored with the vacancy and the second state (List) are all that are not missing. Ideally "Missing" should always be very few documents so the data transfer over the wire should also be low, increasing performance further.

 

So, everything was "hunky-dory" then. The application loaded quickly and felt responsive to the user, but… The bad performance of the LotusScript code was nawing at me… 

After a murky night of coding I came up with the following:

Option Public
Option Declare
Sub Initialize
	Dim s As New NotesSession 
	Dim db As NotesDatabase 
	Dim vRequest As NotesView
	Dim vMatchVacancy As NotesView
	Dim veRequest As NotesViewEntry 
	Dim veMatchVacancy As NotesViewEntry 
	Dim rowIds As String
	Dim key As String
	Dim i As Integer
	Dim count As Long
	Dim hasEmptySlots As Boolean
	
	Dim navMatch As NotesViewNavigator 
	Dim navRequest As NotesViewNavigator 
	Dim ve As NotesViewEntry
	
	On Error GoTo handler
	
	Set db = s.Currentdatabase

	Set vMatchVacancy = db.getView("vMatchVacancy")
	Set vRequest = db.getView("vRequest-list-match")
	
	Call vRequest.refresh()
	Call vMatchVacancy.refresh()
	
	Set navMatch = vMatchVacancy.createViewNav()
	Set navRequest = vRequest.createViewNav()
	
	count = vMatchVacancy.Allentries.Count
	i = 0
	
	' do not do AutoUpdates
	vMatchVacancy.AutoUpdate = False
	vRequest.AutoUpdate = False
	
	' enable cache for max buffering
	navMatch.BufferMaxEntries = 100
	' if we are not interested in the number of children, we can go a little faster
	navMatch.EntryOptions = Vn_entryopt_nocountdata
	

	Set veMatchVacancy = navMatch.GetFirst
	
	Print "content-type: text;charset=utf-8;"
		
	While ( i <  count )  
		hasEmptySlots = False
		key = veMatchVacancy.Columnvalues(0)
		
		Set veRequest = vRequest.Getentrybykey(key, True)
		
		If(veRequest Is Nothing) Then
			Print  rowIds & veMatchVacancy.Columnvalues(1) & ","
		End if
		
		Set veMatchVacancy=navMatch.getNext(veMatchVacancy)
		i = i + 1
	Wend

	
exitSub:
	Exit Sub 
	
handler: 
	MsgBox db.filepath & "agentMatchVacancys - " & Error & Chr(13) + "Module: " & CStr( GetThreadInfo(1) ) & ", Line: " & CStr( Erl ) 
	Print Error & Chr(13) + "Module: " & CStr( GetThreadInfo(1) ) & ", Line: " & CStr( Erl ) 
	
	Resume exitSub 
	
End Sub

The big difference here is the use of the NotesViewNavigator. When using the NotesViewNavigator object you have the opportunity to use it's cache – "BufferMaxEntries". I set it to 100 in my case as the view will show no more then 100 rows at a time. I also set the EntryOptions to "VN_ENTRYOPT_NOCOUNTDATA" as I have no parent/child relationship in the view.

All in all the the running time of the agent went from 4000ms to 25ms! Pretty darn impressive if anyone were to ask me!

 

This technique is nothing new, but the performance gains are so huge I thought it's well wort repeating.

I was heavily influenced by this article: "Fast Retrieval of View Data Using the ViewNavigator Cache – V8.52" and I highly recommend you check that out for more details.

 

[EDIT]

After re-running the performance tests in my local test environment I've "only" managed a 200% increase in performance. Beware, YMMV….

5

Infoware and Tine SA – launching a social intranet – session at Social Connections

Posted by:

A true customer story about implementing a social intranet at one of our two sessions at Social Connections Conference in Prag 16-17 June 2014.

Ulf Stider, Infoware and Per Ejnar Thomsen, Tine SA shares their experiences from the project where IBM Connections is one of the cornerstones.

We are very excited to been given this opportunity!

Read more here: Social Connections – Launching a social intranet

 

Ulf Stider

Ulf Stider – Sales Manager, Infoware

Ulf Stider is Sales manager at Infoware, a collaboration enthusiast with experience from enterprise implementation and integration projects with Domino, Sametime, Portal, Connections, Smartcloud or Tivoli as part of the solution.

PerEjnarThomsen

Per Ejnar Thomsen – IT business developer, TINE SA

Per Ejnar Thomsen is titled an IT business developer / advisor at TINE with former experience as a consultant within the ECM-area. He is a key resource in TINEs intranet team, dedicated to social and enterprise search, product owner of enterprise search and intranet development project manager.

0

Infoware sponsors the Social Connections conference in Prague

Posted by:

We are for the second time around proud to be sponsors of the great conference Social Connections in June! This time the conference will be held in the beautiful city of Prague, and we are all very excited to be given this opportunity.

So, what is Social Connections?

The conference is arranged by the devoted people of the IBM Connections User Group, who work hard to fill the event with excellent speakers, interesting exhibitors, and of course to gather a great audience. At the event we will meet professionals, IBM:ers and clients, who all have different experiences from working with IBM Connections. And they are all up for a discussion and share their knowledge with you.

What will Infoware do in Prague?

First of all, we are sponsors and exhibitors at the event. This means that we will take a huge part in the discussion both in our exhibitor's booth and in a speaker session. We will be available for private meetings, knowledge sharing and so on. Our agenda is of course to speak about Social Business within organizations, and how IBM Connections is the perfect way to reach better and more efficient ways to work. Both regarding implementation projects, how to raise interest in the organization and how to get return of investment.

And as a necessary complement to IBM Connections, we offer our product DomainPatrol Social, which is a excellent tool for managing content and users in IBM Connections. Never again do you need to feel that your content in IBM Connections is stuck where you created it. Just move it with DomainPatrol Social. Keep your environment tidy and up-to-date.

Just be sure to contact us, and we will more then happy to give you more information or help you through all the steps in the process. We have several references who can give you their perspective of how to create a successful environment.

Please join us in Prague! The event is free to attend!

Visit Social Connections

Five Reasons to Attend

Stay social!

0

Infoware on stage talking about mobile development at IBM Connect Stockholm 2014

Posted by:

Our new mobile room booking app has rendered interest from customers as well as partners. We will now show it live in one of the sessions at IBM Connect Stockholm 2014 on February, 19. Don’t miss out!

Our room booking app allows you to quickly and easily get an overview of all your organization’s meetings and room bookings. With the app you can book rooms, check the booking status and above that contact your colleagues. All in your mobile device! Ulf Stider will furthermore discuss mobile development, IBM Worklight, XPages and Open Ratio.

Learn more info about our room booking app here: Room booking app

Read more about IBM Connect Stockholm 2014 here: IBM Connect Stockholm 2014 

MobileRoomBookingApp

0

Infoware is one of the exhibitors at the Social Business Exhibition at IBM Client Center Kista

Posted by:

Energize your life's work and stay social!

Infoware is one of few Business Partners chosen to participate in the Social Business Exhibition at IBM Client Center Nordic in Kista. Throughout 2014 you can visit the IBM Client Center to learn more about Infoware's investment in Social Business and the way we work smarter. After all, Social Business is about the future.IBMSocialBusiness

The opening ceremony will begin with Annika Ekdahl, SWG Manager ICS Sweden, who will talk about IBM's position in the field. Later Infoware's Sales Manger, Ulf Stider, will introduce the specially invited audience, about how we create Social Business and how we use it in today's work.

If you want to know more how we can make your business Social, or if you want to visit the IBM Client Center Nordic, please do not hesitate to contact us

info@infoware.se

 

 

0

Infoware in the spotlight at IBM Connect 2014

Posted by:

IBM Connect is about people and technology.  It is about how passionate people together with IBM social software creates social and successful business.  A number of IBM clients were here to tell their stories. 

During 2013 Infoware has successfully implemented a number of Sametime- and Connections-installations. Infoware has developed and launched a new release of DomainPatrol Social. We have developed and launched a cool mobile app for room and resource booking. We have invested time in certification for onboarding to IBM Smart Cloud.  For all this work we got a lot of recognision at this years IBM Connect.  Here is when in Keynote session 103 The power of Social Software in the enterprise when Infoware was mentioned to be one of the partners adding value to IBM Connections.

Personally I also had the pleasure attending Keynote session 104 Transforming Life's Work – IBM Social Business Cloud Strategy where Infowares was displayed as beeing one of the partners that is certified to help clients Onboard.
 

We are happy to be on a limited list of IBM Business partners in the world. Today 29 partners are on the global list. Infoware is one of them. If you are considering going to the cloud – talk to us. We can advice you on everything from IBM licenses to taking you on board.

For our unique expertise regarding IBM Sametime – Infoware was one of the Business Partners  that was mentioned and had the logo on the screen during the Keynote session: 105 IBM Sametime Roadmap: Because Social Isn’t Social If You Can’t Communicate. 

 

In at least three sessions Infoware was recognised for our skills and contribution to the IBM social business at IBM Connect 2014. It is very rewarding to know that our hard and passionate work is competetive on a global market. IBM Connect is the place to meet up with old friends from customers, other business partners and IBM:ers in different roles. Infoware now also has a global network of resellers for our products.
IBM Connect is the place to meet everybody. It was also exciting to meet the customers we have been doing business with but never met in person. It is all about people. Infoware product DomainPatrol Social creates a lot of interest not only for itself but for our deep knowledge in IBM Connections. We often get involved in discussions regarding tricky technical issues.
When it comes to sessions and talking to people – there is no more talking about IF getting into social business. The talking is about how and when. On premise or in the cloud. We can see the trend of engaging the customers in contributing in developing the businesses. Customer interaction based on social technology creates measureable increased customer loyalty.
We are ready – are you? Do not hesitate to contact us if you want to talk social business.
0

Success in booth 212 at IBM Connect

Posted by:

We have had a hectic couple of days here in booth 212 at IBM Connect in Orlando. The respons from our visitors has been very positive, and we feel that we are right on target with DomainPatrol Social. Many of the customers who have been using IBM Connections, see the need of managing and rearranging the content, and are frustrated that you can not do that. DomainPatrol Social does that for you! Contact us at sales@infoware.se and we will give you a short demo!

20140129-165105.jpg

0
Page 6 of 13 «...45678...»