• Welcome to KonaKart Community Forum. Please login or sign up.
 

Developing a custom Konakart Portlet

Started by Kim.Zeevaarders, May 30, 2011, 04:20:40 pm

Previous topic - Next topic

Kim.Zeevaarders

Hi,

I planning on developing a simple Konakart Portlet which will list some links to the details of the "new" products (same as te list on the main page when you log in to the store front). I will get this data through use of the highlevel konakart soap api.

I already created a new project (in eclipse) and copied the following things from the kkeclips project to my testproject:
- the web-inf folder (only the files under this directory, not the subfolders, e.g. web.xml, struts-config.xml, etc.)
- all libraries from the web-inf/lib directory
- alle property files under the src/properties directory.

At this point I think I have all necessary files to use the konakart soap-api in my project (if not, please point out the missing things :)) and build a simple struts/jsp page with a singkle action that call the soap-apis to retrieve the new products from the database and show them as links in the jsp page.

However, to get this program to run succesfully as a portlet I need to comply to the JSR168 specification, which I know very little about...

I already build the portlet_war with ant (target=make_liferay_portlet_war) that is referenced from the user guide and deployed it in liferay. This all works very smooth (except that I do not see any categories in the left upper corner ánd cannot add products to the basket, but this is for later concern).

Further analysis of the build target in the build.xml file shows the following core actions being performed:

      <echo message="Lay out the WAR in the staging area" />
      <echo message="Copy (almost) the whole konakart webapp to staging area" />
      <copy todir="${custom.home}/konakart_portlet/stage/konakart/">
         <fileset dir="${konakart.dir}">
            <exclude name="**/struts.jar" />
            <exclude name="**/*.jsp" />
            <exclude name="**/web.xml" />
            <exclude name="**/struts-config.xml" />
         </fileset>
      </copy>

      <echo message="Copy the jars reqd for the portlet to staging area" />
      <copy todir="${custom.home}/konakart_portlet/stage/konakart/WEB-INF/lib">
         <fileset dir="./konakart_portlet/struts">
            <include name="struts-1.2.7.jar" />
            <include name="portals-bridges.jar" />
         </fileset>
      </copy>

      <echo message="Copy the config files reqd for the portlet to staging area" />
      <copy todir="${custom.home}/konakart_portlet/stage/konakart/WEB-INF/">
         <fileset dir="./konakart_portlet/struts">
            <include name="*.xml" />
            <include name="*.tld" />
         </fileset>
         <fileset dir="./konakart_portlet/liferay">
            <include name="*.xml" />
         </fileset>
      </copy>

      <echo message="Filter the JSPs to staging area for the portlet WAR" />
      <java classname="com.dsdata.util.PortalBuildUtils"
            fork="false"
            failonerror="true"
            timeout="20000">
         <arg value="jsp" />
         <arg value="-p" />
         <arg value="liferay" />
         <arg value="-i" />
         <arg value="${konakart.dir}/" />
         <arg value="-o" />
         <arg value="${custom.home}/konakart_portlet/stage/konakart/" />
         <classpath refid="konakart.portlet.build.utils" />
      </java>

      <echo message="Filter the web.xml to staging area for the portlet WAR" />
      <java classname="com.dsdata.util.PortalBuildUtils"
            fork="false"
            failonerror="true"
            timeout="20000">
         <arg value="webxml" />
         <arg value="-p" />
         <arg value="liferay" />
         <arg value="-i" />
         <arg value="${konakart.dir}/WEB-INF/web.xml" />
         <arg value="-o" />
         <arg value="${custom.home}/konakart_portlet/stage/konakart/WEB-INF/web.xml" />
         <classpath refid="konakart.portlet.build.utils" />
      </java>

      <echo message="Filter the struts-config.xml to staging area for the portlet WAR" />
      <java classname="com.dsdata.util.PortalBuildUtils"
            fork="false"
            failonerror="true"
            timeout="20000">
         <arg value="strutsconfig" />
         <arg value="-p" />
         <arg value="liferay" />
         <arg value="-i" />
         <arg value="${konakart.dir}/WEB-INF/struts-config.xml" />
         <arg value="-o" />
         <arg value="${custom.home}/konakart_portlet/stage/konakart/WEB-INF/struts-config.xml" />
         <classpath refid="konakart.portlet.build.utils" />
      </java>

As I can see a staging directory is created, almost the whole webapps/konakart directory is copied there, jars and .xml files are added to the lib directory and the jsp's and web.xml are filtered/adjusted by something called the portal build uility.

My question is as follows: Do I need to "reverse engineer" this build target for my own custom portlet? What approach do you advise people trying to build their own portlet from scratch? Where can I find more information about the portal build utility and the several added .xml config files that are added?

Furthermore, the user guide is very limited on this subject and only gives a brief explanation about integrating the entire store front in liferay. Nothing is mentioned about the approach when starting from scratch.

I would really appreciate if you guys could get me on my way with this one :)

Many thx in advance,

Kim

kate

If you're building a portlet for Liferay from scratch you really need to reference Liferay documentation to find out the best way to do that.   The only contact there with KonaKart would be through the APIs.

Kim.Zeevaarders

Kate,

Thanks for the response.

So it's actually not a real feature, you guys only wrote an ant script to convert the store front app to comply to the JSR-168 standard.

If U want somethin custom you're on your own :)

I'll dive into Liferay development then...

Regards,

Kim

kate

Huh? 

I'd say that creating a portlet from the store front is a good feature.

It's the same with anything...  if you want something different you have to create it yourself.

At least you have a comprehensive set of APIs to make that possible.