You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Dahl, Sandra" <SD...@dvsAnalytics.com> on 2010/02/02 23:23:15 UTC

login portlet extension

Our application requires a login portlet that is like the login portlet that ships that Jetpseed 2. However, our application requires some changes to the portlet. Examples of changes include changing the messages the portlet displays and tracking the number of unsuccessful log in attempts.

What is the best way to take the standard login portlet and extend it so our changes do not interfere with future Jetspeed releases? Is the login portlet included with j2-admin?

Thanks!
Sandi


________________________________
Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us by return email or telephone immediately. Thank you.

RE: login portlet extension

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
As I suspected. That works perfectly. Thanks!

Sandi


-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Tuesday, February 09, 2010 12:03 PM
To: Jetspeed Developers List
Subject: Re: login portlet extension

On Tue, Feb 9, 2010 at 10:56 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> Since the build worked for you, I tried at the command prompt rather than
> inside eclipse and the project built successfully. The next step I took was
> to delete j2-admin.war from tomcat's webapps director, copy in the new
> extended-j2admin.war into tomcat's webapps directory, and delete tomcat's
> work and temp directories. When tomcat is restarted and the portal opened,
> the following error is in the jetspeed log:
> 09.02.2010 11:52:29 ERROR
> [org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute():194] Error
> rendering portlet OID template-top2.page-template.dp-1.dp-12
> javax.portlet.PortletException: Failed to get Request Dispatcher for
> Portlet Application: /j2-admin, servlet: /container
>
> The login portlet displays the same message on the page. What am I missing?
>
>
Sounds like the web application war and directory are named
extended-j2admin, whereas the PSML references an application named j2-admin.
To resolve this naming conflict, you have two choices: modify the pre-seeded
PSML to reference extended-j2admin OR rename the war file to "j2-admin.war"
prior to deploying

Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential.  It is intended only for the exclusive use of the addressee.  If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify us by return email or telephone immediately.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: login portlet extension

Posted by David Sean Taylor <d....@onehippo.com>.
On Tue, Feb 9, 2010 at 10:56 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> Since the build worked for you, I tried at the command prompt rather than
> inside eclipse and the project built successfully. The next step I took was
> to delete j2-admin.war from tomcat's webapps director, copy in the new
> extended-j2admin.war into tomcat's webapps directory, and delete tomcat's
> work and temp directories. When tomcat is restarted and the portal opened,
> the following error is in the jetspeed log:
> 09.02.2010 11:52:29 ERROR
> [org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute():194] Error
> rendering portlet OID template-top2.page-template.dp-1.dp-12
> javax.portlet.PortletException: Failed to get Request Dispatcher for
> Portlet Application: /j2-admin, servlet: /container
>
> The login portlet displays the same message on the page. What am I missing?
>
>
Sounds like the web application war and directory are named
extended-j2admin, whereas the PSML references an application named j2-admin.
To resolve this naming conflict, you have two choices: modify the pre-seeded
PSML to reference extended-j2admin OR rename the war file to "j2-admin.war"
prior to deploying

RE: login portlet extension

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
Since the build worked for you, I tried at the command prompt rather than inside eclipse and the project built successfully. The next step I took was to delete j2-admin.war from tomcat's webapps director, copy in the new extended-j2admin.war into tomcat's webapps directory, and delete tomcat's work and temp directories. When tomcat is restarted and the portal opened, the following error is in the jetspeed log:
09.02.2010 11:52:29 ERROR [org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute():194] Error rendering portlet OID template-top2.page-template.dp-1.dp-12
javax.portlet.PortletException: Failed to get Request Dispatcher for Portlet Application: /j2-admin, servlet: /container

The login portlet displays the same message on the page. What am I missing?

Thanks!
Sandi



-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Monday, February 08, 2010 1:32 PM
To: Jetspeed Developers List
Subject: Re: login portlet extension

Im not sure ... I just downloaded the zip and tried it out, worked fine for
me. Could it be that you don't have the 2.2.1-SNAPSHOT in your repo?

<dependency>
          <groupId>org.apache.portals.jetspeed-2</groupId>
          <artifactId>j2-admin</artifactId>
          <type>war</type>
          <version>2.2.1-SNAPSHOT</version>
    </dependency>


