Help with Jetspeed

2005-02-02 Thread lorenzo baylon
hi there!!!
 my name is lhorenz, a neophyte in java programming and became so 
 interested about your project Jetspeed.
 I tried to install it in my system by downloading the source files, 
 and to create my own trial portlet, I've created an action and a 
 velocity file. May I ask where to put these files (directory) 
 together with the source files of Jetspeed so I can rebuild it and 
 deploy later? how about the rebuilding process, I'm getting this 
 error message  BUILD FAILED
 /home/angelbert/downloads/current/jetspeed-1.5/build.xml:24: 
 Following error occured while executing this line
 java.io.FileNotFoundException: 
 /home/angelbert/downloads/current/jetspeed-1.5/build/build.xml (No 
 such file or directory)

 May I ask this help from you guys?

 Thanks in advance and more power!!!

 lhorenz
-- 
___
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: latest FileSystemPAM mods

2005-02-02 Thread Scott T. Weaver
That was if somehow a portlet app was being deployed and the app already 
existed, i.e. deploy somehow fired in favor of redeploy. I think it was 
there to support a very slim chance of this happening. I don't think you 
need to worry about porting it.

Randy Watler wrote:
Scott,
I am confused by this change to FileSystemPAM:
@@ -387,6 +387,12 @@
// save it to the registry
log.info(Saving the portlet.xml in the registry...);
+ if(registry.namedPortletApplicationExists(app.getName()))
+ {
+ log.warn(Deployment has found an app with the application name, 
+app.getName()+
+ . The existing app will be removed in favor of this one.);
+ undeploy(paWar);
+ }
registry.registerPortletApplication(app);
log.info(Committing registry changes...);

I would like this logic to somehow be moved to the 
DeployPortletAppEventListener instead of bailing out in the middle of 
a registration process here by undeploying. Under what conditions were 
you trying to undeploy here? I do not understand how this could even 
happen unless there were some kind of race condition involved... what 
am I missing?

I was not able to port this change forward into my version of 
FileSystemPAM. We need to resolve this issue if we need to preserve 
this functionality.

Randy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Great minds discuss ideas. Average minds discuss events. Small minds discuss 
people.  - Admiral Hyman Rickover
***
*   Scott T. Weaver   *
* [EMAIL PROTECTED] *
* http://www.einnovation.com*
* --  *
*   Apache Jetspeed Enterprise Portal *
* Apache Pluto Portlet Container  *
* *
* OpenEdit, Website Content Management*
* http://www.openedit.org   *
***
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view database-edit.vm

2005-02-02 Thread rogerrut
rogerrut2005/02/02 11:48:12

  Modified:applications/demo/src/webapp/WEB-INF/view database-edit.vm
  Log:
  SSO- Disabling code fixed. SSO fields were editable
  
  Revision  ChangesPath
  1.5   +4 -3  
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-edit.vm
  
  Index: database-edit.vm
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-edit.vm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- database-edit.vm  2 Feb 2005 00:49:05 -   1.4
  +++ database-edit.vm  2 Feb 2005 19:48:12 -   1.5
  @@ -82,13 +82,13 @@
   tr

   th class=portlet-section-alternatefont 
class=portlet-form-field-label$MESSAGES.getString(label.jdbc.driver)/font/th

   td

  -  input type=input name=SSOJdbcDriver $!disableSSO  
value=$!prefsMap.get('JdbcDriver') size=60 maxlength=60 
class=portlet-form-field-label/ 

  +  input type=input name=SSOJdbcDriver $!disableSSO  
value=$!prefsMap.get('SSOJdbcDriver') size=60 maxlength=60 
class=portlet-form-field-label/ 

   /td

 /tr

 tr

   th class=portlet-section-alternatefont 
class=portlet-form-field-label$MESSAGES.getString(label.jdbc.connection)/font/th

   td

  -  input type=input name=SSOJdbcConnection $!disableSSO 
value=$!prefsMap.get('JdbcConnection') size=60 maxlength=60 
class=portlet-form-field-label/ 

  +  input type=input name=SSOJdbcConnection $!disableSSO 
value=$!prefsMap.get('SSOJdbcConnection') size=60 maxlength=60 
class=portlet-form-field-label/ 

   /td

 /tr

 tr

  @@ -160,7 +160,8 @@
 function disableSSO(flag) 

 {

   document.forms['J2DBEdit'].SSOSite.disabled = flag;

  -document.forms['J2DBEdit'].SSOPrincipal.disabled = flag;

  +document.forms['J2DBEdit'].SSOJdbcDriver.disabled = flag;

  +document.forms['J2DBEdit'].SSOJdbcConnection.disabled = flag;
   

 }

   

 function presave()

  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl LanguageImpl.java

2005-02-02 Thread weaver
weaver  2005/02/02 12:59:26

  Modified:components/registry/src/java/org/apache/jetspeed/om/impl
LanguageImpl.java
  Log:
  Additional fix for  issues surrounding the random disappearence of localized 
