You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2006-05-24 18:35:26
|
Author: soh...@jb... Date: 2006-05-24 14:35:03 -0400 (Wed, 24 May 2006) New Revision: 4408 Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteForum.xhtml Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml Log: http://jira.jboss.com/jira/browse/JBFORUMS-60 - Delete Forum http://jira.jboss.com/jira/browse/JBFORUMS-61 - Delete All Forum Posts http://jira.jboss.com/jira/browse/JBFORUMS-62 - Move All Forum contents Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 18:35:03 UTC (rev 4408) @@ -40,6 +40,7 @@ public static final String EDIT_CATEGORY = "editCategory"; public static final String EDIT_FORUM = "editForum"; public static final String DELETE_CATEGORY = "deleteCategory"; + public static final String DELETE_FORUM = "deleteForum"; //---------parameter constants-------------------------------------------------------------------------------------------------- public static final String p_categoryId = "c"; public static final String p_forumId = "f"; Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 18:35:03 UTC (rev 4408) @@ -21,6 +21,7 @@ */ package org.jboss.portlet.forums.ui.action; +import java.util.ArrayList; import java.util.Iterator; import java.util.Collection; @@ -28,6 +29,7 @@ import org.jboss.portlet.forums.model.Category; import org.jboss.portlet.forums.model.Forum; +import org.jboss.portlet.forums.model.Topic; /** * @@ -57,6 +59,7 @@ * ui data associated with selecting a category to perform a certain operation */ private int selectedCategory = 0; + private int selectedForum = 0; //-----ui data------------------------------------------------------------------------------------------------------------------------- /** * @return Returns the categoryName. @@ -116,6 +119,22 @@ { this.selectedCategory = selectedCategory; } + /** + * + * + */ + public int getSelectedForum() + { + return this.selectedForum; + } + /** + * + * + */ + public void setSelectedForum(int selectedForum) + { + this.selectedForum = selectedForum; + } //cleanup related---------------------------------------------------------------------------------------------------------------------- /** * @@ -126,6 +145,7 @@ this.forumName = null; this.forumDescription = null; this.selectedCategory = 0; + this.selectedForum = 0; } //------------------------------------------------------------------------------------------------------------------------------------- /** @@ -375,6 +395,66 @@ * * */ + public String deleteForum() + { + String navState = null; + boolean success = false; + try + { + int forumId = -1; + String cour = ForumUtil.getParameter(Constants.p_forumId); + if(cour!=null && cour.trim().length()>0) + { + forumId = Integer.parseInt(cour); + } + + Forum source = BaseController.getForumsModule().findForumById(new Integer(forumId)); + + //move all the topics/posts of this forum to the specified target forum + if(this.selectedForum!=-1) + { + Forum target = BaseController.getForumsModule().findForumById(new Integer(selectedForum)); + target.getTopics().addAll(source.getTopics()); + target.setPostCount(target.getPostCount() + source.getPostCount()); + target.setTopicCount(target.getTopicCount() + source.getTopicCount()); + for (Iterator i = target.getTopics().iterator(); i.hasNext();) + { + Topic tp = (Topic)i.next(); + tp.setForum(target); + } + + //clear the source out before delete + source.setTopics(new ArrayList()); + } + + + //means delete all topic/posts on this forum + BaseController.getForumsModule().removeForum(source); + + + JSFUtil.setMessage(Constants.FEEDBACK,"The Forum \""+this.forumName+"\" was successfully deleted."); + navState = Constants.DELETE_FORUM; + success = true; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + finally + { + if(success) + { + //cleanup the state + this.cleanup(); + } + } + return navState; + } + + /** + * + * + */ public String moveCategoryUp() { String navState = null; Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java 2006-05-24 18:35:03 UTC (rev 4408) @@ -61,6 +61,24 @@ { JSFUtil.handleException(e); } - return null ; + return null; } + + /** + * + * + */ + public List getForums() + { + try + { + List forums = getForumsModule().findForums(); + return forums; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + return null; + } } Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 18:35:03 UTC (rev 4408) @@ -374,9 +374,9 @@ </navigation-case> </navigation-rule> <navigation-rule> - <from-view-id>/views/admin/editForum.xhtml</from-view-id> + <from-view-id>/views/admin/deleteForum.xhtml</from-view-id> <navigation-case> - <from-outcome>editForum</from-outcome> + <from-outcome>deleteForum</from-outcome> <to-view-id>/views/admin/index.xhtml</to-view-id> </navigation-case> </navigation-rule> Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteForum.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteForum.xhtml 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteForum.xhtml 2006-05-24 18:35:03 UTC (rev 4408) @@ -0,0 +1,84 @@ +<!-- +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +--> + +<div xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:c="http://java.sun.com/jstl/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> + + <ui:composition template="/views/common/common.xhtml"> + <ui:define name="mainContent"> + + <h1>${resource.Forum_delete}</h1> + + <p>${resource.Forum_delete_explain}</p> + + <!-- display the delete category widget --> + <h:form> + <input type="hidden" name="f" value="#{param['f']}"/> + <table cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> + <tr> + <th colspan="2" class="thHead">${resource.Forum_delete}</th> + </tr> + <tr> + <td class="row1">${resource.Forum}</td> + <td class="row1"><span class="row1">#{adminController.forumName}</span></td> + </tr> + <tr> + <td class="row1">${resource.Move_contents} to - </td> + <td class="row1"> + <h:selectOneMenu value="#{adminController.selectedForum}"> + <f:selectItem itemValue="-1" itemLabel="Delete All Topics/Posts" /> + <c:forEach items="#{adminPanel.forums}" var="forum"> + <c:if test="#{forum.id != param['f']}"> + <f:selectItem itemValue="#{forum.id}" itemLabel="#{forum.name}" /> + </c:if> + </c:forEach> + </h:selectOneMenu> + </td> + </tr> + <tr> + <td class="catBottom" colspan="2" align="center"> + <h:commandButton value="Submit" styleClass="mainoption" action="#{adminController.deleteForum}"/> + </td> + </tr> + </table> + </h:form> + + + + <!-- integrate the jump box --> + <table cellspacing="0" cellpadding="0" border="0" align="right"> + <tr> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> + </tr> + </table> + + </ui:define> + </ui:composition> +</div> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 17:39:43 UTC (rev 4407) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 18:35:03 UTC (rev 4408) @@ -52,7 +52,10 @@ <td class="catLeft" colspan="3"> <span class="cattitle"> <b> - <a href="">${category.title}</a> + <h:outputLink value="#{forums:outputLink(shared.links['category'],true)}"> + <f:param name="c" value="#{category.id}"/> + ${category.title} + </h:outputLink> </b> </span> </td> @@ -101,7 +104,10 @@ <tr> <td class="row2"> <span class="gen"> - <a href="" target="_new">${forum.name}</a> + <h:outputLink value="#{forums:outputLink(shared.links['forum'],true)}" target="_new"> + <f:param name="f" value="#{forum.id}"/> + ${forum.name} + </h:outputLink> </span> <br/><span class="gensmall">${forum.description}</span> </td> @@ -123,9 +129,15 @@ </forums:isAllowed> </td> <td class="row2" align="center" valign="middle"> - <span class="gen"> - <a href="">${resource.Delete}</a> - </span> + <!-- security check to make sure this link should be displayed or not --> + <forums:isAllowed fragment="acl://deleteForum/deleteLink" contextData="#{forum}"> + <span class="gen"> + <h:outputLink value="#{forums:outputLink('/views/admin/deleteForum.jsf',true)}"> + <f:param name="f" value="#{forum.id}"/> + <h:outputText value="${resource.Delete}"/> + </h:outputLink> + </span> + </forums:isAllowed> </td> <td class="row1" align="center" valign="middle"> <span class="gen"> |
From: <jbo...@li...> - 2006-05-24 17:39:54
|
Author: soh...@jb... Date: 2006-05-24 13:39:43 -0400 (Wed, 24 May 2006) New Revision: 4407 Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteCategory.xhtml Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml Log: http://jira.jboss.com/jira/browse/JBFORUMS-59 - Delete Category Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 17:39:43 UTC (rev 4407) @@ -39,6 +39,7 @@ public static final String FEEDBACK = "feedback"; public static final String EDIT_CATEGORY = "editCategory"; public static final String EDIT_FORUM = "editForum"; + public static final String DELETE_CATEGORY = "deleteCategory"; //---------parameter constants-------------------------------------------------------------------------------------------------- public static final String p_categoryId = "c"; public static final String p_forumId = "f"; Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 17:39:43 UTC (rev 4407) @@ -52,7 +52,11 @@ */ private String forumName = null; private String forumDescription = null; - private int forumCategory = 0; + + /** + * ui data associated with selecting a category to perform a certain operation + */ + private int selectedCategory = 0; //-----ui data------------------------------------------------------------------------------------------------------------------------- /** * @return Returns the categoryName. @@ -100,18 +104,29 @@ * * */ - public int getForumCategory() + public int getSelectedCategory() { - return this.forumCategory; + return this.selectedCategory; } /** * * */ - public void setForumCategory(int forumCategory) + public void setSelectedCategory(int selectedCategory) { - this.forumCategory = forumCategory; + this.selectedCategory = selectedCategory; } + //cleanup related---------------------------------------------------------------------------------------------------------------------- + /** + * + */ + public void cleanup() + { + this.categoryName = null; + this.forumName = null; + this.forumDescription = null; + this.selectedCategory = 0; + } //------------------------------------------------------------------------------------------------------------------------------------- /** * @@ -148,7 +163,7 @@ Forum forum = BaseController.getForumsModule().findForumById(new Integer(forumId)); this.forumName = forum.getName(); this.forumDescription = forum.getDescription(); - this.forumCategory = forum.getCategory().getId().intValue(); + this.selectedCategory = forum.getCategory().getId().intValue(); } } catch(Exception e) @@ -181,7 +196,7 @@ if(success) { //cleanup the state - this.categoryName = null; + this.cleanup(); } } return navState; @@ -221,13 +236,59 @@ if(success) { //cleanup the state - this.categoryName = null; + this.cleanup(); } } return navState; } /** + * + * + */ + public String deleteCategory() + { + String navState = null; + boolean success = false; + try + { + int categoryId = -1; + String cour = ForumUtil.getParameter(Constants.p_categoryId); + if(cour!=null && cour.trim().length()>0) + { + categoryId = Integer.parseInt(cour); + } + + //grab the category from the module and set the title + Category source = BaseController.getForumsModule().findCategoryById(new Integer(categoryId)); + Category target = BaseController.getForumsModule().findCategoryById(new Integer(this.selectedCategory)); + + //move all the forums from source category to the selected target category + BaseController.getForumsModule().addAllForums(source,target); + + //remove the source category + BaseController.getForumsModule().removeCategory(source); + + JSFUtil.setMessage(Constants.FEEDBACK,"The Category \""+this.categoryName+"\" was successfully deleted."); + navState = Constants.DELETE_CATEGORY; + success = true; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + finally + { + if(success) + { + //cleanup the state + this.cleanup(); + } + } + return navState; + } + + /** * adds a new forum * */ @@ -261,8 +322,7 @@ if(success) { //cleanup the state - this.forumName = null; - this.forumDescription = null; + this.cleanup(); } } return navState; @@ -287,7 +347,7 @@ //grab the forum from the module and set the proper information Forum forum = getForumsModule().findForumById(new Integer(forumId)); - Category selectedCategory = getForumsModule().findCategoryById(new Integer(this.forumCategory)); + Category selectedCategory = getForumsModule().findCategoryById(new Integer(this.selectedCategory)); forum.setCategory(selectedCategory); forum.setName(this.forumName); forum.setDescription(this.forumDescription); @@ -305,9 +365,7 @@ if(success) { //cleanup the state - this.forumName = null; - this.forumDescription = null; - this.forumCategory = 0; + this.cleanup(); } } return navState; Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2006-05-24 17:39:43 UTC (rev 4407) @@ -2347,3 +2347,5 @@ Message_code=Code Message_quote=Quote Message_wrote=wrote + +Category_delete=Delete Category Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 17:39:43 UTC (rev 4407) @@ -367,6 +367,13 @@ </navigation-case> </navigation-rule> <navigation-rule> + <from-view-id>/views/admin/deleteCategory.xhtml</from-view-id> + <navigation-case> + <from-outcome>deleteCategory</from-outcome> + <to-view-id>/views/admin/index.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> <from-view-id>/views/admin/editForum.xhtml</from-view-id> <navigation-case> <from-outcome>editForum</from-outcome> Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteCategory.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteCategory.xhtml 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/deleteCategory.xhtml 2006-05-24 17:39:43 UTC (rev 4407) @@ -0,0 +1,83 @@ +<!-- +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +--> + +<div xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:c="http://java.sun.com/jstl/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> + + <ui:composition template="/views/common/common.xhtml"> + <ui:define name="mainContent"> + + <h1>${resource.Category_delete}</h1> + + <p>${resource.Forum_delete_explain}</p> + + <!-- display the delete category widget --> + <h:form> + <input type="hidden" name="c" value="#{param['c']}"/> + <table cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> + <tr> + <th colspan="2" class="thHead">${resource.Category_delete}</th> + </tr> + <tr> + <td class="row1">${resource.Category}</td> + <td class="row1"><span class="row1">#{adminController.categoryName}</span></td> + </tr> + <tr> + <td class="row1">${resource.Move_contents} to - </td> + <td class="row1"> + <h:selectOneMenu value="#{adminController.selectedCategory}"> + <c:forEach items="#{adminPanel.categories}" var="category"> + <c:if test="#{category.id != param['c']}"> + <f:selectItem itemValue="#{category.id}" itemLabel="#{category.title}" /> + </c:if> + </c:forEach> + </h:selectOneMenu> + </td> + </tr> + <tr> + <td class="catBottom" colspan="2" align="center"> + <h:commandButton value="Submit" styleClass="mainoption" action="#{adminController.deleteCategory}"/> + </td> + </tr> + </table> + </h:form> + + + + <!-- integrate the jump box --> + <table cellspacing="0" cellpadding="0" border="0" align="right"> + <tr> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> + </tr> + </table> + + </ui:define> + </ui:composition> +</div> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml 2006-05-24 17:39:43 UTC (rev 4407) @@ -60,7 +60,7 @@ <tr> <td class="row1">${resource.Category}</td> <td class="row2"> - <h:selectOneMenu value="#{adminController.forumCategory}"> + <h:selectOneMenu value="#{adminController.selectedCategory}"> <c:forEach items="#{adminPanel.categories}" var="category"> <f:selectItem itemValue="#{category.id}" itemLabel="#{category.title}" /> </c:forEach> @@ -68,7 +68,7 @@ </td> </tr> <tr> - <td class="catBottom" colspan="2" align="center"><input type="hidden" name="mode" value="modforum"/> + <td class="catBottom" colspan="2" align="center"> <h:commandButton value="Update" styleClass="mainoption" action="#{adminController.editForum}"/> </td> </tr> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 15:47:52 UTC (rev 4406) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 17:39:43 UTC (rev 4407) @@ -68,9 +68,15 @@ </forums:isAllowed> </td> <td class="cat" align="center" valign="middle"> - <span class="gen"> - <a href="">${resource.Delete}</a> - </span> + <!-- security check to make sure this link should be displayed or not --> + <forums:isAllowed fragment="acl://deleteCategory/deleteLink" contextData="#{category}"> + <span class="gen"> + <h:outputLink value="#{forums:outputLink('/views/admin/deleteCategory.jsf',true)}"> + <f:param name="c" value="#{category.id}"/> + <h:outputText value="${resource.Delete}"/> + </h:outputLink> + </span> + </forums:isAllowed> </td> <td class="cat" align="center" valign="middle" nowrap="nowrap"> <span class="gen"> |
From: <jbo...@li...> - 2006-05-24 15:47:55
|
Author: jfr...@jb... Date: 2006-05-24 11:47:52 -0400 (Wed, 24 May 2006) New Revision: 4406 Modified: labs/jbossweb/trunk/src/share/examples/php/simplexml.php Log: Make the output a little more readable. Modified: labs/jbossweb/trunk/src/share/examples/php/simplexml.php =================================================================== --- labs/jbossweb/trunk/src/share/examples/php/simplexml.php 2006-05-24 15:00:55 UTC (rev 4405) +++ labs/jbossweb/trunk/src/share/examples/php/simplexml.php 2006-05-24 15:47:52 UTC (rev 4406) @@ -16,6 +16,6 @@ $s = simplexml_import_dom($dom); -echo "If all is OK you should read the title of the book: bla"; +echo "If all is OK you should read the title of the book \"bla\": "; echo $s->book[0]->title; ?> |
From: <jbo...@li...> - 2006-05-24 15:01:04
|
Author: soh...@jb... Date: 2006-05-24 11:00:55 -0400 (Wed, 24 May 2006) New Revision: 4405 Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml Log: http://jira.jboss.com/jira/browse/JBFORUMS-58 - Edit Forum Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 15:00:55 UTC (rev 4405) @@ -38,6 +38,7 @@ public static final String TOPIC_DELETED = "topicDeleted"; public static final String FEEDBACK = "feedback"; public static final String EDIT_CATEGORY = "editCategory"; + public static final String EDIT_FORUM = "editForum"; //---------parameter constants-------------------------------------------------------------------------------------------------- public static final String p_categoryId = "c"; public static final String p_forumId = "f"; Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 15:00:55 UTC (rev 4405) @@ -22,6 +22,7 @@ package org.jboss.portlet.forums.ui.action; import java.util.Iterator; +import java.util.Collection; import org.jboss.portlet.forums.ui.*; @@ -51,7 +52,7 @@ */ private String forumName = null; private String forumDescription = null; - + private int forumCategory = 0; //-----ui data------------------------------------------------------------------------------------------------------------------------- /** * @return Returns the categoryName. @@ -95,6 +96,22 @@ { this.forumName = forumName; } + /** + * + * + */ + public int getForumCategory() + { + return this.forumCategory; + } + /** + * + * + */ + public void setForumCategory(int forumCategory) + { + this.forumCategory = forumCategory; + } //------------------------------------------------------------------------------------------------------------------------------------- /** * @@ -105,7 +122,7 @@ try { //load the selected category if a categoryid is found - //fetch the category to be edited + //fetch the category to be edited/deleted int categoryId = -1; String cour = ForumUtil.getParameter(Constants.p_categoryId); if(cour!=null && cour.trim().length()>0) @@ -117,6 +134,22 @@ Category category = BaseController.getForumsModule().findCategoryById(new Integer(categoryId)); this.categoryName = category.getTitle(); } + + //load the selected forum is a forumid is found + //fetch the forum to be edited/deleted + int forumId = -1; + String forumIdStr = ForumUtil.getParameter(Constants.p_forumId); + if(forumIdStr!=null && forumIdStr.trim().length()>0) + { + forumId = Integer.parseInt(forumIdStr); + } + if(forumId!=-1) + { + Forum forum = BaseController.getForumsModule().findForumById(new Integer(forumId)); + this.forumName = forum.getName(); + this.forumDescription = forum.getDescription(); + this.forumCategory = forum.getCategory().getId().intValue(); + } } catch(Exception e) { @@ -233,12 +266,57 @@ } } return navState; - } + } /** * * */ + public String editForum() + { + String navState = null; + boolean success = false; + try + { + int forumId = -1; + String cour = ForumUtil.getParameter(Constants.p_forumId); + if(cour!=null && cour.trim().length()>0) + { + forumId = Integer.parseInt(cour); + } + + //grab the forum from the module and set the proper information + Forum forum = getForumsModule().findForumById(new Integer(forumId)); + Category selectedCategory = getForumsModule().findCategoryById(new Integer(this.forumCategory)); + forum.setCategory(selectedCategory); + forum.setName(this.forumName); + forum.setDescription(this.forumDescription); + + JSFUtil.setMessage(Constants.FEEDBACK,"The Forum \""+this.forumName+"\" was successfully updated."); + navState = Constants.EDIT_FORUM; + success = true; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + finally + { + if(success) + { + //cleanup the state + this.forumName = null; + this.forumDescription = null; + this.forumCategory = 0; + } + } + return navState; + } + + /** + * + * + */ public String moveCategoryUp() { String navState = null; Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewAdminPanel.java 2006-05-24 15:00:55 UTC (rev 4405) @@ -22,8 +22,11 @@ package org.jboss.portlet.forums.ui.view; +import java.util.Iterator; import java.util.List; +import org.jboss.portlet.forums.model.Category; +import org.jboss.portlet.forums.model.Forum; import org.jboss.portlet.forums.ui.BaseController; import org.jboss.portlet.forums.ui.Constants; import org.jboss.portlet.forums.ui.ForumUtil; @@ -51,7 +54,8 @@ { try { - return getForumsModule().findCategories(); + List categories = getForumsModule().findCategories(); + return categories; } catch(Exception e) { Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 15:00:55 UTC (rev 4405) @@ -365,5 +365,12 @@ <from-outcome>editCategory</from-outcome> <to-view-id>/views/admin/index.xhtml</to-view-id> </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/views/admin/editForum.xhtml</from-view-id> + <navigation-case> + <from-outcome>editForum</from-outcome> + <to-view-id>/views/admin/index.xhtml</to-view-id> + </navigation-case> </navigation-rule> </faces-config> \ No newline at end of file Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editForum.xhtml 2006-05-24 15:00:55 UTC (rev 4405) @@ -0,0 +1,92 @@ +<!-- +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +--> + +<div xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:c="http://java.sun.com/jstl/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> + + <ui:composition template="/views/common/common.xhtml"> + <ui:define name="mainContent"> + + <h1>${resource.Edit_forum}</h1> + + <p>${resource.Forum_edit_delete_explain}</p> + + + <!-- edit forum widget --> + <h:form> + <input type="hidden" name="f" value="#{param['f']}"/> + <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> + <tr> + <th class="thHead" colspan="2">${resource.Forum_settings}</th> + </tr> + <tr> + <td class="row1">${resource.Forum_name}</td> + <td class="row2"> + <h:inputText id="Forum" size="25" styleClass="post" value="#{adminController.forumName}" required="true"/> + &nbsp;<h:message for="Forum" style="color:red" styleClass="liteoption"/>&nbsp; + </td> + </tr> + <tr> + <td class="row1">${resource.Forum_desc}</td> + <td class="row2"> + <h:inputTextarea rows="5" cols="45" styleClass="post" value="#{adminController.forumDescription}"/> + </td> + </tr> + <tr> + <td class="row1">${resource.Category}</td> + <td class="row2"> + <h:selectOneMenu value="#{adminController.forumCategory}"> + <c:forEach items="#{adminPanel.categories}" var="category"> + <f:selectItem itemValue="#{category.id}" itemLabel="#{category.title}" /> + </c:forEach> + </h:selectOneMenu> + </td> + </tr> + <tr> + <td class="catBottom" colspan="2" align="center"><input type="hidden" name="mode" value="modforum"/> + <h:commandButton value="Update" styleClass="mainoption" action="#{adminController.editForum}"/> + </td> + </tr> + </table> + </h:form> + + <br clear="all"/> + + + <!-- integrate the jump box --> + <table cellspacing="0" cellpadding="0" border="0" align="right"> + <tr> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> + </tr> + </table> + + </ui:define> + </ui:composition> +</div> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 14:30:17 UTC (rev 4404) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 15:00:55 UTC (rev 4405) @@ -58,7 +58,7 @@ </td> <td class="cat" align="center" valign="middle"> <!-- security check to make sure this link should be displayed or not --> - <forums:isAllowed fragment="acl://editCategory/editLink"> + <forums:isAllowed fragment="acl://editCategory/editLink" contextData="#{category}"> <span class="gen"> <h:outputLink value="#{forums:outputLink('/views/admin/editCategory.jsf',true)}"> <f:param name="c" value="#{category.id}"/> @@ -97,7 +97,7 @@ <span class="gen"> <a href="" target="_new">${forum.name}</a> </span> - <br/><span class="gensmall"></span> + <br/><span class="gensmall">${forum.description}</span> </td> <td class="row1" align="center" valign="middle"> <span class="gen">${forum.topicCount}</span> @@ -106,9 +106,15 @@ <span class="gen">${forum.postCount}</span> </td> <td class="row1" align="center" valign="middle"> - <span class="gen"> - <a href="">${resource.Edit}</a> - </span> + <!-- security check to make sure this link should be displayed or not --> + <forums:isAllowed fragment="acl://editForum/editLink" contextData="#{forum}"> + <span class="gen"> + <h:outputLink value="#{forums:outputLink('/views/admin/editForum.jsf',true)}"> + <f:param name="f" value="#{forum.id}"/> + <h:outputText value="${resource.Edit}"/> + </h:outputLink> + </span> + </forums:isAllowed> </td> <td class="row2" align="center" valign="middle"> <span class="gen"> @@ -166,9 +172,9 @@ <!-- integrate the jump box --> <table cellspacing="0" cellpadding="0" border="0" align="right"> <tr> - <td align="right" valign="top" nowrap="nowrap"> - <ui:include src="/views/jumpbox.xhtml"/> - </td> + <td align="right" valign="top" nowrap="nowrap"> + <ui:include src="/views/jumpbox.xhtml"/> + </td> </tr> </table> |
From: <jbo...@li...> - 2006-05-24 14:30:40
|
Author: rl...@jb... Date: 2006-05-24 10:30:17 -0400 (Wed, 24 May 2006) New Revision: 4404 Modified: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Log: add jdbc params Modified: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java 2006-05-24 14:04:56 UTC (rev 4403) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java 2006-05-24 14:30:17 UTC (rev 4404) @@ -59,7 +59,7 @@ import java.util.Properties; /** - * Run tests using Surefire. + * Run tests using Surefire. This is a fork which allows us to run jrunit style tests * * @author Jason van Zyl * @version $Id: SurefirePlugin.java 406180 2006-05-14 01:40:09Z brett $ @@ -70,6 +70,42 @@ public class SurefirePlugin extends AbstractMojo { + + /** + * The directory of for the file benchmark receiver + * + * @parameter expression="${fileReceiverDir}" + */ + private String fileReceiverDir; + + /** + * The classname of the driver to use + * + * @parameter expression="${jdbcDriverClass}" + */ + private String jdbcDriverClass; + + /** + * The URL of the driver to use + * + * @parameter expression="${jdbcDriverURL}" + */ + private String jdbcDriverUrl; + + /** + * The user of the driver to use + * + * @parameter expression="${jdbcDriverUser}" + */ + private String jdbcDriverUser; + + /** + * The classname of the driver to use + * + * @parameter expression="${jdbcDriverPassword}" + */ + private String jdbcDriverPassword; + /** * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion. * @@ -352,28 +388,29 @@ public void execute() throws MojoExecutionException, MojoFailureException { - this.getLog().info("JBOSS FORK HACK"); - this.getLog().info("Setting up JRUNIT"); + this.getLog().info("Executing JRunit Test Plugin"); + this.getLog().info("Creating a new benchmark receiver"); org.jboss.jrunit.controller.ant.AntBenchmarkReceiver receiver = new AntBenchmarkReceiver(); + AntQuitBenchmark quit = new AntQuitBenchmark(); + + this.getLog().info("Creating a new database receiver"); AntDatabaseBenchmarkReceiver dbReceiver = new AntDatabaseBenchmarkReceiver(); - dbReceiver.setJdbcClass(null); - dbReceiver.setJdbcPassword(null); - dbReceiver.setJdbcURL(null); - dbReceiver.setJdbcUserName(null); - dbReceiver.setOnlyIf(null); + dbReceiver.setJdbcClass(jdbcDriverClass); + dbReceiver.setJdbcPassword(jdbcDriverPassword); + dbReceiver.setJdbcURL(jdbcDriverUrl); + dbReceiver.setJdbcUserName(jdbcDriverUser); + dbReceiver.setOnlyIf(jdbcDriverClass); + + this.getLog().info("Creating a File Benchmark Receiver receiver"); AntFileBenchmarkReceiver fileBenchMarkReceiver = new AntFileBenchmarkReceiver(); - fileBenchMarkReceiver.setDirectory("./build"); + fileBenchMarkReceiver.setDirectory(fileReceiverDir); + receiver.getReceivers().add(dbReceiver); receiver.getReceivers().add(fileBenchMarkReceiver); - - - - - - + if ( skip ) { getLog().info( "Tests are skipped." ); @@ -784,4 +821,76 @@ surefireBooter.addReport( XMLReporter.class.getName(), new Object[]{reportsDirectory, trimStackTrace} ); } } + /** + * Get the jdbcDriverClass. + * + * @return the jdbcDriverClass. + */ + public String getJdbcDriverClass() + { + return jdbcDriverClass; + } + /** + * Set the jdbcDriverClass. + * + * @param jdbcDriverClass The jdbcDriverClass to set. + */ + public void setJdbcDriverClass(String jdbcDriverClass) + { + this.jdbcDriverClass = jdbcDriverClass; + } + /** + * Get the jdbcDriverPassword. + * + * @return the jdbcDriverPassword. + */ + public String getJdbcDriverPassword() + { + return jdbcDriverPassword; + } + /** + * Set the jdbcDriverPassword. + * + * @param jdbcDriverPassword The jdbcDriverPassword to set. + */ + public void setJdbcDriverPassword(String jdbcDriverPassword) + { + this.jdbcDriverPassword = jdbcDriverPassword; + } + /** + * Get the jdbcDriverUrl. + * + * @return the jdbcDriverUrl. + */ + public String getJdbcDriverUrl() + { + return jdbcDriverUrl; + } + /** + * Set the jdbcDriverUrl. + * + * @param jdbcDriverUrl The jdbcDriverUrl to set. + */ + public void setJdbcDriverUrl(String jdbcDriverUrl) + { + this.jdbcDriverUrl = jdbcDriverUrl; + } + /** + * Get the jdbcDriverUser. + * + * @return the jdbcDriverUser. + */ + public String getJdbcDriverUser() + { + return jdbcDriverUser; + } + /** + * Set the jdbcDriverUser. + * + * @param jdbcDriverUser The jdbcDriverUser to set. + */ + public void setJdbcDriverUser(String jdbcDriverUser) + { + this.jdbcDriverUser = jdbcDriverUser; + } } |
From: <jbo...@li...> - 2006-05-24 14:05:15
|
Author: jfr...@jb... Date: 2006-05-24 10:04:56 -0400 (Wed, 24 May 2006) New Revision: 4403 Added: labs/jbossweb/trunk/src/share/examples/php/metainf/ labs/jbossweb/trunk/src/share/examples/php/metainf/context.xml Modified: labs/jbossweb/trunk/src/share/native/build/build.xml Log: Due to the name org.apache.... the servlet needs to be in a privilegde context. Added: labs/jbossweb/trunk/src/share/examples/php/metainf/context.xml =================================================================== --- labs/jbossweb/trunk/src/share/examples/php/metainf/context.xml 2006-05-24 13:49:24 UTC (rev 4402) +++ labs/jbossweb/trunk/src/share/examples/php/metainf/context.xml 2006-05-24 14:04:56 UTC (rev 4403) @@ -0,0 +1 @@ +<Context privileged="true" /> Modified: labs/jbossweb/trunk/src/share/native/build/build.xml =================================================================== --- labs/jbossweb/trunk/src/share/native/build/build.xml 2006-05-24 13:49:24 UTC (rev 4402) +++ labs/jbossweb/trunk/src/share/native/build/build.xml 2006-05-24 14:04:56 UTC (rev 4403) @@ -8,6 +8,9 @@ <lib dir="../../../../output/jbossweb-1.0.0.CR1/server/default/deploy/jbossweb.sar"> <include name="**/servlets-php.jar"/> </lib> + <metainf dir="../../examples/php/metainf"> + <include name="**/context.xml"/> + </metainf> <!-- No class needed <classes dir="../../../../output/classes/org/apache/catalina/servlets/php"> <include name="**/Handler.class"/> |
Author: rl...@jb... Date: 2006-05-24 09:49:24 -0400 (Wed, 24 May 2006) New Revision: 4402 Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.classpath labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.project labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/java/SurefireTest1.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/java/SurefireTest2.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/java/SurefireTest3.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test-data/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test-data/testng.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/java/TestNGJavadocTest.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/pom.xml labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/JunitTest.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/TestNGTest.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/test/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/test/SurefirePlugin.java labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/apt/ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/apt/howto.apt labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/apt/introduction.apt labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/apt/testng.apt labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/site/site.xml Log: initial entry Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.classpath =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.classpath 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.classpath 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,13 @@ +<classpath> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="C:/projects/serialization/libs/jrunit.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/maven/surefire/surefire-api/2.0/surefire-api-2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.8/log4j-1.2.8.jar"/> + <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/> + <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar"/> + <classpathentry kind="var" path="M2_REPO/org/apache/maven/surefire/surefire-booter/2.0/surefire-booter-2.0.jar"/> +</classpath> \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.project =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.project 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/.project 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,14 @@ +<projectDescription> + <name>maven-jrunit-plugin</name> + <comment>Maven Plugins</comment> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments/> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <parent> + <artifactId>maven-plugins</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>1</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>maven-jrunit-plugin</artifactId> + <packaging>maven-plugin</packaging> + <name>Maven JRunit Plugin</name> + <version>1.0</version> + <contributors> + <contributor> + <name>Joakim Erdfelt</name> + <email>jo...@er...</email> + </contributor> + </contributors> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-booter</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>jrunit</groupId> + <artifactId>jrunit</artifactId> + <version>3.8.1</version> + <scope>system</scope> + <systemPath>c:/projects/serialization/libs/jrunit.jar</systemPath> + </dependency> + <dependency> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>1.6.5</version> + </dependency> + <dependency> + <groupId>apache-log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.8</version> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin</connection> + <developerConnection>scm:svn:https://svn.labs.jboss.org/labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin</developerConnection> + <url>https://svn.labs.jboss.org/labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin</url> + </scm> + + <build> + <plugins> + <!-- define a plugin for running jrunit tests --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.1.3</version> + </plugin> + </plugins> + + </build> + + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>it</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>Surefire plugin integration tests</name> + + <modules> + <module>test1</module> + <module>test2</module> + <module>test3</module> + </modules> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test1</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for default configuration</name> + <description>Test for default surefire configuration</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/java/SurefireTest1.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/java/SurefireTest1.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test1/src/test/java/SurefireTest1.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,66 @@ +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class SurefireTest1 + extends TestCase +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + public SurefireTest1( String name, String extraName ) + { + super( name ); + } + + public static Test suite() + { + TestSuite suite = new TestSuite(); + Test test = new SurefireTest2( "testSetUp", "dummy" ); + suite.addTest( test ); + TestSetup setup = new TestSetup( suite ) + { + + protected void setUp() + { + //oneTimeSetUp(); + } + + protected void tearDown() + { + oneTimeTearDown(); + } + + }; + + return setup; + } + + protected void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + protected void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + public void testSetUp() + { + assertTrue( "setUp was not called", setUpCalled ); + } + + public static void oneTimeTearDown() + { + assertTrue( "tearDown was not called", tearDownCalled ); + } + +} Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test2</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for MSUREFIRE-20</name> + <description>forkMode=pertest fails to call setUp</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>pertest</forkMode> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/java/SurefireTest2.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/java/SurefireTest2.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test2/src/test/java/SurefireTest2.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,66 @@ +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class SurefireTest2 + extends TestCase +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + public SurefireTest2( String name, String extraName ) + { + super( name ); + } + + public static Test suite() + { + TestSuite suite = new TestSuite(); + Test test = new SurefireTest2( "testSetUp", "dummy" ); + suite.addTest( test ); + TestSetup setup = new TestSetup( suite ) + { + + protected void setUp() + { + //oneTimeSetUp(); + } + + protected void tearDown() + { + oneTimeTearDown(); + } + + }; + + return setup; + } + + protected void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + protected void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + public void testSetUp() + { + assertTrue( "setUp was not called", setUpCalled ); + } + + public static void oneTimeTearDown() + { + assertTrue( "tearDown was not called", tearDownCalled ); + } + +} Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test3</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for MSUREFIRE-54</name> + <description>XML test reports are not well-formed when failure message contains quotes.</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.1.2</version> + <configuration> + <testFailureIgnore>true</testFailureIgnore > + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/java/SurefireTest3.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/java/SurefireTest3.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test3/src/test/java/SurefireTest3.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,36 @@ +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +public class SurefireTest3 + extends TestCase +{ + + public SurefireTest3( ) + { + super( ); + } + + public SurefireTest3( String name ) + { + super( name ); + } + + + public void testQuote() + { + fail( "\"" ); + } + + public void testLower() + { + fail( "<" ); + } + + public void testGreater() + { + fail( ">" ); + } + +} Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test4</artifactId> + <version>1.0-SNAPSHOT</version> + <name>TestNG Suites</name> + <description>Uses suite xml file definitions to invoke testng tests</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng-jdk15</artifactId> + <version>4.4.7</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <suiteXmlFiles> + <file>src/test-data/testng.xml</file> + </suiteXmlFiles> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test/java/TestNGSuiteTest.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,34 @@ +import org.testng.annotations.Configuration; +import org.testng.annotations.Test; +import org.testng.internal.Utils; + + +/** + * Tests that forcing testng to run tests via the + * <code>"${maven.test.forcetestng}"</code> configuration option + * works. + * + * @author jkuhnert + */ +public class TestNGSuiteTest { + + /** + * Sets up testObject + */ + @Configuration(beforeTestClass = true) + public void configureTest() + { + testObject = new Object(); + } + + Object testObject; + + /** + * Tests reporting an error + */ + @Test + public void isTestObjectNull() + { + assert testObject != null : "testObject is null"; + } +} \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test-data/testng.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test-data/testng.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test4/src/test-data/testng.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > + +<suite name="Suite 1 Test" verbose="1" > + + <test name="Sample Test" > + <classes> + <class name="TestNGSuiteTest" /> + </classes> + </test> + +</suite> \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test5</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for testng jdk14 integration</name> + <description>calls testng jdk14 javadoc based tests</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng-jdk14</artifactId> + <version>4.4.7</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <testSourceDirectory>src/test/java</testSourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <groups>functional</groups> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/java/TestNGJavadocTest.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/java/TestNGJavadocTest.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test5/src/test/java/TestNGJavadocTest.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,42 @@ +import org.testng.Assert; + + +/** + * Tests that forcing testng to run tests via the + * <code>"${maven.test.forcetestng}"</code> configuration option + * works. + * + * @author jkuhnert + */ +public class TestNGJavadocTest { + + /** + * Sets up testObject + * @testng.configuration beforeTestClass = "true" + * groups = "functional" + */ + public void configureTest() + { + testObject = new Object(); + } + + Object testObject; + + /** + * Tests reporting an error + * @testng.test groups = "functional, notincluded" + */ + public void isTestObjectNull() + { + Assert.assertNotNull(testObject, "testObject is null"); + } + + /** + * Sample method that shouldn't be run by test suite. + * @testng.test groups = "notincluded" + */ + public void shouldNotRun() + { + Assert.assertTrue(false, "Group specified by test shouldnt be run."); + } +} \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/pom.xml =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/pom.xml 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/pom.xml 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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.maven.plugins.surefire</groupId> + <artifactId>test6</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for testng integration</name> + <description>calls testng test</description> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng-jdk15</artifactId> + <version>4.4.7</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <groups>functional</groups> + <threadCount>3</threadCount> + <parallel>true</parallel> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/JunitTest.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/JunitTest.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/JunitTest.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,29 @@ +import junit.framework.TestCase; + +/** + * Provided to ensure both junit and testng tests can run happily + * together. + * + * @author jkuhnert + */ +public class JunitTest extends TestCase { + + Object testObject; + + /** + * Creats an object instance + */ + public void setUp() + { + testObject = new Object(); + } + + /** + * Tests that object created in setup + * isn't null. + */ + public void testJunitObject() + { + assertNotNull(testObject); + } +} Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/TestNGTest.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/TestNGTest.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/it/test6/src/test/java/TestNGTest.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,43 @@ +import org.testng.annotations.Configuration; +import org.testng.annotations.Test; +import org.testng.internal.Utils; + + +/** + * Tests that forcing testng to run tests via the + * <code>"${maven.test.forcetestng}"</code> configuration option + * works. + * + * @author jkuhnert + */ +public class TestNGTest { + + /** + * Sets up testObject + */ + @Configuration(beforeTestClass = true, groups = "functional") + public void configureTest() + { + testObject = new Object(); + } + + Object testObject; + + /** + * Tests reporting an error + */ + @Test(groups = {"functional", "notincluded"}) + public void isTestObjectNull() + { + assert testObject != null : "testObject is null"; + } + + /** + * Sample method that shouldn't be run by test suite. + */ + @Test(groups = "notincluded") + public void shouldNotRun() + { + assert false == true : "Group specified by test shouldnt be run."; + } +} \ No newline at end of file Added: labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java =================================================================== --- labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java 2006-05-24 09:53:26 UTC (rev 4401) +++ labs/jbossbuild/trunk/projects/maven-plugins/maven-jrunit-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java 2006-05-24 13:49:24 UTC (rev 4402) @@ -0,0 +1,787 @@ +package org.apache.maven.plugin.surefire; + +/* + * Copyright 2001-2006 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. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionResult; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.surefire.booter.ForkConfiguration; +import org.apache.maven.surefire.booter.SurefireBooter; +import org.apache.maven.surefire.booter.SurefireBooterForkException; +import org.apache.maven.surefire.booter.SurefireExecutionException; +import org.apache.maven.surefire.report.BriefConsoleReporter; +import org.apache.maven.surefire.report.BriefFileReporter; +import org.apache.maven.surefire.report.ConsoleReporter; +import org.apache.maven.surefire.report.DetailedConsoleReporter; +import org.apache.maven.surefire.report.FileReporter; +import org.apache.maven.surefire.report.ForkingConsoleReporter; +import org.apache.maven.surefire.report.XMLReporter; +import org.codehaus.plexus.util.StringUtils; +import org.jboss.jrunit.controller.ant.AntBenchmarkReceiver; +import org.jboss.jrunit.controller.ant.AntDatabaseBenchmarkReceiver; +import org.jboss.jrunit.controller.ant.AntFileBenchmarkReceiver; +import org.jboss.jrunit.controller.ant.AntQuitBenchmark; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +/** + * Run tests using Surefire. + * + * @author Jason van Zyl + * @version $Id: SurefirePlugin.java 406180 2006-05-14 01:40:09Z brett $ + * @requiresDependencyResolution test + * @goal test + * @phase test + */ +public class SurefirePlugin + extends AbstractMojo +{ + /** + * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, but quite convenient on occasion. + * + * @parameter expression="${maven.test.skip}" + */ + private boolean skip; + + /** + * Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion. + * + * @parameter expression="${maven.test.failure.ignore}" + */ + private boolean testFailureIgnore; + + /** + * The base directory of the project being tested. This can be obtained in your unit test by System.getProperty("basedir"). + * + * @parameter expression="${basedir}" + * @required + */ + private File basedir; + + /** + * The directory containing generated classes of the project being tested. + * + * @parameter expression="${project.build.outputDirectory}" + * @required + */ + private File classesDirectory; + + /** + * The directory containing generated test classes of the project being tested. + * + * @parameter expression="${project.build.testOutputDirectory}" + * @required + */ + private File testClassesDirectory; + + /** + * The classpath elements of the project being tested. + * + * @parameter expression="${project.testClasspathElements}" + * @required + * @readonly + */ + private List classpathElements; + + /** + * Base directory where all reports are written to. + * + * @parameter expression="${project.build.directory}/surefire-reports" + */ + private File reportsDirectory; + + /** + * The test source directory containing test class sources. + * + * @parameter expression="${project.build.testSourceDirectory}" + * @required + */ + private File testSourceDirectory; + + /** + * Specify this parameter if you want to use the test pattern matching notation, Ant pattern matching, to select tests to run. + * The Ant pattern will be used to create an include pattern formatted like <code>**/${test}.java</code> + * When used, the <code>includes</code> and <code>excludes</code> patterns parameters are ignored + * + * @parameter expression="${test}" + */ + private String test; + + /** + * List of patterns (separated by commas) used to specify the tests that should be included in testing. + * When not specified and whent the <code>test</code> parameter is not specified, the default includes will be + * <code>**/Test*.java **/*Test.java **/*TestCase.java</code> + * + * @parameter + */ + private List includes; + + /** + * List of patterns (separated by commas) used to specify the tests that should be excluded in testing. + * When not specified and whent the <code>test</code> parameter is not specified, the default excludes will be + * <code>**/Abstract*Test.java **/Abstract*TestCase.java **/*$*</code> + * + * @parameter + */ + private List excludes; + + /** + * ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use System.setProperty( "localRepository"). + * + * @parameter expression="${localRepository}" + * @required + * @readonly + */ + private ArtifactRepository localRepository; + + /** + * List of System properties to pass to the JUnit tests. + * + * @parameter + */ + private Properties systemProperties; + + /** + * Map of of plugin artifacts. + * + * @parameter expression="${plugin.artifactMap}" + * @required + * @readonly + */ + private Map pluginArtifactMap; + + /** + * Map of of project artifacts. + * + * @parameter expression="${project.artifactMap}" + * @required + * @readonly + */ + private Map projectArtifactMap; + + /** + * Option to print summary of test suites or just print the test cases that has errors. + * + * @parameter expression="${surefire.printSummary}" + * default-value="true" + */ + private boolean printSummary; + + /** + * Selects the formatting for the test report to be generated. Can be set as brief or plain. + * + * @parameter expression="${surefire.reportFormat}" + * default-value="brief" + */ + private String reportFormat; + + /** + * Option to generate a file test report or just output the test report to the console. + * + * @parameter expression="${surefire.useFile}" + * default-value="true" + */ + private boolean useFile; + + /** + * Option to specify the forking mode. Can be "never" (default), "once" or "always". + * "none" and "pertest" are also accepted for backwards compatibility. + * + * @parameter expression="${forkMode}" default-value="once" + */ + private String forkMode; + + /** + * Option to specify the jvm (or path to the java executable) to use with + * the forking options. For the default we will assume that java is in the path. + * + * @parameter expression="${jvm}" + * default-value="java" + */ + private String jvm; + + /** + * Arbitrary options to set on the command line. + * + * @parameter expression="${argLine}" + */ + private String argLine; + + /** + * Additional environments to set on the command line. + * + * @parameter + */ + private Map environmentVariables = new HashMap(); + + /** + * Command line working directory. + * + * @parameter + */ + private File workingDirectory; + + /** + * When false it makes tests run using the standard classloader delegation instead of the default + * Maven isolated classloader. Only used when forking (forkMode is not "none").<br/> + * Setting it to false helps with some problems caused by conflicts between + * xml parsers in the classpath and the Java 5 provider parser. + * + * @parameter expression="${childDelegation}" + * default-value="false" + */ + private boolean childDelegation; + + /** + * Groups for this test. Only classes/methods/etc decorated with one of the + * groups specified here will be included in test run, if specified. + * + * @parameter expression="${groups}" + */ + private String groups; + + /** + * Excluded groups. Any methods/classes/etc with one of the groups specified in this + * list will specifically not be run. + * + * @parameter expression="${excludedGroups}" + */ + private String excludedGroups; + + /** + * List of TestNG suite xml file locations, seperated by commas. It should be noted that + * if suiteXmlFiles is specified, <b>no</b> other tests will be run, ignoring other parameters, + * like includes and excludes. + * + * @parameter + */ + private File[] suiteXmlFiles; + + /** + * The attribute thread-count allows you to specify how many threads should be allocated + * for this execution. Only makes sense to use in conjunction with parallel. + * + * @parameter expression="${threadCount}" + * default-value="5" + */ + private int threadCount; + + /** + * When you use the parallel attribute, TestNG will try to run all your test methods in + * separate threads, except for methods that depend on each other, which will be run in + * the same thread in order to respect their order of execution. + * + * @parameter expression="${parallel}" + * default-value="false" + * @todo test how this works with forking, and console/file output parallelism + */ + private boolean parallel; + + /** + * Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace. + * + * @parameter expression="${trimStackTrace}" default-value="true" + */ + private boolean trimStackTrace; + + /** + * @component + */ + private ArtifactResolver artifactResolver; + + /** + * @component + */ + private ArtifactFactory artifactFactory; + + /** + * @parameter expression="${project.pluginArtifactRepositories}" + */ + private List remoteRepositories; + + /** + * @component + */ + private ArtifactMetadataSource metadataSource; + + private static final String BRIEF_REPORT_FORMAT = "brief"; + + private static final String PLAIN_REPORT_FORMAT = "plain"; + + private Properties originalSystemProperties; + + /** + * @parameter expression="${disableXmlReport}" default-value="false" + */ + private boolean disableXmlReport; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + this.getLog().info("JBOSS FORK HACK"); + this.getLog().info("Setting up JRUNIT"); + + org.jboss.jrunit.controller.ant.AntBenchmarkReceiver receiver = new AntBenchmarkReceiver(); + AntQuitBenchmark quit = new AntQuitBenchmark(); + AntDatabaseBenchmarkReceiver dbReceiver = new AntDatabaseBenchmarkReceiver(); + dbReceiver.setJdbcClass(null); + dbReceiver.setJdbcPassword(null); + dbReceiver.setJdbcURL(null); + dbReceiver.setJdbcUserName(null); + dbReceiver.setOnlyIf(null); + + AntFileBenchmarkReceiver fileBenchMarkReceiver = new AntFileBenchmarkReceiver(); + fileBenchMarkReceiver.setDirectory("./build"); + receiver.getReceivers().add(dbReceiver); + receiver.getReceivers().add(fileBenchMarkReceiver); + + + + + + + if ( skip ) + { + getLog().info( "Tests are skipped." ); + } + else if ( !testClassesDirectory.exists() ) + { + getLog().info( "No tests to run." ); + } + else + { + if ( parallel ) + { + if ( threadCount < 1 ) + { + throw new MojoFailureException( "Must have at least one thread in parallel mode" ); + } + } + + SurefireBooter surefireBooter = constructSurefireBooter(); + + getLog().info( "Surefire report directory: " + reportsDirectory ); + + boolean success; + try + { + success = surefireBooter.run(); + } + catch ( SurefireBooterForkException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + catch ( SurefireExecutionException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + + if ( originalSystemProperties != null ) + { + // restore system properties + System.setProperties( originalSystemProperties ); + } + + if ( !success ) + { + String msg = "There are test failures."; + + if ( testFailureIgnore ) + { + getLog().error( msg ); + } + else + { + throw new MojoFailureException( msg ); + } + } + } + } + + private SurefireBooter constructSurefireBooter() + throws MojoExecutionException, MojoFailureException + { + SurefireBooter surefireBooter = new SurefireBooter(); + + Artifact surefireArtifact = (Artifact) pluginArtifactMap.get( "org.apache.maven.surefire:surefire-booter" ); + if ( surefireArtifact == null ) + { + throw new MojoExecutionException( "Unable to locate surefire-booter in the list of plugin artifacts" ); + } + + surefireArtifact.isSnapshot(); // TODO: this is ridiculous, but it fixes getBaseVersion to be -SNAPSHOT if needed + + Artifact junitArtifact; + Artifact testNgArtifact; + try + { + addArtifact( surefireBooter, surefireArtifact ); + + junitArtifact = (Artifact) projectArtifactMap.get( "junit:junit" ); + + // TODO: this is pretty manual, but I'd rather not require the plugin > dependencies section right now + testNgArtifact = (Artifact) projectArtifactMap.get( "org.testng:testng" ); + + if ( testNgArtifact != null ) + { + VersionRange range = VersionRange.createFromVersionSpec( "[4.7,)" ); + if ( !range.containsVersion( testNgArtifact.getSelectedVersion() ) ) + { + throw new MojoFailureException( + "TestNG support requires version 4.7 or above. You have declared version " + + testNgArtifact.getVersion() ); + } + + // The plugin uses a JDK based profile to select the right testng. We might be explicity using a + // different one since its based on the source level, not the JVM. Prune using the filter. + addProvider( surefireBooter, "surefire-testng", surefireArtifact.getBaseVersion(), testNgArtifact ); + } + else + { + // only need to discover JUnit if there is no TestNG, it runs the tests for you. + if ( junitArtifact != null ) + { + addProvider( surefireBooter, "surefire-junit", surefireArtifact.getBaseVersion(), null ); + } + } + } + catch ( ArtifactNotFoundException e ) + { + throw new MojoExecutionException( + "Unable to locate required surefire provider dependency: " + e.getMessage(), e ); + } + catch ( InvalidVersionSpecificationException e ) + { + throw new MojoExecutionException( "Error determining the TestNG version requested: " + e.getMessage(), e ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( "Error to resolving surefire provider dependency: " + e.getMessage(), e ); + } + + if ( suiteXmlFiles != null && suiteXmlFiles.length > 0 ) + { + if ( testNgArtifact == null ) + { + throw new MojoExecutionException( "suiteXmlFiles is configured, but there is no TestNG dependency" ); + } + for ( int i = 0; i < suiteXmlFiles.length; i++ ) + { + File file = suiteXmlFiles[i]; + if ( file.exists() ) + { + surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGXmlTestSuite", + new Object[]{file, testSourceDirectory.getAbsolutePath()} ); + } + } + } + else + { + List includes; + List excludes; + + if ( test != null ) + { + // Check to see if we are running a single test. The raw parameter will + // come through if it has not been set. + + // FooTest -> **/FooTest.java + + includes = new ArrayList(); + + excludes = new ArrayList(); + + String[] testRegexes = StringUtils.split( test, "," ); + + for ( int i = 0; i < testRegexes.length; i++ ) + { + includes.add( "**/" + testRegexes[i] + ".java" ); + } + } + else + { + includes = this.includes; + + excludes = this.excludes; + + // defaults here, qdox doesn't like the end javadoc value + // Have to wrap in an ArrayList as surefire expects an ArrayList instead of a List for some reason + if ( includes == null || includes.size() == 0 ) + { + includes = new ArrayList( + Arrays.asList( new String[]{"**/Test*.java", "**/*Test.java", "**/*TestCase.java"} ) ); + } + if ( excludes == null || excludes.size() == 0 ) + { + excludes = new ArrayList( + Arrays.asList( new String[]{"**/Abstract*Test.java", "**/Abstract*TestCase.java", "**/*$*"} ) ); + } + } + + if ( testNgArtifact != null ) + { + surefireBooter.addTestSuite( "org.apache.maven.surefire.testng.TestNGDirectoryTestSuite", new Object[]{ + testClassesDirectory, includes, excludes, groups, excludedGroups, Boolean.valueOf( parallel ), + new Integer( threadCount ), testSourceDirectory.getAbsolutePath()} ); + } + else if ( junitArtifact != null ) + { + surefireBooter.addTestSuite( "org.apache.maven.surefire.junit.JUnitDirectoryTestSuite", + new Object[]{testClassesDirectory, includes, excludes} ); + } + else + { + throw new MojoExecutionException( "No Java test frameworks found" ); + } + } + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + + getLog().debug( "Test Classpath :" ); + + // no need to add classes/test classes directory here - they are in the classpath elements already + + for ( Iterator i = classpathElements.iterator(); i.hasNext(); ) + { + String classpathElement = (String) i.next(); + + getLog().debug( " " + classpathElement ); + + surefireBooter.addClassPathUrl( classpathElement ); + + // TODO: fix + // Some test suites (TestNG) do not utilise the separate classloader, so we need to make all the tests + // available in the main classloader as well (this is consistent with the old behaviour in Surefire 1.5) + surefireBooter.addSurefireClassPathUrl( classpathElement ); + } + + // ---------------------------------------------------------------------- + // Forking + // ---------------------------------------------------------------------- + + ForkConfiguration fork = new ForkConfiguration(); + + fork.setForkMode( forkMode ); + + processSystemProperties( !fork.isForking() ); + + if ( getLog().isDebugEnabled() ) + { + showMap( systemProperties, "system property" ); + } + + if ( fork.isForking() ) + { + fork.setSystemProperties( systemProperties ); + + fork.setJvmExecutable( jvm ); + + if ( workingDirectory != null ) + { + fork.setWorkingDirectory( workingDirectory ); + } + else + { + fork.setWorkingDirectory( basedir ); + } + + fork.setArgLine( argLine ); + + fork.setEnvironmentVariables( environmentVariables ); + + if ( getLog().isDebugEnabled() ) + { + showMap( environmentVariables, "environment variable" ); + + fork.setDebug( true ); + } + } + + surefireBooter.setForkConfiguration( fork ); + + surefireBooter.setChildDelegation( childDelegation ); + + addReporters( surefireBooter, fork.isForking() ); + + return surefireBooter; + } + + private void showMap( Map map, String setting ) + { + for ( Iterator i = map.keySet().iterator(); i.hasNext(); ) + { + String key = (String) i.next(); + String value = (String) map.get( key ); + getLog().debug( "Setting " + setting + " [" + key + "]=[" + value + "]" ); + } + } + + private void addProvider( SurefireBooter surefireBooter, String provider, String version, + Artifact filteredArtifact ) + throws ArtifactNotFoundException, ArtifactResolutionException + { + Artifact providerArtifact = artifactFactory.createDependencyArtifact( "org.apache.maven.surefire", provider, + VersionRange.createFromVersion( version ), + "jar", null, Artifact.SCOPE_TEST ); + ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact ); + + for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + { + Artifact artifact = (Artifact) i.next(); + + getLog().debug( "Adding to surefire test classpath: " + artifact.getFile().getAbsolutePath() ); + + surefireBooter.addSurefireClassPathUrl( artifact.getFile().getAbsolutePath() ); + } + } + + private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact ) + throws ArtifactResolutionException, ArtifactNotFoundException + { + ArtifactFilter filter = null; + if ( filteredArtifact != null ) + { + filter = new ExcludesArtifactFilter( + Collections.singletonList( filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId() ) ); + } + + Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); + + return artifactResolver.resolveTransitively( Collections.singleton( providerArtifact ), originatingArtifact, + localRepository, remoteRepositories, metadataSource, filter ); + } + + private void addArtifact( SurefireBooter surefireBooter, Artifact surefireArtifact ) + throws ArtifactNotFoundException, ArtifactResolutionException + { + ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact ); + + for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); ) + { + Artifact artifact = (Artifact) i.next(); + + getLog().debug( "Adding to surefire booter test classpath: " + artifact.getFile().getAbsolutePath() ); + + surefireBooter.addSurefireBootClassPathUrl( artifact.getFile().getAbsolutePath() ); + } + } + + protected void processSystemProperties( boolean setInSystem ) + { + if ( systemProperties == null ) + { + systemProperties = new Properties(); + } + + originalSystemProperties = (Properties) System.getProperties().clone(); + + systemProperties.setProperty( "basedir", basedir.getAbsolutePath() ); + + systemProperties.setProperty( "localRepository", localRepository.getBasedir() ); + + if ( setInSystem ) + { + // Add all system properties configured by the user + Iterator iter = systemProperties.keySet().iterator(); + + while ( iter.hasNext() ) + { + String key = (String) iter.next(); + + String value = systemProperties.getProperty( key ); + + System.setProperty( key, value ); + } + } + } + + /** + * <p> Adds Reporters that will generate reports with different formatting. + * <p> The Reporter that will be added will be based on the value of the parameter + * useFile, reportFormat, and printSummary. + * + * @param surefireBooter The surefire booter that will run tests. + * @param forking + */ + private void addReporters( SurefireBooter surefireBooter, boolean forking ) + { + Boolean trimStackTrace = Boolean.valueOf( this.trimStackTrace ); + if ( useFile ) + { + if ( printSummary ) + { + if ( forking ) + { + surefireBooter.addRe... [truncated message content] |
From: <jbo...@li...> - 2006-05-24 09:53:35
|
Author: mla...@jb... Date: 2006-05-24 05:53:26 -0400 (Wed, 24 May 2006) New Revision: 4401 Modified: labs/jbossweb/trunk/src/share/resources/bin/service.bat Log: Update service description code. Note: We should make the version bound to the actual build. Modified: labs/jbossweb/trunk/src/share/resources/bin/service.bat =================================================================== --- labs/jbossweb/trunk/src/share/resources/bin/service.bat 2006-05-24 08:40:11 UTC (rev 4400) +++ labs/jbossweb/trunk/src/share/resources/bin/service.bat 2006-05-24 09:53:26 UTC (rev 4401) @@ -22,7 +22,7 @@ goto cmdEnd :cmdInstall -jbosssvc.exe -iwdc JBossWebServer "%CD%" "JBoss Web Server 4" "JBoss Web Server Version 4.0.4-beta" service.bat +jbosssvc.exe -iwdc JBossWebServer "%CD%" "JBoss Web Server 4" "JBoss Web Server Version 1.0.0/CR1" service.bat goto cmdEnd :cmdUninstall |
From: <jbo...@li...> - 2006-05-24 08:40:37
|
Author: mic...@jb... Date: 2006-05-24 04:40:11 -0400 (Wed, 24 May 2006) New Revision: 4400 Added: labs/jbossrules/trunk/documentation/training/developers-course/Module 6 - rule formats.odp labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Approve.java labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PolicyApprovalLauncher.java labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/archive/ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/archive/raw.drl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/technical.drl Removed: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl Modified: labs/jbossrules/trunk/documentation/training/developers-course/course_outline.odt labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Policy.java labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java Log: lab 4 finished Added: labs/jbossrules/trunk/documentation/training/developers-course/Module 6 - rule formats.odp =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/Module 6 - rule formats.odp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: labs/jbossrules/trunk/documentation/training/developers-course/course_outline.odt =================================================================== (Binary files differ) Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 08:40:11 UTC (rev 4400) @@ -5,6 +5,7 @@ Instructions: This excercise is a self contained Eclipse project. + There are 2 parts, decision tables, and DSLs. FOR DECISION TABLES: @@ -34,19 +35,41 @@ techie folk to edit in relative safety. (http://support.microsoft.com/?kbid=214081) - - NOTE: when you make a change to the spreadsheet, you will need to refresh the eclipse project to pick up the latest (of course, if you change it to load direct from a file system, not the classpath, then you won't need to do this). DSLs: - Step 11: + Step 11: Locate the src/rules/approval package. Open the approval rules. + Step 12: Locate the PolicyApprovalLauncher class. + Step 13: Run the PolicyApprovalLauncher class as a java application, note the console output. + Step 14: open the acme.dsl and examine the mappings for the domain language. + Add a mapping for the "then" section to log some debug message. + Open the approval.drl and add the log expression to a rule that you think + will fire. Then re-run the launcher. + Step 15: Modify or add a constraint to a rule, re-launch and observe + Step 16: open the technical.drl file, and change APPROVAL or REJECTED messages. Relaunch. + Step 17: Right click on the .dsl file, and open as a text file, note the format of the mappings. + Step 18: Open the approval.drl file, make a "typo" and save, observe an error showing up on the appropriate line + (errors may be parse errors, or an "expand" error). + Step 18: (optional) - store rules from approval in seperate files. Modify the launcher to load them all up from + the seperate files. + Step 19: (optional - advanced) - note the way that multiple patterns + are added to the "d : Driver(..)" construct. + Discuss alternative ways, perhaps more mappings for combinations + that capture all constraints on a line. + + Add a mapping like: "Set Driver to 'd'" which will simply + bind a Driver instance to a "d" variable. + Then add mappings to add constraints in the form of + "eval( /* java code with 'd' */)" - this is less efficient + but can provide more flexibility. + Step 20: Open the archive/raw.drl file, to see what the rules would look like + without a DSL. Note the use of little facts like "Approve" and "Rejection" + to control the behaviour. - - Pre-requisites: Eclipse 3.2 must be installed JBoss Rules plug in installed into Eclipse Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Approve.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Approve.java 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Approve.java 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,24 @@ +package org.acme.insurance; + +/** + * This is a simple fact class to mark something as approved. + * @author Michael Neale + * + */ +public class Approve { + + private String reason; + + public Approve(String reason) { + this.reason = reason; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + +} Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Approve.java ___________________________________________________________________ Name: svn:eol-style + native Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Policy.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Policy.java 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Policy.java 2006-05-24 08:40:11 UTC (rev 4400) @@ -11,7 +11,7 @@ public class Policy { private String type = "COMPREHENSIVE"; - private boolean approved = true; + private boolean approved = false; private int discountPercent = 0; private int basePrice; Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 08:40:11 UTC (rev 4400) @@ -1,5 +1,9 @@ package org.acme.insurance; +/** + * + * @author Michael Neale + */ public class Rejection { private String reason; Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PolicyApprovalLauncher.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PolicyApprovalLauncher.java 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PolicyApprovalLauncher.java 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,147 @@ +package org.acme.insurance.launcher; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + +import org.acme.insurance.Driver; +import org.acme.insurance.Policy; +import org.drools.RuleBase; +import org.drools.RuleBaseFactory; +import org.drools.WorkingMemory; +import org.drools.compiler.DroolsParserException; +import org.drools.compiler.PackageBuilder; + +/** + * Sample file for launching rules with a DSL. + * @author Michael Neale + */ +public class PolicyApprovalLauncher { + + public static void main(String[] args) throws Exception { + PolicyApprovalLauncher launcher = new PolicyApprovalLauncher(); + launcher.executeExample(); + } + + private void executeExample() throws Exception { + + RuleBase ruleBase = loadRuleBase(); + + testUnsafeDriver(ruleBase); + testSafeMature(ruleBase); + testUnsafeAreaAndPriors(ruleBase); + + } + + /** + * This shows how rules are loaded up from multiple files. + * Some are technical, and some are DSL based. + */ + private RuleBase loadRuleBase() throws DroolsParserException, IOException, Exception { + PackageBuilder builder = new PackageBuilder(); + + //this loads the DSL business rules + builder.addPackageFromDrl(getMainRules(), getDSL()); + + //loads the technical rules + builder.addPackageFromDrl(getTechnicalRules()); + + //package it all up + RuleBase ruleBase = RuleBaseFactory.newRuleBase(); + ruleBase.addPackage(builder.getPackage()); + return ruleBase; + + //note there is a utlity class called + //'RuleBaseLoader' which can do the above in one hit, but only + //for 1 file per rulebase. + } + + + /////////////////////////////////////////////////// + // The trial scenarios follow below + /////////////////////////////////////////////////// + + + private void testUnsafeDriver(RuleBase ruleBase) { + WorkingMemory wm = ruleBase.newWorkingMemory(); + + Driver driver = new Driver(); + driver.setPriorClaims(new Integer(4)); + Policy policy = new Policy(); + policy.setType("COMPREHENSIVE"); + policy.setApproved(false); + + wm.assertObject(driver); + wm.assertObject(policy); + + wm.fireAllRules(); + + System.out.println("Policy approved: " + policy.isApproved()); + } + + private void testSafeMature(RuleBase ruleBase) { + WorkingMemory wm = ruleBase.newWorkingMemory(); + + Driver driver = new Driver(); + driver.setPriorClaims(new Integer(0)); + driver.setAge(new Integer(45)); + + Policy policy = new Policy(); + policy.setType("COMPREHENSIVE"); + policy.setApproved(false); + + wm.assertObject(driver); + wm.assertObject(policy); + + wm.fireAllRules(); + + System.out.println("Policy approved: " + policy.isApproved()); + } + + private void testUnsafeAreaAndPriors(RuleBase ruleBase) { + WorkingMemory wm = ruleBase.newWorkingMemory(); + + Driver driver = new Driver(); + driver.setPriorClaims(new Integer(2)); + driver.setAge(new Integer(22)); + driver.setLocationRiskProfile("MED"); + + Policy policy = new Policy(); + policy.setType("COMPREHENSIVE"); + policy.setApproved(false); + + wm.assertObject(driver); + wm.assertObject(policy); + + wm.fireAllRules(); + + System.out.println("Policy approved: " + policy.isApproved()); + } + + + //////////////////////////////////////////////////////////// + // Loading from classpath, for convenience. + // Feel free to change it to the file system if you like. + //////////////////////////////////////////////////////////// + + private Reader getMainRules() { + InputStream stream = this.getClass() + .getResourceAsStream("/approval/approval.drl"); + return new InputStreamReader(stream); + } + + private Reader getTechnicalRules() { + InputStream stream = this.getClass() + .getResourceAsStream("/approval/technical.drl"); + return new InputStreamReader(stream); + } + + private Reader getDSL() { + InputStream stream = this.getClass() + .getResourceAsStream("/approval/acme.dsl"); + return new InputStreamReader(stream); + } + + +} Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/launcher/PolicyApprovalLauncher.java ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,13 @@ +#ACME Discount insurance rule language +[then]Log "{message}"=System.out.println("{message}"); +[when]The Driver is less than {age} years old=d : Driver(age < {age}) +[when]The Driver is greater than {age} years old=d : Driver(age > {age}) +[when]The Driver has had more than {prior} prior claims=d : Driver(priorClaims > {prior}) +[when]The Policy type is '{type}'=Policy(type == "{type}") +[then]Reject the policy with explanation : '{reason}'=assert(new Rejection("{reason}")); +[when]The Driver has a location risk profile of '{risk}'=d : Driver(locationRiskProfile == "{risk}") +[when]The Driver has an age of at least {age}=d : Driver(age >= {age}) +[when]The Driver is between {lower} and {upper} years old=d : Driver(age >= {lower}, age <= {upper}) +[when]Policy has not been rejected=not Rejection() +[when]Driver has had {number} prior claims=d : Driver(priorClaims == {number}) +[then]Approve the policy with the reason : '{reason}'=assert(new Approve("{reason}")); Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme.dsl ___________________________________________________________________ Name: svn:eol-style + native Deleted: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 08:40:11 UTC (rev 4400) @@ -1,4 +0,0 @@ -#place your comments here - this is just a description for your own purposes. -[when]There is a Person with name of "{name}"=Person(name=="{name}") -[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") -[then]Log "{message}"=System.out.println("{message}"); Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approval.drl 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,82 @@ +#created on: 23/05/2006 +package org.acme.insurance +expander acme.dsl + +# +# These rules are mostly "negative" in the sense that +# a driver has to not be rejected. There is +# one rule that allows immediate approval however. +# + +rule "Driver has had too many accidents" + + when + The Driver has had more than 3 prior claims + then + Reject the policy with explanation : 'Too many accidents' + +end + +rule "Driver is underage" + + when + The Driver is less than 18 years old + then + Reject the policy with explanation : 'Driver is underage. Try another insurer' + +end + +rule "Driver is in marginal age" + #remember, don't leave any blank lines in between expressions + when + The Driver is between 18 and 24 years old + The Driver has had more than 1 prior claims + The Policy type is 'COMPREHENSIVE' + then + Reject the policy with explanation : 'No accidents allowed if in marginal age group' +end + +rule "Driver in unsafe area for marginal age" + when + The Policy type is 'COMPREHENSIVE' + The Driver is less than 25 years old + The Driver has a location risk profile of 'HIGH' + then + Reject the policy with explanation : 'Marginal age driver in high risk area' +end + +rule "Driver in unsafe area with priors" + when + The Driver has a location risk profile of 'MED' + The Policy type is 'COMPREHENSIVE' + The Driver is less than 25 years old + The Driver has had more than 1 prior claims + then + Reject the policy with explanation : 'Driver in that area is too risky - given past accidents and age.' +end + +rule "Driver unsafe for third party" + when + The Policy type is 'THIRD_PARTY' + The Driver has had more than 2 prior claims + then + Reject the policy with explanation : 'Too many priors for third party' +end + +rule "Driver in bad area for theft" + when + The Policy type is 'FIRE_THEFT' + The Driver has a location risk profile of 'HIGH' + then + Reject the policy with explanation : 'Unsafe area for theft' +end + +rule "Quick approval - safe driver, any policy type" + when + Policy has not been rejected + The Driver has an age of at least 30 + Driver has had 0 prior claims + then + Approve the policy with the reason : 'Driver is safe and mature.' +end + Deleted: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 08:40:11 UTC (rev 4400) @@ -1,23 +0,0 @@ -#created on: 23/05/2006 -package org.acme.insurance - -expander acme_insure.dsl - - -rule "Your First Rule" - - when - #conditions - then - #actions - -end - -rule "Your Second Rule" - #include attributes such as "salience" here... - when - #conditions - then - #actions - -end Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/archive/raw.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/archive/raw.drl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/archive/raw.drl 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,107 @@ +#created on: 23/05/2006 +package org.acme.insurance + + +rule "Driver underage" + + when + Driver(age < 18) + then + assert(new Rejection("Driver is underage")); + +end + +rule "Driver in marginal age bracket" + when + Driver(age > 18, age < 25, priorClaims > 1) + Policy(type == "COMPREHENSIVE") + then + assert(new Rejection("No accidents accepted if in marginal age group")); +end + +rule "Driver unsafe - accident history" + when + Driver(priorClaims > 3) + then + assert(new Rejection("Too many accidents")); +end + +rule "Driver in unsafe area for comprehensive" + when + d: Driver(locationRiskProfile == "HIGH") + d: Driver(age < 25) + Policy(type == "COMPREHENSIVE") + then + assert(new Rejection("Driver in that area is too risky")); +end + +rule "Driver in unsafe area for comprehensive and priors" + when + d : Driver(locationRiskProfile == "MED") + d : Driver(priorClaims > 1) + d : Driver(age < 25) + Policy(type == "COMPREHENSIVE") + then + assert(new Rejection("Driver in that area is too risky - given past accidents and age.")); +end + +rule "Driver unsafe for third party" + when + Policy(type == "THIRD_PARTY") + Driver(priorClaims > 2) + then + assert(new Rejection("Too many priors for third party")); +end + +rule "Driver in bad area for theft" + + when + Policy(type == "FIRE_THEFT") + d : Driver(locationRiskProfile == "HIGH") + then + assert(new Rejection("Unsafe area for theft")); +end + +rule "Quick approval - safe driver, any policy type" + when + not Rejection() + d: Driver(age >= 30) + d: Driver(priorClaims == 0) + then + assert(new Approve("Driver is safe, and mature")); +end + +rule "Approve policy affirmative" + salience 100 #this can short circuit any processing + when + a : Approve() + p : Policy() + then + p.setApproved(true); + System.out.println("APPROVED: " + + a.getReason()); + drools.clearAgenda(); #stop processing (bit of a hack ;) +end + +rule "Approve if not rejected" + salience -100 #approve if there are no objections + when + not Rejection() + p : Policy(approved == false) + then + System.out.println("APPROVED: due to no objections."); + p.setApproved(true); +end + +rule "Reject application" + salience 100 #this can short circuit any other processing + when + r : Rejection() + d : Driver() + p : Policy() + then + System.out.println("REJECTED: " + r.getReason()); + p.setApproved(false); + retract(d); +end + Deleted: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 08:40:11 UTC (rev 4400) @@ -1,67 +0,0 @@ -#created on: 23/05/2006 -package org.acme.insurance - - -rule "Driver underage" - - when - Driver(age < 18) - then - assert(new Rejection("Driver is underage")); - -end - -rule "Driver in margina age bracket" - when - Driver(age > 18, age < 25, priorClaims > 1) - Policy(type == "COMPREHENSIVE") - then - assert(new Rejection("No accidents accepted if in marginal age group")); -end - -rule "Driver unsafe" - when - Driver(priorClaims > 3) - then - assert(new Rejection("Too many accidents")); -end - -rule "Driver in unsafe area for comprehensive" - when - Policy(type == "COMPREHENSIVE") - Driver(locationRiskProfile == "HIGH") - or - Driver(locationRiskProfile == "MED", priorClaims > 2) - - then - assert(new Rejection("Driver in that area is too risky")); -end - -rule "Driver unsafe for third party" - when - Policy(type == "THIRD_PARTY") - Driver(priorClaims > 2) - then - assert(new Rejection("Too many priors for third party")); -end - -rule "Driver in bad area for theft" - - when - Policy(type == "FIRE_THEFT") - d : Driver(locationRiskProfile == "HIGH") - then - assert(new Rejection("Unsafe area for theft")); -end - -rule "Handle Reject of application" - - when - r : Rejection() - d : Driver() - then - #may also notify at this point, send an email etc - retract(d); - #call some utility or a method on "d" -end - Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/technical.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/technical.drl 2006-05-24 08:38:59 UTC (rev 4399) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/technical.drl 2006-05-24 08:40:11 UTC (rev 4400) @@ -0,0 +1,44 @@ +package org.acme.insurance + +#NOTE: This is designed to be used +# with the approval.drl rules. This +# just shows how you can span files, and keep +# technical rules, like the ones below, seperate. +# +# The rules below handle updating of the approval status, +# and controlling the operation of the rules using salience (priority) + + +rule "Approve policy affirmative" + salience 100 #this can short circuit any processing + when + a : Approve() + p : Policy() + then + p.setApproved(true); + System.out.println("APPROVED: " + + a.getReason()); + drools.clearAgenda(); #stop processing (bit of a hack ;) +end + +rule "Approve if not rejected" + salience -100 #approve if there are no objections + when + not Rejection() + p : Policy(approved == false) + then + System.out.println("APPROVED: due to no objections."); + p.setApproved(true); +end + +rule "Reject application" + salience 100 #this can short circuit any other processing + when + r : Rejection() + d : Driver() + p : Policy() + then + System.out.println("REJECTED: " + r.getReason()); + p.setApproved(false); + retract(d); #effectively halts the rules +end Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/technical.drl ___________________________________________________________________ Name: svn:eol-style + native |
From: <jbo...@li...> - 2006-05-24 08:39:15
|
Author: mic...@jb... Date: 2006-05-24 04:38:59 -0400 (Wed, 24 May 2006) New Revision: 4399 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Function.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Rule.xml Log: typos Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Function.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Function.xml 2006-05-24 07:13:25 UTC (rev 4398) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Function.xml 2006-05-24 08:38:59 UTC (rev 4399) @@ -27,11 +27,11 @@ (perhaps with only differing parameters for each rule - for example the contents of an email message).</para> - <para>A typica function declaration looks like:</para> + <para>A typical function declaration looks like:</para> <para>function String calcSomething(String arg) {</para> - <para> return "hola !";</para> + <para>return "hola !";</para> <para>}</para> @@ -40,7 +40,7 @@ you don't have to have parameters if they are not needed). Return type is just like a normal method. To call the function from within a rule (in a consequence, or perhaps an eval, simply use the function name, and toss in - the parameters - just like a method call). </para> + the parameters - just like a method call).</para> <para>An alternative to a function, could be to use a static method in a helper class: Foo.doSomething(), or perhaps pass in an instance of a helper Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Rule.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Rule.xml 2006-05-24 07:13:25 UTC (rev 4398) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Rule.xml 2006-05-24 08:38:59 UTC (rev 4399) @@ -894,20 +894,21 @@ <title>A note on autoboxing and primitive types</title> <para>Java 5 supports autoboxing and unboxing between primitives of - appropraite types. This makes for very convenience and easier to read - code. However, as drools runs in J2SE 1.4 as well, we can't rely on this. - Thus we have to autobox at times. Fields that are referred to are - autoboxed in the corresponding object type automatically (if they are - already an object, then there is no change). However, it is important to - note that they are not "unboxed" automatically. Thus if you bind to a - field that is an "int" in your object model, it will behave like an Object - in the rule (ie predicates, return value constraints and the RHS).</para> + appropriate types. This makes for very convenient and easy to read code. + However, as drools runs in J2SE 1.4 as well, we can't rely on this. Thus + we have to autobox at times. Fields that are referred to are autoboxed in + the corresponding object type automatically (if they are already an + object, then there is no change). However, it is important to note that + they are not "unboxed" automatically. Thus if you bind to a field that is + an "int" in your object model, it will behave like an Object in the rule + (ie predicates, return value constraints and the RHS).</para> <para>As a general rule, if possible, make your fields object types (at least until java 5), or at least think of your fields as object types even if they are not to start with). Another special note, is that for return value constraints, the return value snippet of code must return an Object (not a primitive). Now, I bet you can't wait for Java 5 to be the minimum - !</para> + ! The fact that not quite *everything* in java is an object causes + headaches like this (keep those tablets handy).</para> </section> </section> \ No newline at end of file |
From: <jbo...@li...> - 2006-05-24 07:13:28
|
Author: mla...@jb... Date: 2006-05-24 03:13:25 -0400 (Wed, 24 May 2006) New Revision: 4398 Modified: labs/jbossweb/trunk/src/share/native/build/buildworld.bat Log: Use static CRT so we don't need MSVCRT80 dependency for jbosssvc executable. Modified: labs/jbossweb/trunk/src/share/native/build/buildworld.bat =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildworld.bat 2006-05-24 06:38:27 UTC (rev 4397) +++ labs/jbossweb/trunk/src/share/native/build/buildworld.bat 2006-05-24 07:13:25 UTC (rev 4398) @@ -85,7 +85,7 @@ cd .. cd .. cd jbosssvc -nmake -f NMAKEMakefile install +nmake -f NMAKEMakefile STATIC_CRT=1 install cd .. nmake -f NMAKEMakefile %FLAVOR%=1 install |
From: <jbo...@li...> - 2006-05-24 06:38:34
|
Author: mla...@jb... Date: 2006-05-24 02:38:27 -0400 (Wed, 24 May 2006) New Revision: 4397 Modified: labs/jbossweb/trunk/src/share/native/build/buildprep.sh Log: Remove buildsvc.bat script. We use buildworld instead. Modified: labs/jbossweb/trunk/src/share/native/build/buildprep.sh =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildprep.sh 2006-05-24 06:36:03 UTC (rev 4396) +++ labs/jbossweb/trunk/src/share/native/build/buildprep.sh 2006-05-24 06:38:27 UTC (rev 4397) @@ -63,7 +63,6 @@ cd .. cp ./buildworld.sh ${NATIVEDIST}/ cp ./buildworld.bat ${NATIVEDIST}/ -cp ./buildsvc.bat ${NATIVEDIST}/ cp ./NMAKEcommon.inc ${NATIVEDIST}/build/ cp ../NMAKEmakefile ${NATIVEDIST}/ cp ../srclib/apr/NMAKEmakefile ${NATIVEDIST}/srclib/apr-${APRVER}/ |
From: <jbo...@li...> - 2006-05-24 06:36:10
|
Author: mla...@jb... Date: 2006-05-24 02:36:03 -0400 (Wed, 24 May 2006) New Revision: 4396 Removed: labs/jbossweb/trunk/src/share/native/build/buildsvc.bat Log: Remove buildsvc script. We use buildworld instead. Deleted: labs/jbossweb/trunk/src/share/native/build/buildsvc.bat =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildsvc.bat 2006-05-24 06:35:21 UTC (rev 4395) +++ labs/jbossweb/trunk/src/share/native/build/buildsvc.bat 2006-05-24 06:36:03 UTC (rev 4396) @@ -1,46 +0,0 @@ -@echo off -REM -REM JBoss, the OpenSource J2EE webOS -REM -REM Distributable under LGPL license. -REM See terms of license at gnu.org. -REM -REM -REM @author Mladen Turk -REM -REM -REM -@if "%OS%" == "Windows_NT" setlocal -set MSVS8VC=C:\opt\MSVS8\VC\bin -REM set MSVS8VC=C:\D\Microsoft\MSVS8\VC\bin - - -@if not "%1" == "d" goto checkCPU -@shift -@rmdir /S /Q jbosssvc 2>NUL -svn export http://anonsvn.labs.jboss.com/labs/jbossweb/trunk/src/windows/native/service/jbosssvc -svn export http://anonsvn.labs.jboss.com/labs/jbossweb/trunk/src/share/native/build jbosssvc/build - -:checkCPU -@if /i "%1" == "x86" goto cpuX86 -@if /i "%1" == "amd64" goto cpuAMD64 -@if /i "%1" == "ia64" goto cpuIA64 -echo Usage: buildsvc <CPU> -goto cmdEnd - -:cpuX86 -set CPU=I386 -call %MSVS8VC%\vcvars32 -goto cmdBuild - -:cpuAMD64 -set CPU=AMD64 -call %MSVS8VC%\amd64\vcvarsamd64 -goto cmdBuild - -:cmdBuild -cd jbosssvc -nmake -f NMAKEMakefile -nmake -f NMAKEMakefile install - -:cmdEnd |
From: <jbo...@li...> - 2006-05-24 06:35:25
|
Author: mla...@jb... Date: 2006-05-24 02:35:21 -0400 (Wed, 24 May 2006) New Revision: 4395 Modified: labs/jbossweb/trunk/src/share/native/build/buildprep.bat Log: Checkout jbosssvc from jbossweb. Modified: labs/jbossweb/trunk/src/share/native/build/buildprep.bat =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildprep.bat 2006-05-24 06:32:46 UTC (rev 4394) +++ labs/jbossweb/trunk/src/share/native/build/buildprep.bat 2006-05-24 06:35:21 UTC (rev 4395) @@ -16,6 +16,9 @@ REM Replace NATIVEEXT with tagged version number, like 1.1.0 set NATIVEEXT=current +REM JBossWeb SVN repository +set JBOSSWEBSVN=http://anonsvn.labs.jboss.com/labs/jbossweb/trunk + REM Use tag or trunk set NATIVESVN=http://svn.apache.org/repos/asf/tomcat/connectors/trunk REM set NATIVESVN=http://svn.apache.org/repos/asf/tomcat/connectors/tags/other/TOMCAT_NATIVE_1_1_3 @@ -29,6 +32,9 @@ REM Prebuild cd %NATIVEDIST% +REM Export Service code +svn export %JBOSSWEBSVN%/src/windows/native/service/jbosssvc + mkdir srclib cd srclib @@ -45,7 +51,6 @@ cd .. cp ./buildworld.bat %NATIVEDIST%/ -cp ./buildsvc.bat %NATIVEDIST%/ cp ./NMAKEcommon.inc %NATIVEDIST%/build/ cp ../NMAKEmakefile %NATIVEDIST%/ cp ../srclib/apr/NMAKEmakefile %NATIVEDIST%/srclib/apr-%APRVER%/ |
From: <jbo...@li...> - 2006-05-24 06:32:54
|
Author: mla...@jb... Date: 2006-05-24 02:32:46 -0400 (Wed, 24 May 2006) New Revision: 4394 Modified: labs/jbossweb/trunk/src/share/native/build/buildworld.bat Log: Call build for jbosssvc. Modified: labs/jbossweb/trunk/src/share/native/build/buildworld.bat =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildworld.bat 2006-05-24 06:31:40 UTC (rev 4393) +++ labs/jbossweb/trunk/src/share/native/build/buildworld.bat 2006-05-24 06:32:46 UTC (rev 4394) @@ -84,7 +84,9 @@ nmake -f NMAKEMakefile %FLAVOR%=1 cd .. cd .. -nmake -f NMAKEMakefile %FLAVOR%=1 +cd jbosssvc +nmake -f NMAKEMakefile install +cd .. nmake -f NMAKEMakefile %FLAVOR%=1 install :cmdEnd |
From: <jbo...@li...> - 2006-05-24 06:31:45
|
Author: mla...@jb... Date: 2006-05-24 02:31:40 -0400 (Wed, 24 May 2006) New Revision: 4393 Modified: labs/jbossweb/trunk/src/share/native/NMAKEmakefile Log: Add missing empty line. Modified: labs/jbossweb/trunk/src/share/native/NMAKEmakefile =================================================================== --- labs/jbossweb/trunk/src/share/native/NMAKEmakefile 2006-05-24 06:24:16 UTC (rev 4392) +++ labs/jbossweb/trunk/src/share/native/NMAKEmakefile 2006-05-24 06:31:40 UTC (rev 4393) @@ -140,6 +140,7 @@ @gmkdir -p $(INSTALLDIR) @cp -f -t $(INSTALLDIR) $(BUILDLIB) @cp -f -t $(INSTALLDIR) $(WITH_OPENSSL)/out32/openssl.exe + !ELSE install: all @gmkdir -p $(INSTALLDIR) |
From: <jbo...@li...> - 2006-05-24 06:24:23
|
Author: mla...@jb... Date: 2006-05-24 02:24:16 -0400 (Wed, 24 May 2006) New Revision: 4392 Modified: labs/jbossweb/trunk/src/windows/native/service/jbosssvc/NMAKEmakefile Log: Update path to common nmake include. Modified: labs/jbossweb/trunk/src/windows/native/service/jbosssvc/NMAKEmakefile =================================================================== --- labs/jbossweb/trunk/src/windows/native/service/jbosssvc/NMAKEmakefile 2006-05-24 02:27:13 UTC (rev 4391) +++ labs/jbossweb/trunk/src/windows/native/service/jbosssvc/NMAKEmakefile 2006-05-24 06:24:16 UTC (rev 4392) @@ -26,7 +26,7 @@ TARGET = EXE PROJECT = jbosssvc -!include <build/NMAKEcommon.inc> +!include <../build/NMAKEcommon.inc> !IF !DEFINED(SRCDIR) || "$(SRCDIR)" == "" SRCDIR = . |
Author: soh...@jb... Date: 2006-05-23 22:27:13 -0400 (Tue, 23 May 2006) New Revision: 4391 Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/ACLTagHandler.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/Authorization.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContext.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContextImpl.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationInterface.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationListener.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFActionContext.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFSecurityContext.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFUIContext.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/SecurityContext.java labs/jbossforums/trunk/thirdparty/facelets/ labs/jbossforums/trunk/thirdparty/facelets/lib/ labs/jbossforums/trunk/thirdparty/facelets/lib/el-api.jar labs/jbossforums/trunk/thirdparty/facelets/lib/jsf-facelets.jar Modified: labs/jbossforums/trunk/forums/build.xml labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java labs/jbossforums/trunk/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editCategory.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml labs/jbossforums/trunk/tools/etc/buildfragments/libraries.ent Log: 1) Integrate an Authorization SPI into the Forums - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82310 Modified: labs/jbossforums/trunk/forums/build.xml =================================================================== --- labs/jbossforums/trunk/forums/build.xml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/build.xml 2006-05-24 02:27:13 UTC (rev 4391) @@ -80,6 +80,7 @@ <path refid="apache.myfaces.classpath"/> <path refid="jboss.hibernate.classpath"/> <path refid="jbportal.classpath"/> + <path refid="facelets.classpath"/> </path> <!-- Configure modules --> Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/ACLTagHandler.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/ACLTagHandler.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/ACLTagHandler.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,161 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +//core java +import java.io.IOException; +import java.util.StringTokenizer; + + +//jsf +import javax.faces.context.FacesContext; +import javax.faces.FacesException; +import javax.faces.component.UIComponent; + +//logging +import org.apache.log4j.Logger; +import org.jboss.portlet.forums.ui.PortalUtil; + +//servlet +import javax.el.ELException; +import javax.el.ExpressionFactory; +import javax.el.ValueExpression; + + +//facelets +import com.sun.facelets.FaceletContext; +import com.sun.facelets.tag.TagConfig; +import com.sun.facelets.tag.TagHandler; +import com.sun.facelets.tag.TagAttribute; +import com.sun.facelets.el.ELAdaptor; + + +/** + * + * @author Sohil Shah - soh...@jb... - Mar 29, 2006 + * + */ +public class ACLTagHandler extends TagHandler +{ + /** + * + */ + private static final Logger log = Logger.getLogger(ACLTagHandler.class); + + //possible attributes + private TagAttribute fragment = null; //required + private TagAttribute contextData = null; //optional + + /** + * @param config + */ + public ACLTagHandler(TagConfig config) + { + super(config); + + // helper method for getting a required attribute + this.fragment = this.getRequiredAttribute("fragment"); + + // helper method, optional attribute + this.contextData = this.getAttribute("contextData"); + } + + /** + * Threadsafe Method for controlling evaluation of + * its child tags, represented by "nextHandler" + */ + public void apply(FaceletContext ctx, UIComponent parent) + throws IOException,FacesException,ELException + { + FacesContext facesContext = ctx.getFacesContext(); + + //make sure an authorization provider has been hooked in + try + { + if(Authorization.getProvider()==null) + { + //no authorization will be enforced + this.nextHandler.apply(ctx, parent); + return; + } + } + catch(Exception e) + { + throw new FacesException(e); + } + + //an authorization provider is hooked in....go ahead and perform authorization + try + { + String resource = this.fragment.getValue(); + String contextStr = null; + + if(this.contextData!=null) + { + contextStr = this.contextData.getValue(); + } + + //resourcesetup + Object[] runtime = null; + if(contextStr!=null && contextStr.trim().length()>0) + { + StringTokenizer st = new StringTokenizer(contextStr,","); + runtime = new Object[st.countTokens()]; + int i=0; + while(st.hasMoreTokens()) + { + String parameter = st.nextToken(); + Object parameterValue = null; + + //evaluate this expression to a value + ExpressionFactory f = ctx.getExpressionFactory(); + ValueExpression expr = f.createValueExpression(ctx,parameter,Object.class); + parameterValue = expr.getValue(ELAdaptor.getELContext(facesContext)); + + runtime[i++] = parameterValue; + } + } + + //check access here + JSFUIContext securityContext = new JSFUIContext(PortalUtil.getUser(),facesContext); + securityContext.setFragment(resource); + securityContext.setContextData(runtime); + + //feed this context to the Authorization system which will decide whether + //access should be granted or not + boolean isAccessAllowed = Authorization.getProvider().hasAccess(securityContext); + + if(isAccessAllowed) + { + this.nextHandler.apply(ctx, parent); + } + } + catch(NoSuchMethodException nsme) + { + throw new FacesException(nsme); + } + catch(Exception e) + { + throw new FacesException(e); + } + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/Authorization.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/Authorization.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/Authorization.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,70 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +//jmx related +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import org.jboss.mx.util.MBeanProxy; +import org.jboss.mx.util.MBeanServerLocator; + +/* + * Created on May 19, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public class Authorization +{ + static AuthorizationContext cachedContext = null; + + /** + * look this jmx service up and make this service available to clients of this system + * also cache this provider so that jmx lookup is only required once during the life-time of this application + * + */ + public static AuthorizationContext getContext() throws Exception + { + if(Authorization.cachedContext==null) + { + //get the registered cms service mbean + MBeanServer mbeanServer = MBeanServerLocator.locateJBoss(); + Authorization.cachedContext = (AuthorizationContext)MBeanProxy.get(AuthorizationContext.class, + new ObjectName("portal.forums:service=AuthorizationContext"), + mbeanServer); + } + return Authorization.cachedContext; + } + + /** + * + * + */ + public static AuthorizationInterface getProvider() throws Exception + { + AuthorizationInterface provider = null; + + provider = getContext().getProvider(); + + return provider; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContext.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContext.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContext.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,36 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +/* + * Created on May 19, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public interface AuthorizationContext +{ + /** + * + * + */ + public AuthorizationInterface getProvider(); +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContextImpl.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContextImpl.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationContextImpl.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,103 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +//logging related +import org.apache.log4j.Logger; + + +/* + * Created on May 19, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public class AuthorizationContextImpl implements AuthorizationContext +{ + /** + * + */ + private static final Logger log = Logger.getLogger(AuthorizationContextImpl.class); + + /** + * + */ + private AuthorizationInterface provider = null; + private String providerImpl = null; + + /** + * + * + */ + public AuthorizationContextImpl() + { + } + + + /** + * @param providerImpl The providerImpl to set. + */ + public void setProviderImpl(String providerImpl) + { + this.providerImpl = providerImpl; + } + + //----AuthorizationContext implementation------------------------------------------------------------------------------------------------ + /** + * @return Returns the provider. + */ + public AuthorizationInterface getProvider() + { + return provider; + } + //------jmx mbean related operations------------------------------------------------------------------------------------------------------- + /** + * + * + */ + public void start() + { + try + { + this.provider = (AuthorizationInterface)Class.forName(this.providerImpl).newInstance(); + //reset the cachedContext + Authorization.cachedContext = null; + log.info(AuthorizationContextImpl.class.getName()+" successfully started......"); + } + catch(Exception e) + { + this.stop(); + log.error(this,e); + log.info(AuthorizationContextImpl.class.getName()+" failed to start......"); + } + } + + /** + * + * + */ + public void stop() + { + this.provider = null; + this.providerImpl = null; + Authorization.cachedContext = null; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationInterface.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationInterface.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationInterface.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,32 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +/* + * Created on May 18, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public interface AuthorizationInterface +{ + public boolean hasAccess(SecurityContext context); +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationListener.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationListener.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/AuthorizationListener.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,167 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +//core java api +import java.lang.reflect.Method; +import java.security.AccessControlException; + +//jsf api +import javax.faces.FacesException; +import javax.faces.context.FacesContext; +import javax.faces.application.Application; +import javax.faces.component.ActionSource; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.el.MethodBinding; +import javax.faces.el.VariableResolver; + + +//myfaces integration +import org.apache.myfaces.application.ActionListenerImpl; + +//jsf forums classes +import org.jboss.portlet.forums.ui.JSFUtil; +import org.jboss.portlet.forums.ui.PortalUtil; + + +/* + * Created on May 17, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public class AuthorizationListener extends ActionListenerImpl +{ + /** + * + */ + public AuthorizationListener() throws Exception + { + } + + /* + */ + public void processAction(ActionEvent actionEvent) throws AbortProcessingException + { + FacesContext facesContext = FacesContext.getCurrentInstance(); + + //make sure an authorization provider has been hooked in + try + { + if(Authorization.getProvider()==null) + { + //no authorization will be enforced + super.processAction(actionEvent); + return; + } + } + catch(Exception e) + { + throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e); + } + + + //an authorization provider is hooked in, go ahead and enforce authorization + boolean isAccessAllowed = this.isAccessAllowed(actionEvent); + + if(isAccessAllowed) + { + //make method call + super.processAction(actionEvent); + } + else + { + AccessControlException ace = new AccessControlException("Access Denied"); + JSFUtil.handleException(ace); + throw new AbortProcessingException(ace); + } + } + + /** + * + * + */ + private boolean isAccessAllowed(ActionEvent actionEvent) + { + boolean isAccessAllowed = false; + FacesContext facesContext = FacesContext.getCurrentInstance(); + Application application = facesContext.getApplication(); + + //enforce authorization security + try + { + ActionSource actionSource = (ActionSource)actionEvent.getComponent(); + MethodBinding methodBinding = actionSource.getAction(); + Method businessAction = null; + Object managedBean = null; + if(methodBinding!=null) + { + //this means a business action is going to be called...this needs to be authorized + VariableResolver variableResolver = application.getVariableResolver(); + String expression = methodBinding.getExpressionString(); + String[] methodInfo = this.parseExpression(expression); + + managedBean = variableResolver.resolveVariable(facesContext,methodInfo[0]); + businessAction = managedBean.getClass().getMethod(methodInfo[1],null); + } + + //start building the SecurityContext here for the Authorization System + JSFActionContext securityContext = new JSFActionContext(PortalUtil.getUser(),facesContext); + securityContext.setBusinessAction(businessAction); + securityContext.setManagedBean(managedBean); + + //feed this context to the Authorization system which will decide whether + //access should be granted or not + isAccessAllowed = Authorization.getProvider().hasAccess(securityContext); + } + catch(NoSuchMethodException nsme) + { + throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), nsme); + } + catch(Exception e) + { + throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e); + } + return isAccessAllowed; + } + + /** + * + * Created on May 18, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ + private String[] parseExpression(String expression) + { + String[] values = new String[2]; + + int startIndex = expression.indexOf('{') + 1; + int endIndex = expression.trim().length()-1; + int dotIndex = expression.indexOf('.'); + + + values[0] = expression.substring(startIndex,dotIndex).trim(); + values[1] = expression.substring(dotIndex+1,endIndex).trim(); + + return values; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFActionContext.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFActionContext.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFActionContext.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,90 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +import java.lang.reflect.Method; + +import javax.faces.context.FacesContext; + +/* + * Created on May 23, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public class JSFActionContext extends JSFSecurityContext +{ + /** + * this is the action method on a JSF Managed Bean that is being called + * and needs to be authorized access to + */ + private Method businessAction = null; + + /** + * This is the JSF Managed Bean that is being used + */ + private Object managedBean = null; + + /** + * + * + */ + public JSFActionContext(Object identity,FacesContext facesContext) + { + super(identity,facesContext); + } + + /** + * + * + */ + public Method getBusinessAction() + { + return this.businessAction; + } + + /** + * + * + */ + public void setBusinessAction(Method businessAction) + { + this.businessAction = businessAction; + } + + /** + * + * + */ + public Object getManagedBean() + { + return this.managedBean; + } + + /** + * + * + */ + public void setManagedBean(Object managedBean) + { + this.managedBean = managedBean; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFSecurityContext.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFSecurityContext.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFSecurityContext.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,87 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +import java.lang.reflect.Method; + +import javax.faces.context.FacesContext; + + + +/* + * Created on May 19, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public abstract class JSFSecurityContext implements SecurityContext +{ + /** + * + */ + private FacesContext facesContext = null; + + + /** + * this is current user that needs to be authorized.. + * left the type of this identity open ended.. + * the actual provider can then cast it based on what it expects it to be + */ + private Object identity = null; + + + /** + * + * + */ + public JSFSecurityContext(Object identity,FacesContext facesContext) + { + this.facesContext = facesContext; + this.identity = identity; + } + + + + /** + * @return Returns the identity. + */ + public Object getIdentity() + { + return this.identity; + } + + /** + * @param identity The identity to set. + */ + public void setIdentity(Object identity) + { + this.identity = identity; + } + + /** + * + * + */ + public FacesContext getFacesContext() + { + return this.facesContext; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFUIContext.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFUIContext.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/JSFUIContext.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,78 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +import javax.faces.context.FacesContext; + +/* + * Created on May 23, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public class JSFUIContext extends JSFSecurityContext +{ + /** + * + * + */ + private String fragment = null; + private Object[] contextData = null; + + /** + * + * + */ + public JSFUIContext(Object identity,FacesContext facesContext) + { + super(identity,facesContext); + } + + + /** + * @return Returns the contextData. + */ + public Object[] getContextData() + { + return contextData; + } + /** + * @param contextData The contextData to set. + */ + public void setContextData(Object[] contextData) + { + this.contextData = contextData; + } + /** + * @return Returns the fragment. + */ + public String getFragment() + { + return fragment; + } + /** + * @param fragment The fragment to set. + */ + public void setFragment(String fragment) + { + this.fragment = fragment; + } +} Added: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/SecurityContext.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/SecurityContext.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/auth/SecurityContext.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -0,0 +1,32 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2005, JBoss Inc., and individual contributors as indicated +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.portlet.forums.auth; + +/* + * Created on May 18, 2006 + * + * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + */ +public interface SecurityContext +{ + public Object getIdentity(); +} Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -227,10 +227,12 @@ { User user = null; String userName = - FacesContext.getCurrentInstance().getExternalContext().getRemoteUser(); - UserModule userModule = - (UserModule) new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME); - user = userModule.findUserByUserName(userName); + FacesContext.getCurrentInstance().getExternalContext().getRemoteUser(); + if(userName!=null && userName.trim().length()>0) + { + UserModule userModule = (UserModule) new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME); + user = userModule.findUserByUserName(userName); + } return user; } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/AdminController.java 2006-05-24 02:27:13 UTC (rev 4391) @@ -44,7 +44,6 @@ * */ private String categoryName = null; //this is used by the create new category usecase - private Category category = null; //this is used in the edit category usecase /** * ui data associated with "Forum" information @@ -59,7 +58,7 @@ */ public String getCategoryName() { - return categoryName; + return this.categoryName; } /** * @param categoryName The categoryName to set. @@ -67,22 +66,8 @@ public void setCategoryName(String categoryName) { this.categoryName = categoryName; - } + } /** - * @return Returns the category. - */ - public Category getCategory() - { - return category; - } - /** - * @param category The category to set. - */ - public void setCategory(Category category) - { - this.category = category; - } - /** * @return Returns the forumDescription. */ public String getForumDescription() @@ -129,7 +114,8 @@ } if(categoryId!=-1) { - this.category = BaseController.getForumsModule().findCategoryById(new Integer(categoryId)); + Category category = BaseController.getForumsModule().findCategoryById(new Integer(categoryId)); + this.categoryName = category.getTitle(); } } catch(Exception e) @@ -177,8 +163,19 @@ String navState = null; boolean success = false; try - { - JSFUtil.setMessage(Constants.FEEDBACK,"The Category \""+this.category.getTitle()+"\" was successfully updated."); + { + int categoryId = -1; + String cour = ForumUtil.getParameter(Constants.p_categoryId); + if(cour!=null && cour.trim().length()>0) + { + categoryId = Integer.parseInt(cour); + } + + //grab the category from the module and set the title + Category category = BaseController.getForumsModule().findCategoryById(new Integer(categoryId)); + category.setTitle(this.categoryName); + + JSFUtil.setMessage(Constants.FEEDBACK,"The Category \""+this.categoryName+"\" was successfully updated."); navState = Constants.EDIT_CATEGORY; success = true; } @@ -191,7 +188,7 @@ if(success) { //cleanup the state - this.category = null; + this.categoryName = null; } } return navState; Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-sar/META-INF/jboss-service.xml 2006-05-24 02:27:13 UTC (rev 4391) @@ -19,5 +19,35 @@ <attribute name="FromAddress">po...@ex...</attribute> <attribute name="JNDIName">java:portal/ForumsModule</attribute> <depends optional-attribute-name="Hibernate" proxy-type="attribute">portal.forums:service=Hibernate</depends> - </mbean> + </mbean> + <!-- configure the AuthorizationContext for this application --> + <mbean name="portal.forums:service=AuthorizationContext" + code="org.jboss.portlet.forums.auth.AuthorizationContextImpl" + xmbean-dd="" + > + <!-- plug-in an AuthorizationProvider that implements the AuthorizationInterface here --> + <attribute name="providerImpl">org.jboss.forums.security.AuthorizationProvider</attribute> + <xmbean> + <class>org.jboss.portlet.forums.auth.AuthorizationContextImpl</class> + <constructor> + <name>org.jboss.portlet.forums.auth.AuthorizationContextImpl</name> + </constructor> + <attribute access="write" setMethod="setProviderImpl"> + <name>providerImpl</name> + <type>java.lang.String</type> + </attribute> + <attribute access="read" getMethod="getProvider"> + <name>provider</name> + <type>org.jboss.portlet.forums.auth.AuthorizationInterface</type> + </attribute> + <operation> + <description>The start lifecycle operation</description> + <name>start</name> + </operation> + <operation> + <description>The stop lifecycle operation</description> + <name>stop</name> + </operation> + </xmbean> + </mbean> </server> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-24 02:27:13 UTC (rev 4391) @@ -15,6 +15,9 @@ <!-- standalone facelets integration --> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> + <!-- custom action listener with integrated authorization checking --> + <action-listener>org.jboss.portlet.forums.auth.AuthorizationListener</action-listener> + <!-- internationalization --> <locale-config> <default-locale>en</default-locale> @@ -29,7 +32,7 @@ <!-- starts before restoreView --> <phase-listener>org.jboss.portlet.forums.ui.event.BeginTransactionListener</phase-listener> <!-- starts after renderResponse --> - <phase-listener>org.jboss.portlet.forums.ui.event.EndTransactionListener</phase-listener> + <phase-listener>org.jboss.portlet.forums.ui.event.EndTransactionListener</phase-listener> </lifecycle> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-05-24 02:27:13 UTC (rev 4391) @@ -94,13 +94,20 @@ <function-name>folderTypeURL</function-name> <function-class>org.jboss.portlet.forums.ui.ThemeHelper</function-class> <function-signature>java.lang.String getFolderTypeURL(org.jboss.portlet.forums.model.Topic,boolean)</function-signature> - </function> - <!-- + </function> + + <!-- function to get folderType --> <function> <function-name>folderType</function-name> <function-class>org.jboss.portlet.forums.ui.ThemeHelper</function-class> <function-signature>java.lang.String getFolderType(org.jboss.portlet.forums.model.Topic)</function-signature> - </function> + </function> + + <!-- access control tag --> + <tag> + <tag-name>isAllowed</tag-name> + <handler-class>org.jboss.portlet.forums.auth.ACLTagHandler</handler-class> + </tag> </facelet-taglib> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editCategory.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editCategory.xhtml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/editCategory.xhtml 2006-05-24 02:27:13 UTC (rev 4391) @@ -45,9 +45,10 @@ </tr> <tr> <td class="row1">${resource.Category}</td> - <td class="row2"> - <h:inputText id="Category" styleClass="post" size="25" value="#{adminController.category.title}" required="true"/> - &nbsp;<h:message for="Category" style="color:red" styleClass="liteoption"/>&nbsp; + <td class="row2"> + <h:inputText id="Category" styleClass="post" size="25" + value="#{adminController.categoryName}" required="true"/> + &nbsp;<h:message for="Category" style="color:red" styleClass="liteoption"/>&nbsp; </td> </tr> <tr> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-24 02:27:13 UTC (rev 4391) @@ -57,12 +57,15 @@ </span> </td> <td class="cat" align="center" valign="middle"> - <span class="gen"> - <h:outputLink value="#{forums:outputLink('/views/admin/editCategory.jsf',true)}"> - <f:param name="c" value="#{category.id}"/> - <h:outputText value="${resource.Edit}"/> - </h:outputLink> - </span> + <!-- security check to make sure this link should be displayed or not --> + <forums:isAllowed fragment="acl://editCategory/editLink"> + <span class="gen"> + <h:outputLink value="#{forums:outputLink('/views/admin/editCategory.jsf',true)}"> + <f:param name="c" value="#{category.id}"/> + <h:outputText value="${resource.Edit}"/> + </h:outputLink> + </span> + </forums:isAllowed> </td> <td class="cat" align="center" valign="middle"> <span class="gen"> Added: labs/jbossforums/trunk/thirdparty/facelets/lib/el-api.jar =================================================================== (Binary files differ) Property changes on: labs/jbossforums/trunk/thirdparty/facelets/lib/el-api.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossforums/trunk/thirdparty/facelets/lib/jsf-facelets.jar =================================================================== (Binary files differ) Property changes on: labs/jbossforums/trunk/thirdparty/facelets/lib/jsf-facelets.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: labs/jbossforums/trunk/tools/etc/buildfragments/libraries.ent =================================================================== --- labs/jbossforums/trunk/tools/etc/buildfragments/libraries.ent 2006-05-24 00:58:31 UTC (rev 4390) +++ labs/jbossforums/trunk/tools/etc/buildfragments/libraries.ent 2006-05-24 02:27:13 UTC (rev 4391) @@ -117,6 +117,13 @@ <filelist dir="${apache.myfaces.lib}" files="myfaces-api.jar,myfaces-impl.jar,tomahawk.jar"/> </path> + <!-- Facelets --> + <property name="facelets.root" value="${project.thirdparty}/facelets"/> + <property name="facelets.lib" value="${facelets.root}/lib"/> + <path id="facelets.classpath"> + <filelist dir="${facelets.lib}" files="jsf-facelets.jar,el-api.jar"/> + </path> + <!-- Hibernate --> <property name="jboss.hibernate.root" value="${project.thirdparty}/jboss-hibernate"/> <property name="jboss.hibernate.lib" value="${jboss.hibernate.root}/lib"/> |
From: <jbo...@li...> - 2006-05-24 00:58:39
|
Author: unibrew Date: 2006-05-23 20:58:31 -0400 (Tue, 23 May 2006) New Revision: 4390 Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ThemeHelper.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml Log: [JBFORUMS-39] Adding new tag: folderType and some work done on moderator's panel and user profile view Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-24 00:58:31 UTC (rev 4390) @@ -109,4 +109,9 @@ * DOCUMENT_ME */ int POST_GLOBAL_ANNONCE = 3; + + /** + * DOCUMENT_ME + */ + int TOPIC_MOVED = 2; } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ThemeHelper.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ThemeHelper.java 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ThemeHelper.java 2006-05-24 00:58:31 UTC (rev 4390) @@ -21,6 +21,12 @@ */ package org.jboss.portlet.forums.ui; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; + import org.apache.log4j.Logger; import org.jboss.portlet.forums.ForumsConstants; @@ -33,6 +39,7 @@ /** * @author <a href="mailto:soh...@jb...">Sohil Shah</a> + * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> * */ public class ThemeHelper @@ -50,6 +57,11 @@ private ForumsTheme theme = null; /** + * If number of posts in topic exceeds this value it means that this topic is hot. + */ + public static final int hotThreshold = 10; + + /** * * */ @@ -59,7 +71,7 @@ this.theme = new ForumsTheme(); //start theme this.theme.setExtendedProperties(new TCCLXProperties(ForumsConstants.THEMENAME, "theme.properties")); - this.theme.start(); + this.theme.start(); } @@ -113,7 +125,7 @@ { String folderTypeURL = ThemeHelper.getURL("resourceFolderURL"); - int hotThreshold = 10; + FolderType folderType = ThemeHelper.singleton.theme.getFolderType(topic.getType(), topic.getStatus(), topic.getReplies() >= hotThreshold); @@ -128,6 +140,52 @@ return folderTypeURL; } + + /** + * + * + */ + public static String getFolderType(Topic topic) + { + + // Getting ResourceBundle with current Locale + FacesContext ctx = FacesContext.getCurrentInstance(); + UIViewRoot uiRoot = ctx.getViewRoot(); + Locale locale = uiRoot.getLocale(); + ClassLoader ldr = Thread.currentThread().getContextClassLoader(); + ResourceBundle bundle = ResourceBundle.getBundle("ResourceJSF", locale, ldr); + + String topicType=null; + + int topicStatus = topic.getStatus(); + FolderType folderType = + ThemeHelper.singleton.theme.getFolderType(topic.getType(), + topicStatus, + topic.getReplies() >= + hotThreshold); + + try { + if (topicStatus != ConstantsHelper.getConstantInt("TOPIC_MOVED")) + { + try + { + topicType = bundle.getString(folderType.type); + } + catch (java.util.MissingResourceException e) + { + topicType = ""; + } + } else + { + topicType = bundle.getString("Topic_Moved"); + } + } catch (Exception e) + { + log.error(ThemeHelper.singleton,e); + return ""; + } + return topicType; + } //-------------------------------------------------------------------------------------------------------------------------------------------- /** Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-05-24 00:58:31 UTC (rev 4390) @@ -25,10 +25,20 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.ResourceBundle; + +import javax.faces.component.UIComponent; +import javax.faces.component.UIViewRoot; +import javax.faces.component.html.HtmlInputHidden; +import javax.faces.context.FacesContext; + import org.jboss.portlet.forums.model.Forum; import org.jboss.portlet.forums.model.Topic; +import org.jboss.portlet.forums.theme.FolderType; +import org.jboss.portlet.forums.theme.ForumsTheme; import org.jboss.portlet.forums.ui.BaseController; import org.jboss.portlet.forums.ui.Constants; import org.jboss.portlet.forums.ui.ForumUtil; @@ -37,7 +47,7 @@ /** * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> */ -public class ModeratorAction +public class ModeratorAction extends BaseController { //business data being generated in this bean by executing ui actions @@ -54,7 +64,8 @@ public Forum getForum() { return this.forum; - } + } + public String getPagination() { /** @@ -75,12 +86,36 @@ public void setCheckboxes(Map checkboxes) { this.checkboxes = checkboxes; + Iterator it = checkboxes.keySet().iterator(); + System.out.println("test"); + while (it.hasNext()) + { + String temp = (String)it.next(); + System.out.println("KEY: "+temp+" VALUE:"+checkboxes.get(temp)); + } } public Map getCheckboxes() { + try { + if (checkboxes!=null) { + Iterator it = checkboxes.keySet().iterator(); + System.out.println("GETCHECKBOXES FULL"); + while (it.hasNext()) + { + Integer temp = (Integer)it.next(); + System.out.println("KEY: "+temp+" VALUE:"+checkboxes.get(temp)); + } + } else + { + System.out.println("GETCHECKBOXES: EMPTY"); + } + } catch (Exception e) + { + e.printStackTrace(); + } return checkboxes; - } + } //------------user preferences------------------------------------------------------------------------------------------------------------- @@ -137,15 +172,19 @@ { // start with a stub implementation this.forum = BaseController.getForumsModule().findForumById(new Integer(forumId)); - checkboxes = new HashMap(forum.getTopicCount()); + //checkboxes = new HashMap(forum.getTopicCount()); + checkboxes=new HashMap(); Iterator it = forum.getTopics().iterator(); while (it.hasNext()) { Topic topic = (Topic)it.next(); - checkboxes.put(topic.getId(),Boolean.FALSE); + //checkboxes.put(topic.getId(),Boolean.FALSE); } - } + } } + + + //------------------------------------------------------------------------------------------------------------------------------------- Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml 2006-05-24 00:58:31 UTC (rev 4390) @@ -94,5 +94,13 @@ <function-name>folderTypeURL</function-name> <function-class>org.jboss.portlet.forums.ui.ThemeHelper</function-class> <function-signature>java.lang.String getFolderTypeURL(org.jboss.portlet.forums.model.Topic,boolean)</function-signature> - </function> + </function> + <!-- + function to get folderType + --> + <function> + <function-name>folderType</function-name> + <function-class>org.jboss.portlet.forums.ui.ThemeHelper</function-class> + <function-signature>java.lang.String getFolderType(org.jboss.portlet.forums.model.Topic)</function-signature> + </function> </facelet-taglib> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-05-24 00:58:31 UTC (rev 4390) @@ -12,9 +12,9 @@ <!-- TODO: <n:errors/> <n:success/> + +<h:messages layout="table" infoStyle="color:green" warnStyle="color:red" /> --> -<!-- TODO: REWRITE S_POST_DAYS_ACTION -<form method="post" action="${n:out("S_POST_DAYS_ACTION")}">--> <h:form> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <tr> @@ -48,10 +48,10 @@ <th width="17%" nowrap="nowrap">&nbsp;${resource.Last_Post}&nbsp;</th> <th width="5%" class="thRight" nowrap="nowrap">&nbsp;${resource.Select}&nbsp;</th> </tr> - <c:forEach items="#{moderator.forum.topics}" var="topicrow"> + <c:forEach items="#{moderator.forum.topics}" var="topicrow" > <tr> <td class="row1" align="center" valign="middle"> - <img src="#{forums:themeURL('resourceFolderURL')}" + <img src="#{forums:folderTypeURL(topicrow,moderator.anonymous)}" width="19" height="18" alt="${resource.Topic_Moved}" @@ -59,15 +59,12 @@ </td> <td class="row1"> &nbsp; - <!-- TODO: NEEDS SUPPORT OF EXECUTING THEME METHODS - <span class="topictitle">${n:out("topicrow.TOPIC_TYPE")} - --> + <span class="topictitle">${forums:folderType(topicrow)} <h:outputLink value="#{forums:outputLink(shared.links['topic'],true)}" styleClass="topictitle"> <f:param name="t" value="${topicrow.id}"/> <h:outputText value="${topicrow.subject}"/> </h:outputLink> - - <!-- TODO: LOOK ABOVE </span> --> + </span> </td> <td class="row2" align="center" valign="middle"><span class="postdetails">${topicrow.replies}</span></td> @@ -80,10 +77,6 @@ </c:forEach> <tr align="right"> <td class="catBottom" colspan="5" height="29"> - - <!-- TODO: IT IS PROBABLY USELESS IN JSF IMPLEMENTATION SO IT WILL BE DELETED - ${n:out("S_HIDDEN_FIELDS")} - --> <h:commandButton action="#{moderator.deleteTopic}" class="liteoption" value="${resource.Delete}"> <f:param name="f" value="#{forum.forum.id}"/> @@ -107,13 +100,13 @@ <tr> <td align="left" valign="middle"> <span class="nav"> - <b>#{forum.pagination}</b> + <b>#{moderator.pagination}</b> </span> </td> <td align="right" valign="top" nowrap="nowrap"> <span class="gensmall"></span> <br/> - <span class="nav">#{forum.pageNumber}</span> + <span class="nav">#{moderator.pageNumber}</span> </td> </tr> </table> @@ -127,6 +120,4 @@ </table> </ui:define> </ui:composition> - - </div> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml 2006-05-24 00:48:45 UTC (rev 4389) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/profile/viewprofile_body.xhtml 2006-05-24 00:58:31 UTC (rev 4390) @@ -54,7 +54,7 @@ <tr> <th class="thHead" colspan="2" height="25" nowrap="nowrap">${resource.L_VIEWING_PROFILE}</th> </tr> - <!-- <tr> TODO: MISSING AVATAR FEATURE + <!-- <tr> TODO: MISSING AVATAR FEATURE - NEW FEATURE FOR FORUMS <td class="catLeft" width="40%" height="28" align="center"><b><span class="gen">${n:i18n("L_AVATAR")}</span></b> </td> <td class="catRight" width="60%"><b><span class="gen">${n:i18n("L_ABOUT_USER")}</span></b></td> @@ -78,7 +78,8 @@ </td> <td valign="top"> <b><span class="gen">${profile.poster.postCount}</span></b> - <!--<br/><span + <!-- TODO: MISSING STATS - NEW FEATURE FOR FORUMS + <br/><span class="genmed">[${n:out("POST_PERCENT_STATS")} / ${n:out("POST_DAY_STATS")}]</span> <br/><span class="genmed"><a href="${n:out("U_SEARCH_USER")}" class="genmed">${n:i18n("L_SEARCH_USER_POSTS")}</a></span>--> </td> |
From: <jbo...@li...> - 2006-05-24 00:48:52
|
Author: mic...@jb... Date: 2006-05-23 20:48:45 -0400 (Tue, 23 May 2006) New Revision: 4389 Modified: labs/jbossrules/trunk/documentation/training/developers-course/course_outline.odt Log: more changes Modified: labs/jbossrules/trunk/documentation/training/developers-course/course_outline.odt =================================================================== (Binary files differ) |
Author: mic...@jb... Date: 2006-05-23 20:45:28 -0400 (Tue, 23 May 2006) New Revision: 4388 Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt Log: more changes Modified: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/Instructions.txt 2006-05-24 00:45:28 UTC (rev 4388) @@ -40,7 +40,9 @@ the latest (of course, if you change it to load direct from a file system, not the classpath, then you won't need to do this). + DSLs: + Step 11: Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,19 @@ +package org.acme.insurance; + +public class Rejection { + + private String reason; + + public Rejection(String reason) { + this.reason = reason; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + +} Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/java/org/acme/insurance/Rejection.java ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,4 @@ +#place your comments here - this is just a description for your own purposes. +[when]There is a Person with name of "{name}"=Person(name=="{name}") +[when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") +[then]Log "{message}"=System.out.println("{message}"); Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/acme_insure.dsl ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,23 @@ +#created on: 23/05/2006 +package org.acme.insurance + +expander acme_insure.dsl + + +rule "Your First Rule" + + when + #conditions + then + #actions + +end + +rule "Your Second Rule" + #include attributes such as "salience" here... + when + #conditions + then + #actions + +end Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/approve.drl ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl =================================================================== --- labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 00:43:00 UTC (rev 4387) +++ labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl 2006-05-24 00:45:28 UTC (rev 4388) @@ -0,0 +1,67 @@ +#created on: 23/05/2006 +package org.acme.insurance + + +rule "Driver underage" + + when + Driver(age < 18) + then + assert(new Rejection("Driver is underage")); + +end + +rule "Driver in margina age bracket" + when + Driver(age > 18, age < 25, priorClaims > 1) + Policy(type == "COMPREHENSIVE") + then + assert(new Rejection("No accidents accepted if in marginal age group")); +end + +rule "Driver unsafe" + when + Driver(priorClaims > 3) + then + assert(new Rejection("Too many accidents")); +end + +rule "Driver in unsafe area for comprehensive" + when + Policy(type == "COMPREHENSIVE") + Driver(locationRiskProfile == "HIGH") + or + Driver(locationRiskProfile == "MED", priorClaims > 2) + + then + assert(new Rejection("Driver in that area is too risky")); +end + +rule "Driver unsafe for third party" + when + Policy(type == "THIRD_PARTY") + Driver(priorClaims > 2) + then + assert(new Rejection("Too many priors for third party")); +end + +rule "Driver in bad area for theft" + + when + Policy(type == "FIRE_THEFT") + d : Driver(locationRiskProfile == "HIGH") + then + assert(new Rejection("Unsafe area for theft")); +end + +rule "Handle Reject of application" + + when + r : Rejection() + d : Driver() + then + #may also notify at this point, send an email etc + retract(d); + #call some utility or a method on "d" +end + Property changes on: labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/approval/raw.drl ___________________________________________________________________ Name: svn:eol-style + native |
From: <jbo...@li...> - 2006-05-24 00:43:14
|
Author: mic...@jb... Date: 2006-05-23 20:43:00 -0400 (Tue, 23 May 2006) New Revision: 4387 Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/semantics/java/FunctionFixer.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/semantics/java/FunctionFixerTest.java Log: JBRULES-273 Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/semantics/java/FunctionFixer.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/semantics/java/FunctionFixer.java 2006-05-23 22:52:54 UTC (rev 4386) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/semantics/java/FunctionFixer.java 2006-05-24 00:43:00 UTC (rev 4387) @@ -39,51 +39,145 @@ } public String fix(String raw, Pattern pattern) { - if (raw == null) return null; - StringBuffer buf = new StringBuffer(); - int startIndex = 0, lastIndex = 0; - + if (raw == null) return null; + StringBuffer buf = new StringBuffer(); + int lastIndex = 0, startIndex = 0; + Matcher matcher = pattern.matcher(raw); while (matcher.find(startIndex)) { - startIndex = getStartIndex(matcher); - + + // instead of just using matcher.end(), grow the endIndex + // as necessary to close all '(' in the matched String + int endIndex = findEndParenthesis(raw, matcher); + if (endIndex < 0) { + // this means that the first '(' is inside quotes - jump it ant try again + startIndex = matcher.start(3); + continue; + } else { + // next iteration will start from here + startIndex = endIndex; + } + + String params = matcher.group(3).trim(); + if (endIndex > matcher.end()) { + // params have to grow since endIndex changed + params += raw.substring(matcher.end() - 1, endIndex - 1); + } + // Recursively process parameters + params = fix(params, pattern); + + String function = null; + String pre = matcher.group(1); if (matcher.group(1) != null) { String trimmedPre = pre.trim(); - if (trimmedPre.endsWith( "." ) || trimmedPre.endsWith( "new" )) { - //leave alone - continue; - } + if (trimmedPre.endsWith(".") || trimmedPre.endsWith("new")) { + // leave alone + function = raw.substring(matcher.start(2), matcher.start(3) - 1); + } } - String function = matcher.group(2).trim(); - //if we have a reserve d work, DO NOT TOUCH ! - if (KEYWORDS.contains( function )) continue; - String params = matcher.group(3).trim(); + if (function == null) { + function = matcher.group(2).trim(); + // if we have a reserve d work, DO NOT TOUCH ! + if (KEYWORDS.contains(function)) { + function = raw.substring(matcher.start(2), matcher.start(3) - 1); + } else { + function = ucFirst(function) + "." + function; + } + } - String target = ucFirst(function) + "." + function + "(" + params + ")"; + // Every scenario must reach this so that "params" + // are correctly processed + String target = function + "(" + params + ")"; - buf.append( raw.substring( lastIndex, matcher.start( 2 ) ) ); - buf.append( target ); - - lastIndex = matcher.end(); + buf.append(raw.substring(lastIndex, matcher.start(2))); + buf.append(target); + + lastIndex = endIndex; } - - buf.append( raw.substring( lastIndex ) ); - return buf.toString(); - } - private int getStartIndex(Matcher matcher) { - return matcher.start(3) <= 0 ? matcher.end() + 1 : matcher.start(3); - } + buf.append(raw.substring(lastIndex)); + return buf.toString(); + } private String ucFirst(String name) { return name.toUpperCase().charAt( 0 ) + name.substring( 1 ); } /** - * This list was obtained from http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html - */ + * Search a raw string for all '(' after matcher.start(3), until + * the match is over and return the end index the contains the last + * ')' needed to close all opened parenthesis. + * + * @param raw + * The raw String containg the match and everything else. + * @param matcher + * The matched stuff. + * @return the index of the last ')' needed to close all '(' in the match, + * or -1 if the first '(' is inside quotes (and thus being invalid). + */ + private int findEndParenthesis(String raw, Matcher matcher) { + // start is the first '('; end is the end of the match + int start = matcher.start(3) - 1, end = matcher.end(); + + // Count the number of '(' and ')' in raw String + int oCount = 0, cCount = 0; + + // Handles text inside quotes (""): + // * -1 means no quote opened + // * positive int represent the index of the opened quote + int lastQuoteIndex = -1; + + for (int i = 0; i < raw.length(); i++) { + + // if we reached the end of raw and opened/close parenthesis are OK + if (i > end && oCount == cCount) { + // Check if there was an opened quote that was never closed + // (before the first '(') + if (lastQuoteIndex >= 0 && lastQuoteIndex <= start) { + return -1; + } + // Everything OK - we are done! + break; + } + + switch (raw.charAt(i)) { + case '"': + if (lastQuoteIndex >= 0) { + // Check if the quotes contains the first '(' + if (lastQuoteIndex <= start && start <= i) { + return -1; + } + lastQuoteIndex = -1; + } else { + lastQuoteIndex = i; + } + break; + case '(': + if (lastQuoteIndex < 0 && i >= start) { + ++oCount; + } + break; + case ')': + if (lastQuoteIndex < 0 && i >= start) { + ++cCount; + if (i >= end) { + // found a ')' that needs to be included + end = i + 1; + } + } + } + + } // for + + return end; + } + + /** + * This list was obtained from + * http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html + */ private static Set getJavaKeywords() { Set keys = new HashSet(); keys.add("abstract"); Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/semantics/java/FunctionFixerTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/semantics/java/FunctionFixerTest.java 2006-05-23 22:52:54 UTC (rev 4386) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/semantics/java/FunctionFixerTest.java 2006-05-24 00:43:00 UTC (rev 4387) @@ -75,27 +75,31 @@ FunctionFixer fixer = new FunctionFixer(); assertEquals( "if (Foo.foo(bar)) { Bar.bar(baz); }", fixer.fix( "if (foo(bar)) { bar(baz); }" ) ); - - } public void testInBrackets() { FunctionFixer fixer = new FunctionFixer(); assertEquals( "if (Foo.foo(bar))", fixer.fix( "if (foo(bar))" ) ); - - - } public void testAlreadyAdded() { FunctionFixer fixer = new FunctionFixer(); assertEquals( "Foo.foo(bar)", - fixer.fix( "Foo.foo(bar)" ) ); + fixer.fix( "Foo.foo(bar)" ) ); + } + + public void testInString() { + FunctionFixer fixer = new FunctionFixer(); + assertEquals( "\"if (foo(bar))\"", + fixer.fix( "\"if (foo(bar))\"" ) ); + } + + public void testComplexWithBrackets() { + FunctionFixer fixer = new FunctionFixer(); + assertEquals( "System.out.println(\"foo(\" + Foo.foo(bar) + Bar.bar(baz)", + fixer.fix( "System.out.println(\"foo(\" + foo(bar) + bar(baz)" ) ); + } - - } - - } \ No newline at end of file |
Author: szimano Date: 2006-05-23 18:52:54 -0400 (Tue, 23 May 2006) New Revision: 4386 Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/TagMeTag.java labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/MetaMoveFilter.java Modified: labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml labs/jbosslabs/trunk/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java labs/jbosslabs/trunk/portal-extensions/forge-podcast/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-status/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-timetracker/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/polls/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld Log: gwt tagme + labs filter JBLAB-674 Modified: labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml 2006-05-23 22:52:54 UTC (rev 4386) @@ -21,6 +21,16 @@ <filter-name>titleAndTimestampFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> + + <filter> + <filter-name>moveMeta</filter-name> + <filter-class>org.jboss.forge.portal.MetaMoveFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>moveMeta</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> <!-- SSL Processor --> <filter> Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/TagMeTag.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/TagMeTag.java 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/taglib/TagMeTag.java 2006-05-23 22:52:54 UTC (rev 4386) @@ -0,0 +1,107 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.forge.common.taglib; + +import java.io.IOException; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +public class TagMeTag extends TagSupport{ + + private String user; + private String div; + private String service; + private String path; + private String id; + + private static final long serialVersionUID = 1L; + + @Override + public int doStartTag() throws JspException { + return SKIP_BODY; + } + + public int doEndTag() throws JspException { + try { + pageContext.getOut().write(getMetaProperties()); + } catch (IOException e) { + throw new JspException(e); + } + + return EVAL_PAGE; + } + + private String getMetaProperties() { + StringBuffer buffer = new StringBuffer(); + buffer.append(getMetaProperty("tagMeSet"+id, id)); + buffer.append(getMetaProperty("tagMeDiv"+id, div)); + buffer.append(getMetaProperty("tagMePath"+id, path)); + buffer.append(getMetaProperty("tagMeUser"+id, user)); + buffer.append(getMetaProperty("tagMeClass"+id, service)); + return buffer.toString(); + } + + private String getMetaProperty(String key, String value) { + return "<meta name='gwt:property' content='"+key+"="+value+"' />"; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDiv() { + return div; + } + + public void setDiv(String div) { + this.div = div; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-contributor/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-feeds/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2006-05-23 22:52:54 UTC (rev 4386) @@ -49,235 +49,265 @@ * @author Ryszard Kozmik */ public class Freezone extends JBossLabsPortlet { - @Inject - private ContentManager cm; + @Inject + private ContentManager cm; - @CacheItem - private FreezoneConfWatcher conf; + @CacheItem + private FreezoneConfWatcher conf; - private final static String ERROR_404_MSG = "404 - Not found."; + private final static String ERROR_404_MSG = "404 - Not found."; - private void sendResponseNotFound(JBossRenderResponse response) - throws IOException { - response.setContentType(Constants.PAGES_MIME_TYPE); - response.getWriter().println(ERROR_404_MSG); - } + private void sendResponseNotFound(JBossRenderResponse response) + throws IOException { + response.setContentType(Constants.PAGES_MIME_TYPE); + response.getWriter().println(ERROR_404_MSG); + } - public void labsDoView(JBossRenderRequest request, - JBossRenderResponse response) throws IOException, PortletException { - /* - * Checking if the user has access to the selected project (this isn't - * checked in the url mapper). - */ - String projectId = ProjectsHelper.getSelectedProjectId(request); - String portalName = ForgeHelper.getPortalName(request); + public void labsDoView(JBossRenderRequest request, + JBossRenderResponse response) throws IOException, PortletException { + /* + * Checking if the user has access to the selected project (this isn't + * checked in the url mapper). + */ + String projectId = ProjectsHelper.getSelectedProjectId(request); + String portalName = ForgeHelper.getPortalName(request); - if ((projectId != null) && (!ProjectsHelper.getProjects( - portalName).projectExists( - new RenderRequestPermissionsChecker(request), projectId))) { - sendResponseNotFound(response); - return; - } + if ((projectId != null) + && (!ProjectsHelper.getProjects(portalName) + .projectExists( + new RenderRequestPermissionsChecker(request), + projectId))) { + sendResponseNotFound(response); + return; + } - // Getting the path requested by the user. - Object requestedPathObject = request.getAttribute(Constants.ATTR_REQ_PATH); + // Getting the path requested by the user. + Object requestedPathObject = request + .getAttribute(Constants.ATTR_REQ_PATH); - String requestedPath; - if (requestedPathObject == null) { - requestedPath = request.getParameter(Constants.ATTR_REQ_PATH); - } else { - requestedPath = requestedPathObject.toString(); - } + String requestedPath; + if (requestedPathObject == null) { + requestedPath = request.getParameter(Constants.ATTR_REQ_PATH); + } else { + requestedPath = requestedPathObject.toString(); + } - // It is used if an instance has defined preference in instance descriptor. - Object requestedPathFromPref = request.getPreferences().getValue("page", null ); + // It is used if an instance has defined preference in instance + // descriptor. + Object requestedPathFromPref = request.getPreferences().getValue( + "page", null); - if (requestedPathFromPref != null){ - requestedPath = (String)requestedPathFromPref; - } + if (requestedPathFromPref != null) { + requestedPath = (String) requestedPathFromPref; + } - if (requestedPath == null) { - sendResponseNotFound(response); - return; - } + if (requestedPath == null) { + sendResponseNotFound(response); + return; + } - Node requestedNode; - try { - requestedNode = cm.getNode(requestedPath); - } catch (ResourceDoesNotExist e) { - // Even if the resource doesn't exist, writing an edit link, to - // (possibly) create a new page.ru - if (isAllowedToEdit(portalName, request, response)) { - response.setContentType(Constants.PAGES_MIME_TYPE); - writeEditLink(portalName, requestedPath, request, response); - response.getWriter().println(ERROR_404_MSG); - } else { - sendResponseNotFound(response); - } + Node requestedNode; + try { + requestedNode = cm.getNode(requestedPath); + } catch (ResourceDoesNotExist e) { + // Even if the resource doesn't exist, writing an edit link, to + // (possibly) create a new page.ru + if (isAllowedToEdit(portalName, request, response)) { + response.setContentType(Constants.PAGES_MIME_TYPE); + writeTagmeButton(request, response); + writeEditLink(portalName, requestedPath, request, response); + response.getWriter().println(ERROR_404_MSG); + } else { + sendResponseNotFound(response); + } - return; - } + return; + } - response.setContentType(Constants.PAGES_MIME_TYPE); - if (isAllowedToEdit(portalName, request, response)) { - writeEditLink(portalName, requestedPath, request, response); - Tools.transfer(requestedNode.getContentInputStream(), - response.getWriter()); - } else { - Tools.transfer(requestedNode.getContentInputStream(), - response.getPortletOutputStream()); - } - } + response.setContentType(Constants.PAGES_MIME_TYPE); + writeTagmeButton(request, response); + if (isAllowedToEdit(portalName, request, response)) { + writeEditLink(portalName, requestedPath, request, response); + Tools.transfer(requestedNode.getContentInputStream(), response + .getWriter()); + } else { + Tools.transfer(requestedNode.getContentInputStream(), response + .getWriter()); + } + } - @SuppressWarnings("unchecked") - @Override - protected boolean isAllowed(JBossRenderRequest request, - JBossRenderResponse response) { - Object requestedPathFromPref = request.getPreferences().getValue("page", null ); - Object cmsPathObject = request.getAttribute(Constants.ATTR_REQ_PATH); - String cmsPath = null; - if (cmsPathObject!=null) { - cmsPath= cmsPathObject.toString(); - } - if (requestedPathFromPref!=null) { - cmsPath=(String)requestedPathFromPref; - } + private void writeTagmeButton(JBossRenderRequest request, + JBossRenderResponse response) throws PortletException, IOException { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( + "/WEB-INF/jsp/normal.jsp"); - List<String> loggedInOnly = conf.get(ForgeHelper.getPortalName(request)); + rd.include(request, response); + } - return (request.getUser() != null) || (loggedInOnly != null && !loggedInOnly.contains(cmsPath)); - } + @SuppressWarnings("unchecked") + @Override + protected boolean isAllowed(JBossRenderRequest request, + JBossRenderResponse response) { + Object requestedPathFromPref = request.getPreferences().getValue( + "page", null); + Object cmsPathObject = request.getAttribute(Constants.ATTR_REQ_PATH); + String cmsPath = null; + if (cmsPathObject != null) { + cmsPath = cmsPathObject.toString(); + } + if (requestedPathFromPref != null) { + cmsPath = (String) requestedPathFromPref; + } - /* - * EDITING PART - */ + List<String> loggedInOnly = conf + .get(ForgeHelper.getPortalName(request)); - private final static String LOG_MSG = "Freezone save"; - private final static String ERROR_403_MSG = "403 not authorized"; - private final static String EDIT_LINK_JSP = "freezone/edit_link.jsp"; - private final static String EDIT_JSP = "freezone/edit.jsp"; + return (request.getUser() != null) + || (loggedInOnly != null && !loggedInOnly.contains(cmsPath)); + } - private final static String ATTR_RETURN = "return"; + /* + * EDITING PART + */ - private final static String PARAM_MESSAGE = "message"; - private final static String MESSAGE_SAVE_ERROR = - "There was an error while saving; please try again or contact the " + - "administrator. Error: "; + private final static String LOG_MSG = "Freezone save"; - private final static String ACTION_SAVE = "save"; - private final static String ACTION_CANCEL = "cancel"; - private final static String ACTION_PREVIEW = "preview"; - private final static String CONTENT = "content"; + private final static String ERROR_403_MSG = "403 not authorized"; - protected boolean isAllowedToEdit(String portalName, JBossRenderRequest request, - JBossRenderResponse response) { - return ProjectsHelper.getProjects(portalName).editPermissionAllowed( - new RenderRequestPermissionsChecker(request), - ProjectsHelper.getSelectedProjectId(request, true)); - } + private final static String EDIT_LINK_JSP = "freezone/edit_link.jsp"; - protected void writeEditLink(String portalName, String requestedPath, - JBossRenderRequest request, JBossRenderResponse response) - throws IOException, PortletException { - PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( - ForgeHelper.createRepoAccessPath(portalName, EDIT_LINK_JSP)); + private final static String EDIT_JSP = "freezone/edit.jsp"; - String ret = request.getParameter(ATTR_RETURN); - if (ret == null) { - Object retObj = request.getAttribute(Constants.ATTR_URL); - if (retObj != null) { - ret = retObj.toString(); - } - } + private final static String ATTR_RETURN = "return"; - request.setAttribute(ATTR_RETURN, ret); - request.setAttribute(Constants.ATTR_REQ_PATH, requestedPath); + private final static String PARAM_MESSAGE = "message"; - rd.include(request, response); - } + private final static String MESSAGE_SAVE_ERROR = "There was an error while saving; please try again or contact the " + + "administrator. Error: "; - private Node getNodeForPath(String path) throws PortletException { - try { - return cm.getNode(path); - } catch (ResourceDoesNotExist resourceDoesNotExist) { - try { - return cm.getRootDirectory().newNode(path); - } catch (Exception e) { - throw new PortletException(e); - } - } - } + private final static String ACTION_SAVE = "save"; - protected void doEdit(JBossRenderRequest request, - JBossRenderResponse response) - throws PortletException, PortletSecurityException, IOException { - String portalName = ForgeHelper.getPortalName(request); + private final static String ACTION_CANCEL = "cancel"; - // We'll be sending text/html for sure. - response.setContentType(Constants.PAGES_MIME_TYPE); + private final static String ACTION_PREVIEW = "preview"; - // First checking if a user is allowed to edit the page. - if (!isAllowedToEdit(portalName, request, response)) { - response.getWriter().write(ERROR_403_MSG); - return; - } + private final static String CONTENT = "content"; - // Setting the content attribute. - String content = request.getParameter(CONTENT); - if (content == null) { - content = getNodeForPath(request.getParameter( - Constants.ATTR_REQ_PATH)).getContent(); - } + protected boolean isAllowedToEdit(String portalName, + JBossRenderRequest request, JBossRenderResponse response) { + return ProjectsHelper.getProjects(portalName).editPermissionAllowed( + new RenderRequestPermissionsChecker(request), + ProjectsHelper.getSelectedProjectId(request, true)); + } - request.setAttribute(CONTENT, content); + protected void writeEditLink(String portalName, String requestedPath, + JBossRenderRequest request, JBossRenderResponse response) + throws IOException, PortletException { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( + ForgeHelper.createRepoAccessPath(portalName, EDIT_LINK_JSP)); - // Showing the edit page. - PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( - ForgeHelper.createRepoAccessPath(portalName, EDIT_JSP)); + String ret = request.getParameter(ATTR_RETURN); + if (ret == null) { + Object retObj = request.getAttribute(Constants.ATTR_URL); + if (retObj != null) { + ret = retObj.toString(); + } + } - rd.include(request, response); - } + request.setAttribute(ATTR_RETURN, ret); + request.setAttribute(Constants.ATTR_REQ_PATH, requestedPath); - public void processAction(ActionRequest request, ActionResponse response) - throws PortletException, PortletSecurityException, IOException { - // Passing necessary parameters. - response.setRenderParameter(Constants.ATTR_REQ_PATH, - request.getParameter(Constants.ATTR_REQ_PATH)); - response.setRenderParameter(ATTR_RETURN, request.getParameter(ATTR_RETURN)); - /*request.setAttribute(ProjectsHelper.PROJECT_URL_PARAM, - request.getParameter(ProjectsHelper.PROJECT_URL_PARAM));*/ + rd.include(request, response); + } - if (request.getParameter(ACTION_PREVIEW) != null) { - // Preview. - response.setRenderParameter(CONTENT, request.getParameter(CONTENT)); + private Node getNodeForPath(String path) throws PortletException { + try { + return cm.getNode(path); + } catch (ResourceDoesNotExist resourceDoesNotExist) { + try { + return cm.getRootDirectory().newNode(path); + } catch (Exception e) { + throw new PortletException(e); + } + } + } - return; - } + protected void doEdit(JBossRenderRequest request, + JBossRenderResponse response) throws PortletException, + PortletSecurityException, IOException { + String portalName = ForgeHelper.getPortalName(request); - if (request.getParameter(ACTION_SAVE) != null) { - // Save. - Node n = getNodeForPath(request.getParameter(Constants.ATTR_REQ_PATH)); - n.setContent(request.getParameter(CONTENT)); + // We'll be sending text/html for sure. + response.setContentType(Constants.PAGES_MIME_TYPE); - try { - n.save(LOG_MSG); - } catch (SaveException e) { - response.setRenderParameter(CONTENT, request.getParameter(CONTENT)); - response.setRenderParameter(PARAM_MESSAGE, MESSAGE_SAVE_ERROR + e.toString()); + // First checking if a user is allowed to edit the page. + if (!isAllowedToEdit(portalName, request, response)) { + response.getWriter().write(ERROR_403_MSG); + return; + } - return; - } + // Setting the content attribute. + String content = request.getParameter(CONTENT); + if (content == null) { + content = getNodeForPath( + request.getParameter(Constants.ATTR_REQ_PATH)).getContent(); + } - // Save successfull, returning to the normal view. - response.setPortletMode(PortletMode.VIEW); + request.setAttribute(CONTENT, content); - return; - } + // Showing the edit page. + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( + ForgeHelper.createRepoAccessPath(portalName, EDIT_JSP)); - if (request.getParameter(ACTION_CANCEL) != null) { - // Canceling the edit - returning to normal view. + rd.include(request, response); + } - response.setPortletMode(PortletMode.VIEW); - } - } + public void processAction(ActionRequest request, ActionResponse response) + throws PortletException, PortletSecurityException, IOException { + // Passing necessary parameters. + response.setRenderParameter(Constants.ATTR_REQ_PATH, request + .getParameter(Constants.ATTR_REQ_PATH)); + response.setRenderParameter(ATTR_RETURN, request + .getParameter(ATTR_RETURN)); + /* + * request.setAttribute(ProjectsHelper.PROJECT_URL_PARAM, + * request.getParameter(ProjectsHelper.PROJECT_URL_PARAM)); + */ + + if (request.getParameter(ACTION_PREVIEW) != null) { + // Preview. + response.setRenderParameter(CONTENT, request.getParameter(CONTENT)); + + return; + } + + if (request.getParameter(ACTION_SAVE) != null) { + // Save. + Node n = getNodeForPath(request + .getParameter(Constants.ATTR_REQ_PATH)); + n.setContent(request.getParameter(CONTENT)); + + try { + n.save(LOG_MSG); + } catch (SaveException e) { + response.setRenderParameter(CONTENT, request + .getParameter(CONTENT)); + response.setRenderParameter(PARAM_MESSAGE, MESSAGE_SAVE_ERROR + + e.toString()); + + return; + } + + // Save successfull, returning to the normal view. + response.setPortletMode(PortletMode.VIEW); + + return; + } + + if (request.getParameter(ACTION_CANCEL) != null) { + // Canceling the edit - returning to normal view. + + response.setPortletMode(PortletMode.VIEW); + } + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-podcast/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-podcast/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-podcast/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Added: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/MetaMoveFilter.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/MetaMoveFilter.java 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/MetaMoveFilter.java 2006-05-23 22:52:54 UTC (rev 4386) @@ -0,0 +1,85 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.forge.portal; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +/** + * This Filter moves all meta tags to head section. This is made to make tagme + * work (it needs gwt:meta props) + * + * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> + * + */ +public class MetaMoveFilter implements Filter { + + public void init(FilterConfig conf) throws ServletException { + + } + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + CharResponseWrapper wrapper = new CharResponseWrapper( + (HttpServletResponse) response); + chain.doFilter(request, wrapper); + + if (wrapper.getContentType() != null + && wrapper.getContentType().startsWith("text/html")) { + + PrintWriter out = response.getWriter(); + + out.write(moveAllMeta(wrapper.toString())); + + out.close(); + } + } + + private String moveAllMeta(String content) { + StringBuffer newContent = new StringBuffer(content); + + Matcher matcher = Pattern.compile("<meta.*/>").matcher(content); + + while (matcher.find()) { + String meta = content.substring(matcher.start(), matcher.end()); + newContent.insert(newContent.indexOf("<head>") + "<head>".length(), + meta); + } + + return newContent.toString(); + } + + public void destroy() { + } + +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-root-redirect/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-23 22:52:54 UTC (rev 4386) @@ -11,6 +11,17 @@ </goal> <goal name="buildGWT"> + <!--<ant:java classname="com.google.gwt.dev.GWTCompiler"> + <ant:classpath> + <ant:pathelement path="src/java" /> + <ant:pathelement location="../binaries/maven-repo-addons/google/jars/gwt-user.jar" /> + <ant:pathelement location="../binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar" /> + </ant:classpath> + <ant:arg value="-out" /> + <ant:arg value="target/tagme-servlet/www" /> + <ant:arg value="org.jboss.labs.tagme.gwt.TagMe" /> + </ant:java>--> + <ant:exec executable="java" > <ant:arg value="-cp" /> <ant:arg value="src/java:../binaries/maven-repo-addons/google/jars/gwt-user.jar:../binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar" /> Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-23 22:52:54 UTC (rev 4386) @@ -120,7 +120,7 @@ private Button getButton(String path, String user, String clas) { - return new Button("ClickMe", new TagMeShowPopupListener(path, user, clas)); + return new Button("TagMe", new TagMeShowPopupListener(path, user, clas)); } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java 2006-05-23 22:52:54 UTC (rev 4386) @@ -96,7 +96,7 @@ popUp.add(panel); - popUp.setPopupPosition(10,10); + popUp.setPopupPosition(0,0); popUp.show(); } Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/forge-timetracker/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-timetracker/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/forge-timetracker/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/polls/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/polls/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/polls/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> Modified: labs/jbosslabs/trunk/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld 2006-05-23 20:38:27 UTC (rev 4385) +++ labs/jbosslabs/trunk/portal-extensions/primates/src/web/WEB-INF/tld/forge.tld 2006-05-23 22:52:54 UTC (rev 4386) @@ -28,6 +28,36 @@ </tag> <tag> + <name>tagmeButton</name> + <tagclass>org.jboss.forge.common.taglib.TagMeTag</tagclass> + <attribute> + <name>div</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>service</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>user</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>path</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>id</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> <name>param</name> <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> <attribute> |
From: <jbo...@li...> - 2006-05-23 17:27:23
|
Author: mla...@jb... Date: 2006-05-23 13:27:01 -0400 (Tue, 23 May 2006) New Revision: 4384 Added: labs/jbossweb/trunk/src/share/native/srclib/zlib/ labs/jbossweb/trunk/src/share/native/srclib/zlib/NMAKEmakefile labs/jbossweb/trunk/src/share/native/srclib/zlib/zlib1.rc Log: Added zlib library build repository Added: labs/jbossweb/trunk/src/share/native/srclib/zlib/NMAKEmakefile =================================================================== --- labs/jbossweb/trunk/src/share/native/srclib/zlib/NMAKEmakefile 2006-05-23 17:25:52 UTC (rev 4383) +++ labs/jbossweb/trunk/src/share/native/srclib/zlib/NMAKEmakefile 2006-05-23 17:27:01 UTC (rev 4384) @@ -0,0 +1,129 @@ +# Copyright 2001-2006 The Apache Software Foundation or its licensors, as +# applicable. +# +# 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. +# +# ==================================================================== +# +# NMAKEmakefile Master Zlib makefile. +# Usage: +# DLL=1 Build DLL version +# ASM=1 Use Masm +# DEBUG=1 Build DEBUG version of Zlib +# +# Originally contributed by Mladen Turk <mturk jboss.com> +# +# ==================================================================== +# + +!IFDEF DLL +TARGET = DLL +PROJECT = zlib1 +!ELSE +TARGET = LIB +PROJECT = zlib1 +!ENDIF + +CFLAGS = -wd4996 $(CFLAGS) + +!IF !DEFINED(SRCDIR) || "$(SRCDIR)" == "" +SRCDIR = . +!ENDIF + +!include <../../build/NMAKEcommon.inc> + +INCLUDES = -I$(SRCDIR) +PDBFLAGS = -Fo$(BUILDIR)\ -Fd$(BUILDIR)\$(PROJECT)-src +OBJECTS = \ + $(BUILDIR)\adler32.obj \ + $(BUILDIR)\compress.obj \ + $(BUILDIR)\crc32.obj \ + $(BUILDIR)\deflate.obj \ + $(BUILDIR)\gzio.obj \ + $(BUILDIR)\infback.obj \ + $(BUILDIR)\inffast.obj \ + $(BUILDIR)\inflate.obj \ + $(BUILDIR)\inftrees.obj \ + $(BUILDIR)\trees.obj \ + $(BUILDIR)\uncompr.obj \ + $(BUILDIR)\zutil.obj + +!IFDEF ASM +CFLAGS = -DASMV -DASMINF $(CFLAGS) +!IF "$(CPU)" == "AMD64" +ASM_OBJECTS = \ + $(BUILDIR)\inffas8664.obj \ + $(BUILDIR)\gvmat64.obj \ + $(BUILDIR)\inffas64.obj + +!ELSE +ASM_OBJECTS = \ + $(BUILDIR)\gvmat32c.obj \ + $(BUILDIR)\gvmat32.obj \ + $(BUILDIR)\inffas32.obj + +!ENDIF +!ELSE +ASM_OBJECTS = +!ENDIF + +!IFDEF DLL +BUILDLIB = $(BUILDIR)\$(PROJECT).dll +BUILDPDB = $(BUILDIR)\$(PROJECT).pdb +BUILDRES = $(BUILDIR)\$(PROJECT).res +BUILDMAN = $(BUILDLIB).manifest +!ELSE +BUILDLIB = $(BUILDIR)\$(PROJECT).lib +!ENDIF + +all : $(BUILDIR) $(BUILDLIB) + +$(BUILDIR) : + @$(MAKETARGET) + +{$(SRCDIR)}.c{$(BUILDIR)}.obj: + $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $< + +!IF "$(CPU)" == "AMD64" +{$(SRCDIR)/contrib/masmx64}.c{$(BUILDIR)}.obj: + $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $< + +{$(SRCDIR)/contrib/masmx64}.asm{$(BUILDIR)}.obj: + $(ML) $(AFLAGS) /Fo$@ $< + +!ELSE +{$(SRCDIR)/contrib/masmx86}.c{$(BUILDIR)}.obj: + $(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $< + +{$(SRCDIR)/contrib/masmx86}.asm{$(BUILDIR)}.obj: + $(ML) $(AFLAGS) /Fo$@ $< + +!ENDIF + + +$(OBJECTS): $(SRCDIR)/*.h + +!IFDEF DLL +$(BUILDRES): win32/zlib1.rc + $(RC) $(RCFLAGS) /fo $(BUILDRES) win32/zlib1.rc +$(BUILDLIB): $(BUILDIR) $(OBJECTS) $(ASM_OBJECTS) $(BUILDRES) + $(LINK) $(LFLAGS) $(OBJECTS) $(ASM_OBJECTS) $(BUILDRES) $(LIBS) /def:win32/zlib.def /pdb:$(BUILDPDB) /out:$(BUILDLIB) + IF EXIST $(BUILDMAN) \ + mt -nologo -manifest $(BUILDMAN) -outputresource:$(BUILDLIB);2 +!ELSE +$(BUILDLIB): $(BUILDIR) $(OBJECTS) $(ASM_OBJECTS) + $(LINK) $(LFLAGS) $(OBJECTS) $(ASM_OBJECTS) /out:$(BUILDLIB) +!ENDIF + +clean: + @$(CLEANTARGET) Property changes on: labs/jbossweb/trunk/src/share/native/srclib/zlib/NMAKEmakefile ___________________________________________________________________ Name: svn:eol-style + CRLF Added: labs/jbossweb/trunk/src/share/native/srclib/zlib/zlib1.rc =================================================================== --- labs/jbossweb/trunk/src/share/native/srclib/zlib/zlib1.rc 2006-05-23 17:25:52 UTC (rev 4383) +++ labs/jbossweb/trunk/src/share/native/srclib/zlib/zlib1.rc 2006-05-23 17:27:01 UTC (rev 4384) @@ -0,0 +1,39 @@ +#include <windows.h> + +#ifdef GCC_WINDRES +VS_VERSION_INFO VERSIONINFO +#else +VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE +#endif + FILEVERSION 1,2,3,0 + PRODUCTVERSION 1,2,3,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS 1 +#else + FILEFLAGS 0 +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + BEGIN + VALUE "FileDescription", "zlib data compression library\0" + VALUE "FileVersion", "1.2.3\0" + VALUE "InternalName", "zlib1.dll\0" + VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0" + VALUE "OriginalFilename", "zlib1.dll\0" + VALUE "ProductName", "zlib\0" + VALUE "ProductVersion", "1.2.3\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END Property changes on: labs/jbossweb/trunk/src/share/native/srclib/zlib/zlib1.rc ___________________________________________________________________ Name: svn:eol-style + CRLF |
From: <jbo...@li...> - 2006-05-23 17:26:08
|
Author: mla...@jb... Date: 2006-05-23 13:25:52 -0400 (Tue, 23 May 2006) New Revision: 4383 Modified: labs/jbossweb/trunk/src/share/native/build/NMAKEcommon.inc Log: Added Masm macro. Modified: labs/jbossweb/trunk/src/share/native/build/NMAKEcommon.inc =================================================================== --- labs/jbossweb/trunk/src/share/native/build/NMAKEcommon.inc 2006-05-23 16:20:49 UTC (rev 4382) +++ labs/jbossweb/trunk/src/share/native/build/NMAKEcommon.inc 2006-05-23 17:25:52 UTC (rev 4383) @@ -271,3 +271,16 @@ !ENDIF JAVA_INCLUDES=$(JAVA_INCLUDES) -I "$(JAVA_HOME)/include/win32" !ENDIF + +!IF !DEFINED(ML) || "$(ML)" == "" +!IF "$(CPU)" == "I386" +ML = ml.exe +AFLAGS = /coff /Zi /c +!ELSEIF "$(CPU)" == "AMD64" +ML = ml64.exe +AFLAGS = /Zi /c +!ELSEIF "$(CPU)" == "IA64" +ML = ml64.exe +AFLAGS = /coff /Zi /c +!ENDIF +!ENDIF |