On Mon, Feb 8, 2010 at 10:49 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> Hi, David. Thank you for the example. I am trying the maven solution you
> have below and get the error below when running
> org.apache.maven.plugins:maven-war-plugin:2.0.2:war.
>
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building extended-j2admin Maven Webapp
> [INFO]    task-segment:
> [org.apache.maven.plugins:maven-war-plugin:2.0.2:war]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [war:war {execution: default-cli}]
> [INFO] Exploding webapp...
> [INFO] Assembling webapp extended-j2admin in
> W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
> [INFO] Copy webapp webResources to
> W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error unpacking file: W:\eclipseWorkspace\j2-admin\target\classesto:
> W:\eclipseWorkspace\extended-j2admin\target\war\work\cla
>
> Embedded error: The source must not be a directory.
>
> ThankS! Sandi
> -----Original Message-----
> From: David Sean Taylor [mailto:d.taylor@onehippo.com]
> Sent: Wednesday, February 03, 2010 4:04 PM
> To: Jetspeed Developers List
> Subject: Re: login portlet extension
>
> On Wed, Feb 3, 2010 at 7:44 AM, Dahl, Sandra <SD...@dvsanalytics.com>
> wrote:
>
> > Thanks for the information, David. In general, what is the best practice
> > for extending an existing Jetspeed portlet so future Jetspeed updates can
> be
> > easily implemented?
> >
> > I think there are two approaches you can take:
>
> 1. write your own administrative portlet application, and manage all code
> yourself
> 2. overlay the j2-admin.war artifact from maven
>
> The first solution doesn't work well for re-use, as much j2-admin's
> functionality is hidden down in JSP files. Additionally, we do not
> distribute j2-admin as a jar file to reuse java classes. With that in mind,
> lets look at how you can approach the second solution.
>
> Many people prefer Ant for this kind of processing. In fairness to Ant,
> lets
> look at how you could do that. I didn't have an example with the j2-admin
> war, but here is an similar example using the jetspeed layouts war.
>
> <target name='overlay-layouts'>
> <mkdir dir='${installer.target}/unpack/'/>
> <unjar
>
> src="${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war"
>   dest="${installer.target}/unpack/jetspeed-layouts/"/>
> <copy overwrite='true'
> todir='${installer.target}/unpack/jetspeed-layouts/WEB-INF/'
>      file="./src/layouts/portlet.xml"/>
> <jar
>
> destfile='${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war'
> basedir="${installer.target}/unpack/jetspeed-layouts/" update='true'/>
> </target>
>
> In the target above, the Ant target overlays my customized portlet.xml on
> top of the jetspeed-layouts war, and then create the new merged war file.
> The downside to this approach, we don't take the jetspeed-layouts.war file
> out of a Maven repository.
>
> As a hybrid solution, if you prefer Ant but are required to use Maven, you
> can embed ant commands into Maven at the generate-resources phase. There
> are
> examples of this in the jetspeed-installer and enterprise sub-projects
>
> Here is a pure Maven solution, which I would consider a best practice for
> Maven builds. In this example I use the Maven War Plugin's overlay feature:
>
> http://maven.apache.org/plugins/maven-war-plugin/overlays.html
>
> Here is a complete pom.xml example:
>
> <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/maven-v4_0_0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>org.apache.portals.jetspeed-2</groupId>
>  <artifactId>extended-j2admin</artifactId>
>  <packaging>war</packaging>
>  <version>0.0.1-SNAPSHOT</version>
>  <name>extended-j2admin Maven Webapp</name>
>  <url>http://maven.apache.org</url>
>  <dependencies>
>    <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>3.8.1</version>
>      <scope>test</scope>
>    </dependency>
>    <dependency>
>    <groupId>org.apache.portals.jetspeed-2</groupId>
>    <artifactId>j2-admin</artifactId>
>    <type>war</type>
>    <version>2.2.1-SNAPSHOT</version>
>    </dependency>
>  </dependencies>
>  <build>
>    <finalName>extended-j2admin</finalName>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-war-plugin</artifactId>
>        <configuration>
>          <overlays>
>            <overlay>
>              <id>j2-admin</id>
>      <groupId>org.apache.portals.jetspeed-2</groupId>
>      <artifactId>j2-admin</artifactId>
>            </overlay>
>           <overlay>
>              <!-- empty groupId/artifactId is detected as the current build
> -->
>            </overlay>
>          </overlays>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
> I have zipped up the entire project for you to play around with and put it
> on my retired server here:
>
> http://www.bluesunrise.com/jetspeed-2/2.2/extended-j2admin.zip
>
> There are two files in the overlay project's webapp source:
>
> 1. the web.xml, to show an example of replacing an existing file, where I
> simply changed the display-name and description as an example:
>
>  <display-name>Sandra's Jetspeed-2 Portal Administration
> Portlets</display-name>
>  <description>Sandra's Administration Portlets for the Jetspeed-2
> Enterprise Portal</description>
>
> 2. the index.jsp, to show an example of adding a new file
>
> Confidentiality Notice:
> The information contained in this communication, including attachments, is
> privileged and confidential.  It is intended only for the exclusive use of
> the addressee.  If the reader is not the intended recipient, or the
> employee, or the agent responsible for delivering it to the intended
> recipient, you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If you have received
> this communication in error, please notify us by return email or telephone
> immediately.  Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>

Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential.  It is intended only for the exclusive use of the addressee.  If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify us by return email or telephone immediately.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: login portlet extension

