facebook

Portlet development (XDoclet related) [Workaround]

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #206189 Reply

    Kris
    Member

    I do not understand the following:
    my eclipse provides support for @portlet tags, but I cannot get the xdoclet to “parse” those tags unless i manually edit the xdoclet-build.xml file. By doing that, things worked out fine, and the portlet.xml file got generated, but that is not really a solution, since the file is autogenerated and one should not edit it.

    I see i the documentation there is a portlet module, but I cannot add xdoclet confuguration that would support the @portlet tags.
    Any suggestions?
    Rgds, Kris

    btw: a quick workaround by editing the xdoclet-build.xml file is adding the following task:

    
    <target name="portlet" description="Standard Portlet">
    <taskdef name="portletdoclet" 
       classname="xdoclet.modules.portlet.PortletDocletTask"
       classpathref="xdoclet.classpath"/>
    
    <portletdoclet destdir="WebRoot/WEB-INF">
    
      <fileset dir="src">
        <include name="**/*Portlet.java" />
      </fileset>
            
      <portletxml/>
    </portletdoclet>
    </target>
    
    #206192

    Hey,
    Nice to see that someone else is trying to use MyEclipse to create portlets.
    If only we had some way of creating portlets using wizards … [Enhancement] 😀

    ??Nice To Have??
    +1

    Greetz,
    Les.

    #206195

    Riyad Kalla
    Member

    Hey you guys know how it works, if enough people want the functionality, then we will definately provide it.

    sudkcoce,
    Just to update you, I’ve asked our XDoclet guy to look at your question. He should get back to you today.

    #206196

    Can we start a poll or something to see if people dig this ???

    Greetz,
    Les.

    #206199

    Riyad Kalla
    Member
    #206207

    Greg
    Member

    sudkcoce,

    The reason you can’t find the portlet doclet in the XDoclet configuration menu is because it isn’t there :). MyEclipse does have support for the portletdoclet task, but it doesn’t show up in the configuration page.

    The portletdoclet should be in the “Add Doclet” list in the XDoclet configuration. Currently, there are 9 doclets in the list and there is a way you can add the portletdoclet item to this list. The file that generates this doclet list is located at

    $MYECLISE_INSTALL_DIR/eclipse/puglins/org.jboss.ide.eclipse.xdoclet.run/resources/reference.xml

    You can add support for the portletdoclet by adding a task definition there. You should be able to follow the example of other tasks in this file as well as using the portlet documentation from the xdoclet website. Once you add in the new task, restart MyEclipse and you should see the new task in the “Add Doclet” list.

    If you get this to work and would like to contribute your work back to MyEclipse, we will add it in our next release and give you appropriate credit in the ME credits screen. But either way, I will add this as an enhancement request to MyEclipse XDoclet support so the ME devs will know about it. We appreciate your feekback.

    Thank you.

    #206209

    Kris
    Member

    <b>Greg</b>, <b>support-rkalla</b>.
    Thanks a lot for your prompt reply. Your answer is _exactly_ what I needed :lol:.
    I will try to fix the thing and will contribute the solution!
    Best regards,
    Kris

    #206258

    Kris
    Member

    I have added support for portaldoclet thanks to your extensible framework! So, here’s my solution to make portlet developers happier. 😀
    First, make sure you have the portlet.jar library in your project’s classpath.
    Second, append the task/configuration. The two files that need to be modified reside here:

    $MYECLISE_INSTALL_DIR/eclipse/plugins/com.genuitec.jboss.ide.eclipse.xdoclet.run_2.7.1/resources
    
    reference.xml:
    =============
    ...
    <task name="portletdoclet" className="xdoclet.modules.portlet.PortletDocletTask" used="true">
            <attribute name="excludedTags" used="false"/>
            <attribute name="destDir" used="false"/>
            <attribute name="mergeDir" used="false"/>
            <attribute name="force" used="false"/>
            <attribute name="verbose" used="false"/>
            <attribute name="addedTags" used="false"/>
            <element name="configParam" displayName="configParam" used="true">
                <attribute name="name" used="false"/>
                <attribute name="value" used="false"/>
            </element>
            <element name="fileset" used="true">
               <attribute name="dir" value="src" used="true"/>
               <element name="include" used="true">
                   <attribute name="name" value="**/*Portlet.java" used="true"/>
               </element>
               <element name="exclude" used="false">
                   <attribute name="name" value="**/*Portlet.java" used="true"/>
               </element>
            </element>
            <element name="PackageSubstitution" displayName="PackageSubstitution" used="true">
                <attribute name="packages" used="false"/>
                <attribute name="substituteWith" used="false"/>
            </element>
            <element name="portletxml" displayName="portletxml" used="true">
                <attribute name="useIds" used="false"/>
                <attribute name="xmlencoding" used="false"/>
                <attribute name="schema" used="false"/>
                <attribute name="validateXML" used="false"/>
                <attribute name="acceptInterfaces" used="false"/>
                <attribute name="acceptAbstractClasses" used="false"/>
                <attribute name="packageSubstitutions" used="false"/>
                <attribute name="packageSubstitutionInheritanceSupported" used="false"/>
                <attribute name="subTaskClassName" used="false"/>
                <attribute name="prefixWithPackageStructure" used="false"/>
                <attribute name="templateFile" used="false"/>
                <attribute name="havingClassTag" used="false"/>
                <attribute name="ofType" used="false"/>
                <attribute name="subTaskName" used="false"/>
                <attribute name="destDir" used="false"/>
                <attribute name="mergeDir" used="false"/>
                <element name="ConfigParam" displayName="ConfigParam" used="true">
                    <attribute name="name" used="false"/>
                    <attribute name="value" used="false"/>
                </element>
                <element name="OfType" displayName="OfType" used="true">
                    <attribute name="type" used="false"/>
                </element>
                <element name="PackageSubstitution" displayName="PackageSubstitution" used="true">
                    <attribute name="packages" used="false"/>
                    <attribute name="substituteWith" used="false"/>
                </element>
                         >
            </element>
            <element name="subTask" displayName="subTask" used="true">
                <attribute name="subTaskName" used="false"/>
                <attribute name="destDir" used="false"/>
                <attribute name="mergeDir" used="false"/>
                <attribute name="currentMethodTag" used="false"/>
                <attribute name="currentClassTag" used="false"/>
                <attribute name="currentFieldTag" used="false"/>
                <attribute name="currentPackage" used="false"/>
                <attribute name="currentMethod" used="false"/>
                <attribute name="currentConstructor" used="false"/>
                <attribute name="currentField" used="false"/>
                <attribute name="currentClass" used="false"/>
            </element>
            <element name="template" displayName="template" used="true">
                <attribute name="acceptInterfaces" used="false"/>
                <attribute name="acceptAbstractClasses" used="false"/>
                <attribute name="packageSubstitutions" used="false"/>
                <attribute name="packageSubstitutionInheritanceSupported" used="false"/>
                <attribute name="subTaskClassName" used="false"/>
                <attribute name="prefixWithPackageStructure" used="false"/>
                <attribute name="engine" used="false"/>
                <attribute name="destinationFile" used="false"/>
                <attribute name="templateURL" used="false"/>
                <attribute name="templateFile" used="false"/>
                <attribute name="extent" used="false"/>
                <attribute name="havingClassTag" used="false"/>
                <attribute name="ofType" used="false"/>
                <attribute name="subTaskName" used="false"/>
                <attribute name="destDir" used="false"/>
                <attribute name="mergeDir" used="false"/>
                <attribute name="currentMethodTag" used="false"/>
                <attribute name="currentClassTag" used="false"/>
                <attribute name="currentFieldTag" used="false"/>
                <attribute name="currentPackage" used="false"/>
                <attribute name="currentMethod" used="false"/>
                <attribute name="currentConstructor" used="false"/>
                <attribute name="currentField" used="false"/>
                <attribute name="currentClass" used="false"/>
            </element>
            <element name="xmlTemplate" displayName="xmlTemplate" used="true">
                <attribute name="useIds" used="false"/>
                <attribute name="xmlencoding" used="false"/>
                <attribute name="schema" used="false"/>
                <attribute name="validateXML" used="false"/>
                <attribute name="acceptInterfaces" used="false"/>
                <attribute name="acceptAbstractClasses" used="false"/>
                <attribute name="packageSubstitutions" used="false"/>
                <attribute name="packageSubstitutionInheritanceSupported" used="false"/>
                <attribute name="subTaskClassName" used="false"/>
                <attribute name="prefixWithPackageStructure" used="false"/>
                <attribute name="engine" used="false"/>
                <attribute name="destinationFile" used="false"/>
                <attribute name="templateURL" used="false"/>
                <attribute name="templateFile" used="false"/>
                <attribute name="extent" used="false"/>
                <attribute name="havingClassTag" used="false"/>
                <attribute name="ofType" used="false"/>
                <attribute name="subTaskName" used="false"/>
                <attribute name="destDir" used="false"/>
                <attribute name="mergeDir" used="false"/>
                <attribute name="currentMethodTag" used="false"/>
                <attribute name="currentClassTag" used="false"/>
                <attribute name="currentFieldTag" used="false"/>
                <attribute name="currentPackage" used="false"/>
                <attribute name="currentMethod" used="false"/>
                <attribute name="currentConstructor" used="false"/>
                <attribute name="currentField" used="false"/>
                <attribute name="currentClass" used="false"/>
            </element>
        </task>
    ...
    
    
    standards.xml:
    =============
    ...
    <configuration name="Standard Portlet" used="true">
          <task name="portletdoclet" used="true" className="xdoclet.modules.portlet.PortletDocletTask">
             <attribute name="excludedTags" value="@version,@author,@todo" used="true"/>
             <attribute name="destDir" value="src" used="true"/>
             <attribute name="mergeDir" value="" used="false"/>
             <attribute name="force" value="" used="false"/>
             <attribute name="verbose" value="true" used="true"/>
             <attribute name="addedTags" value="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}" used="true"/>
             <attribute name="ignoredtags" value="" used="false"/>
             <attribute name="validating" value="" used="false"/>
             <element name="fileset" used="true">
                <attribute name="dir" value="src" used="true"/>
                <element name="include" used="true">
                    <attribute name="name" value="**/*Portlet.java" used="true"/>
                </element>
                <element name="exclude" used="false">
                    <attribute name="name" value="**/*Portlet.java" used="true"/>
                </element>
             </element>
             <element name="portletxml" displayName="portletxml" used="true">
                 <attribute name="useIds" value="" used="false"/>
                 <attribute name="xmlencoding" value="" used="false"/>
                 <attribute name="schema" value="" used="false"/>
                 <attribute name="validateXML" value="" used="false"/>
                 <attribute name="acceptInterfaces" value="" used="false"/>
                 <attribute name="acceptAbstractClasses" value="" used="false"/>
                 <attribute name="packageSubstitutions" value="" used="false"/>
                 <attribute name="packageSubstitutionInheritanceSupported" value="" used="false"/>
                 <attribute name="subTaskClassName" value="" used="false"/>
                 <attribute name="prefixWithPackageStructure" value="" used="false"/>
                 <attribute name="templateFile" value="" used="false"/>
                 <attribute name="havingClassTag" value="" used="false"/>
                 <attribute name="ofType" value="" used="false"/>
                 <attribute name="subTaskName" value="" used="false"/>
                 <attribute name="destDir" value="WebRoot/WEB-INF" used="true"/>
                 <attribute name="mergeDir" value="" used="false"/>
             </element>
          </task>
       </configuration>
    ...
    

    After that, restart Eclipse. The portletdoclet support is added the same way as the “Standard Web”. The default dir for portlet.xml is WebRoot/WEB-INF.

    I would have attached the files for your convenience, but cannot seem to find that option. 🙁

    A note for support:
    A thing that I found strange in the reference.xml file are the “orphaned” > tags. The XML document validation passed through ok, so I didn’t touch them…

    Best regards,
    Kristjan Cocev

    #206270

    Greg
    Member

    Kristjan,

    Thanks for your efforts. I have updated the enhancement request in our tracking system to include your contributions. Great Work!

    #206340

    Kris
    Member

    One more problem solved.
    The xdoclet template has the schema elements in the <portlet-app> tag all wrong. 🙁
    The result of this is that the portal parser will not be able to parse the generated portlet.xml file and subsequently fail to deploy the portlet.
    I have modified the xdoclet-portlet-module-1.2.jar file by changing the template resource, but unfortunatelly cannot upload the file here.
    But don’t dispair, you can modify the portlet.xml file by hand (only one tag):

    
    portlet.xml
    ============
    <?xml version="1.0" encoding="UTF-8"?>
    <portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
    ...
    

    Best regards,
    Kris

    ps. Greg, the xdoclet-portlet-module-1.2.jar file located under $MYECLISE_INSTALL_DIR\eclipse\plugins\com.genuitec.jboss.ide.eclipse.xdoclet.core_2.7.1 has to be mofdified the following way:
    the <portlet-app> element in the file xdoclet\modules\portlet\resources\portlet_xml.xdt should read:

    
    <portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
    

    Mybe you could send this to xdoclet guys as a bugfix for xdoclet-portlet-module-1.2.jar. So I expect the xdoclet-portlet-module-1.3.jar in the near future… 😆

    #206342

    Riyad Kalla
    Member

    Kristjan,
    We love you AND have sent your fix along to be implemented. Thanks again!

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Portlet development (XDoclet related) [Workaround]

You must be logged in to post in the forum log in