portlet titles.
  
  Revision  ChangesPath
  1.10  +113 -95   
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java
  
  Index: LanguageImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/impl/LanguageImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LanguageImpl.java 14 Jan 2005 21:07:56 -  1.9
  +++ LanguageImpl.java 2 Feb 2005 20:59:26 -   1.10
  @@ -21,9 +21,11 @@
   import java.util.Collections;
   import java.util.Enumeration;
   import java.util.HashMap;
  +import java.util.HashSet;
   import java.util.Iterator;
  -import java.util.ListResourceBundle;
   import java.util.Locale;
  +import java.util.Map;
  +import java.util.MissingResourceException;
   import java.util.ResourceBundle;
   import java.util.StringTokenizer;
   
  @@ -33,24 +35,25 @@
   
   /**
* 
  - * LanguageImpl
  - * br
  - * Okay, base Language really has nothing to really do at all with language 
  - * per se.  It actually represents the locallized codetitle/code and
  - * codeshort-title/code attributes of a portlet's definition.  It
  - * also contains a resource bundle for the specifc locale.
  - * br
  - * TODO: org.apache.pluto.om.common.Language should be seperated  into 
  - * TODO a Language class that just contains the resource bundle and
  - * TODO a Title class that contains a localized title and short title.
  + * LanguageImpl br
  + * Okay, base Language really has nothing to really do at all with language 
per
  + * se. It actually represents the locallized codetitle/code and
  + * codeshort-title/code attributes of a portlet's definition. It also
  + * contains a resource bundle for the specifc locale. br
  + * TODO: org.apache.pluto.om.common.Language should be seperated into TODO a
  + * Language class that just contains the resource bundle and TODO a Title 
class
  + * that contains a localized title and short title.
* 
  - * @author a href=mailto:[EMAIL PROTECTED]Scott T. Weaver/a
  + * @author a href=mailto:[EMAIL PROTECTED]Scott T. Weaver /a
* @version $Id$
  - *
  + *  
*/
   public class LanguageImpl implements MutableLanguage, Serializable
   {
   
  +public static final String JAVAX_PORTLET_KEYWORDS = 
javax.portlet.keywords;
  +public static final String JAVAX_PORTLET_SHORT_TITLE = 
javax.portlet.short-title;
  +public static final String JAVAX_PORTLET_TITLE = javax.portlet.title;
   private Locale locale; // new Locale(en);
   private String title;
   private String shortTitle;
  @@ -58,8 +61,8 @@
   private ResourceBundle resourceBundle;
   
   /**
  - * This field can be used by persistence tools for storing PK info
  - * Otherwise it has no effect on the functioning of the portal.
  + * This field can be used by persistence tools for storing PK info 
Otherwise
  + * it has no effect on the functioning of the portal.
*/
   protected long id;
   
  @@ -70,41 +73,33 @@
   this(Locale.getDefault(), null, , , );
   }
   
  -public LanguageImpl(Locale locale, String title)
  +public LanguageImpl( Locale locale, String title )
   {
   this(locale, null, title, , );
   }
   
  -public LanguageImpl(
  -Locale locale,
  -ResourceBundle bundle,
  -String defaultTitle,
  -String defaultShortTitle,
  -String defaultKeyWords)
  -{
  -this.resourceBundle =
  -new ResourceBundleImpl(
  -bundle,
  -new DefaultsResourceBundle(defaultTitle, defaultShortTitle, 
defaultKeyWords));
  +public LanguageImpl( Locale locale, ResourceBundle bundle, String 
defaultTitle, String defaultShortTitle,
  +String defaultKeyWords )
  +{
  +
  +HashMap defaults = new HashMap(3);
  +defaults.put(JAVAX_PORTLET_TITLE, defaultTitle);
  +defaults.put(JAVAX_PORTLET_SHORT_TITLE, defaultShortTitle);
  +defaults.put(JAVAX_PORTLET_KEYWORDS, defaultKeyWords);
  +this.resourceBundle = new DefaultsResourceBundle(bundle, defaults);
   
   this.locale = locale;
  -setTitle(this.resourceBundle.getString(javax.portlet.title));
  -
setShortTitle(this.resourceBundle.getString(javax.portlet.short-title));
  -setKeywords(this.resourceBundle.getString(javax.portlet.keywords));
  +setTitle(this.resourceBundle.getString(JAVAX_PORTLET_TITLE));
  +
setShortTitle(this.resourceBundle.getString(JAVAX_PORTLET_SHORT_TITLE));
  +

Re: [J2] New PAM/Deployer

2005-02-02 Thread Scott T. Weaver
Seems to be working for me.  However, I had to modify the redploy() 
method in FilSystemPAM as such:

   // It might be the case were things have become 
unsynchronized and the target app for redploy
   // actully needs the full deploy treatment. 
   if 
(registry.namedPortletApplicationExists(paWar.getPortletApplicationName()))
   {
   doUnregister(paWar.getPortletApplicationName(), false);
   String paName = paWar.getPortletApplicationName();
   DirectoryHelper deployedDir = new DirectoryHelper(new 
File(webAppsDir + / + paName));
   PortletApplicationWar existingWar = new 
PortletApplicationWar(deployedDir, paName, / + paName);

   existingWar.removeWar();
   existingWar.close();
   sysDeploy(paWar, DEPLOY_WAR);
   }
   else
   {
   deploy(paWar);
   }
reason being that it appears that if an app is deployed in the app 
server but not in jetspeed, the app is never registered to jetspeed.  I 
added a simple check that if we were  trying to redeploy an app that 
exists in the container but not in jetspeed we just do a full deploy 
instead.

Does this make sense?  I was having issues redploying my custom portal 
that uses the pam app for the LocaleSelector however, the deployment 
of the portal DOES NOT remove the pam app from tomcat, hence the issue I 
have outlined above rearing its head.  Adding the above logic seemed to 
fix this for me.

Randy Watler wrote:
I have committed a new PAM/deployer implementation that uses the 
deploy-tool component to infuse portlet application war files for J2. 
This is being done in an attempt to simplify the deployment process 
and make it more reliable. Please bear with me on this change... I 
need feedback from all of you on how the new approach fairs in your 
environment.

This implementation, (WarInfusionPAM), eliminates the requirement to 
have the Tomcat manager web application in place and all of the 
associated configuration options. Instead, this PAM places WAR files, 
(or expanded webapp directories and context.xml file sin the case of 
Tomcat4), in the container target webapps directory. The assumption is 
that the container will support auto, live or hot deployment of 
some sort. When the portlet application webapp is loaded, it uses the 
JetspeedContainerServlet.init() invocation to register the portlet 
application in the webapp with the PAM implementation. Hopefully, 
there will no longer be a need to specialize deployment 
implementations per container.

I have left the preexisting deployer option in place, 
(ApplicationServerPAM), so you should be able to roll back the PAM 
implementation if you run into problems. You will need to comment out 
the WarInfusionPAM bean and uncomment the ApplicationServerPAM and 
TomcatManager bean entries.

There is one option that can be set in the spring configuration of 
WarInfusionPAM to control whether the PAM interacts with the webapps 
directory  using expanded webapps directories or with war files. By 
default, it uses expanded webapps if a context.xml file is found in 
the webapps directory, (i.e. jetspeed and jetspeed.xml). Setting the 
boolean field value in jetspeed-spring.xml forces the selected mode.

At the moment, there is a problem with undeploy/redeploy on Windows 
platforms. I believe this is due to file read locks on the WEB-INF/lib 
jar files, possibly others. I am currently working on a solution 
and/or workaround for this problem.

Randy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Great minds discuss ideas. Average minds discuss events. Small minds discuss 
people.  - Admiral Hyman Rickover
***
*   Scott T. Weaver   *
* [EMAIL PROTECTED] *
* http://www.einnovation.com*
* --  *
*   Apache Jetspeed Enterprise Portal *
* Apache Pluto Portlet Container  *
* *
* OpenEdit, Website Content Management*
* http://www.openedit.org   *
***
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/file - New directory

2005-02-02 Thread taylor
taylor  2005/02/02 14:01:43

  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/file - 
New directory

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/file FilePortlet.java

2005-02-02 Thread taylor
taylor  2005/02/02 14:01:44

  Added:   applications/gems/src/java/org/apache/portals/gems/file
FilePortlet.java
  Log:
  useful little file portlet using prefs for source
  
  Revision  ChangesPath
  1.1  
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
  
  Index: FilePortlet.java
  ===
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *  http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.file;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  
  import javax.portlet.PortletException;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  import javax.portlet.PortletPreferences;
  
  import org.apache.portals.bridges.common.GenericServletPortlet;
  
  
  /**
   * FilePortlet
   * 
   * @author a href=mailto:[EMAIL PROTECTED]David Sean Taylor/a
   * @version $Id: FilePortlet.java,v 1.1 2005/02/02 22:01:44 taylor Exp $
   */
  public class FilePortlet extends GenericServletPortlet
  {
  
  public void doView(RenderRequest request, RenderResponse response) throws 
PortletException, IOException
  {
  response.setContentType(text/html);
  PortletPreferences prefs = request.getPreferences();
  String fileName = prefs.getValue(file, null);
  if (fileName != null)
  {
  InputStream is = 
this.getPortletContext().getResourceAsStream(fileName);
  drain(is, response.getPortletOutputStream());
  is.close();
  }
  else
  {
  response.getWriter().println(Could not find file preference );
  }
  }
  
  static final int BLOCK_SIZE=4096;
  
  public static void drain(InputStream r,OutputStream w) throws IOException
  {
  byte[] bytes=new byte[BLOCK_SIZE];
  try
  {
int length=r.read(bytes);
while(length!=-1)
{
if(length!=0)
{
w.write(bytes,0,length);
}
length=r.read(bytes);
}
}
finally
{
  bytes=null;
}
  
  }
 
  
  }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [J2] New PAM/Deployer

2005-02-02 Thread Randy Watler
Scott
Thanks for the feedback. I think I understand the scenario. Let me look 
at it for a bit here... I am wondering why we are in the redeploy() case 
at all if the application was not previously known to J2? Initially, 
this seems like a deployer issue to me rather than a PAM shortcoming.

Randy
Scott T. Weaver wrote:
Seems to be working for me.  However, I had to modify the redploy() 
method in FilSystemPAM as such:

   // It might be the case were things have become 
unsynchronized and the target app for redploy
   // actully needs the full deploy treatment.if 
(registry.namedPortletApplicationExists(paWar.getPortletApplicationName())) 

   {
   doUnregister(paWar.getPortletApplicationName(), false);
   String paName = paWar.getPortletApplicationName();
   DirectoryHelper deployedDir = new DirectoryHelper(new 
File(webAppsDir + / + paName));
   PortletApplicationWar existingWar = new 
PortletApplicationWar(deployedDir, paName, / + paName);

   existingWar.removeWar();
   existingWar.close();
   sysDeploy(paWar, DEPLOY_WAR);
   }
   else
   {
   deploy(paWar);
   }
reason being that it appears that if an app is deployed in the app 
server but not in jetspeed, the app is never registered to jetspeed.  
I added a simple check that if we were  trying to redeploy an app that 
exists in the container but not in jetspeed we just do a full deploy 
instead.

Does this make sense?  I was having issues redploying my custom portal 
that uses the pam app for the LocaleSelector however, the deployment 
of the portal DOES NOT remove the pam app from tomcat, hence the issue 
I have outlined above rearing its head.  Adding the above logic seemed 
to fix this for me.

Randy Watler wrote:
I have committed a new PAM/deployer implementation that uses the 
deploy-tool component to infuse portlet application war files for J2. 
This is being done in an attempt to simplify the deployment process 
and make it more reliable. Please bear with me on this change... I 
need feedback from all of you on how the new approach fairs in your 
environment.

This implementation, (WarInfusionPAM), eliminates the requirement to 
have the Tomcat manager web application in place and all of the 
associated configuration options. Instead, this PAM places WAR files, 
(or expanded webapp directories and context.xml file sin the case of 
Tomcat4), in the container target webapps directory. The assumption 
is that the container will support auto, live or hot deployment 
of some sort. When the portlet application webapp is loaded, it uses 
the JetspeedContainerServlet.init() invocation to register the 
portlet application in the webapp with the PAM implementation. 
Hopefully, there will no longer be a need to specialize deployment 
implementations per container.

I have left the preexisting deployer option in place, 
(ApplicationServerPAM), so you should be able to roll back the PAM 
implementation if you run into problems. You will need to comment out 
the WarInfusionPAM bean and uncomment the ApplicationServerPAM and 
TomcatManager bean entries.

There is one option that can be set in the spring configuration of 
WarInfusionPAM to control whether the PAM interacts with the webapps 
directory  using expanded webapps directories or with war files. By 
default, it uses expanded webapps if a context.xml file is found in 
the webapps directory, (i.e. jetspeed and jetspeed.xml). Setting the 
boolean field value in jetspeed-spring.xml forces the selected mode.

At the moment, there is a problem with undeploy/redeploy on Windows 
platforms. I believe this is due to file read locks on the 
WEB-INF/lib jar files, possibly others. I am currently working on a 
solution and/or workaround for this problem.

Randy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security SecurityException.java

2005-02-02 Thread ate
ate 2005/02/02 15:45:29

  Modified:jetspeed-api/src/java/org/apache/jetspeed/security
SecurityException.java
  Log:
  Added INVALID_NEW_PASSWORD exception
  
  Revision  ChangesPath
  1.8   +3 -0  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/SecurityException.java
  
  Index: SecurityException.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/SecurityException.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SecurityException.java25 Nov 2004 02:25:57 -  1.7
  +++ SecurityException.java2 Feb 2005 23:45:28 -   1.8
  @@ -50,6 +50,9 @@
   /** pInvalid password exception message./p */
   public static final String INVALID_PASSWORD = Invalid password.;
   
  +/** pInvalid new password exception message./p */
  +public static final String INVALID_NEW_PASSWORD = Invalid new 
password.;
  +
   /** pIncorrect password exception message./p */
   public static final String INCORRECT_PASSWORD = Incorrect password.;
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security PasswordAlreadyUsedException.java InvalidNewPasswordException.java InvalidPasswordException.java

2005-02-02 Thread ate
ate 2005/02/02 15:47:08

  Added:   jetspeed-api/src/java/org/apache/jetspeed/security
PasswordAlreadyUsedException.java
InvalidNewPasswordException.java
InvalidPasswordException.java
  Log:
  Extended SecurityExceptions for easier localization
  
  Revision  ChangesPath
  1.1  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/PasswordAlreadyUsedException.java
  
  Index: PasswordAlreadyUsedException.java
  ===
  /* Copyright 2004 Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
  */
  package org.apache.jetspeed.security;
  
  /**
   * Exception thrown when supplied password has been used before.
   *
   * @author a href=mailto:[EMAIL PROTECTED]Ate Douma/a
   * @version $Id: PasswordAlreadyUsedException.java,v 1.1 2005/02/02 23:47:08 
ate Exp $
   */
  public class PasswordAlreadyUsedException extends SecurityException
  {
  public PasswordAlreadyUsedException()
  {
  super(PASSWORD_ALREADY_USED);
  }
  }
  
  
  
  1.1  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/InvalidNewPasswordException.java
  
  Index: InvalidNewPasswordException.java
  ===
  /* Copyright 2004 Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
  */
  package org.apache.jetspeed.security;
  
  /**
   * Exception thrown when supplied new password is invalid.
   *
   * @author a href=mailto:[EMAIL PROTECTED]Ate Douma/a
   * @version $Id: InvalidNewPasswordException.java,v 1.1 2005/02/02 23:47:08 
ate Exp $
   */
  public class InvalidNewPasswordException extends SecurityException
  {
  public InvalidNewPasswordException()
  {
  super(INVALID_NEW_PASSWORD);
  }
  }
  
  
  
  1.1  
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/security/InvalidPasswordException.java
  
  Index: InvalidPasswordException.java
  ===
  /* Copyright 2004 Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
  */
  package org.apache.jetspeed.security;
  
  /**
   * Exception thrown when supplied password is invalid.
   *
   * @author a href=mailto:[EMAIL PROTECTED]Ate Douma/a
   * @version $Id: InvalidPasswordException.java,v 1.1 2005/02/02 23:47:08 ate 
Exp $
   */
  public class InvalidPasswordException extends SecurityException
  {
  public InvalidPasswordException()
  {
  super(INVALID_PASSWORD);
  }
  }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl DefaultPasswordCredentialProvider.java

2005-02-02 Thread ate
ate 2005/02/02 17:19:55

  Modified:
components/security/src/java/org/apache/jetspeed/security/spi/impl
DefaultPasswordCredentialProvider.java
  Log:
  Removed obsolete methods
  
  Revision  ChangesPath
  1.4   +1 -39 
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialProvider.java
  
  Index: DefaultPasswordCredentialProvider.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialProvider.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultPasswordCredentialProvider.java25 Nov 2004 02:25:57 -  
1.3
  +++ DefaultPasswordCredentialProvider.java3 Feb 2005 01:19:55 -   
1.4
  @@ -70,44 +70,6 @@
   }
   
   /**
  - * @see 
org.apache.jetspeed.security.spi.PasswordCredentialProvider#postLoadInternalCredential(java.lang.String,
 org.apache.jetspeed.security.om.InternalCredential)
  - */
  -public boolean postLoadInternalCredential(String userName, 
InternalCredential credential) throws SecurityException
  -{
  -boolean updated = false;
  -if (!credential.isEncoded()  getEncoder() != null)
  -{
  -if ( getValidator() != null)
  -{
  -getValidator().validate(credential.getValue());
  -}
  -
credential.setValue(getEncoder().encode(userName,credential.getValue()));
  -credential.setEncoded(true);
  -updated = true;
  -}
  -return updated;
  -}
  -
  -/**
  - * @see 
org.apache.jetspeed.security.spi.PasswordCredentialProvider#postLoadInternalCredential(java.lang.String,
 org.apache.jetspeed.security.om.InternalCredential)
  - */
  -public boolean postAuthenticateInternalCredential(String userName, 
InternalCredential credential) throws SecurityException
  -{
  -boolean updated = false;
  -if (!credential.isEncoded()  getEncoder() != null)
  -{
  -if ( getValidator() != null)
  -{
  -getValidator().validate(credential.getValue());
  -}
  -
credential.setValue(getEncoder().encode(userName,credential.getValue()));
  -credential.setEncoded(true);
  -updated = true;
  -}
  -return updated;
  -}
  -
  -/**
* @see 
org.apache.jetspeed.security.spi.PasswordCredentialProvider#create(java.lang.String,
 java.lang.String)
*/
   public PasswordCredential create(String userName, String password) 
throws SecurityException
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl DefaultInternalPasswordCredentialInterceptor.java

2005-02-02 Thread ate
ate 2005/02/02 17:22:51

  Modified:
components/security/src/java/org/apache/jetspeed/security/spi/impl
DefaultInternalPasswordCredentialInterceptor.java
  Log:
  Invalid stored password is now always set to updateRequired after loading and 
not yet encoded
  so that it can be validated again before an admin sets updateRequired to 
false again: password has to be valid before that is allowed.
  
  Revision  ChangesPath
  1.4   +21 -5 
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultInternalPasswordCredentialInterceptor.java
  
  Index: DefaultInternalPasswordCredentialInterceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultInternalPasswordCredentialInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultInternalPasswordCredentialInterceptor.java 12 Nov 2004 03:17:46 
-  1.3
  +++ DefaultInternalPasswordCredentialInterceptor.java 3 Feb 2005 01:22:51 
-   1.4
  @@ -43,14 +43,30 @@
   throws SecurityException
   {
   boolean updated = false;
  -if (!credential.isEncoded()  pcProvider.getEncoder() != null)
  +if (!credential.isEncoded())
   {
  +boolean encode = pcProvider.getEncoder() != null;
   if ( pcProvider.getValidator() != null)
   {
  -pcProvider.getValidator().validate(credential.getValue());
  +try
  +{
  +
pcProvider.getValidator().validate(credential.getValue());
  +}
  +catch (SecurityException e)
  +{
  +// database contains an invalid password
  +// allow login (assuming the user knows the invalid 
value) but enforce an update
  +credential.setUpdateRequired(true);
  +// don't encode it yet to be able to check 
setUpdateRequired(false)
  +// in DefaultCredentialHandler.setPasswordUpdateRequired
  +encode = false;
  +}
   }
  -
credential.setValue(pcProvider.getEncoder().encode(userName,credential.getValue()));
  -credential.setEncoded(true);
  +if ( encode )
  +{
  +
credential.setValue(pcProvider.getEncoder().encode(userName,credential.getValue()));
  +credential.setEncoded(true);
  +}
   updated = true;
   }
   return updated;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl SimpleCredentialPasswordValidator.java InternalPasswordCredentialHistoryHandlingInterceptor.java DefaultCredentialPasswordValidator.java

2005-02-02 Thread ate
ate 2005/02/02 17:24:09

  Modified:
components/security/src/java/org/apache/jetspeed/security/spi/impl
SimpleCredentialPasswordValidator.java

InternalPasswordCredentialHistoryHandlingInterceptor.java
DefaultCredentialPasswordValidator.java
  Log:
  Throw more specialized SecurityExceptions to allow easier localization
  
  Revision  ChangesPath
  1.3   +4 -3  
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/SimpleCredentialPasswordValidator.java
  
  Index: SimpleCredentialPasswordValidator.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/SimpleCredentialPasswordValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleCredentialPasswordValidator.java8 Nov 2004 22:35:41 -   
1.2
  +++ SimpleCredentialPasswordValidator.java3 Feb 2005 01:24:09 -   
1.3
  @@ -14,6 +14,7 @@
   */
   package org.apache.jetspeed.security.spi.impl;
   
  +import org.apache.jetspeed.security.InvalidPasswordException;
   import org.apache.jetspeed.security.SecurityException;
   import org.apache.jetspeed.security.spi.CredentialPasswordValidator;
   
  @@ -50,7 +51,7 @@
   
   if ( minPasswordLength  0  pwd.length  minPasswordLength )
   {
  -throw new SecurityException(SecurityException.INVALID_PASSWORD);
  +throw new InvalidPasswordException();
   }
   
   if ( minNumberOfDigits  0)
  @@ -64,7 +65,7 @@
   }
   if (digits  minNumberOfDigits)
   {
  -throw new 
SecurityException(SecurityException.INVALID_PASSWORD);
  +throw new InvalidPasswordException();
   }
   }
   }
  
  
  
  1.3   +3 -2  
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/InternalPasswordCredentialHistoryHandlingInterceptor.java
  
  Index: InternalPasswordCredentialHistoryHandlingInterceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/InternalPasswordCredentialHistoryHandlingInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InternalPasswordCredentialHistoryHandlingInterceptor.java 25 Nov 2004 