Posted by David Sean Taylor <d....@onehippo.com>.
Im not sure ... I just downloaded the zip and tried it out, worked fine for
me. Could it be that you don't have the 2.2.1-SNAPSHOT in your repo?

<dependency>
          <groupId>org.apache.portals.jetspeed-2</groupId>
          <artifactId>j2-admin</artifactId>
          <type>war</type>
          <version>2.2.1-SNAPSHOT</version>
    </dependency>


On Mon, Feb 8, 2010 at 10:49 AM, Dahl, Sandra <SD...@dvsanalytics.com>wrote:

> Hi, David. Thank you for the example. I am trying the maven solution you
> have below and get the error below when running
> org.apache.maven.plugins:maven-war-plugin:2.0.2:war.
>
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building extended-j2admin Maven Webapp
> [INFO]    task-segment:
> [org.apache.maven.plugins:maven-war-plugin:2.0.2:war]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [war:war {execution: default-cli}]
> [INFO] Exploding webapp...
> [INFO] Assembling webapp extended-j2admin in
> W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
> [INFO] Copy webapp webResources to
> W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error unpacking file: W:\eclipseWorkspace\j2-admin\target\classesto:
> W:\eclipseWorkspace\extended-j2admin\target\war\work\cla
>
> Embedded error: The source must not be a directory.
>
> ThankS! Sandi
> -----Original Message-----
> From: David Sean Taylor [mailto:d.taylor@onehippo.com]
> Sent: Wednesday, February 03, 2010 4:04 PM
> To: Jetspeed Developers List
> Subject: Re: login portlet extension
>
> On Wed, Feb 3, 2010 at 7:44 AM, Dahl, Sandra <SD...@dvsanalytics.com>
> wrote:
>
> > Thanks for the information, David. In general, what is the best practice
> > for extending an existing Jetspeed portlet so future Jetspeed updates can
> be
> > easily implemented?
> >
> > I think there are two approaches you can take:
>
> 1. write your own administrative portlet application, and manage all code
> yourself
> 2. overlay the j2-admin.war artifact from maven
>
> The first solution doesn't work well for re-use, as much j2-admin's
> functionality is hidden down in JSP files. Additionally, we do not
> distribute j2-admin as a jar file to reuse java classes. With that in mind,
> lets look at how you can approach the second solution.
>
> Many people prefer Ant for this kind of processing. In fairness to Ant,
> lets
> look at how you could do that. I didn't have an example with the j2-admin
> war, but here is an similar example using the jetspeed layouts war.
>
> <target name='overlay-layouts'>
> <mkdir dir='${installer.target}/unpack/'/>
> <unjar
>
> src="${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war"
>   dest="${installer.target}/unpack/jetspeed-layouts/"/>
> <copy overwrite='true'
> todir='${installer.target}/unpack/jetspeed-layouts/WEB-INF/'
>      file="./src/layouts/portlet.xml"/>
> <jar
>
> destfile='${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war'
> basedir="${installer.target}/unpack/jetspeed-layouts/" update='true'/>
> </target>
>
> In the target above, the Ant target overlays my customized portlet.xml on
> top of the jetspeed-layouts war, and then create the new merged war file.
> The downside to this approach, we don't take the jetspeed-layouts.war file
> out of a Maven repository.
>
> As a hybrid solution, if you prefer Ant but are required to use Maven, you
> can embed ant commands into Maven at the generate-resources phase. There
> are
> examples of this in the jetspeed-installer and enterprise sub-projects
>
> Here is a pure Maven solution, which I would consider a best practice for
> Maven builds. In this example I use the Maven War Plugin's overlay feature:
>
> http://maven.apache.org/plugins/maven-war-plugin/overlays.html
>
> Here is a complete pom.xml example:
>
> <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/maven-v4_0_0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>org.apache.portals.jetspeed-2</groupId>
>  <artifactId>extended-j2admin</artifactId>
>  <packaging>war</packaging>
>  <version>0.0.1-SNAPSHOT</version>
>  <name>extended-j2admin Maven Webapp</name>
>  <url>http://maven.apache.org</url>
>  <dependencies>
>    <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>3.8.1</version>
>      <scope>test</scope>
>    </dependency>
>    <dependency>
>    <groupId>org.apache.portals.jetspeed-2</groupId>
>    <artifactId>j2-admin</artifactId>
>    <type>war</type>
>    <version>2.2.1-SNAPSHOT</version>
>    </dependency>
>  </dependencies>
>  <build>
>    <finalName>extended-j2admin</finalName>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-war-plugin</artifactId>
>        <configuration>
>          <overlays>
>            <overlay>
>              <id>j2-admin</id>
>      <groupId>org.apache.portals.jetspeed-2</groupId>
>      <artifactId>j2-admin</artifactId>
>            </overlay>
>           <overlay>
>              <!-- empty groupId/artifactId is detected as the current build
> -->
>            </overlay>
>          </overlays>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
> I have zipped up the entire project for you to play around with and put it
> on my retired server here:
>
> http://www.bluesunrise.com/jetspeed-2/2.2/extended-j2admin.zip
>
> There are two files in the overlay project's webapp source:
>
> 1. the web.xml, to show an example of replacing an existing file, where I
> simply changed the display-name and description as an example:
>
>  <display-name>Sandra's Jetspeed-2 Portal Administration
> Portlets</display-name>
>  <description>Sandra's Administration Portlets for the Jetspeed-2
> Enterprise Portal</description>
>
> 2. the index.jsp, to show an example of adding a new file
>
> Confidentiality Notice:
> The information contained in this communication, including attachments, is
> privileged and confidential.  It is intended only for the exclusive use of
> the addressee.  If the reader is not the intended recipient, or the
> employee, or the agent responsible for delivering it to the intended
> recipient, you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If you have received
> this communication in error, please notify us by return email or telephone
> immediately.  Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>

