Message Boards

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Re-use service layer
Answer
8/6/12 11:44 PM
Thank you for sharing this project. I'm just getting familiar with XMLPortletFactory, but it looks great so far! emoticon

Regarding wiki page How to re-use generated service layer:
(I would have commented there but I don't seem to have permission to add a comment.)

Following the instructions on that page I got compilation errors. I had to add two additional source directories to the service build. Perhaps indexing and permissions were added after that wiki page was created? The updated section of build-common-plugin.xml is below.

Is there any risk / concern about adding these additional files to the service?

 1        <path id="service.classpath">
 2            <fileset dir="${app.server.lib.global.dir}" includes="*.jar" />
 3            <fileset dir="${project.dir}/lib" includes="activation.jar,jsp-api.jar,mail.jar,servlet-api.jar" />
 4            <fileset dir="docroot/WEB-INF/lib" excludes="${plugin.name}-service.jar" includes="*.jar" />
 5            <!-- Added.  See http://www.xmlportletfactory.org/wiki/-/wiki/Main/How+to+re-use+generated+service+layer
 6              -->
 7            <fileset dir="${app.server.lib.portal.dir}" includes="util-java.jar" />
 8        </path>
 9
10        <copy todir="docroot/WEB-INF/service">
11          <fileset dir="docroot/WEB-INF/src/" includes="**/model/impl/*.java" />
12          <fileset dir="docroot/WEB-INF/src/" includes="**/service/impl/*.java" />
13          <fileset dir="docroot/WEB-INF/src/" includes="**/service/base/*.java" />
14          <!-- Added.  The following two lines were not included in wiki instructions above -->
15          <fileset dir="docroot/WEB-INF/src/" includes="**/service/permission/*.java" />
16          <fileset dir="docroot/WEB-INF/src/" includes="**/util/*.java" />
17        </copy>

RE: Re-use service layer
Answer
8/7/12 1:54 AM as a reply to Deb Troxel.
Follow up to my own question -

I was blindly following along with the wiki instructions, but now I am wondering why it might be necessary to copy any of the src implementation files to the service layer. I restored build-common-plugin.xml to the standard version and was still able to read and create service objects from the dependent portlet referencing only the service interfaces that are included in the jar by default.

Since XMLPortletFactory is creating standard Liferay service builder code, wouldn't sharing be accomplished the same as for any other service?
http://www.liferay.com/community/wiki/-/wiki/Main/Using+Class+Loader+Proxy+classes+to+share+plugins+services

RE: Re-use service layer
Answer
8/7/12 6:49 AM as a reply to Deb Troxel.
Hola Deb,

You are correct on all asumptions, there has been new features added to XMLPortletFactory since the creation of the wiki page, I will update it today.

The re-use of generated service layer is for non-dependent portlets, I found that if I wanted to use (for example) Dynamic Queries from an external portlet, I have to insert the ?????-service.jar into that portlets lib folder, but did not work if I dont insert a few other folders into it.

Just tested with this new includes and works fine:

1        <copy todir="docroot/WEB-INF/service">
2            <fileset dir="docroot/WEB-INF/src/" includes="**/model/impl/*.java"/>
3            <fileset dir="docroot/WEB-INF/src/" includes="**/service/base/*.java"/>
4            <fileset dir="docroot/WEB-INF/src/" includes="**/service/impl/*.java"/>
5            <fileset dir="docroot/WEB-INF/src/" includes="**/service/permission/*.java"/>
6            <fileset dir="docroot/WEB-INF/src/" includes="**/service/persistence/*.java"/>
7            <fileset dir="docroot/WEB-INF/src/" includes="**/util/*.java"/>
8        </copy>


I did not spend much time investigating this matter, maybe you or someone that reads this post can share his knowledge, and tell us better ways to achieve same results.

Thanks for participating Deb, emoticon

Saludos, Jack.

RE: Re-use service layer
Answer
8/7/12 7:22 PM as a reply to Jack A. Rider.
Hi Jack,

Thanks for the quick reply! If I learn more regarding this I will share my discoveries here.

Deb