02:25:57 -  1.2
  +++ InternalPasswordCredentialHistoryHandlingInterceptor.java 3 Feb 2005 
01:24:09 -   1.3
  @@ -22,6 +22,7 @@
   import java.util.Date;
   import java.util.Iterator;
   
  +import org.apache.jetspeed.security.PasswordAlreadyUsedException;
   import org.apache.jetspeed.security.SecurityException;
   import org.apache.jetspeed.security.om.InternalCredential;
   import org.apache.jetspeed.security.om.InternalUserPrincipal;
  @@ -100,7 +101,7 @@
   if ( historicalPasswordCredential.getValue() != null 
   
historicalPasswordCredential.getValue().equals(password) )
   {
  -throw new 
SecurityException(SecurityException.PASSWORD_ALREADY_USED);
  +throw new PasswordAlreadyUsedException();
   }
   }
   }
  
  
  
  1.3   +3 -2  
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultCredentialPasswordValidator.java
  
  Index: DefaultCredentialPasswordValidator.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultCredentialPasswordValidator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultCredentialPasswordValidator.java   8 Nov 2004 22:35:41 -   
1.2
  +++ DefaultCredentialPasswordValidator.java   3 Feb 2005 01:24:09 -   
1.3
  @@ -14,6 +14,7 @@
   */
   package org.apache.jetspeed.security.spi.impl;
   
  +import org.apache.jetspeed.security.InvalidPasswordException;
   import org.apache.jetspeed.security.SecurityException;
   import org.apache.jetspeed.security.spi.CredentialPasswordValidator;
   
  @@ -37,6 +38,6 @@
   public void validate(String clearTextPassword) throws SecurityException
   {
   if ( clearTextPassword == null || clearTextPassword.length() == 0)
  -throw new SecurityException(SecurityException.INVALID_PASSWORD);
  +throw new InvalidPasswordException();
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl DefaultCredentialHandler.java

2005-02-02 Thread ate
ate 2005/02/02 17:26:12

  Modified:
components/security/src/java/org/apache/jetspeed/security/spi/impl
DefaultCredentialHandler.java
  Log:
  Throw more specialized SecurityExceptions to allow easier localization and 
don't allow setting updateRequired to false if the current password is invalid.
  
  Revision  ChangesPath
  1.13  +24 -10
jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultCredentialHandler.java
  
  Index: DefaultCredentialHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultCredentialHandler.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultCredentialHandler.java 4 Dec 2004 21:08:18 -   1.12
  +++ DefaultCredentialHandler.java 3 Feb 2005 01:26:12 -   1.13
  @@ -24,6 +24,9 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.jetspeed.security.InvalidNewPasswordException;
  +import org.apache.jetspeed.security.InvalidPasswordException;
  +import org.apache.jetspeed.security.PasswordAlreadyUsedException;
   import org.apache.jetspeed.security.SecurityException;
   import org.apache.jetspeed.security.om.InternalCredential;
   import org.apache.jetspeed.security.om.InternalUserPrincipal;
  @@ -145,29 +148,35 @@
   credentials = new ArrayList();
   }
   
  +InternalCredential credential = getPasswordCredential(internalUser, 
userName );
  +
   if (null != oldPassword)
   {
  -if ( pcProvider.getValidator() != null )
  -{
  -pcProvider.getValidator().validate(oldPassword);
  -}
  -if ( pcProvider.getEncoder() != null )
  +if ( credential != null  
  +credential.getValue() != null  
  +credential.isEncoded()  
  +pcProvider.getEncoder() != null )
   {
   oldPassword = pcProvider.getEncoder().encode(userName, 
oldPassword);
   }
   }
   
  -InternalCredential credential = getPasswordCredential(internalUser, 
userName );
  -
   if (oldPassword != null  (credential == null || 
credential.getValue() == null || !credential.getValue().equals(oldPassword)))
   {
   // supplied PasswordCredential not defined for this user
  -throw new SecurityException(SecurityException.INVALID_PASSWORD);
  +throw new InvalidPasswordException();
   }
   
   if ( pcProvider.getValidator() != null )
   {
  -pcProvider.getValidator().validate(newPassword);
  +try
  +{
  +pcProvider.getValidator().validate(newPassword);
  +}
  +catch (InvalidPasswordException ipe)
  +{
  +throw new InvalidNewPasswordException();
  +}
   }
   
   boolean encoded = false;
  @@ -196,7 +205,7 @@
   }
   else if ( oldPassword.equals(newPassword) )
   {
  -throw new SecurityException(SecurityException.INVALID_PASSWORD);
  +throw new PasswordAlreadyUsedException();
   }
   
   if ( ipcInterceptor != null )
  @@ -256,6 +265,11 @@
   InternalCredential credential = 