RE: login portlet extension

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
Hi, David. Thank you for the example. I am trying the maven solution you have below and get the error below when running org.apache.maven.plugins:maven-war-plugin:2.0.2:war.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building extended-j2admin Maven Webapp
[INFO]    task-segment: [org.apache.maven.plugins:maven-war-plugin:2.0.2:war]
[INFO] ------------------------------------------------------------------------
[INFO] [war:war {execution: default-cli}]
[INFO] Exploding webapp...
[INFO] Assembling webapp extended-j2admin in W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
[INFO] Copy webapp webResources to W:\eclipseWorkspace\extended-j2admin\target\extended-j2admin
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error unpacking file: W:\eclipseWorkspace\j2-admin\target\classesto: W:\eclipseWorkspace\extended-j2admin\target\war\work\cla

Embedded error: The source must not be a directory.

ThankS! Sandi
-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Wednesday, February 03, 2010 4:04 PM
To: Jetspeed Developers List
Subject: Re: login portlet extension

On Wed, Feb 3, 2010 at 7:44 AM, Dahl, Sandra <SD...@dvsanalytics.com> wrote:

> Thanks for the information, David. In general, what is the best practice
> for extending an existing Jetspeed portlet so future Jetspeed updates can be
> easily implemented?
>
> I think there are two approaches you can take:

1. write your own administrative portlet application, and manage all code
yourself
2. overlay the j2-admin.war artifact from maven

The first solution doesn't work well for re-use, as much j2-admin's
functionality is hidden down in JSP files. Additionally, we do not
distribute j2-admin as a jar file to reuse java classes. With that in mind,
lets look at how you can approach the second solution.

Many people prefer Ant for this kind of processing. In fairness to Ant, lets
look at how you could do that. I didn't have an example with the j2-admin
war, but here is an similar example using the jetspeed layouts war.

<target name='overlay-layouts'>
<mkdir dir='${installer.target}/unpack/'/>
<unjar
src="${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war"
   dest="${installer.target}/unpack/jetspeed-layouts/"/>
<copy overwrite='true'
todir='${installer.target}/unpack/jetspeed-layouts/WEB-INF/'
      file="./src/layouts/portlet.xml"/>
<jar
destfile='${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war'
basedir="${installer.target}/unpack/jetspeed-layouts/" update='true'/>
</target>