getPasswordCredential(internalUser, userName );
   if ( credential != null  !credential.isExpired()  
credential.isUpdateRequired() != updateRequired )
   {
  +// only allow setting updateRequired off if (non-Encoded) 
password is valid
  +if ( !updateRequired  !credential.isEncoded()  
pcProvider.getValidator() != null )
  +{
  +
pcProvider.getValidator().validate(credential.getValue());
  +}
   credential.setUpdateRequired(updateRequired);
   long time = new Date().getTime();
   credential.setModifiedDate(new Timestamp(time));
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security ChangePasswordPortlet.java

2005-02-02 Thread ate
ate 2005/02/02 17:28:11

  Modified:
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
ChgPwdResources_en.properties
ChgPwdResources_nl.properties
ChgPwdResources.properties
   
applications/security/src/java/org/apache/jetspeed/portlets/security
ChangePasswordPortlet.java
  Log:
  Improved password validation messages using more specialized exceptions
  
  Revision  ChangesPath
  1.4   +4 -1  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_en.properties
  
  Index: ChgPwdResources_en.properties
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_en.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ChgPwdResources_en.properties 25 Nov 2004 02:25:57 -  1.3
  +++ ChgPwdResources_en.properties 3 Feb 2005 01:28:11 -   1.4
  @@ -31,6 +31,9 @@
   chgpwd.error.currentPasswordNull=Current password is required
   chgpwd.error.newPasswordNull=New password is required
   chgpwd.error.newPasswordsDoNotMatch=Passwords do not match
  +chgpwd.error.invalidPassword=Invalid current password
  +chgpwd.error.invalidNewPassword=Invalid new password
  +chgpwd.error.passwordAlreadyUsed=Password already used
   chgpwd.label.Logout=Logout
   chgpwd.message.change.required=Your password needs to be changed.
   chgpwd.message.expires.today=Your password will expire today.
  
  
  
  1.3   +4 -1  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_nl.properties
  
  Index: ChgPwdResources_nl.properties
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources_nl.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChgPwdResources_nl.properties 25 Nov 2004 02:25:57 -  1.2
  +++ ChgPwdResources_nl.properties 3 Feb 2005 01:28:11 -   1.3
  @@ -29,6 +29,9 @@
   chgpwd.error.currentPasswordNull=Huidige Wachtwoord is verplicht
   chgpwd.error.newPasswordNull=Nieuw Wachtwoord is verplicht
   chgpwd.error.newPasswordsDoNotMatch=Wachtwoorden komen niet overeen
  +chgpwd.error.invalidPassword=Huidig wachtwoord incorrect
  +chgpwd.error.invalidNewPassword=Ongeldig nieuw wachtwoord
  +chgpwd.error.passwordAlreadyUsed=Wachtwoord reeds eerder gebruikt
   chgpwd.label.Logout=Uitloggen
   chgpwd.message.change.required=Het wachtwoord moet gewijzigd worden.
   chgpwd.message.expires.today=Het wachtwoord verloopt vandaag.
  
  
  
  1.3   +4 -1  
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources.properties
  
  Index: ChgPwdResources.properties
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/resources/ChgPwdResources.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChgPwdResources.properties25 Nov 2004 02:25:57 -  1.2
  +++ ChgPwdResources.properties3 Feb 2005 01:28:11 -   1.3
  @@ -29,6 +29,9 @@
   chgpwd.error.currentPasswordNull=Current password is required
   chgpwd.error.newPasswordNull=New password is required
   chgpwd.error.newPasswordsDoNotMatch=Passwords do not match
  +chgpwd.error.invalidPassword=Invalid current password
  +chgpwd.error.invalidNewPassword=Invalid new password
  +chgpwd.error.passwordAlreadyUsed=Password already used
   chgpwd.label.Logout=Logout
   chgpwd.message.change.required=Your password needs to be changed.
   chgpwd.message.expires.today=Your password will expire today.
  
  
  
  1.6   +17 -1 
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java
  
  Index: ChangePasswordPortlet.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/ChangePasswordPortlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChangePasswordPortlet.java4 Jan 2005 15:50:37 -   1.5
  +++ ChangePasswordPortlet.java3 Feb 2005 01:28:11 -   1.6
  @@ -32,6 +32,9 @@
   import javax.servlet.http.HttpServletRequest;
   
   import org.apache.jetspeed.request.RequestContext;
  +import org.apache.jetspeed.security.InvalidNewPasswordException;
  +import 

cvs commit: jakarta-jetspeed-2/applications/security/src/webapp/WEB-INF/security/users user-details.jsp

2005-02-02 Thread ate
ate 2005/02/02 17:30:54

  Modified:
applications/security/src/java/org/apache/jetspeed/portlets/security/users
UserDetailsPortlet.java
   applications/security/src/webapp/WEB-INF/security/users
user-details.jsp
  Added:   
applications/security/src/java/org/apache/jetspeed/portlets/security/resources
UsersResources.properties
UsersPwdResources_en.properties
UsersResources_nl.properties
  Log:
  Now displaying exception/error messages, for now only password validation 
errors are localized.
  
  Revision  ChangesPath
  1.3   +60 -6 
jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java
  
  Index: UserDetailsPortlet.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/users/UserDetailsPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserDetailsPortlet.java   22 Dec 2004 22:59:40 -  1.2
  +++ UserDetailsPortlet.java   3 Feb 2005 01:30:53 -   1.3
  @@ -16,12 +16,15 @@
   package org.apache.jetspeed.portlets.security.users;
   
   import java.io.IOException;
  +import java.io.NotSerializableException;
   import java.security.Principal;
  +import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.LinkedHashMap;
   import java.util.LinkedList;
   import java.util.List;
  +import java.util.ResourceBundle;
   import java.util.Set;
   import java.util.prefs.Preferences;
   
  @@ -29,6 +32,7 @@
   import javax.portlet.ActionResponse;
   import javax.portlet.PortletConfig;
   import javax.portlet.PortletException;
  +import javax.portlet.PortletRequest;
   import javax.portlet.PortletSession;
   import javax.portlet.RenderRequest;
   import javax.portlet.RenderResponse;
  @@ -41,6 +45,9 @@
   import org.apache.jetspeed.profiler.rules.PrincipalRule;
   import org.apache.jetspeed.security.Group;
   import org.apache.jetspeed.security.GroupManager;
  +import org.apache.jetspeed.security.InvalidNewPasswordException;
  +import org.apache.jetspeed.security.InvalidPasswordException;
  +import org.apache.jetspeed.security.PasswordAlreadyUsedException;
   import org.apache.jetspeed.security.PasswordCredential;
   import org.apache.jetspeed.security.Role;
   import org.apache.jetspeed.security.RoleManager;
  @@ -93,7 +100,9 @@
   
   /** the id of the groups control */
   private static final String GROUPS_CONTROL = jetspeedGroups;
  -
  +
  +/** The Error Messages KEY */
  +public static final String ERROR_MESSAGES = errorMessages;
   
   private UserManager  userManager;
   private RoleManager  roleManager;
  @@ -270,6 +279,13 @@
  
   request.setAttribute(SecurityResources.REQUEST_SELECT_TAB, 
selectedTab);
   }
  +
  +// check for ErrorMessages
  +ArrayList errorMessages = 