In the target above, the Ant target overlays my customized portlet.xml on
top of the jetspeed-layouts war, and then create the new merged war file.
The downside to this approach, we don't take the jetspeed-layouts.war file
out of a Maven repository.

As a hybrid solution, if you prefer Ant but are required to use Maven, you
can embed ant commands into Maven at the generate-resources phase. There are
examples of this in the jetspeed-installer and enterprise sub-projects

Here is a pure Maven solution, which I would consider a best practice for
Maven builds. In this example I use the Maven War Plugin's overlay feature:

http://maven.apache.org/plugins/maven-war-plugin/overlays.html

Here is a complete pom.xml example:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.portals.jetspeed-2</groupId>
  <artifactId>extended-j2admin</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>extended-j2admin Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.portals.jetspeed-2</groupId>
    <artifactId>j2-admin</artifactId>
    <type>war</type>
    <version>2.2.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>extended-j2admin</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <overlays>
            <overlay>
              <id>j2-admin</id>
      <groupId>org.apache.portals.jetspeed-2</groupId>
      <artifactId>j2-admin</artifactId>
            </overlay>
           <overlay>
              <!-- empty groupId/artifactId is detected as the current build
-->
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

I have zipped up the entire project for you to play around with and put it
on my retired server here:

http://www.bluesunrise.com/jetspeed-2/2.2/extended-j2admin.zip

There are two files in the overlay project's webapp source:

1. the web.xml, to show an example of replacing an existing file, where I
simply changed the display-name and description as an example:

  <display-name>Sandra's Jetspeed-2 Portal Administration
Portlets</display-name>
  <description>Sandra's Administration Portlets for the Jetspeed-2
Enterprise Portal</description>

2. the index.jsp, to show an example of adding a new file

Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential.  It is intended only for the exclusive use of the addressee.  If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify us by return email or telephone immediately.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: login portlet extension

Posted by David Sean Taylor <d....@onehippo.com>.
On Wed, Feb 3, 2010 at 7:44 AM, Dahl, Sandra <SD...@dvsanalytics.com> wrote:

> Thanks for the information, David. In general, what is the best practice
> for extending an existing Jetspeed portlet so future Jetspeed updates can be
> easily implemented?
>
> I think there are two approaches you can take:

1. write your own administrative portlet application, and manage all code
yourself
2. overlay the j2-admin.war artifact from maven

The first solution doesn't work well for re-use, as much j2-admin's
functionality is hidden down in JSP files. Additionally, we do not
distribute j2-admin as a jar file to reuse java classes. With that in mind,
lets look at how you can approach the second solution.

Many people prefer Ant for this kind of processing. In fairness to Ant, lets
look at how you could do that. I didn't have an example with the j2-admin
war, but here is an similar example using the jetspeed layouts war.

<target name='overlay-layouts'>
<mkdir dir='${installer.target}/unpack/'/>
<unjar
src="${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war"
   dest="${installer.target}/unpack/jetspeed-layouts/"/>
<copy overwrite='true'
todir='${installer.target}/unpack/jetspeed-layouts/WEB-INF/'
      file="./src/layouts/portlet.xml"/>
<jar
destfile='${installer.target}/portal/webapps/dash/WEB-INF/deploy/local/jetspeed-layouts.war'
basedir="${installer.target}/unpack/jetspeed-layouts/" update='true'/>
</target>

In the target above, the Ant target overlays my customized portlet.xml on
top of the jetspeed-layouts war, and then create the new merged war file.
The downside to this approach, we don't take the jetspeed-layouts.war file
out of a Maven repository.

As a hybrid solution, if you prefer Ant but are required to use Maven, you
can embed ant commands into Maven at the generate-resources phase. There are
examples of this in the jetspeed-installer and enterprise sub-projects

Here is a pure Maven solution, which I would consider a best practice for
Maven builds. In this example I use the Maven War Plugin's overlay feature:

http://maven.apache.org/plugins/maven-war-plugin/overlays.html

Here is a complete pom.xml example:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.portals.jetspeed-2</groupId>
  <artifactId>extended-j2admin</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>extended-j2admin Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>org.apache.portals.jetspeed-2</groupId>
    <artifactId>j2-admin</artifactId>
    <type>war</type>
    <version>2.2.1-SNAPSHOT</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>extended-j2admin</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <overlays>
            <overlay>
              <id>j2-admin</id>
      <groupId>org.apache.portals.jetspeed-2</groupId>
      <artifactId>j2-admin</artifactId>
            </overlay>
           <overlay>
              <!-- empty groupId/artifactId is detected as the current build