(ArrayList)PortletMessaging.consume(request, ERROR_MESSAGES);
  +if (errorMessages != null )
  +{
  +request.setAttribute(ERROR_MESSAGES,errorMessages);
  +}
   
   super.doView(request, response);
   }
  @@ -336,7 +352,26 @@
   updateUserCredential(actionRequest, actionResponse);
   }
   }
  -}
  +}
  +
  +private void publishErrorMessage(PortletRequest request, String message)
  +{
  +try
  +{
  +ArrayList errors = 
(ArrayList)PortletMessaging.receive(request,ERROR_MESSAGES);
  +if ( errors == null )
  +{
  +errors = new ArrayList();
  +}
  +errors.add(message);
  +PortletMessaging.publish(request, ERROR_MESSAGES, errors);
  +}
  +catch (NotSerializableException e)
  +{
  +// TODO Auto-generated catch block
  +e.printStackTrace();
  +}
  +}
   
   public void removeUser(ActionRequest actionRequest, ActionResponse 
actionResponse) 
   throws PortletException
  @@ -354,7 +389,7 @@
   }
   catch (Exception e)
   {
  -
  +publishErrorMessage(actionRequest,e.getMessage());
   }
   }
   }
  @@ -377,6 +412,8 @@
   
   private void updateUserCredential(ActionRequest actionRequest, 
ActionResponse actionResponse)
   {
  +ResourceBundle bundle = 
ResourceBundle.getBundle(org.apache.jetspeed.portlets.security.resources.UsersResources,actionRequest.getLocale());
  +
   String userName = (String)
   
actionRequest.getPortletSession().getAttribute(SecurityResources.PAM_CURRENT_USER,
 
   

cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager WarInfusionPAM.java

2005-02-02 Thread rwatler
rwatler 2005/02/02 17:47:15

  Modified:portal/src/java/org/apache/jetspeed/tools/pamanager
WarInfusionPAM.java
  Log:
  minimize deployer footprint in webapps during deploy and redeploy
  
  Revision  ChangesPath
  1.2   +38 -23
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/WarInfusionPAM.java
  
  Index: WarInfusionPAM.java
  ===
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/WarInfusionPAM.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WarInfusionPAM.java   2 Feb 2005 03:12:36 -   1.1
  +++ WarInfusionPAM.java   3 Feb 2005 01:47:15 -   1.2
  @@ -237,11 +237,11 @@
   deleteDirectory(deployPortletAppDirectory);
   if (!deployPortletAppContextFile.exists()  
!deployPortletAppDirectory.exists()  !deployPortletAppWarFile.exists())
   {
  -log.info(Portlet application undeployment from  + 
deployPortletAppWarFile.getAbsolutePath() +  complete.);
  +log.error(Portlet application undeployment of  + 
deployPortletAppWarFile.getAbsolutePath() + ,  + 
deployPortletAppContextFile.getAbsolutePath() + , and/or  + 
deployPortletAppDirectory.getAbsolutePath() +  complete.);
   }
   else
   {
  -log.error(Portlet application undeployment from  + 
deployPortletAppWarFile.getAbsolutePath() +  failed, unable to undeploy.);
  +log.error(Portlet application undeployment of  + 
deployPortletAppWarFile.getAbsolutePath() + ,  + 
deployPortletAppContextFile.getAbsolutePath() + , and/or  + 
deployPortletAppDirectory.getAbsolutePath() +  failed, unable to undeploy.);
   }
   }
   
  @@ -465,57 +465,72 @@
   // undeploy any existing artifacts; move new portlet app
   // context and expanded war file or war file into webapps
   // container deployment directory as atomically as possible
  -deployPortletAppWarFile.delete();
  -deployPortletAppContextFile.delete();
  -deleteDirectory(deployPortletAppDirectory);
  -if (!deployPortletAppContextFile.exists()  
!deployPortletAppDirectory.exists()  !deployPortletAppWarFile.exists())
  +if (tempDeployPortletAppWarFile != null)
   {
  -if (tempDeployPortletAppWarFile != null)
  +// undeploy and deploy portlet app war file
  +deployPortletAppWarFile.delete();
  +if (!deployPortletAppWarFile.exists())
   {
  -// deploy portlet app war file
   
tempDeployPortletAppWarFile.renameTo(deployPortletAppWarFile);
   if (deployPortletAppWarFile.exists())
   {
  -log.info(Portlet application deployment to  + 
deployPortletAppWarFile.getAbsolutePath() +  complete.);
  +log.info(Portlet application deployment of  + 
deployPortletAppWarFile.getAbsolutePath() +  complete.);
   }
   else
   {
  -log.error(Portlet application deployment to  + 
deployPortletAppWarFile.getAbsolutePath() +  failed, unable to deploy.);
  +log.error(Portlet application deployment of  + 
deployPortletAppWarFile.getAbsolutePath() +  failed, unable to deploy.);
   }
   }
  -else if ((tempDeployPortletAppContextFile != null)  
(tempDeployPortletAppDirectory != null))
  +else
  +{
  +log.error(Portlet application deployment of  + 
deployPortletAppWarFile.getAbsolutePath() +  failed, unable to undeploy.);
  +}
  +}
  +else if ((tempDeployPortletAppContextFile != null)  
(tempDeployPortletAppDirectory != null))
  +{
  +// undeploy and deploy portlet app context.xml and 
expanded war file directory
  +deployPortletAppContextFile.delete();
  +deleteDirectory(deployPortletAppDirectory);
  +if (!deployPortletAppContextFile.exists()  
!deployPortletAppDirectory.exists())
   {
  -// deploy portlet app context.xml and expanded war 
file directory
   
tempDeployPortletAppContextFile.renameTo(deployPortletAppContextFile);
   
tempDeployPortletAppDirectory.renameTo(deployPortletAppDirectory);
   if (deployPortletAppContextFile.exists()  
deployPortletAppDirectory.exists())
   

Garbage Collection of threadlocal variables (was Re: J2 Struts Bridge NullPointer when portal page viewed)

2005-02-02 Thread Scott Heaberlin
Follow up:  

Having not reached any breakpoints set in the J2 Struts Bridge code
during my debugging sessions, I felt it a necessary formality to
change the portlet-class from StrutsPortlet to something that would
make no use of the Struts Bridge.  I replaced the struts portlet with
a simple portlet that printed out its classname to the response.

Same result with the redeployed app - NullPointer before it even
reaches the portlet.

Is there any way possible that the threadlocal data
(org.apache.pluto.om.portlet.PortletDefinition) stored in
JetspeedPortletFactoryProxy can be lost due to something such as
garbage collection?  I cannot otherwise explain its disappearance
during the lifecycle of a request for this particular deployed portlet
application.  It is obviously not struts-bridge related, nor is is it
systemic in my J2 environment (nearly cvs-head at this point - it
should be the state of cvs just after Ate's latest bridge commits) as
I have other custom portlet webapps deployed and running with no
problem.  Yet it is a chronic problem for this particular deployed
webapp for some reason.

Any thoughts?


On Tue, 1 Feb 2005 02:06:00 -0500, Scott Heaberlin [EMAIL PROTECTED] wrote:
 Hello all -
 
 I can configure and deploy an existing tiles app within J2
 (/jetspeed/WEB-INF/deploy) and view / use the application in tomcat at
 its non-portlet context (eg, /webapp). However, whenever I request a
 .psml with a fragment that contains the struts portlet configured for
 the app, I get a NullPointerException at line 217 (latest cvs head) of
  JetspeedContainerServlet.
 
 For the longest time I was unable to get the app to work in either
 context (portal vs webapp), but I was *finally* able to at least run
 the app deployed by J2 but requested at the web context root. To do
 so, I had to remove my request-processor elements in the
 struts-config-module.xml files and just letting StrutsPortlet notice
 the TilesPlugin usage and configure TilesPortletRequestProcessor on
 its own.  The only thing I gain from this is the ability to run the
 app at the direct webapp context.  When viewing the app via
 strutsportlet, I get the following stack trace that has hounded me
 since day one with this Tiles-app-in-J2 quest.
 
 web.xml snippets:
 
 servlet-nameaction/servlet-name
 
 !--servlet-classorg.apache.struts.action.ActionServlet/servlet-class--
 
 servlet-classorg.apache.portals.bridges.struts.PortletServlet/servlet-class
 init-param
 !-- jgossip module--
   param-nameconfig/jgossip/param-name
   param-value/WEB-INF/struts-config-jgossip.xml/param-value
 /init-param
 ...
   taglib
 taglib-uri/tags/struts-html/taglib-uri
 
 taglib-location/WEB-INF/struts-1.2.4-portlet-html-0.2.tld/taglib-location
   /taglib
 
 struts-config-jgossip.xml snippet:
  !-- let StrutsPortlet figure out the req processor --
  !--
  controller pagePattern=$M$P
  inputForward=true
 
 processorClass=org.apache.portals.bridges.struts.PortletTilesRequestProcessor/
  --
 ...
 plug-in className=org.apache.struts.tiles.TilesPlugin
 set-property property=definitions-config
 value=/WEB-INF/tiles-defs-jgossip.xml/
 set-property property=moduleAware value=true/
 set-property property=definitions-parser-validate 
 value=true/
 /plug-in
 
 portlet.xml snippet:
 portlet-app id=jgossip version=1.0
   portlet id=JGossipPortlet
 init-param
   nameServletContextProvider/name
   valueorg.apache.jetspeed.portlet.ServletContextProviderImpl/value
 /init-param
 init-param
   nameViewPage/name
   value/jgossip/jgossip/value
 /init-param
 portlet-nameJGossipPortlet/portlet-name
 display-nameJGossip Forum Portlet/display-name
 descriptionThis is the JGossip forum portlet/description
 
 portlet-classorg.apache.portals.bridges.struts.StrutsPortlet/portlet-class
 expiration-cache-1/expiration-cache
   mime-typetext/html/mime-type
   portlet-modeVIEW/portlet-mode
 /supports
 
 struts-portlet-config.xml:
 Note: All I am wanting to do at this point is to view the first URL,
 which performs a login action and redirects, which seems to fit in
 with Ate's Struts Bridge doc recommendations.  I have tried changing
 the portlet-url-type default attrib from 'render' to 'action' and have
 the same result with both.
 config
   render-context
 attribute name=errors/
 attribute name=message/
   /render-context
   portlet-url-type default=action
   /portlet-url-type
 
 Again, viewing in the deployed web root works - the app runs as normal.
 Viewing within J2 yields the following *every* time:
 
 2005-02-01 01:58:17 StandardContext[/jgossip]JetspeedContainerServlet:
 Error rendering JetspeedContainerServlet error page:
 java.lang.NullPointerException
 java.lang.NullPointerException
 at 
 

Re: [J2] New PAM/Deployer

2005-02-02 Thread watler
Scott:

More comments below

 Scott

 Thanks for the feedback. I think I understand the scenario.

I take this back. I am not sure how an app can be both unknown to J2 and
be the subject of a redeploy event/PAM invocation. Can you elaborate? Is
there a deployer bug underlying all of this?

 Let me look
 at it for a bit here... I am wondering why we are in the redeploy() case
 at all if the application was not previously known to J2? Initially,
 this seems like a deployer issue to me rather than a PAM shortcoming.

I have added a similar test to this in DeployPortletAppListener. Please
review and let me know if it is equivalent from your perspective.
Basically, I am claiming that if someone is invoking *PAM.redeploy(), they
are expecting an unregister and a subsequent deploy.


 reason being that it appears that if an app is deployed in the app
 server but not in jetspeed, the app is never registered to jetspeed.

Not really. If you drop in an infused app into the container's webapps
directory, it will be registered via the JetspeedContainerServlet on init.
This is one of the advantages of this approach.

 I added a simple check that if we were  trying to redeploy an app that
 exists in the container but not in jetspeed we just do a full deploy
 instead.

Again, this confuses me, (sorry I am being so dense here). If an app is
simply in the container's webapps directory, as opposed to the jetspeed
WEB-INF/deploy directory, how did it ever get involved with the deployer?

 Does this make sense?  I was having issues redploying my custom portal
 that uses the pam app for the LocaleSelector however, the deployment
 of the portal DOES NOT remove the pam app from tomcat, hence the issue
 I have outlined above rearing its head.

A previously deployed and registered app left in webapps will be
registered automatically once by jetspeed on startup and once again by the
app itself on JetspeedContainerServlet init. I think this situation is
less than optimal since a race condition could surface between these two
registration attempts... but I doubt that it is causing you problems at
this point since it seems rare. Bottom line is that I do not see how the
pam application left in webapps but not in the jetspeed deploy directory
is causing problems. Perhaps you have an old version of the pam webapp
that was not infused in the webapps directory? Still, that does not
explain the redeploy PAM invocation...

  Adding the above logic seemed
 to fix this for me.

Like I said above, I echoed this modification in the deployer portlet app
listener. Hopefully, this will be an equivalent patch. I'd still like to
understand more about your custom deployment so that I can make sure other
bugs like this are found.

Thanks again Scott... talk to you in the morning. :)

Randy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [J2] New PAM/Deployer

2005-02-02 Thread Marcel Dullaart
Hi Randy,

I will not be able to test the new PAM/deployer until sunday night.
I'll inform you about the results of using it on JBoss 4.0.1 then.

Cheers,
Marcel

On Wed, 2 Feb 2005 22:54:15 -0700 (MST), [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Scott:
 
 More comments below
 
  Scott
 
  Thanks for the feedback. I think I understand the scenario.
 
 I take this back. I am not sure how an app can be both unknown to J2 and
 be the subject of a redeploy event/PAM invocation. Can you elaborate? Is
 there a deployer bug underlying all of this?
 
  Let me look
  at it for a bit here... I am wondering why we are in the redeploy() case
  at all if the application was not previously known to J2? Initially,
  this seems like a deployer issue to me rather than a PAM shortcoming.
 
 I have added a similar test to this in DeployPortletAppListener. Please
 review and let me know if it is equivalent from your perspective.
 Basically, I am claiming that if someone is invoking *PAM.redeploy(), they
 are expecting an unregister and a subsequent deploy.
 
 
  reason being that it appears that if an app is deployed in the app
  server but not in jetspeed, the app is never registered to jetspeed.
 
 Not really. If you drop in an infused app into the container's webapps
 directory, it will be registered via the JetspeedContainerServlet on init.
 This is one of the advantages of this approach.
 
  I added a simple check that if we were  trying to redeploy an app that
  exists in the container but not in jetspeed we just do a full deploy
  instead.
 
 Again, this confuses me, (sorry I am being so dense here). If an app is
 simply in the container's webapps directory, as opposed to the jetspeed
 WEB-INF/deploy directory, how did it ever get involved with the deployer?
 
  Does this make sense?  I was having issues redploying my custom portal
  that uses the pam app for the LocaleSelector however, the deployment
  of the portal DOES NOT remove the pam app from tomcat, hence the issue
  I have outlined above rearing its head.
 
 A previously deployed and registered app left in webapps will be
 registered automatically once by jetspeed on startup and once again by the
 app itself on JetspeedContainerServlet init. I think this situation is
 less than optimal since a race condition could surface between these two
 registration attempts... but I doubt that it is causing you problems at
 this point since it seems rare. Bottom line is that I do not see how the
 pam application left in webapps but not in the jetspeed deploy directory
 is causing problems. Perhaps you have an old version of the pam webapp
 that was not infused in the webapps directory? Still, that does not
 explain the redeploy PAM invocation...
 
   Adding the above logic seemed
  to fix this for me.
 
 Like I said above, I echoed this modification in the deployer portlet app
 listener. Hopefully, this will be an equivalent patch. I'd still like to
 understand more about your custom deployment so that I can make sure other
 bugs like this are found.
 
 Thanks again Scott... talk to you in the morning. :)
 
 Randy
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED] 
 For additional commands, e-mail: [EMAIL PROTECTED] 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]