-->
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

I have zipped up the entire project for you to play around with and put it
on my retired server here:

http://www.bluesunrise.com/jetspeed-2/2.2/extended-j2admin.zip

There are two files in the overlay project's webapp source:

1. the web.xml, to show an example of replacing an existing file, where I
simply changed the display-name and description as an example:

  <display-name>Sandra's Jetspeed-2 Portal Administration
Portlets</display-name>
  <description>Sandra's Administration Portlets for the Jetspeed-2
Enterprise Portal</description>

2. the index.jsp, to show an example of adding a new file

RE: login portlet extension

Posted by "Dahl, Sandra" <SD...@dvsAnalytics.com>.
Thanks for the information, David. In general, what is the best practice for extending an existing Jetspeed portlet so future Jetspeed updates can be easily implemented?

Thanks!
Sandi


-----Original Message-----
From: David Sean Taylor [mailto:d.taylor@onehippo.com]
Sent: Tuesday, February 02, 2010 4:54 PM
To: Jetspeed Developers List
Subject: Re: login portlet extension

On Tue, Feb 2, 2010 at 2:23 PM, Dahl, Sandra <SD...@dvsanalytics.com> wrote:

> Our application requires a login portlet that is like the login portlet
> that ships that Jetpseed 2. However, our application requires some changes
> to the portlet. Examples of changes include changing the messages the
> portlet displays and tracking the number of unsuccessful log in attempts.
>

The login messages are stored in a resource file found in the j2-admin
application under
org.apache.jetspeed.portlets.security.resources.LoginResources_(language).properties

There already is a feature for configuring limits on unsuccessful logins.
See the online documentation here:

http://portals.apache.org/jetspeed-2/deployguide/credentials.html
http://portals.apache.org/jetspeed-2/deployguide/security-config.html



>
> What is the best way to take the standard login portlet and extend it so
> our changes do not interfere with future Jetspeed releases? Is the login
> portlet included with j2-admin?
>
>
Yes, its a part of j2-admin application. If you want to extend say the
resource messages, you can repackage the j2-admin war, and override the
resource files by placing yours in the WEB-INF/classes directory under the
same package as the replaced Jetspeed resources


> Thanks!
> Sandi
>
>
> ________________________________
> Confidentiality Notice:
> The information contained in this communication, including attachments, is
> privileged and confidential. It is intended only for the exclusive use of
> the addressee. If the reader is not the intended recipient, or the employee,
> or the agent responsible for delivering it to the intended recipient, you
> are hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us by return email or telephone
> immediately. Thank you.
>

Confidentiality Notice:
The information contained in this communication, including attachments, is privileged and confidential.  It is intended only for the exclusive use of the addressee.  If the reader is not the intended recipient, or the employee, or the agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify us by return email or telephone immediately.  Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: login portlet extension

Posted by David Sean Taylor <d....@onehippo.com>.
On Tue, Feb 2, 2010 at 2:23 PM, Dahl, Sandra <SD...@dvsanalytics.com> wrote:

> Our application requires a login portlet that is like the login portlet
> that ships that Jetpseed 2. However, our application requires some changes
> to the portlet. Examples of changes include changing the messages the
> portlet displays and tracking the number of unsuccessful log in attempts.
>

The login messages are stored in a resource file found in the j2-admin
application under
org.apache.jetspeed.portlets.security.resources.LoginResources_(language).properties

There already is a feature for configuring limits on unsuccessful logins.
See the online documentation here:

http://portals.apache.org/jetspeed-2/deployguide/credentials.html
http://portals.apache.org/jetspeed-2/deployguide/security-config.html



>
> What is the best way to take the standard login portlet and extend it so
> our changes do not interfere with future Jetspeed releases? Is the login
> portlet included with j2-admin?
>
>
Yes, its a part of j2-admin application. If you want to extend say the
resource messages, you can repackage the j2-admin war, and override the
resource files by placing yours in the WEB-INF/classes directory under the
same package as the replaced Jetspeed resources


> Thanks!
> Sandi
>
>
> ________________________________
> Confidentiality Notice:
> The information contained in this communication, including attachments, is
> privileged and confidential. It is intended only for the exclusive use of
> the addressee. If the reader is not the intended recipient, or the employee,
> or the agent responsible for delivering it to the intended recipient, you
> are hereby notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us by return email or telephone
> immediately. Thank you.
>