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-29 04:42:30
|
Author: mic...@jb... Date: 2006-05-29 00:42:22 -0400 (Mon, 29 May 2006) New Revision: 4460 Modified: labs/jbossrules/trunk/documentation/training/developers-course/Module 6 - rule formats.odp labs/jbossrules/trunk/documentation/training/developers-course/course_outline.odt labs/jbossrules/trunk/documentation/training/developers-course/lab-4-rule-formats/src/rules/decisiontables/PolicyPricing.xls Log: module finished Modified: labs/jbossrules/trunk/documentation/training/developers-course/Module 6 - rule formats.odp =================================================================== (Binary files differ) 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/src/rules/decisiontables/PolicyPricing.xls =================================================================== (Binary files differ) |
Author: unibrew Date: 2006-05-28 20:41:33 -0400 (Sun, 28 May 2006) New Revision: 4459 Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_move.xhtml Removed: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/DeleteTopic.java 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/ModeratorAction.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml Log: [JBFORUMS-51] Working on move action for moderator's panel. 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-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-29 00:41:33 UTC (rev 4459) @@ -48,6 +48,7 @@ public static final String p_postId = "p"; public static final String p_userId = "uid"; public static final String p_option = "o"; + public static final String p_forum_to_id="forum_to_id"; public static final String p_poll_title = "POLL_TITLE"; public static final String p_poll_delete = "POLL_DELETE"; public static final String p_attachment = "ATTACHMENT"; Deleted: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/DeleteTopic.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/DeleteTopic.java 2006-05-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/DeleteTopic.java 2006-05-29 00:41:33 UTC (rev 4459) @@ -1,87 +0,0 @@ -/* -* 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.ui.action; - -import org.jboss.portlet.forums.ui.BaseController; -import org.jboss.portlet.forums.ui.Constants; -import org.jboss.portlet.forums.ui.ForumUtil; -import org.jboss.portlet.forums.ui.JSFUtil; - -import org.jboss.portlet.forums.model.Forum; -import org.jboss.portlet.forums.model.Topic; - - -/** - * @author <a href="mailto:rys...@jb...">Ryszard Kozmik</a> - * - */ -public class DeleteTopic - extends ActionController -{ - //---------------------------------------------------------------------------------------------------------------------------------- - - /** - * - * - */ - public DeleteTopic() - { - - } - //actions--------------------------------------------------------------------------------------------------------------------------------- - - /** - * - */ - public String confirmDelete() - { - String navState = null; - try - { - //get the post id - int topicId = -1; - String t = ForumUtil.getParameter(Constants.p_topicId); - if (t != null && t.trim().length() > 0) - { - topicId = Integer.parseInt(t); - } - - //setup the business objects/data of interest - Topic topic = - BaseController.getForumsModule().findTopicById(new Integer(topicId)); - Forum forum = topic.getForum(); - - this.getForumsModule().removeTopic(topic); - forum.setPostCount(forum.getPostCount() - 1); - forum.setTopicCount(forum.getTopicCount() - 1); - - //set the proper navigation state - navState = Constants.TOPIC_DELETED; - - } - catch (Exception e) - { - JSFUtil.handleException(e); - } - return navState; - } -} 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-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-05-29 00:41:33 UTC (rev 4459) @@ -180,7 +180,57 @@ public String moveTopic () { - return ""; + System.out.println("HELLO WORLD"); + String message=""; + String forum_to_id = ForumUtil.getParameter(Constants.p_forum_to_id); + if (forum_to_id==null || forum_to_id.trim().compareToIgnoreCase("-1")==0) + { + message = bundle.getString("ERR_NO_DEST_FORUM"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return "success"; + } + + try { + Forum forum = this.getForumsModule().findForumById(new Integer(forum_to_id)); + } catch (Exception e) + { + message = bundle.getString("ERR_INTERNAL"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return "success"; + } + Iterator it = checkboxes.keySet().iterator(); + try { + while (it.hasNext()) + { + Integer topicId = (Integer)it.next(); + boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); + if (value) + { + Topic topic = null; + try { + topic = getForumsModule().findTopicById(topicId); + } catch(Exception e) + { + message = bundle.getString("ERR_INTERNAL"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return "success"; + } + forum.addTopic(topic); + } + } + message = bundle.getString("SUCC_TOPIC_MOVED"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate")); + this.forum = BaseController.getForumsModule().findForumById(forum.getId()); + checkboxes=new HashMap(); + } catch (Exception e) + { + JSFUtil.handleException(e); + } + return "success"; } public String lockTopic () @@ -288,6 +338,20 @@ } } + public String moveConfirm() + { + if (isAnyCheckboxSelected()) + { + return "confirmMove"; + } else + { + String message = bundle.getString("None_selected"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return ""; + } + } + private boolean isAnyCheckboxSelected() { Iterator it = checkboxes.keySet().iterator(); 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-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2006-05-29 00:41:33 UTC (rev 4459) @@ -1090,6 +1090,7 @@ Confirm_move_topic=Are you sure you want to move the selected topic/s? Move_to_forum=Move to forum +Move_dstination_forum=Select destination forum Leave_shadow_topic=Leave shadow topic in old forum. L_SPLIT_TOPIC=Split Topic Control Panel 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-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-05-29 00:41:33 UTC (rev 4459) @@ -1,3 +1,27 @@ +<!-- +/* +* 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" @@ -78,7 +102,7 @@ <f:param name="f" value="#{forum.forum.id}"/> </h:commandButton> &nbsp; - <h:commandButton action="#{moveConfirm}" class="liteoption" value="${resource.Move}"> + <h:commandButton action="#{moderator.moveConfirm}" class="liteoption" value="${resource.Move}"> <f:param name="f" value="#{forum.forum.id}"/> </h:commandButton> &nbsp; @@ -114,7 +138,6 @@ </td> </tr> </table> -<ui:debug hotkey="l" /> </ui:define> </ui:composition> </div> Added: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_move.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_move.xhtml 2006-05-28 22:06:26 UTC (rev 4458) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_move.xhtml 2006-05-29 00:41:33 UTC (rev 4459) @@ -0,0 +1,114 @@ +<!-- +/* +* 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"> + <form> + <table width="100%" cellspacing="2" cellpadding="2" border="0" + align="center"> + <tr> + <td align="left" class="nav"> + <h:outputLink value="#{forums:outputLink(shared.links['forum'],true)}" + styleClass="nav"> + <f:param name="f" value="#{moderator.forum.id}"/> + <h:outputText value="#{moderator.forum.name}"/> + </h:outputLink> + </td> + </tr> + </table> + <table width="100%" cellpadding="4" cellspacing="1" border="0" + class="forumline"> + <tr> + <th height="25" class="thHead"> + <b>${resource.Confirm}</b> + </th> + </tr> + <tr> + <td class="row1"> + <table width="100%" border="0" cellspacing="0" + cellpadding="1"> + <tr> + <td>&nbsp;</td> + </tr> + <tr> + <td align="center"> + <span class="gen"> + ${resource.Move_to_forum} &nbsp; + <select name="forum_to_id"> + <option value="-1">${resource.Select_forum}</option> + <c:forEach items="${jumpbox.categories}" + var="category"> + <option value="-1"></option> + <option value="-1">${category.title}</option> + <option value="-1">----------------</option> + <c:forEach items="${category.forums}" + var="forum"> + <option value="${forum.id}">${forum.name}</option> + </c:forEach> + </c:forEach> + </select> + <br/> + <br/> + <!-- TODO: FUTURE FEATURE: SHADOW NOT AVAILABLE--> + <!--<input type="checkbox" name="move_leave_shadow" checked="checked"DISABLED/>${resource.Leave_shadow_topic}[N/A yet...]<br /> --> + <br/> + ${resource.Confirm_move_topic} + </span> + <br/> + <br/> + <h:commandButton type="submit" value="Yes" + styleClass="mainoption" + action="#{moderator.moveTopic}"> + <f:param name="f" + value="#{moderator.forum.id}"/> + </h:commandButton> + &nbsp;&nbsp; + <h:commandButton type="button" value="No" + styleClass="liteoption" + onclick="javascript:history.back();"> + <f:param name="f" + value="#{moderator.forum.id}"/> + </h:commandButton> + </td> + </tr> + <tr> + <td>&nbsp;</td> + </tr> + </table> + </td> + </tr> + </table> + </form> + <ui:debug key="s" /> + </ui:define> + </ui:composition> + +</div> \ No newline at end of file |
From: <jbo...@li...> - 2006-05-28 22:06:30
|
Author: KrisVerlaenen Date: 2006-05-28 18:06:26 -0400 (Sun, 28 May 2006) New Revision: 4458 Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PatternDescr.java Log: rule parser now stores end of ColumnDescr Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-05-28 21:59:48 UTC (rev 4457) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/RuleParser.java 2006-05-28 22:06:26 UTC (rev 4458) @@ -3118,6 +3118,7 @@ break; } + } catch (RecognitionException re) { reportError(re); @@ -3361,7 +3362,8 @@ opt_eol(); following.pop(); - + Token end = input.LT(-1); + d.setEndLocation(offset(end.getLine()), end.getCharPositionInLine()); } } Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PatternDescr.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PatternDescr.java 2006-05-28 21:59:48 UTC (rev 4457) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/PatternDescr.java 2006-05-28 22:06:26 UTC (rev 4458) @@ -28,12 +28,19 @@ private int line; private int column; + private int endLine; + private int endColumn; public void setLocation(int line, int column) { this.line = line; this.column = column; } + public void setEndLocation(int line, int column) { + this.endLine = line; + this.endColumn = column; + } + public int getLine() { return this.line; } @@ -41,4 +48,12 @@ public int getColumn() { return this.column; } + + public int getEndLine() { + return this.endLine; + } + + public int getEndColumn() { + return this.endColumn; + } } \ No newline at end of file |
Author: KrisVerlaenen Date: 2006-05-28 17:59:48 -0400 (Sun, 28 May 2006) New Revision: 4457 Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModel.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModelPresentation.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugTarget.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpoint.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsStackFrame.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsThread.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/IDroolsDebugConstants.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLAnnotationModel.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DroolsLineBreakpointAdapter.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/LocationDeterminator.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/DroolsLaunchConfigurationDelegate.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/DroolsSourceLookupDirector.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/DroolsSourceLookupParticipant.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/DroolsSourcePathComputerDelegate.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/launching/DroolsVMDebugger.java labs/jbossrules/trunk/drools-ide/src/test/java/org/drools/ide/editors/completion/LocationDeterminatorTest.java Modified: labs/jbossrules/trunk/drools-ide/.classpath labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF labs/jbossrules/trunk/drools-ide/plugin.xml labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLDocumentProvider.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLRuleEditor.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/util/ProjectClassLoader.java Log: added support for debug (still disabled) added more advance code completion Modified: labs/jbossrules/trunk/drools-ide/.classpath =================================================================== --- labs/jbossrules/trunk/drools-ide/.classpath 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/.classpath 2006-05-28 21:59:48 UTC (rev 4457) @@ -9,7 +9,7 @@ <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/> <classpathentry kind="lib" path="lib/antlr-3.0ea8.jar"/> <classpathentry kind="lib" path="lib/commons-jci-core-1.0-406301.jar"/> - <classpathentry kind="lib" path="lib/drools-compiler-3.0-RC-3.jar"/> - <classpathentry kind="lib" path="lib/drools-core-3.0-RC-3.jar"/> + <classpathentry kind="lib" path="lib/drools-compiler-3.0.jar"/> + <classpathentry kind="lib" path="lib/drools-core-3.0.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF =================================================================== --- labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/META-INF/MANIFEST.MF 2006-05-28 21:59:48 UTC (rev 4457) @@ -12,6 +12,8 @@ org.eclipse.debug.ui, org.eclipse.jdt.core, org.eclipse.jdt.debug, + org.eclipse.jdt.debug.ui, + org.eclipse.jdt.launching, org.eclipse.jdt.ui, org.eclipse.jface.text, org.eclipse.ui, @@ -27,7 +29,8 @@ org.eclipse.ui.navigator.resources, org.eclipse.ui.presentations.r21, org.eclipse.ui.views, - org.eclipse.ui.workbench.texteditor + org.eclipse.ui.workbench.texteditor, + org.eclipse.pde.ui Eclipse-LazyStart: true Bundle-ClassPath: ide.jar, lib/antlr-2.7.6.jar, @@ -48,6 +51,6 @@ lib/commons-jci-core-1.0-406301.jar, lib/commons-jci-eclipse-3.2.0.666.jar, lib/commons-jci-janino-2.4.3.jar, - lib/drools-compiler-3.0-RC-3.jar, - lib/drools-core-3.0-RC-3.jar, - lib/janino-2.4.3.jar + lib/janino-2.4.3.jar, + lib/drools-compiler-3.0.jar, + lib/drools-core-3.0.jar Modified: labs/jbossrules/trunk/drools-ide/plugin.xml =================================================================== --- labs/jbossrules/trunk/drools-ide/plugin.xml 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/plugin.xml 2006-05-28 21:59:48 UTC (rev 4457) @@ -134,6 +134,22 @@ <persistent value="true" /> </extension> + <extension + id="droolsBreakpointMarker" + point="org.eclipse.core.resources.markers" + name="Drools Breakpoint Marker"> + <super type="org.eclipse.debug.core.breakpointMarker"/> + <persistent value="true"/> + </extension> + + <extension point="org.eclipse.debug.core.breakpoints"> + <breakpoint + id="droolsBreakpoint" + markerType="org.drools.ide.droolsBreakpointMarker" + class="org.drools.ide.debug.core.DroolsLineBreakpoint"> + </breakpoint> + </extension> + <extension point="org.eclipse.jdt.core.classpathContainerInitializer"> <classpathContainerInitializer class="org.drools.ide.util.DroolsClasspathContainerInitializer" id="DROOLS" /> </extension> @@ -147,10 +163,75 @@ </extension> <extension point = "org.eclipse.ui.preferencePages"> - <page id="org.drools.ide.preferences.DroolsPreferencePage" - class="org.drools.ide.preferences.DroolsPreferencePage" - name="JBoss Rules Preferences"> - </page> + <page id="org.drools.ide.preferences.DroolsPreferencePage" + class="org.drools.ide.preferences.DroolsPreferencePage" + name="JBoss Rules Preferences"> + </page> </extension> + <!-- Extensions for the interactive debugger + + <extension point = "org.eclipse.debug.core.launchConfigurationTypes"> + <launchConfigurationType + id="org.drools.ide.launching.DroolsLaunchConfigurationDelegate" + name="Drools Application" + delegate="org.drools.ide.launching.DroolsLaunchConfigurationDelegate" + sourceLocatorId="org.drools.ide.launching.DroolsSourceLookupDirector" + sourcePathComputerId="org.drools.ide.launching.DroolsSourcePathComputerDelegate" + modes= "debug" /> + </extension> + + <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + icon="icons/drools.gif" + configTypeID="org.drools.ide.launching.DroolsLaunchConfigurationDelegate" + id="org.drools.ide.launching.DroolsLaunchConfigurationDelegate.Image"> + </launchConfigurationTypeImage> + </extension> + + <extension + point="org.eclipse.debug.ui.launchConfigurationTabGroups"> + <launchConfigurationTabGroup + type="org.drools.ide.launching.DroolsLaunchConfigurationDelegate" + class="org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup" + id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication"> + <launchMode + mode="debug" + perspective="org.eclipse.debug.ui.DebugPerspective" + description="Debug a JBoss Rules application"> + </launchMode> + <launchMode + mode="run" + description="Run a JBoss Rules application"> + </launchMode> + </launchConfigurationTabGroup> + </extension> + + <extension + point="org.eclipse.debug.core.sourceLocators"> + <sourceLocator + name="Drools Source Lookup Director" + class="org.drools.ide.launching.DroolsSourceLookupDirector" + id="org.drools.ide.launching.DroolsSourceLookupDirector"> + </sourceLocator> + </extension> + + <extension + point="org.eclipse.debug.core.sourcePathComputers"> + <sourcePathComputer + class="org.drools.ide.launching.DroolsSourcePathComputerDelegate" + id="org.drools.ide.launching.DroolsSourcePathComputerDelegate"> + </sourcePathComputer> + </extension> + + <extension + point="org.eclipse.debug.ui.debugModelPresentations"> + <debugModelPresentation + class="org.drools.ide.debug.core.DroolsDebugModelPresentation" + id="org.drools.ide.debug"> + </debugModelPresentation> + </extension> + + --> + </plugin> Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModel.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModel.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModel.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,38 @@ +package org.drools.ide.debug.core; + +import org.drools.ide.DroolsIDEPlugin; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.model.IDebugTarget; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jdt.debug.core.IJavaDebugTarget; + +import com.sun.jdi.VirtualMachine; + +public class DroolsDebugModel { + + private DroolsDebugModel() { + } + + public static IDebugTarget newDebugTarget(ILaunch launch, VirtualMachine vm, String name, IProcess process, boolean allowTerminate, boolean allowDisconnect) { + return newDebugTarget(launch, vm, name, process, allowTerminate, allowDisconnect, true); + } + + public static IDebugTarget newDebugTarget(final ILaunch launch, final VirtualMachine vm, final String name, final IProcess process, final boolean allowTerminate, final boolean allowDisconnect, final boolean resume) { + final IJavaDebugTarget[] target = new IJavaDebugTarget[1]; + IWorkspaceRunnable r = new IWorkspaceRunnable() { + public void run(IProgressMonitor m) { + target[0]= new DroolsDebugTarget(launch, vm, name, allowTerminate, allowDisconnect, process, resume); + } + }; + try { + ResourcesPlugin.getWorkspace().run(r, null, 0, null); + } catch (CoreException exc) { + DroolsIDEPlugin.log(exc); + } + return target[0]; + } +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModelPresentation.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModelPresentation.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugModelPresentation.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,16 @@ +package org.drools.ide.debug.core; + +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.jdt.internal.debug.ui.JDIModelPresentation; + +public class DroolsDebugModelPresentation extends JDIModelPresentation { + + protected String getBreakpointText(IBreakpoint breakpoint) { + if (breakpoint instanceof DroolsLineBreakpoint) { + int lineNumber = ((DroolsLineBreakpoint) breakpoint).getDRLLineNumber(); + return breakpoint.getMarker().getResource().getName() + " [line: " + lineNumber + "]"; + } + return super.getBreakpointText(breakpoint); + } + +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugTarget.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugTarget.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsDebugTarget.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,523 @@ +package org.drools.ide.debug.core; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.resources.IMarkerDelta; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.core.model.IThread; +import org.eclipse.jdi.TimeoutException; +import org.eclipse.jdt.internal.debug.core.IJDIEventListener; +import org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint; +import org.eclipse.jdt.internal.debug.core.model.JDIDebugModelMessages; +import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; +import org.eclipse.jdt.internal.debug.core.model.JDIThread; + +import com.sun.jdi.ObjectCollectedException; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.VMDisconnectedException; +import com.sun.jdi.VirtualMachine; +import com.sun.jdi.event.Event; +import com.sun.jdi.event.ThreadDeathEvent; +import com.sun.jdi.event.ThreadStartEvent; +import com.sun.jdi.event.VMStartEvent; +import com.sun.jdi.request.EventRequest; +import com.sun.jdi.request.EventRequestManager; + +public class DroolsDebugTarget extends JDIDebugTarget { + + private ArrayList fThreads; + private ThreadStartHandler fThreadStartHandler = null; + private boolean fSuspended = true; + + public DroolsDebugTarget(ILaunch launch, VirtualMachine jvm, String name, boolean supportTerminate, boolean supportDisconnect, IProcess process, boolean resume) { + super(launch, jvm, name, supportTerminate, supportDisconnect, process, resume); + } + + protected synchronized void initialize() { + setThreadList(new ArrayList(5)); + super.initialize(); + } + + protected JDIThread createThread(ThreadReference thread) { + JDIThread jdiThread= null; + try { + jdiThread= new DroolsThread(this, thread); + } catch (ObjectCollectedException exception) { + // ObjectCollectionException can be thrown if the thread has already + // completed (exited) in the VM. + return null; + } + if (isDisconnected()) { + return null; + } + synchronized (fThreads) { + fThreads.add(jdiThread); + } + jdiThread.fireCreationEvent(); + return jdiThread; + } + + private Iterator getThreadIterator() { + List threadList; + synchronized (fThreads) { + threadList= (List) fThreads.clone(); + } + return threadList.iterator(); + } + + private boolean hasSuspendedThreads() { + Iterator it = getThreadIterator(); + while(it.hasNext()){ + IThread thread = (IThread)it.next(); + if(thread.isSuspended()) + return true; + } + return false; + } + + public boolean canResume() { + return (isSuspended() || hasSuspendedThreads()) + && isAvailable() && !isPerformingHotCodeReplace(); + } + + protected void resume(boolean fireNotification) throws DebugException { + if ((!isSuspended() && !hasSuspendedThreads()) + || !isAvailable()) { + return; + } + try { + setSuspended(false); + resumeThreads(); + VirtualMachine vm = getVM(); + if (vm != null) { + vm.resume(); + } + if (fireNotification) { + fireResumeEvent(DebugEvent.CLIENT_REQUEST); + } + } catch (VMDisconnectedException e) { + disconnected(); + return; + } catch (RuntimeException e) { + setSuspended(true); + fireSuspendEvent(DebugEvent.CLIENT_REQUEST); + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIDebugTarget_exception_resume, new String[] {e.toString()}), e); + } + } + + private void setSuspended(boolean suspended) { + fSuspended = suspended; + } + + public boolean isSuspended() { + return fSuspended; + } + + private void setThreadList(ArrayList threads) { + fThreads = threads; + } + + public IThread[] getThreads() { + synchronized (fThreads) { + return (IThread[])fThreads.toArray(new IThread[0]); + } + } + + protected void removeAllThreads() { + Iterator itr= getThreadIterator(); + while (itr.hasNext()) { + DroolsThread child= (DroolsThread) itr.next(); + child.terminated(); + } + synchronized (fThreads) { + fThreads.clear(); + } + } + + protected void initializeRequests() { + setThreadStartHandler(new ThreadStartHandler()); + new ThreadDeathHandler(); + } + + class ThreadDeathHandler implements IJDIEventListener { + + protected ThreadDeathHandler() { + createRequest(); + } + + /** + * Creates and registers a request to listen to thread + * death events. + */ + protected void createRequest() { + EventRequestManager manager = getEventRequestManager(); + if (manager != null) { + try { + EventRequest req= manager.createThreadDeathRequest(); + req.setSuspendPolicy(EventRequest.SUSPEND_NONE); + req.enable(); + addJDIEventListener(this, req); + } catch (RuntimeException e) { + logError(e); + } + } + } + + /** + * Locates the model thread associated with the underlying JDI thread + * that has terminated, and removes it from the collection of + * threads belonging to this debug target. A terminate event is + * fired for the model thread. + * + * @param event a thread death event + * @param target the target in which the thread died + * @return <code>true</code> - the thread should be resumed + */ + public boolean handleEvent(Event event, JDIDebugTarget target) { + ThreadReference ref= ((ThreadDeathEvent)event).thread(); + DroolsThread thread= (DroolsThread) findThread(ref); + if (thread != null) { + synchronized (fThreads) { + fThreads.remove(thread); + } + thread.terminated(); + } + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.debug.core.IJDIEventListener#wonSuspendVote(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget) + */ + public void wonSuspendVote(Event event, JDIDebugTarget target) { + // do nothing + } + + } + + class ThreadStartHandler implements IJDIEventListener { + + protected EventRequest fRequest; + + protected ThreadStartHandler() { + createRequest(); + } + + /** + * Creates and registers a request to handle all thread start + * events + */ + protected void createRequest() { + EventRequestManager manager = getEventRequestManager(); + if (manager != null) { + try { + EventRequest req= manager.createThreadStartRequest(); + req.setSuspendPolicy(EventRequest.SUSPEND_NONE); + req.enable(); + addJDIEventListener(this, req); + setRequest(req); + } catch (RuntimeException e) { + logError(e); + } + } + } + + /** + * Creates a model thread for the underlying JDI thread + * and adds it to the collection of threads for this + * debug target. As a side effect of creating the thread, + * a create event is fired for the model thread. + * The event is ignored if the underlying thread is already + * marked as collected. + * + * @param event a thread start event + * @param target the target in which the thread started + * @return <code>true</code> - the thread should be resumed + */ + public boolean handleEvent(Event event, JDIDebugTarget target) { + ThreadReference thread= ((ThreadStartEvent)event).thread(); + try { + if (thread.isCollected()) { + return false; + } + } catch (VMDisconnectedException exception) { + return false; + } catch (ObjectCollectedException e) { + return false; + } catch (TimeoutException e) { + // continue - attempt to create the thread + } + DroolsThread jdiThread= (DroolsThread) findThread(thread); + if (jdiThread == null) { + jdiThread = (DroolsThread) createThread(thread); + if (jdiThread == null) { + return false; + } + } else { + jdiThread.disposeStackFrames(); + jdiThread.fireChangeEvent(DebugEvent.CONTENT); + } + return !jdiThread.isSuspended(); + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.debug.core.IJDIEventListener#wonSuspendVote(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget) + */ + public void wonSuspendVote(Event event, JDIDebugTarget target) { + // do nothing + } + + /** + * Deregisters this event listener. + */ + protected void deleteRequest() { + if (getRequest() != null) { + removeJDIEventListener(this, getRequest()); + setRequest(null); + } + } + + protected EventRequest getRequest() { + return fRequest; + } + + protected void setRequest(EventRequest request) { + fRequest = request; + } + } + + private void disposeThreadHandler() { + ThreadStartHandler handler = getThreadStartHandler2(); + if (handler != null) { + handler.deleteRequest(); + } + } + + public boolean hasThreads() { + return fThreads.size() > 0; + } + + protected ThreadStartHandler getThreadStartHandler2() { + return fThreadStartHandler; + } + + protected void setThreadStartHandler(ThreadStartHandler threadStartHandler) { + fThreadStartHandler = threadStartHandler; + } + + public boolean isOutOfSynch() throws DebugException { + Iterator threads= getThreadIterator(); + while (threads.hasNext()) { + JDIThread thread= (JDIThread)threads.next(); + if (thread.isOutOfSynch()) { + return true; + } + } + return false; + } + + public boolean mayBeOutOfSynch() { + Iterator threads= getThreadIterator(); + while (threads.hasNext()) { + JDIThread thread= (JDIThread)threads.next(); + if (thread.mayBeOutOfSynch()) { + return true; + } + } + return false; + } + + public JDIThread findThread(ThreadReference tr) { + Iterator iter= getThreadIterator(); + while (iter.hasNext()) { + JDIThread thread = (JDIThread) iter.next(); + if (thread.getUnderlyingThread().equals(tr)) + return thread; + } + return null; + } + + public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { + if (!isAvailable()) { + return; + } + if (supportsBreakpoint(breakpoint)) { + try { + ((JavaBreakpoint)breakpoint).removeFromTarget(this); + getBreakpoints().remove(breakpoint); + Iterator threads = getThreadIterator(); + while (threads.hasNext()) { + ((DroolsThread)threads.next()).removeCurrentBreakpoint(breakpoint); + } + } catch (CoreException e) { + logError(e); + } + } + } + + protected void suspendThreads() { + Iterator threads = getThreadIterator(); + while (threads.hasNext()) { + ((DroolsThread)threads.next()).suspendedByVM(); + } + } + + protected void resumeThreads() throws DebugException { + Iterator threads = getThreadIterator(); + while (threads.hasNext()) { + ((DroolsThread)threads.next()).resumedByVM(); + } + } + + public void disconnect() throws DebugException { + + if (!isAvailable()) { + // already done + return; + } + + if (!canDisconnect()) { + notSupported(JDIDebugModelMessages.JDIDebugTarget_does_not_support_disconnect); + } + + try { + disposeThreadHandler(); + VirtualMachine vm = getVM(); + if (vm != null) { + vm.dispose(); + } + } catch (VMDisconnectedException e) { + // if the VM disconnects while disconnecting, perform + // normal disconnect handling + disconnected(); + } catch (RuntimeException e) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIDebugTarget_exception_disconnecting, new String[] {e.toString()}), e); + } + + } + + public void terminate() throws DebugException { + if (!isAvailable()) { + return; + } + if (!supportsTerminate()) { + notSupported(JDIDebugModelMessages.JDIDebugTarget_does_not_support_termination); + } + try { + setTerminating(true); + disposeThreadHandler(); + VirtualMachine vm = getVM(); + if (vm != null) { + vm.exit(1); + } + IProcess process= getProcess(); + if (process != null) { + process.terminate(); + } + } catch (VMDisconnectedException e) { + // if the VM disconnects while exiting, perform + // normal termination processing + terminated(); + } catch (TimeoutException exception) { + // if there is a timeout see if the associated process is terminated + IProcess process = getProcess(); + if (process != null && process.isTerminated()) { + terminated(); + } else { + // All we can do is disconnect + disconnected(); + } + } catch (RuntimeException e) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIDebugTarget_exception_terminating, new String[] {e.toString()}), e); + } + } + + public void handleVMStart(VMStartEvent event) { + if (isResumeOnStartup()) { + try { + setSuspended(true); + resume(); + } catch (DebugException e) { + logError(e); + } + } + // If any threads have resumed since thread collection was initialized, + // update their status (avoid concurrent modification - use #getThreads()) + IThread[] threads = getThreads(); + for (int i = 0; i < threads.length; i++) { + DroolsThread thread = (DroolsThread) threads[i]; + if (thread.isSuspended()) { + try { + boolean suspended = thread.getUnderlyingThread().isSuspended(); + if (!suspended) { + thread.setRunning(true); + thread.fireResumeEvent(DebugEvent.CLIENT_REQUEST); + } + } catch (VMDisconnectedException e) { + } catch (ObjectCollectedException e){ + } catch (RuntimeException e) { + logError(e); + } + } + } + } + + protected void initializeState() { + + List threads= null; + VirtualMachine vm = getVM(); + if (vm != null) { + try { + threads= vm.allThreads(); + } catch (RuntimeException e) { + internalError(e); + } + if (threads != null) { + Iterator initialThreads= threads.iterator(); + while (initialThreads.hasNext()) { + createThread((ThreadReference) initialThreads.next()); + } + } + } + + if (isResumeOnStartup()) { + setSuspended(false); + } + } + + public void suspend() throws DebugException { + if (isSuspended()) { + return; + } + try { + VirtualMachine vm = getVM(); + if (vm != null) { + vm.suspend(); + } + suspendThreads(); + setSuspended(true); + fireSuspendEvent(DebugEvent.CLIENT_REQUEST); + } catch (RuntimeException e) { + setSuspended(false); + fireResumeEvent(DebugEvent.CLIENT_REQUEST); + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIDebugTarget_exception_suspend, new String[] {e.toString()}), e); + } + } + + public void prepareToSuspendByBreakpoint(JavaBreakpoint breakpoint) { + setSuspended(true); + suspendThreads(); + } + + protected void cancelSuspendByBreakpoint(JavaBreakpoint breakpoint) throws DebugException { + setSuspended(false); + resumeThreads(); + } +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpoint.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpoint.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpoint.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,60 @@ +package org.drools.ide.debug.core; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.internal.debug.core.breakpoints.JavaLineBreakpoint; + +public class DroolsLineBreakpoint extends JavaLineBreakpoint { + + /** + * Default constructor is required for the breakpoint manager + * to re-create persisted breakpoints. After instantiating a breakpoint, + * the <code>setMarker(...)</code> method is called to restore + * this breakpoint's attributes. + */ + public DroolsLineBreakpoint() { + } + + /** + * Constructs a line breakpoint on the given resource at the given + * line number. + * + * @param resource file on which to set the breakpoint + * @param lineNumber line number of the breakpoint + * @throws CoreException if unable to create the breakpoint + */ + public DroolsLineBreakpoint(IResource resource, int lineNumber) + throws CoreException { + super(resource, getRuleClassName(resource, lineNumber), + getRuleLineNumber(resource, lineNumber), -1, -1, 0, true, + createAttributesMap(lineNumber), IDroolsDebugConstants.DROOLS_MARKER_TYPE); + } + + private static Map createAttributesMap(int lineNumber) { + Map map = new HashMap(); + map.put(IDroolsDebugConstants.DRL_LINE_NUMBER, new Integer(lineNumber)); + return map; + } + + public int getDRLLineNumber() { + return getMarker().getAttribute(IDroolsDebugConstants.DRL_LINE_NUMBER, -1); + } + + public String getModelIdentifier() { + return IDroolsDebugConstants.ID_DROOLS_DEBUG_MODEL; + } + + private static String getRuleClassName(IResource resource, int lineNumber) { + String ruleName = "Hello World"; + return "Rule_" + ruleName.replaceAll("[^\\w$]", "_") + "_0"; + } + + private static int getRuleLineNumber(IResource resource, int lineNumber) { + // TODO + return 7; + } +} \ No newline at end of file Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsStackFrame.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsStackFrame.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsStackFrame.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,71 @@ +package org.drools.ide.debug.core; + +import java.util.ArrayList; +import java.util.List; + +import org.drools.ide.DroolsIDEPlugin; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IVariable; +import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame; + +import com.sun.jdi.StackFrame; + +public class DroolsStackFrame extends JDIStackFrame { + + private static final String CONSEQUENCE_SIGNATURE = "(Lorg/drools/spi/KnowledgeHelper"; + + public DroolsStackFrame(DroolsThread thread, StackFrame frame, int depth) { + super(thread, frame, depth); + } + + public boolean isExecutingRule() { + try { + String methodName = getMethodName(); + String signature = getSignature(); + if ("consequence".equals(methodName) && signature.startsWith(CONSEQUENCE_SIGNATURE)) { + // TODO return name of drl + return true; + } + } catch (DebugException exc) { + DroolsIDEPlugin.log(exc); + } + return false; + } + + public int getLineNumber() throws DebugException { + if (isExecutingRule()) { + return convertToDRLLineNumber(); + } + return super.getLineNumber(); + } + + private int convertToDRLLineNumber() { + // TODO + return 21; + } + + protected JDIStackFrame bind(StackFrame frame, int depth) { + return super.bind(frame, depth); + } + + protected StackFrame getUnderlyingStackFrame() throws DebugException { + return super.getUnderlyingStackFrame(); + } + + protected void setUnderlyingStackFrame(StackFrame frame) { + super.setUnderlyingStackFrame(frame); + } + + public IVariable[] getVariables() throws DebugException { + IVariable[] variables = super.getVariables(); + List result = new ArrayList((variables.length - 1)/2); + for (int i = 0; i < variables.length; i++) { + String name = variables[i].getName(); + if (!(name.equals("drools")) && !(name.endsWith("__Handle__"))) { + result.add(variables[i]); + } + } + return (IVariable[]) result.toArray(new IVariable[result.size()]); + } + +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsThread.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsThread.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/DroolsThread.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,170 @@ +package org.drools.ide.debug.core; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.IStackFrame; +import org.eclipse.jdt.debug.core.IJavaThread; +import org.eclipse.jdt.internal.debug.core.model.JDIDebugModelMessages; +import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; +import org.eclipse.jdt.internal.debug.core.model.JDIThread; + +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.InvalidStackFrameException; +import com.sun.jdi.ObjectCollectedException; +import com.sun.jdi.StackFrame; +import com.sun.jdi.ThreadReference; + +public class DroolsThread extends JDIThread { + + private List fStackFrames; + private boolean fRefreshChildren = true; + + public DroolsThread(JDIDebugTarget target, ThreadReference thread) throws ObjectCollectedException { + super(target, thread); + } + + protected void initialize() throws ObjectCollectedException { + super.initialize(); + fStackFrames = new ArrayList(); + } + + public synchronized List computeStackFrames() throws DebugException { + return computeStackFrames(fRefreshChildren); + } + + protected synchronized List computeStackFrames(boolean refreshChildren) throws DebugException { + if (isSuspended()) { + if (isTerminated()) { + fStackFrames.clear(); + } else if (refreshChildren) { + List frames = getUnderlyingFrames(); + int oldSize = fStackFrames.size(); + int newSize = frames.size(); + int discard = oldSize - newSize; // number of old frames to discard, if any + for (int i = 0; i < discard; i++) { + DroolsStackFrame invalid = (DroolsStackFrame) fStackFrames.remove(0); + invalid.bind(null, -1); + } + int newFrames = newSize - oldSize; // number of frames to create, if any + int depth = oldSize; + for (int i = newFrames - 1; i >= 0; i--) { + fStackFrames.add(0, new DroolsStackFrame(this, (StackFrame) frames.get(i), depth)); + depth++; + } + int numToRebind = Math.min(newSize, oldSize); // number of frames to attempt to rebind + int offset = newSize - 1; + for (depth = 0; depth < numToRebind; depth++) { + DroolsStackFrame oldFrame = (DroolsStackFrame) fStackFrames.get(offset); + StackFrame frame = (StackFrame) frames.get(offset); + DroolsStackFrame newFrame = (DroolsStackFrame) oldFrame.bind(frame, depth); + if (newFrame != oldFrame) { + fStackFrames.set(offset, newFrame); + } + offset--; + } + + + } + fRefreshChildren = false; + } else { + return Collections.EMPTY_LIST; + } + return fStackFrames; + } + + private List getUnderlyingFrames() throws DebugException { + if (!isSuspended()) { + // Checking isSuspended here eliminates a race condition in resume + // between the time stack frames are preserved and the time the + // underlying thread is actually resumed. + requestFailed(JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1, null, IJavaThread.ERR_THREAD_NOT_SUSPENDED); + } + try { + return getUnderlyingThread().frames(); + } catch (IncompatibleThreadStateException e) { + requestFailed(JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1, e, IJavaThread.ERR_THREAD_NOT_SUSPENDED); + } catch (RuntimeException e) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2, new String[] {e.toString()}), e); + } catch (InternalError e) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2, new String[] {e.toString()}), e); + } + // execution will not reach this line, as + // #targetRequestFailed will thrown an exception + return null; + } + + protected synchronized void preserveStackFrames() { + fRefreshChildren = true; + Iterator frames = fStackFrames.iterator(); + while (frames.hasNext()) { + ((DroolsStackFrame) frames.next()).setUnderlyingStackFrame(null); + } + } + + protected synchronized void disposeStackFrames() { + fStackFrames.clear(); + fRefreshChildren = true; + } + + protected void popFrame(IStackFrame frame) throws DebugException { + JDIDebugTarget target= (JDIDebugTarget)getDebugTarget(); + if (target.canPopFrames()) { + // JDK 1.4 support + try { + // Pop the frame and all frames above it + StackFrame jdiFrame= null; + int desiredSize= fStackFrames.size() - fStackFrames.indexOf(frame) - 1; + int lastSize= fStackFrames.size() + 1; // Set up to pass the first test + int size= fStackFrames.size(); + while (size < lastSize && size > desiredSize) { + // Keep popping frames until the stack stops getting smaller + // or popFrame is gone. + // see Bug 8054 + jdiFrame = ((DroolsStackFrame) frame).getUnderlyingStackFrame(); + preserveStackFrames(); + getUnderlyingThread().popFrames(jdiFrame); + lastSize= size; + size= computeStackFrames().size(); + } + } catch (IncompatibleThreadStateException exception) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_popping, new String[] {exception.toString()}),exception); + } catch (InvalidStackFrameException exception) { + // InvalidStackFrameException can be thrown when all but the + // deepest frame were popped. Fire a changed notification + // in case this has occured. + fireChangeEvent(DebugEvent.CONTENT); + targetRequestFailed(exception.toString(),exception); + } catch (RuntimeException exception) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_popping, new String[] {exception.toString()}),exception); + } + } + } + + protected void terminated() { + super.terminated(); + } + + protected void removeCurrentBreakpoint(IBreakpoint bp) { + super.removeCurrentBreakpoint(bp); + } + + protected synchronized void suspendedByVM() { + super.suspendedByVM(); + } + + protected synchronized void resumedByVM() throws DebugException { + super.resumedByVM(); + } + + protected void setRunning(boolean running) { + super.setRunning(running); + } + +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/IDroolsDebugConstants.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/IDroolsDebugConstants.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/debug/core/IDroolsDebugConstants.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,9 @@ +package org.drools.ide.debug.core; + +public interface IDroolsDebugConstants { + + String ID_DROOLS_DEBUG_MODEL = "org.drools.ide.debug"; + String DROOLS_MARKER_TYPE = "org.drools.ide.droolsBreakpointMarker"; + String DRL_LINE_NUMBER = "Drools_DRL_LineNumber"; + +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLAnnotationModel.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLAnnotationModel.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLAnnotationModel.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,37 @@ +package org.drools.ide.editors; + +import java.util.Map; + +import org.drools.ide.DroolsIDEPlugin; +import org.drools.ide.debug.core.IDroolsDebugConstants; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.Position; +import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel; + +public class DRLAnnotationModel extends ResourceMarkerAnnotationModel { + + public DRLAnnotationModel(IResource resource) { + super(resource); + } + + protected Position createPositionFromMarker(IMarker marker) { + try { + if (!marker.getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) { + return super.createPositionFromMarker(marker); + } + int line = marker.getAttribute(IDroolsDebugConstants.DRL_LINE_NUMBER, -1); + Map attributes = marker.getAttributes(); + try { + return new Position(fDocument.getLineOffset(line - 1)); + } catch (BadLocationException exc) { + return super.createPositionFromMarker(marker); + } + } catch (CoreException exc) { + DroolsIDEPlugin.log(exc); + return null; + } + } +} Modified: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLDocumentProvider.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLDocumentProvider.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLDocumentProvider.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -1,9 +1,13 @@ package org.drools.ide.editors; import org.drools.ide.editors.scanners.DRLPartionScanner; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.rules.FastPartitioner; +import org.eclipse.jface.text.source.IAnnotationModel; +import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.editors.text.TextFileDocumentProvider; @@ -25,6 +29,9 @@ document.setDocumentPartitioner(partitioner); } return document; - } - + } + + protected IAnnotationModel createAnnotationModel(IFile file) { + return new DRLAnnotationModel(file); + } } Modified: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLRuleEditor.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLRuleEditor.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DRLRuleEditor.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -2,10 +2,17 @@ import java.util.List; +import org.drools.ide.DroolsIDEPlugin; +import org.drools.ide.debug.core.IDroolsDebugConstants; import org.drools.ide.editors.outline.RuleContentOutlinePage; import org.drools.ide.editors.scanners.RuleEditorMessages; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; @@ -19,91 +26,110 @@ */ public class DRLRuleEditor extends TextEditor { - //used to provide additional content assistance/popups when DSLs are used. - private DSLAdapter dslAdapter; - private List imports; - private List functions; + //used to provide additional content assistance/popups when DSLs are used. + private DSLAdapter dslAdapter; + private List imports; + private List functions; + private RuleContentOutlinePage ruleContentOutline = null; - private RuleContentOutlinePage ruleContentOutline = null; + public DRLRuleEditor() { + setSourceViewerConfiguration(new DRLSourceViewerConfig(this)); + setDocumentProvider(new DRLDocumentProvider()); + } - public DRLRuleEditor() { - setSourceViewerConfiguration( new DRLSourceViewerConfig( this ) ); - setDocumentProvider( new DRLDocumentProvider() ); - } + /** For user triggered content assistance */ + protected void createActions() { + super.createActions(); - public void dispose() { - super.dispose(); - } - - /** For user triggered content assistance */ - protected void createActions() { - super.createActions(); + IAction a = new TextOperationAction(RuleEditorMessages + .getResourceBundle(), "ContentAssistProposal.", this, + ISourceViewer.CONTENTASSIST_PROPOSALS); + a + .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + setAction("ContentAssistProposal", a); - IAction a = new TextOperationAction( RuleEditorMessages.getResourceBundle(), - "ContentAssistProposal.", - this, - ISourceViewer.CONTENTASSIST_PROPOSALS ); - a.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS ); - setAction( "ContentAssistProposal", - a ); + a = new TextOperationAction( + RuleEditorMessages.getResourceBundle(), + "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$ + a + .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); + setAction("ContentAssistTip", a); + } - a = new TextOperationAction( RuleEditorMessages.getResourceBundle(), - "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION ); //$NON-NLS-1$ - a.setActionDefinitionId( ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION ); - setAction( "ContentAssistTip", - a ); + /** Return the DSL adapter if one is present */ + public DSLAdapter getDSLAdapter() { + return dslAdapter; + } - } + /** Set the DSL adapter, used for content assistance */ + public void setDSLAdapter(DSLAdapter adapter) { + dslAdapter = adapter; + } - /** Return the DSL adapter if one is present */ - public DSLAdapter getDSLAdapter() { - return dslAdapter; - } + public void setImports(List imports) { + this.imports = imports; + } - /** Set the DSL adapter, used for content assistance */ - public void setDSLAdapter(DSLAdapter adapter) { - dslAdapter = adapter; - } - - public void setImports(List imports) { - this.imports = imports; - } - - public List getImports() { - return imports; - } + public List getImports() { + return imports; + } - public void setFunctions(List functions) { - this.functions = functions; - } - - public List getFunctions() { - return functions; - } + public void setFunctions(List functions) { + this.functions = functions; + } - public Object getAdapter(Class adapter) { - if ( adapter.equals( IContentOutlinePage.class ) ) { - return getContentOutline(); - } - return super.getAdapter( adapter ); - } + public List getFunctions() { + return functions; + } - protected ContentOutlinePage getContentOutline() { - if ( ruleContentOutline == null ) { - ruleContentOutline = new RuleContentOutlinePage( this ); - ruleContentOutline.update(); - } - return ruleContentOutline; - } + public Object getAdapter(Class adapter) { + if (adapter.equals(IContentOutlinePage.class)) { + return getContentOutline(); + } else if (adapter.equals(IToggleBreakpointsTarget.class)) { + return getBreakpointAdapter(); + } + return super.getAdapter(adapter); + } - public void doSave(IProgressMonitor monitor) { - super.doSave( monitor ); - if ( ruleContentOutline != null ) { - ruleContentOutline.update(); - } - dslAdapter = null; - imports = null; - functions = null; - } + protected ContentOutlinePage getContentOutline() { + if (ruleContentOutline == null) { + ruleContentOutline = new RuleContentOutlinePage(this); + ruleContentOutline.update(); + } + return ruleContentOutline; + } + private Object getBreakpointAdapter() { + return new DroolsLineBreakpointAdapter(); + } + + public void doSave(IProgressMonitor monitor) { + super.doSave(monitor); + if (ruleContentOutline != null) { + ruleContentOutline.update(); + } + dslAdapter = null; + imports = null; + functions = null; + } + + public void gotoMarker(IMarker marker) { + try { + if (marker.getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) { + int line = marker.getAttribute(IDroolsDebugConstants.DRL_LINE_NUMBER, -1); + if (line > -1) + --line; + try { + IDocument document = getDocumentProvider().getDocument(getEditorInput()); + selectAndReveal(document.getLineOffset(line), document.getLineLength(line)); + } catch(BadLocationException exc) { + DroolsIDEPlugin.log(exc); + } + } else { + super.gotoMarker(marker); + } + } catch (CoreException exc) { + DroolsIDEPlugin.log(exc); + } + } } Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DroolsLineBreakpointAdapter.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DroolsLineBreakpointAdapter.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/DroolsLineBreakpointAdapter.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,62 @@ +package org.drools.ide.editors; + +import org.drools.ide.debug.core.DroolsLineBreakpoint; +import org.drools.ide.debug.core.IDroolsDebugConstants; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.ILineBreakpoint; +import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPart; + +public class DroolsLineBreakpointAdapter implements IToggleBreakpointsTarget { + + public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) { + // TODO: drools breakpoints can only be created in functions and consequences + return true; + } + + public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) { + return false; + } + + public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) { + return false; + } + + public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { + if (part instanceof DRLRuleEditor2) { + IEditorPart editor = (IEditorPart) part; + IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class); + ITextSelection textSelection = (ITextSelection) selection; + int lineNumber = textSelection.getStartLine(); + IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IDroolsDebugConstants.ID_DROOLS_DEBUG_MODEL); + for (int i = 0; i < breakpoints.length; i++) { + IBreakpoint breakpoint = breakpoints[i]; + if (resource.equals(breakpoint.getMarker().getResource())) { + if (breakpoint.getMarker().getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) { + if (((DroolsLineBreakpoint) breakpoint).getDRLLineNumber() == (lineNumber + 1)) { + breakpoint.delete(); + return; + } + } + } + } + // TODO: drools breakpoints can only be created in functions and consequences + DroolsLineBreakpoint lineBreakpoint = new DroolsLineBreakpoint(resource, lineNumber + 1); + DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint); + } + } + + public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { + // do nothing + } + + public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException { + // do nothing + } +} Added: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/LocationDeterminator.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/LocationDeterminator.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/LocationDeterminator.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -0,0 +1,119 @@ +package org.drools.ide.editors.completion; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.drools.compiler.DrlParser; +import org.drools.compiler.DroolsParserException; +import org.drools.lang.descr.ColumnDescr; +import org.drools.lang.descr.ExistsDescr; +import org.drools.lang.descr.NotDescr; +import org.drools.lang.descr.PackageDescr; +import org.drools.lang.descr.PatternDescr; +import org.drools.lang.descr.RuleDescr; + +public class LocationDeterminator { + + static final int LOCATION_UNKNOWN = 0; + static final int LOCATION_BEGIN_OF_CONDITION = 1; + + static final int LOCATION_INSIDE_CONDITION_START = 100; + + static final String LOCATION_PROPERTY_CLASS_NAME = "ClassName"; + + private LocationDeterminator() { + } + + public static class Location { + private int type; + private Map properties = new HashMap(); + + public Location(int type) { + this.type = type; + } + + public int getType() { + return type; + } + + public void setProperty(String name, Object value) { + properties.put(name, value); + } + + public Object getProperty(String name) { + return properties.get(name); + } + } + + public static Location getLocationInCondition(String backText) { + DrlParser parser = new DrlParser(); + try { + PackageDescr packageDescr = parser.parse(backText); + List rules = packageDescr.getRules(); + if (rules != null && rules.size() == 1) { + return determineLocationForDescr((RuleDescr) rules.get(0)); + } + } catch (DroolsParserException exc) { + // do nothing + } + return new Location(LOCATION_UNKNOWN); + } + + public static Location determineLocationForDescr(PatternDescr descr) { + if (descr instanceof RuleDescr) { + RuleDescr ruleDescr = (RuleDescr) descr; + List subDescrs = ruleDescr.getLhs().getDescrs(); + if (subDescrs.size() == 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + PatternDescr subDescr = (PatternDescr) subDescrs.get(subDescrs.size() - 1); + if (subDescr == null) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + if (subDescr.getEndLine() != 0 || subDescr.getEndColumn() != 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + return determineLocationForDescr(subDescr); + } else if (descr instanceof ColumnDescr) { + Location location = new Location(LOCATION_INSIDE_CONDITION_START); + location.setProperty(LOCATION_PROPERTY_CLASS_NAME, ((ColumnDescr) descr).getObjectType()); + return location; + } else if (descr instanceof ExistsDescr) { + List subDescrs = ((ExistsDescr) descr).getDescrs(); + if (subDescrs.size() == 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + if (subDescrs.size() == 1) { + PatternDescr subDescr = (PatternDescr) subDescrs.get(0); + if (subDescr == null) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + if (subDescr.getEndLine() != 0 || subDescr.getEndColumn() != 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + return determineLocationForDescr(subDescr); + } + return determineLocationForDescr(descr); + } else if (descr instanceof NotDescr) { + List subDescrs = ((NotDescr) descr).getDescrs(); + if (subDescrs.size() == 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + if (subDescrs.size() == 1) { + PatternDescr subDescr = (PatternDescr) subDescrs.get(0); + if (subDescr == null) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + if (subDescr.getEndLine() != 0 || subDescr.getEndColumn() != 0) { + return new Location(LOCATION_BEGIN_OF_CONDITION); + } + return determineLocationForDescr(subDescr); + } + return determineLocationForDescr(descr); + + } + + return new Location(LOCATION_UNKNOWN); + } +} Modified: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java 2006-05-28 01:58:08 UTC (rev 4456) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java 2006-05-28 21:59:48 UTC (rev 4457) @@ -1,9 +1,12 @@ package org.drools.ide.editors.completion; +import java.io.IOException; import java.io.Reader; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.StringTokenizer; import java.util.regex.Pattern; @@ -14,12 +17,26 @@ import org.drools.ide.builder.DroolsBuilder; import org.drools.ide.editors.DRLRuleEditor; import org.drools.ide.editors.DSLAdapter; +import org.drools.ide.util.ProjectClassLoader; +import org.drools.lang.descr.ColumnDescr; +import org.drools.lang.descr.FieldBindingDescr; import org.drools.lang.descr.FunctionDescr; import org.drools.lang.descr.PackageDescr; +import org.drools.lang.descr.PatternDescr; +import org.drools.lang.descr.RuleDescr; +import org.drools.semantics.java.ClassTypeResolver; +import org.drools.util.asm.ClassFieldInspector; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.core.CompletionRequestor; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.eval.IEvaluationContext; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.part.FileEditorInput; /** @@ -35,7 +52,7 @@ * @author Michael Neale, Kris Verlanen */ public class RuleCompletionProcessor extends DefaultCompletionProcessor { - + private static final Pattern query = Pattern.compile(".*\\Wquery\\W.*", Pattern.DOTALL); private static final Image droolsIcon = DroolsPluginImages.getImage(DroolsPluginImages.DROOLS); private static final Image dslIcon = DroolsPluginImages.getImage( DroolsPluginImages.DSL_EXPRESSION ); @@ -80,15 +97,15 @@ addRHSFunctionCompletionProposals( viewer, list, prefix ); + + // addRHSJavaCompletionProposals(list, backText, prefix); } } else if (condition(backText)) { List dslConditions = adapter.listConditionItems(); addDSLProposals( list, prefix, dslConditions ); - addLHSCompletionProposals(viewer, list, adapter, prefix); - - + addLHSCompletionProposals(viewer, list, adapter, prefix, backText); } else { //we are in rule header addRuleHeaderItems( list, @@ -103,38 +120,68 @@ return null; } - private void addLHSCompletionProposals(ITextViewer viewer, final List list, DSLAdapter adapter, final String prefix) throws CoreException, DroolsParserException { + private void addLHSCompletionProposals(ITextViewer viewer, final List list, DSLAdapter adapter, final String prefix, String backText) throws CoreException, DroolsParserException { Iterator iterator; Image droolsIcon = DroolsPluginImages.getImage(DroolsPluginImages.DROOLS);... [truncated message content] |
Author: unibrew Date: 2006-05-27 21:58:08 -0400 (Sat, 27 May 2006) New Revision: 4456 Modified: 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-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/delete_topic.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml Log: [JBFORUMS-43] Deleting, Locking and Unlocking topic in moderator's panel work. 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-27 20:13:08 UTC (rev 4455) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-05-28 01:58:08 UTC (rev 4456) @@ -142,49 +142,40 @@ //ui actions supported by this bean---------------------------------------------------------------------------------------------------- - //TODO: STILL NOT FINISHED public String deleteTopic () { Iterator it = checkboxes.keySet().iterator(); - - // This flag checks if there was at least one topic selected - boolean isAnySet=false; - - String message=""; - + String message=""; try { while (it.hasNext()) { Integer topicId = (Integer)it.next(); - boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); - if ( value ) isAnySet=true; + boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); - try { - Topic topic = getForumsModule().findTopicById(topicId); - //this.getForumsModule().removeTopic(topic); + try { + if (value) + { + Topic topic = getForumsModule().findTopicById(topicId); + this.getForumsModule().removeTopic(topic); + } } catch(Exception e) { message = bundle.getString("ERR_CANNOT_REMOVE_TOPIC"); FacesContext.getCurrentInstance().addMessage("message", new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); - return ""; + return "success"; } } - if (!isAnySet) - { - //message = bundle.getString(""); - FacesContext.getCurrentInstance().addMessage("message", - new FacesMessage(FacesMessage.SEVERITY_WARN,"Hey","ehhh")); - return ""; - } message = bundle.getString("SUCC_TOPIC_REMOVED"); FacesContext.getCurrentInstance().addMessage("message", new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate")); + this.forum = BaseController.getForumsModule().findForumById(forum.getId()); + checkboxes=new HashMap(); } catch (Exception e) { JSFUtil.handleException(e); } - return ""; + return "success"; } public String moveTopic () @@ -192,41 +183,122 @@ return ""; } - //TODO: STILL NOT FINISHED public String lockTopic () { - Iterator it = checkboxes.keySet().iterator(); + if (isAnyCheckboxSelected()) + { + Iterator it = checkboxes.keySet().iterator(); + String message=""; + try { + while (it.hasNext()) + { + Integer topicId = (Integer)it.next(); + boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); + + try { + if (value) + { + Topic topic = getForumsModule().findTopicById(topicId); + topic.setStatus(Constants.TOPIC_LOCKED); + } + } catch(Exception e) + { + message = bundle.getString("ERR_INTERNAL"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return ""; + } + } + message = bundle.getString("SUCC_TOPIC_LOCKED"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate")); + this.forum = BaseController.getForumsModule().findForumById(forum.getId()); + checkboxes=new HashMap(); + } catch (Exception e) + { + JSFUtil.handleException(e); + } + return ""; + } else + { + String message = bundle.getString("None_selected"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return ""; + } - // This flag checks if there was at least one topic selected - boolean isAnySet=false; - while (it.hasNext()) + } + + public String unlockTopic () + { + if (isAnyCheckboxSelected()) { - Integer topicId = (Integer)it.next(); - boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); - if ( value ) isAnySet=true; - + Iterator it = checkboxes.keySet().iterator(); + String message=""; try { - Topic topic = getForumsModule().findTopicById(topicId); - //this.getForumsModule().removeTopic(topic); - } catch(Exception e) + while (it.hasNext()) + { + Integer topicId = (Integer)it.next(); + boolean value = ((Boolean)checkboxes.get(topicId)).booleanValue(); + + try { + if (value) + { + Topic topic = getForumsModule().findTopicById(topicId); + topic.setStatus(Constants.TOPIC_UNLOCKED); + } + } catch(Exception e) + { + message = bundle.getString("ERR_INTERNAL"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return ""; + } + } + message = bundle.getString("SUCC_TOPIC_UNLOCKED"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate")); + this.forum = BaseController.getForumsModule().findForumById(forum.getId()); + checkboxes=new HashMap(); + } catch (Exception e) { - FacesContext.getCurrentInstance().addMessage("message", - new FacesMessage(FacesMessage.SEVERITY_ERROR,"moderate","ERR_CANNOT_REMOVE_TOPIC")); - return ""; - } + JSFUtil.handleException(e); + } + return ""; + } else + { + String message = bundle.getString("None_selected"); + FacesContext.getCurrentInstance().addMessage("message", + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); + return ""; } - if (!isAnySet) + } + + public String deleteConfirm() + { + if (isAnyCheckboxSelected()) { + return "confirmDelete"; + } else + { + String message = bundle.getString("None_selected"); FacesContext.getCurrentInstance().addMessage("message", - new FacesMessage(FacesMessage.SEVERITY_WARN,"","ehhh")); + new FacesMessage(FacesMessage.SEVERITY_ERROR,message,"moderate")); return ""; } - return ""; } - public String unlockTopic () + private boolean isAnyCheckboxSelected() { - return ""; + Iterator it = checkboxes.keySet().iterator(); + while (it.hasNext()) + { + if (((Boolean)checkboxes.get(it.next())).booleanValue()) + { + return true; + } + } + return false; } private void execute() throws Exception @@ -243,17 +315,13 @@ if(f!=null && f.trim().length()>0) { forumId = Integer.parseInt(f); - } + } + System.out.println("FORUMID: "+forumId); if(forumId!=-1) { // start with a stub implementation this.forum = BaseController.getForumsModule().findForumById(new Integer(forumId)); checkboxes=new HashMap(); - Iterator it = forum.getTopics().iterator(); - while (it.hasNext()) - { - Topic topic = (Topic)it.next(); - } } } 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-27 20:13:08 UTC (rev 4455) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-28 01:58:08 UTC (rev 4456) @@ -284,11 +284,11 @@ <navigation-rule> <from-view-id>/views/moderator/modcp_body.xhtml</from-view-id> <navigation-case> - <from-outcome>delete</from-outcome> + <from-outcome>confirmDelete</from-outcome> <to-view-id>/views/moderator/delete_topic.xhtml</to-view-id> </navigation-case> <navigation-case> - <from-outcome>move</from-outcome> + <from-outcome>confirmMove</from-outcome> <to-view-id>/views/moderator/move_topic.xhtml</to-view-id> </navigation-case> </navigation-rule> @@ -297,7 +297,7 @@ <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/views/moderator/modcp_body.xhtml</to-view-id> - </navigation-case> + </navigation-case> </navigation-rule> <!-- managedBean for deletePost usecase --> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/delete_topic.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/delete_topic.xhtml 2006-05-27 20:13:08 UTC (rev 4455) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/delete_topic.xhtml 2006-05-28 01:58:08 UTC (rev 4456) @@ -44,12 +44,14 @@ <h:form> <span class="gen"><br/> ${resource.Topic_delete_confirm} - <br/><br/> - <input type="hidden" name="t" value="#{param['t']}"/> - <input type="hidden" name="f" value="#{param['f']}"/> - <h:commandButton type="submit" value="Yes" styleClass="mainoption" action="#{deleteTopic.confirmDelete}"/> + <br/><br/> + <h:commandButton type="submit" value="Yes" styleClass="mainoption" action="#{moderator.deleteTopic}"> + <f:param name="f" value="#{moderator.forum.id}"/> + </h:commandButton> &nbsp;&nbsp; - <h:commandButton type="button" value="No" styleClass="liteoption" onclick="javascript:history.back();"/> + <h:commandButton type="button" value="No" styleClass="liteoption" onclick="javascript:history.back();"> + <f:param name="f" value="#{moderator.forum.id}"/> + </h:commandButton> </span> </h:form> </td> 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-27 20:13:08 UTC (rev 4455) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/moderator/modcp_body.xhtml 2006-05-28 01:58:08 UTC (rev 4456) @@ -74,11 +74,11 @@ <tr align="right"> <td class="catBottom" colspan="5" height="29"> - <h:commandButton action="delete" class="liteoption" value="${resource.Delete}"> + <h:commandButton action="#{moderator.deleteConfirm}" class="liteoption" value="${resource.Delete}"> <f:param name="f" value="#{forum.forum.id}"/> </h:commandButton> &nbsp; - <h:commandButton action="move" class="liteoption" value="${resource.Move}"> + <h:commandButton action="#{moveConfirm}" class="liteoption" value="${resource.Move}"> <f:param name="f" value="#{forum.forum.id}"/> </h:commandButton> &nbsp; |
Author: adamw Date: 2006-05-27 16:13:08 -0400 (Sat, 27 May 2006) New Revision: 4455 Added: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadsFileAccessMonitor.java labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/TempFilesFileAccessMonitor.java Removed: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/forge-file-access.iml labs/jbosslabs/trunk/portal-extensions/forge-file-access/maven.xml labs/jbosslabs/trunk/portal-extensions/forge-file-access/project.xml labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/jboss-web.xml labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/web.xml labs/jbosslabs/trunk/portal-extensions/project.properties Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-84 Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/forge-file-access.iml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/forge-file-access.iml 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/forge-file-access.iml 2006-05-27 20:13:08 UTC (rev 4455) @@ -13,6 +13,7 @@ <orderEntry type="module" module-name="forge-common" /> <orderEntry type="module" module-name="shotoku-base" /> <orderEntry type="module" module-name="shotoku-aop" /> + <orderEntry type="module" module-name="shotoku-file-access" /> <orderEntryProperties /> </component> </module> Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/maven.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/maven.xml 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/maven.xml 2006-05-27 20:13:08 UTC (rev 4455) @@ -11,12 +11,19 @@ </goal> <goal name="build"> - <attainGoal name="prj-war-build" /> - </goal> + <attainGoal name="jar" /> + <attainGoal name="prj-war-build" /> + </goal> <goal name="deploy"> <attainGoal name="prj-war-deploy" /> - </goal> + <j:set var="jar.to.dir" value="${local.deploy.dir}/shotoku-file-access.war" /> + <attainGoal name="jar-to-dir" /> + <ant:copy todir="${local.deploy.dir}/shotoku-file-access.war/WEB-INF/lib" + overwrite="true" + file="target/file-access-1.0.jar" /> + <attainGoal name="dir-to-jar" /> + </goal> <goal name="clean"> <attainGoal name="prj-clean" /> Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/project.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/project.xml 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/project.xml 2006-05-27 20:13:08 UTC (rev 4455) @@ -36,8 +36,15 @@ <war.bundle>true</war.bundle> </properties> </dependency> - + <dependency> + <groupId>shotoku</groupId> + <artifactId>shotoku-file-access</artifactId> + <version>1.0</version> + <jar>shotoku-file-access.jar</jar> + </dependency> + + <dependency> <groupId>jboss-forge</groupId> <artifactId>forge-common</artifactId> <version>1.0</version> Added: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadsFileAccessMonitor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadsFileAccessMonitor.java 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadsFileAccessMonitor.java 2006-05-27 20:13:08 UTC (rev 4455) @@ -0,0 +1,59 @@ +package org.jboss.forge.fileaccess; + +import org.jboss.shotoku.fileaccess.FileAccessMonitor; +import org.jboss.shotoku.fileaccess.ContentInformation; +import org.jboss.shotoku.ContentManager; +import org.jboss.forge.common.projects.DownloadCountersDescriptor; +import org.jboss.forge.common.projects.DownloadCountersWatcher; +import org.jboss.forge.common.ForgeHelper; + +import javax.servlet.ServletRequest; +import java.io.InputStream; +import java.io.File; + +/** + * @author Adam Warski (ad...@as...) + */ +public class DownloadsFileAccessMonitor implements FileAccessMonitor { + public ContentInformation resourceRequested(String path, ServletRequest request, + ContentManager cm) { + if (path.indexOf("/downloads/") != -1) { + // resolving portal name + String portalName = resolvePortalName(path); + + // Trying to get DownloadCountersDescriptor object from the + // cache + DownloadCountersDescriptor downloadCounters = (DownloadCountersDescriptor) ForgeHelper + .getForgeManagement().getFromCache(portalName, + DownloadCountersDescriptor.class.getName()); + + // Checking if there was DownloadCountersDescriptor object + // in cache. + // If not creating new one. + if (downloadCounters == null) + downloadCounters = (DownloadCountersDescriptor) ForgeHelper + .getForgeManagement().addNodeWatcher( + portalName, + DownloadCountersDescriptor.class + .getName(), + new DownloadCountersWatcher(cm)); + + // Sending the request link to the DownloadCounter to + // increment + // counter for this link if it's one of the tracked links. + if (downloadCounters != null) + downloadCounters.increment(File.separator + path); + } + + return null; + } + + /** + * Method used to resolve portal name to which the download link aims. + * + * @param link + */ + private static String resolvePortalName(String link) { + return link.split(File.separator)[0]; + } +} Deleted: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2006-05-27 20:13:08 UTC (rev 4455) @@ -1,245 +0,0 @@ -/* - * 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.fileaccess; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; - -import org.jboss.shotoku.ContentManager; -import org.jboss.shotoku.Node; -import org.jboss.shotoku.tools.Tools; -import org.jboss.shotoku.aop.Inject; -import org.jboss.forge.common.ForgeHelper; - -import org.jboss.forge.common.projects.DownloadCountersDescriptor; -import org.jboss.forge.common.projects.DownloadCountersWatcher; -import org.jboss.logging.Logger; - -/** - * A filter that enables to download files which are stored in a working copy of - * a content repository. - * - * @author adamw - * @author Ryszard Kozmik - * @author Tomasz Szymanski - */ -public class FileAccessFilter implements Filter { - /** - * <code>ACCESS_DENIED</code> - message shown to the client when he tries - * to access a resource to which he doesn't have access. - */ - private final static String ACCESS_DENIED = "Sorry, you don't have access to this resource"; - - /** - * <code>IMAGES_ACCESS</code> - directory from which files are enabled to - * download (here images should be placed, but other files are allowed too). - */ - private final static String IMAGES_ACCESS = "/images/"; - - /** - * <code>DOWNLOADS_ACCESS</code> - another directory from which files are - * enabled to download. - */ - private final static String DOWNLOADS_ACCESS = "/downloads/"; - - /** - * <code>FREEZONE_ACCESS</code> - another directory from which files are - * enabled to download. - */ - private final static String FREEZONE_ACCESS = "/freezone/"; - - private final static String THEME_ACCESS = "/theme/"; - - private final static String DTD_ACCESS = "dtd/"; - - private final static String KOSMOS_CACHE_ACCESS = "/kosmos-cache/"; - - /** - * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a - * file and sending it to the client. - */ - private final int BUF_SIZE = 1024; - - Logger log = Logger.getLogger(this.getClass()); - - @Inject - private ContentManager contentManager; - - public void init(FilterConfig conf) { - - } - - private void checkResource(String resource) throws Exception { - // Blocking access if somebody tries to change the directory to a higher - // one - if (resource.indexOf("..") != -1) - throw new Exception(); - - // We check only the significant part, that is, after the beginning of - // the options. - String toCheck = resource; - if (resource.indexOf('?') != -1) - toCheck = resource.substring(0, resource.indexOf('?')); - - if ((toCheck.indexOf(IMAGES_ACCESS) != -1) - || (toCheck.indexOf(DOWNLOADS_ACCESS) != -1) - || (toCheck.indexOf(KOSMOS_CACHE_ACCESS) != -1) - || (toCheck.indexOf(FREEZONE_ACCESS) != -1) - || (toCheck.indexOf(THEME_ACCESS) != -1) - || (toCheck.indexOf(DTD_ACCESS) != -1) - || (toCheck.indexOf(ForgeHelper.TMP_FILES_ACCESS) != -1)) { - } else - // Not images, nor downloads - wrong request. - throw new Exception(); - } - - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException { - if (request instanceof HttpServletRequest) { - HttpServletRequest httpRequest = (HttpServletRequest) request; - - String requestURI = httpRequest.getRequestURI(); - /* - * The request URI has the form: /.war-name/path/to/resource, so we - * want to get the part /path/to/resource. - */ - String requestedRes = requestURI.split("[/]", 3)[2]; - - try { - // Checking if we can allow access to this resource. - checkResource(requestedRes); - - // DownloadCounter - // checking if it is file access to downloads - if (requestedRes.indexOf(DOWNLOADS_ACCESS) != -1) { - - // resolving portal name - String portalName = resolvePortalName(requestedRes); - - // Trying to get DownloadCountersDescriptor object from the - // cache - DownloadCountersDescriptor downloadCounters = (DownloadCountersDescriptor) ForgeHelper - .getForgeManagement().getFromCache(portalName, - DownloadCountersDescriptor.class.getName()); - - // Checking if there was DownloadCountersDescriptor object - // in cache. - // If not creating new one. - if (downloadCounters == null) - downloadCounters = (DownloadCountersDescriptor) ForgeHelper - .getForgeManagement().addNodeWatcher( - portalName, - DownloadCountersDescriptor.class - .getName(), - new DownloadCountersWatcher( - contentManager)); - - // Sending the request link to the DownloadCounter to - // increment - // counter for this link if it's one of the tracked links. - if (downloadCounters != null) - downloadCounters.increment(File.separator - + requestedRes); - - } - - InputStream is; - String mimeType; - int contentLength; - - // check if this request is for temp file - if (requestedRes.startsWith(ForgeHelper.TMP_FILES_ACCESS)) { - String fileNumber = requestedRes.substring(ForgeHelper.TMP_FILES_ACCESS.length()); - - log.debug("Getting temp file number: '"+fileNumber+"'"); - - File file = new File(ForgeHelper.getFilePath(Integer.valueOf(fileNumber))); - - is = new FileInputStream(file); - - mimeType = Tools.getNameBasedMimeType(file); - - contentLength = (int)file.length(); - - } else { - Node requestedNode = contentManager.getNode(requestedRes); - mimeType = requestedNode.getMimeType(); - - // Getting the input stream for the requested resource. - is = requestedNode.getContentInputStream(); - - contentLength = (int) requestedNode.getLength(); - } - - // Setting response parameters - response.setContentType(mimeType); - response.setContentLength(contentLength); - - // Getting the output stream of the servlet response. - OutputStream os = response.getOutputStream(); - - // Transferring the bytes - try { - byte[] buffer = new byte[BUF_SIZE]; - int read; - while ((read = is.read(buffer)) != -1) - os.write(buffer, 0, read); - } catch (Exception e2) { - // Nothing that we can really do. Just send an incomplete - // file. - } finally { - os.close(); - is.close(); - } - } catch (Exception e1) { - e1.printStackTrace(); - response.setContentType("text/html"); - response.getWriter().println(ACCESS_DENIED); - } - } - } - - /** - * Method used to resolve portal name to which the download link aims. - * - * @param link - */ - private static String resolvePortalName(String link) { - return link.split(File.separator)[0]; - } - - public void destroy() { - - } - - -} Added: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/TempFilesFileAccessMonitor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/TempFilesFileAccessMonitor.java 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/TempFilesFileAccessMonitor.java 2006-05-27 20:13:08 UTC (rev 4455) @@ -0,0 +1,29 @@ +package org.jboss.forge.fileaccess; + +import org.jboss.shotoku.fileaccess.FileAccessMonitor; +import org.jboss.shotoku.fileaccess.ContentInformation; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.tools.Tools; +import org.jboss.forge.common.ForgeHelper; + +import javax.servlet.ServletRequest; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +/** + * @author Adam Warski (ad...@as...) + */ +public class TempFilesFileAccessMonitor implements FileAccessMonitor { + public ContentInformation resourceRequested(String path, ServletRequest request, + ContentManager cm) throws FileNotFoundException { + if (path.startsWith(ForgeHelper.TMP_FILES_ACCESS)) { + String fileNumber = path.substring(ForgeHelper.TMP_FILES_ACCESS.length()); + File file = new File(ForgeHelper.getFilePath(Integer.valueOf(fileNumber))); + return new ContentInformation(Tools.getNameBasedMimeType(file), + file.length(), new FileInputStream(file)); + } + + return null; + } +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/jboss-web.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/jboss-web.xml 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/jboss-web.xml 2006-05-27 20:13:08 UTC (rev 4455) @@ -1,3 +1,4 @@ <?xml version="1.0"?> <jboss-web> + <context-root>labs-file-access</context-root> </jboss-web> Modified: labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/web.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/web.xml 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/forge-file-access/src/web/WEB-INF/web.xml 2006-05-27 20:13:08 UTC (rev 4455) @@ -1,19 +1,10 @@ <?xml version="1.0"?> -<!DOCTYPE web-app PUBLIC - "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd"> -<web-app> +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> <filter> - <filter-name>fileAccessFilter</filter-name> - <filter-class>org.jboss.forge.fileaccess.FileAccessFilter</filter-class> - </filter> - - <filter-mapping> - <filter-name>fileAccessFilter</filter-name> - <url-pattern>/*</url-pattern> - <dispatcher>REQUEST</dispatcher> - </filter-mapping> - <filter> <filter-name>filesFromRepoFilter</filter-name> <filter-class>org.jboss.forge.common.FilesFromRepoFilter</filter-class> </filter> Modified: labs/jbosslabs/trunk/portal-extensions/project.properties =================================================================== --- labs/jbosslabs/trunk/portal-extensions/project.properties 2006-05-27 19:55:33 UTC (rev 4454) +++ labs/jbosslabs/trunk/portal-extensions/project.properties 2006-05-27 20:13:08 UTC (rev 4455) @@ -19,6 +19,7 @@ maven.jar.shotoku-base=${ext.root.dir}/shotoku/shotoku-base/target/shotoku-base.jar maven.jar.shotoku-feeds=${ext.root.dir}/shotoku/shotoku-feeds/target/shotoku-feeds.jar +maven.jar.shotoku-file-access=${ext.root.dir}/shotoku/shotoku-file-access/target/shotoku-file-access.jar maven.jar.shotoku-aop=${ext.root.dir}/shotoku/shotoku-aop/target/shotoku-aop.jar maven.multiproject.excludes=shotoku/project.xml |
From: <jbo...@li...> - 2006-05-27 19:55:36
|
Author: adamw Date: 2006-05-27 15:55:33 -0400 (Sat, 27 May 2006) New Revision: 4454 Modified: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-84 Modified: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java 2006-05-27 19:24:57 UTC (rev 4453) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java 2006-05-27 19:55:33 UTC (rev 4454) @@ -16,11 +16,20 @@ private List<FileAccessMonitor> monitors; private List<Pattern> allowedPatterns; + private String[] getTokensFromProperty(Properties props, String propName) { + String prop = props.getProperty(propName); + if ((prop == null) || ("".equals(prop))) { + return new String[0]; + } + + return prop.split("[,]"); + } + public FileAccessConfiguration(Properties props) { monitors = new ArrayList<FileAccessMonitor>(); // Reading monitor classes. - String[] monitorsTokens = props.getProperty("monitor.stack", "").split("[,]"); + String[] monitorsTokens = getTokensFromProperty(props, "monitor.stack"); for (String monitorToken : monitorsTokens) { try { monitors.add((FileAccessMonitor) Class.forName(monitorToken).newInstance()); @@ -33,7 +42,7 @@ allowedPatterns = new ArrayList<Pattern>(); // 1. Allowed paths which contain a given string. - String[] containingTokens = props.getProperty("allowed.paths.containing", "").split("[,]"); + String[] containingTokens = getTokensFromProperty(props, "allowed.paths.containing"); for (String containingToken : containingTokens) { allowedPatterns.add(Pattern.compile(".*" + Pattern.quote(containingToken) + ".*")); } @@ -47,7 +56,7 @@ if (path.indexOf("..") != -1) { return false; } - + for (Pattern p : allowedPatterns) { if (p.matcher(path).matches()) { return true; |
From: <jbo...@li...> - 2006-05-27 19:25:05
|
Author: adamw Date: 2006-05-27 15:24:57 -0400 (Sat, 27 May 2006) New Revision: 4453 Added: labs/shotoku/trunk/shotoku-file-access/ labs/shotoku/trunk/shotoku-file-access/maven.xml labs/shotoku/trunk/shotoku-file-access/project.properties labs/shotoku/trunk/shotoku-file-access/project.xml labs/shotoku/trunk/shotoku-file-access/shotoku-file-access.iml labs/shotoku/trunk/shotoku-file-access/src/ labs/shotoku/trunk/shotoku-file-access/src/java/ labs/shotoku/trunk/shotoku-file-access/src/java/org/ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/ContentInformation.java labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfigurationWatcher.java labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessMonitor.java labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessServlet.java labs/shotoku/trunk/shotoku-file-access/src/web/ labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/ labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-app.xml labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-web.xml labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/web.xml Modified: labs/shotoku/trunk/project.properties Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-84 Modified: labs/shotoku/trunk/project.properties =================================================================== --- labs/shotoku/trunk/project.properties 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/project.properties 2006-05-27 19:24:57 UTC (rev 4453) @@ -5,7 +5,7 @@ shotoku.sar.dir=shotoku.sar shotoku.subprojects.cms=base,files,jcr,svn -shotoku.subprojects=${shotoku.subprojects.cms},aop,test,web,admin,feeds,portal +shotoku.subprojects=${shotoku.subprojects.cms},aop,test,web,admin,feeds,portal,file-access maven.final.name=${pom.artifactId} Property changes on: labs/shotoku/trunk/shotoku-file-access ___________________________________________________________________ Name: svn:ignore + target Added: labs/shotoku/trunk/shotoku-file-access/maven.xml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/maven.xml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/maven.xml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,29 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util"> + <!-- Default war-project goals --> + + <goal name="build"> + <attainGoal name="jar" /> + <attainGoal name="war" /> + </goal> + + <goal name="deploy"> + <ant:copy + file="target/shotoku-file-access.war" + todir="${local.deploy.dir}" /> + </goal> + + <goal name="clean"> + <attainGoal name="prj-clean" /> + </goal> + + <goal name="all"> + <attainGoal name="clean" /> + <attainGoal name="build" /> + <attainGoal name="deploy" /> + </goal> +</project> Added: labs/shotoku/trunk/shotoku-file-access/project.properties =================================================================== --- labs/shotoku/trunk/shotoku-file-access/project.properties 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/project.properties 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,6 @@ +maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven +maven.junit.fork=yes +maven.war.src=${basedir}/src/web + +maven.final.name=${pom.artifactId} + Added: labs/shotoku/trunk/shotoku-file-access/project.xml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/project.xml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/project.xml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,47 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project> + <pomVersion>3</pomVersion> + <extend>../project.xml</extend> + <id>shotoku-file-access</id> + <name>Shotoku File Access</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Adam Warski</name> + </organization> + <description></description> + + <dependencies> + <dependency> + <groupId>shotoku</groupId> + <artifactId>shotoku-base</artifactId> + <jar>shotoku-base.jar</jar> + </dependency> + + <dependency> + <groupId>shotoku</groupId> + <artifactId>shotoku-aop</artifactId> + <jar>shotoku-aop.jar</jar> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet</artifactId> + <jar>javax.servlet.jar</jar> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/java</sourceDirectory> + <resources> + <resource> + <directory>src/etc/</directory> + <include>**/*.xml</include> + </resource> + </resources> + </build> +</project> Added: labs/shotoku/trunk/shotoku-file-access/shotoku-file-access.iml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/shotoku-file-access.iml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/shotoku-file-access.iml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module version="4" relativePaths="true" type="JAVA_MODULE"> + <component name="ModuleRootManager" /> + <component name="NewModuleRootManager"> + <output url="file://$MODULE_DIR$/target" /> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/java" isTestSource="false" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="shotoku-base" /> + <orderEntry type="module" module-name="shotoku-aop" /> + <orderEntry type="library" name="jboss" level="application" /> + <orderEntryProperties /> + </component> +</module> + Added: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/ContentInformation.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/ContentInformation.java 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/ContentInformation.java 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,30 @@ +package org.jboss.shotoku.fileaccess; + +import java.io.InputStream; + +/** + * @author Adam Warski (ad...@as...) + */ +public class ContentInformation { + private String mimeType; + private long contentLenght; + private InputStream is; + + public ContentInformation(String mimeType, long contentLenght, InputStream is) { + this.mimeType = mimeType; + this.contentLenght = contentLenght; + this.is = is; + } + + public String getMimeType() { + return mimeType; + } + + public long getContentLenght() { + return contentLenght; + } + + public InputStream getIs() { + return is; + } +} Added: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfiguration.java 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,59 @@ +package org.jboss.shotoku.fileaccess; + +import org.apache.log4j.Logger; + +import java.util.List; +import java.util.Properties; +import java.util.ArrayList; +import java.util.regex.Pattern; + +/** + * @author Adam Warski (ad...@as...) + */ +public class FileAccessConfiguration { + private static final Logger log = Logger.getLogger(FileAccessServlet.class); + + private List<FileAccessMonitor> monitors; + private List<Pattern> allowedPatterns; + + public FileAccessConfiguration(Properties props) { + monitors = new ArrayList<FileAccessMonitor>(); + + // Reading monitor classes. + String[] monitorsTokens = props.getProperty("monitor.stack", "").split("[,]"); + for (String monitorToken : monitorsTokens) { + try { + monitors.add((FileAccessMonitor) Class.forName(monitorToken).newInstance()); + } catch (Exception e) { + log.error("Error loading a file access monitor.", e); + } + } + + // Reading allowed patterns. + allowedPatterns = new ArrayList<Pattern>(); + + // 1. Allowed paths which contain a given string. + String[] containingTokens = props.getProperty("allowed.paths.containing", "").split("[,]"); + for (String containingToken : containingTokens) { + allowedPatterns.add(Pattern.compile(".*" + Pattern.quote(containingToken) + ".*")); + } + } + + public List<FileAccessMonitor> getMonitors() { + return monitors; + } + + public boolean checkPath(String path) { + if (path.indexOf("..") != -1) { + return false; + } + + for (Pattern p : allowedPatterns) { + if (p.matcher(path).matches()) { + return true; + } + } + + return false; + } +} Added: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfigurationWatcher.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfigurationWatcher.java 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessConfigurationWatcher.java 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,50 @@ +package org.jboss.shotoku.fileaccess; + +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; +import org.jboss.shotoku.cache.ShotokuPropertiesWatcher; +import org.jboss.shotoku.cache.ShotokuResourceWatcher; +import org.jboss.shotoku.cache.ChangeType; +import org.jboss.shotoku.tools.Pair; + +import java.util.Map; +import java.util.Properties; +import java.io.IOException; + +/** + * @author Adam Warski (ad...@as...) + */ +public class FileAccessConfigurationWatcher extends ShotokuResourceWatcher<Pair<String, String>, + FileAccessConfiguration> { + private static final String CONFIG_FILE_NAME = "file-access.properties"; + + private FileAccessConfiguration getConfiguration(Pair<String, String> key) { + Properties props = new Properties(); + + try { + props.load(getContentManager(key).getNode( + CONFIG_FILE_NAME).getContentInputStream()); + } catch (IOException e) { + e.printStackTrace(); + } catch (ResourceDoesNotExist e) { + // Well ... + e.printStackTrace(); + } + + return new FileAccessConfiguration(props); + } + + public FileAccessConfiguration init(Pair<String, String> key) { + addWatchedPath(key, CONFIG_FILE_NAME); + return getConfiguration(key); + } + + protected ContentManager initContentManager(Pair<String, String> key) { + return ContentManager.getContentManager(key.getFirst(), key.getSecond()); + } + + protected void update(Pair<String, String> key, FileAccessConfiguration currentObject, + Map<String, ChangeType> changes) { + put(key, getConfiguration(key)); + } +} Added: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessMonitor.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessMonitor.java 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessMonitor.java 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,26 @@ +package org.jboss.shotoku.fileaccess; + +import org.jboss.shotoku.ContentManager; + +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import java.io.InputStream; +import java.io.FileNotFoundException; + +/** + * @author Adam Warski (ad...@as...) + */ +public interface FileAccessMonitor { + /** + * Invoked when the given resource is requested. Can return information about + * content to transmit. + * @param path Path requested. + * @param cm Associated content manager. + * @param request Servlet request. + * @return Null, if content to transmit should be read from Shotoku in the + * normal way. If not null, content from the returned content information will be + * transmitted. + */ + public ContentInformation resourceRequested(String path, ServletRequest request, + ContentManager cm) throws FileNotFoundException; +} Added: labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessServlet.java =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessServlet.java 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/java/org/jboss/shotoku/fileaccess/FileAccessServlet.java 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,123 @@ +package org.jboss.shotoku.fileaccess; + +import org.jboss.shotoku.tools.Pair; +import org.jboss.shotoku.tools.Tools; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.Node; +import org.jboss.shotoku.aop.CacheItem; +import org.apache.log4j.Logger; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.Properties; + +/** + * A filter that enables to download files which are stored in a working copy of + * a content repository. + * + * @author adamw + * @author Ryszard Kozmik + * @author Tomasz Szymanski + */ +public class FileAccessServlet extends HttpServlet { + private static final Logger log = Logger.getLogger(FileAccessServlet.class); + + /** + * <code>ACCESS_DENIED</code> - message shown to the client when he tries + * to access a resource to which he doesn't have access. + */ + private final static String ACCESS_DENIED = "Sorry, you don't have access to this resource"; + + private ContentManager contentManager; + private Pair<String, String> confKey; + + @CacheItem + private FileAccessConfigurationWatcher conf; + + public void init(ServletConfig conf) { + contentManager = ContentManager.getContentManager( + conf.getInitParameter("contentManagerId"), + conf.getInitParameter("contentManagerPrefix")); + + confKey = new Pair<String, String>( + contentManager.getId(), + conf.getInitParameter("configFileDirectory")); + } + + private void writeErrorMessage(HttpServletResponse response) throws IOException { + response.setContentType("text/html"); + response.getWriter().println(FileAccessServlet.ACCESS_DENIED); + } + + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + FileAccessConfiguration fac = conf.get(confKey); + + String requestURI = request.getRequestURI(); + /* + * The request URI has the form: /.war-name/path/to/resource, so we + * want to get the part /path/to/resource. + */ + String requestedRes = requestURI.split("[/]", 3)[2]; + + // Now we get rid of any query strings. + String path = requestedRes; + int qmPos = requestedRes.indexOf('?'); + if (qmPos != -1) { + path = requestedRes.substring(0, qmPos); + } + + try { + // Checking if we can allow access to this resource. + if (!fac.checkPath(path)) { + writeErrorMessage(response); + } + + ContentInformation ci = null; + + // Notifying each monitor. Also checking, if any information about content + // to transmit is returned. + for (FileAccessMonitor fam : fac.getMonitors()) { + ContentInformation ciTemp = fam.resourceRequested(path, request, contentManager); + if (ciTemp != null) { + ci = ciTemp; + } + } + + if (ci == null) { + Node requestedNode = contentManager.getNode(requestedRes); + ci = new ContentInformation(requestedNode.getMimeType(), + requestedNode.getLength(), + requestedNode.getContentInputStream()); + } + + // Setting response parameters + response.setContentType(ci.getMimeType()); + response.setContentLength((int) ci.getContentLenght()); + + // Getting the output stream of the servlet response. + OutputStream os = response.getOutputStream(); + + // Transferring the bytes + try { + Tools.transfer(ci.getIs(), os); + } catch (Exception e2) { + // Nothing that we can really do. Just send an incomplete + // file. + } finally { + os.close(); + ci.getIs().close(); + } + } catch (Exception e) { + e.printStackTrace(); + writeErrorMessage(response); + } + } + + public void destroy() { + + } +} Added: labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-app.xml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-app.xml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-app.xml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,3 @@ +<jboss-app> + <app-name>shotokue-file-access</app-name> +</jboss-app> Added: labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-web.xml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-web.xml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/jboss-web.xml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<jboss-web> + <context-root>file-access</context-root> +</jboss-web> Added: labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/web.xml =================================================================== --- labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/web.xml 2006-05-27 01:27:09 UTC (rev 4452) +++ labs/shotoku/trunk/shotoku-file-access/src/web/WEB-INF/web.xml 2006-05-27 19:24:57 UTC (rev 4453) @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<web-app xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" + version="2.4"> + + <servlet> + <servlet-name>fileAccessServlet</servlet-name> + <servlet-class>org.jboss.shotoku.fileaccess.FileAccessServlet</servlet-class> + <init-param> + <param-name>configFileDirectory</param-name> + <param-value>default/file-access</param-value> + </init-param> + <init-param> + <param-name>contentManagerId</param-name> + <param-value>default</param-value> + </init-param> + <init-param> + <param-name>contentManagerPrefix</param-name> + <param-value></param-value> + </init-param> + </servlet> + + <servlet-mapping> + <servlet-name>fileAccessServlet</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> +</web-app> \ No newline at end of file |
Author: soh...@jb... Date: 2006-05-26 21:27:09 -0400 (Fri, 26 May 2006) New Revision: 4452 Modified: 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 labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/index.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/summary/viewsummary_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_ballot.xhtml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml Log: Integrated Security on the Admin Tool UI and the Message Board UI 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-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-27 01:27:09 UTC (rev 4452) @@ -8,11 +8,11 @@ <!-- general application configuration --> <application> <!-- jbossportal-facelets integration --> - <property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver> - <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler> + <!--property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver> + <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler--> <!-- standalone facelets integration --> - <!--view-handler>com.sun.facelets.FaceletViewHandler</view-handler--> + <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> @@ -281,6 +281,24 @@ <managed-bean-class>org.jboss.portlet.forums.ui.action.ModeratorAction</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> + <navigation-rule> + <from-view-id>/views/moderator/modcp_body.xhtml</from-view-id> + <navigation-case> + <from-outcome>delete</from-outcome> + <to-view-id>/views/moderator/delete_topic.xhtml</to-view-id> + </navigation-case> + <navigation-case> + <from-outcome>move</from-outcome> + <to-view-id>/views/moderator/move_topic.xhtml</to-view-id> + </navigation-case> + </navigation-rule> + <navigation-rule> + <from-view-id>/views/moderator/delete_topic.xhtml</from-view-id> + <navigation-case> + <from-outcome>success</from-outcome> + <to-view-id>/views/moderator/modcp_body.xhtml</to-view-id> + </navigation-case> + </navigation-rule> <!-- managedBean for deletePost usecase --> <managed-bean> @@ -335,30 +353,20 @@ </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> + <navigation-rule> <from-view-id>/views/admin/deleteForum.xhtml</from-view-id> <navigation-case> <from-outcome>deleteForum</from-outcome> <to-view-id>/views/admin/index.xhtml</to-view-id> </navigation-case> </navigation-rule> - <navigation-rule> - <from-view-id>/views/moderator/modcp_body.xhtml</from-view-id> - <navigation-case> - <from-outcome>delete</from-outcome> - <to-view-id>/views/moderator/delete_topic.xhtml</to-view-id> - </navigation-case> - <navigation-case> - <from-outcome>move</from-outcome> - <to-view-id>/views/moderator/move_topic.xhtml</to-view-id> - </navigation-case> - </navigation-rule> - <navigation-rule> - <from-view-id>/views/moderator/delete_topic.xhtml</from-view-id> - <navigation-case> - <from-outcome>success</from-outcome> - <to-view-id>/views/moderator/modcp_body.xhtml</to-view-id> - </navigation-case> - </navigation-rule> + <!-- managedBean for the user preference usecase --> <managed-bean> 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-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/admin/index.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -30,7 +30,7 @@ xmlns:forums="http://www.jboss.com/products/jbossportal/forums" class="bb"> <ui:composition template="/views/common/common.xhtml"> - <ui:define name="mainContent"> + <ui:define name="mainContent"> <!-- Forum admin tool title/messages --> <h1>${resource.Forum_admin}</h1> @@ -47,7 +47,8 @@ </tr> <!-- display a list of categories --> - <c:forEach items="#{adminPanel.categories}" var="category"> + <c:forEach items="#{adminPanel.categories}" var="category"> + <forums:isAllowed fragment="acl://viewCategory" contextData="#{category}"> <tr> <td class="catLeft" colspan="3"> <span class="cattitle"> @@ -59,9 +60,8 @@ </b> </span> </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" contextData="#{category}"> + <td class="cat" align="center" valign="middle"> + <forums:isAllowed fragment="acl://editCategory" contextData="#{category}"> <span class="gen"> <h:outputLink value="#{forums:outputLink('/views/admin/editCategory.jsf',true)}"> <f:param name="c" value="#{category.id}"/> @@ -70,9 +70,8 @@ </span> </forums:isAllowed> </td> - <td class="cat" align="center" valign="middle"> - <!-- security check to make sure this link should be displayed or not --> - <forums:isAllowed fragment="acl://deleteCategory/deleteLink" contextData="#{category}"> + <td class="cat" align="center" valign="middle"> + <forums:isAllowed fragment="acl://deleteCategory" contextData="#{category}"> <span class="gen"> <h:outputLink value="#{forums:outputLink('/views/admin/deleteCategory.jsf',true)}"> <f:param name="c" value="#{category.id}"/> @@ -100,7 +99,8 @@ </td> </tr> <!-- display the forums in this category --> - <c:forEach items="#{category.forums}" var="forum"> + <c:forEach items="#{category.forums}" var="forum"> + <forums:isAllowed fragment="acl://viewForum" contextData="#{forum}"> <tr> <td class="row2"> <span class="gen"> @@ -117,9 +117,8 @@ <td class="row2" align="center" valign="middle"> <span class="gen">${forum.postCount}</span> </td> - <td class="row1" align="center" valign="middle"> - <!-- security check to make sure this link should be displayed or not --> - <forums:isAllowed fragment="acl://editForum/editLink" contextData="#{forum}"> + <td class="row1" align="center" valign="middle"> + <forums:isAllowed fragment="acl://editForum" contextData="#{forum}"> <span class="gen"> <h:outputLink value="#{forums:outputLink('/views/admin/editForum.jsf',true)}"> <f:param name="f" value="#{forum.id}"/> @@ -128,9 +127,8 @@ </span> </forums:isAllowed> </td> - <td class="row2" align="center" valign="middle"> - <!-- security check to make sure this link should be displayed or not --> - <forums:isAllowed fragment="acl://deleteForum/deleteLink" contextData="#{forum}"> + <td class="row2" align="center" valign="middle"> + <forums:isAllowed fragment="acl://deleteForum" contextData="#{forum}"> <span class="gen"> <h:outputLink value="#{forums:outputLink('/views/admin/deleteForum.jsf',true)}"> <f:param name="f" value="#{forum.id}"/> @@ -156,35 +154,42 @@ <td class="row2" align="center" valign="middle"> <!--span class="gen"><a href="">Resync</a></span--> </td> - </tr> - </c:forEach> + </tr> + </forums:isAllowed> + </c:forEach> + <forums:isAllowed fragment="acl://addForum"> <!-- create new forum widget for each category --> - <h:form> + <h:form> + <tr> + <td colspan="7" class="row2"> + <input type="hidden" name="c" value="#{category.id}"/> + <h:inputText styleClass="post" value="#{adminController.forumName}" required="true"/> + <h:commandButton styleClass="liteoption" value="${resource.Create_forum}" action="#{adminController.addForum}"/> + </td> + </tr> + </h:form> + </forums:isAllowed> <tr> - <td colspan="7" class="row2"> - <input type="hidden" name="c" value="#{category.id}"/> - <h:inputText styleClass="post" value="#{adminController.forumName}" required="true"/> - <h:commandButton styleClass="liteoption" value="${resource.Create_forum}" action="#{adminController.addForum}"/> - </td> - </tr> - </h:form> - <tr> <td colspan="7" height="1" class="spaceRow"> <img src="/subSilver/images/spacer.gif" alt="" width="1" height="1"/> </td> </tr> + </forums:isAllowed> </c:forEach> - <!-- Add new category widget --> - <h:form> - <tr> - <td colspan="7" class="catBottom"> - <h:inputText id="Category" styleClass="post" value="#{adminController.categoryName}" required="true"/> - <h:commandButton styleClass="liteoption" value="${resource.Create_category}" action="#{adminController.addCategory}"/> - &nbsp;<h:message for="Category" style="color:red" styleClass="liteoption"/>&nbsp; - </td> - </tr> - </h:form> + <forums:isAllowed fragment="acl://addCategory"> + <!-- Add new category widget --> + <h:form> + <tr> + <td colspan="7" class="catBottom"> + <h:inputText id="Category" styleClass="post" value="#{adminController.categoryName}" required="true"/> + <h:commandButton styleClass="liteoption" value="${resource.Create_category}" action="#{adminController.addCategory}"/> + &nbsp;<h:message for="Category" style="color:red" styleClass="liteoption"/>&nbsp; + </td> + </tr> + </h:form> + </forums:isAllowed> + </table> <!-- integrate the jump box --> @@ -195,7 +200,7 @@ </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/category/viewcategory_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -53,7 +53,7 @@ <!-- display each category and its corresponding forums --> <c:forEach items="#{category.categories}" var="catrow"> - <!-- TODO: insert security check to make sure "viewing this category" is allowed --> + <forums:isAllowed fragment="acl://readCategory" contextData="#{catrow}"> <tr> <td class="catLeft" colspan="2" height="28"> <span class="cattitle"> @@ -68,7 +68,7 @@ <td class="rowpic" colspan="3" align="right">&nbsp;</td> </tr> <c:forEach items="#{category.forums[catrow.id]}" var="forumrow"> - <!-- TODO: insert security check to make sure "viewing this forum" is allowed --> + <forums:isAllowed fragment="acl://readForum" contextData="#{forumrow}"> <tr> <td class="row1" align="center" valign="middle" height="50"> <img src="#{category.forumImages[forumrow.id]}" width="46" height="25" @@ -119,7 +119,9 @@ </span> </td> </tr> - </c:forEach> + </forums:isAllowed> + </c:forEach> + </forums:isAllowed> </c:forEach> </table> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/forums/viewforum_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -35,6 +35,11 @@ <c:if test="#{forum.initialized && forum.forum!=null && forum.forum.id!=-1}"> + <!-- make sure the user is allowed to access both the specified forum and the category that this forum belongs to --> + <forums:isAllowed fragment="acl://readCategory" contextData="#{forum.forum.category}"> + <forums:isAllowed fragment="acl://readForum" contextData="#{forum.forum}"> + + <!-- title, newtopic, forum, and page navigation --> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <tr> @@ -45,9 +50,10 @@ </h:outputLink> </td> </tr> - <tr> + <tr> + <forums:isAllowed fragment="acl://newTopic" contextData="#{forum}"> <td align="left" valign="middle" width="50" colspan="2"> - <!-- TODO: insert security check to make sure "posting" is allowed --> + <h:commandLink id="newTopic" action="#{newTopic.start}"> <f:param name="f" value="#{forum.forum.id}"/> <c:if test="#{forum.forum.status == forums:constantInt('FORUM_LOCKED')}"> @@ -66,8 +72,9 @@ /> </f:verbatim> </c:if> - </h:commandLink> + </h:commandLink> </td> + </forums:isAllowed> <td align="left" valign="middle" class="nav" width="100%"> <span class="nav"> &nbsp;&nbsp;&nbsp; @@ -468,9 +475,9 @@ <!-- newtopic, forum, and page navigation --> <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2"> - <tr> - <td align="left" valign="middle" width="50"> - <!-- TODO: insert security check to make sure "posting" is allowed --> + <tr> + <forums:isAllowed fragment="acl://newTopic" contextData="#{forum}"> + <td align="left" valign="middle" width="50"> <h:commandLink id="newTopic2" action="#{newTopic.start}"> <f:param name="f" value="#{forum.forum.id}"/> <c:if test="#{forum.forum.status == forums:constantInt('FORUM_LOCKED')}"> @@ -489,8 +496,9 @@ /> </f:verbatim> </c:if> - </h:commandLink> + </h:commandLink> </td> + </forums:isAllowed> <td align="left" valign="middle" width="100%"> <span class="nav"> &nbsp;&nbsp;&nbsp; @@ -629,13 +637,16 @@ <td align="right"> <span class="gensmall"> <!-- a list of allowed actions on this forum for this user --> - <span class="gensmall"> - <!-- TODO: insert security check to make sure "posting new topics" is allowed in "this forum" --> - You <b>cannot</b> post new topics in this forum <br/> - <!-- TODO: insert security check to make sure "poll creation" is allowed in "this forum" --> - You <b>cannot</b> create polls in this forum <br/> - <!-- TODO: insert security check to make sure "placing votes" is allowed in "this forum" --> - You <b>cannot</b> vote in polls in this forum <br/> + <span class="gensmall"> + <forums:isAllowed fragment="acl://newTopic"> + You <b>cannot</b> post new topics in this forum <br/> + </forums:isAllowed> + <forums:isAllowed fragment="acl://managePoll"> + You <b>cannot</b> create polls in this forum <br/> + </forums:isAllowed> + <forums:isAllowed fragment="acl://votePoll"> + You <b>cannot</b> vote in polls in this forum <br/> + </forums:isAllowed> <!-- TODO: insert security check to make sure "moderator access" is allowed on "this forum" --> You <b>cannot</b> moderate this forum <b/> </span> @@ -644,6 +655,8 @@ </td> </tr> </table> + </forums:isAllowed> + </forums:isAllowed> </c:if> <c:if test="#{forum.forum==null}"> @@ -665,9 +678,10 @@ </table> </td> </tr> - </table> + </table> </c:if> - + + </ui:define> </ui:composition> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/index.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/index.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/index.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -30,18 +30,16 @@ class="bb" > -<c:if test="#{summary.initialized}"> - - <!-- load forums summary page if summary is not empty --> +<!--c:if test="#{summary.initialized}"> <c:if test="#{summary.numberOfTopicsFound>0}"> <ui:include src="/views/summary/viewsummary_body.xhtml"/> </c:if> - - <!-- if summary is empty load the main category page --> + <c:if test="#{summary.numberOfTopicsFound==0}"> <ui:include src="/views/category/viewcategory_body.xhtml"/> </c:if> +</c:if--> -</c:if> +<ui:include src="/views/category/viewcategory_body.xhtml"/> </div> \ No newline at end of file Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/jumpbox.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -42,20 +42,23 @@ <option value="-1">${resource.Select_forum}</option> <c:forEach items="${jumpbox.categories}" var="category"> + <forums:isAllowed fragment="acl://readCategory" contextData="#{category}"> <option value="-1"></option> <option value="-1">${category.title}</option> <option value="-1">----------------</option> <c:forEach items="${category.forums}" var="forum"> + <forums:isAllowed fragment="acl://readForum" contextData="#{forum}"> <option value="${forum.id}"> ${forum.name} </option> + </forums:isAllowed> </c:forEach> + </forums:isAllowed> </c:forEach> </select> &nbsp; - <input type="submit" value="${resource.Go}" - class="liteoption"/> + <input type="submit" value="${resource.Go}" class="liteoption"/> </span> </td> </tr> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/summary/viewsummary_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/summary/viewsummary_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/summary/viewsummary_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -48,11 +48,11 @@ <!-- topic type --> <tr> <th class="thSides" colspan="1" height="25" valign="middle"> - #{resource[summary.blockTopicsType]} + ${resource[summary.blockTopicsType]} </th> </tr> - <!-- a list of topics for the specified forum --> + <!-- a list of topics for the summary--> <c:forEach items="#{summary.topics}" var="topicrow"> <tr> <td class="row1" width="100%"> @@ -64,7 +64,7 @@ </tr> </c:forEach> - <!-- a list of no topics for the specified forum --> + <!-- number of topics found in the summary --> <tr> <td class="row3" height="30" align="center" valign="middle"> <span class="postdetails"> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_edit_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -476,9 +476,9 @@ </td> </tr> + <forums:isAllowed fragment="acl://managePoll"> <c:if test="#{editPost.pollPresent}"> - <!-- poll ui --> - <!-- TODO: security check to make sure this user has permission to "ADD/EDIT" "Poll" in the Post --> + <!-- poll ui --> <!-- title --> <tr> <th class="thHead" colspan="2">${resource.Add_poll}</th> @@ -536,19 +536,18 @@ </td> </tr> - <!-- enable/disable delete option --> - <!-- TODO: security check to make sure this user has permission to "EDIT" "Post" in the Forum --> + <!-- enable/disable delete option --> <tr> <td colspan="2" align="center"> <input type="button" value="${resource.Delete_poll}" onclick="javascript:document.location='#{forums:outputLink('/views/topics/delete_poll.jsf',true)}';"/> </td> </tr> - </c:if> + </c:if> + </forums:isAllowed> - - <!-- attachment ui --> - <!-- TODO: security check to make sure this user has permission to "AddAttachmentInPost" --> + <forums:isAllowed fragment="acl://managePostAttachments"> + <!-- attachment ui --> <tr> <th class="thHead" colspan="2">${resource.Add_attachment_title}</th> </tr> @@ -617,7 +616,8 @@ </td> </tr> </c:forEach> - </c:if> + </c:if> + </forums:isAllowed> <!-- hookup the buttons --> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -477,8 +477,8 @@ </tr> - <!-- poll ui --> - <!-- TODO: security check to make sure this user has permission to "ADD/EDIT" "Poll" in the Post --> + <!-- poll ui --> + <forums:isAllowed fragment="acl://managePoll"> <tr> <th class="thHead" colspan="2">${resource.Add_poll}</th> </tr> @@ -539,10 +539,11 @@ <span class="gen"><b>${resource.Days}</b></span> &nbsp; <span class="gensmall">${resource.Poll_for_explain}</span> </td> </tr> + </forums:isAllowed> - <!-- attachment ui --> - <!-- TODO: security check to make sure this user has permission to "AddAttachmentInPost" --> + <!-- attachment ui --> + <forums:isAllowed fragment="acl://managePostAttachments"> <tr> <th class="thHead" colspan="2">${resource.Add_attachment_title}</th> </tr> @@ -612,9 +613,9 @@ </span> </td> </tr> - </c:forEach> - + </c:forEach> </c:if> + </forums:isAllowed> <!-- hookup the buttons --> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/posting_reply_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -448,9 +448,8 @@ </tr> - - <!-- attachment ui --> - <!-- TODO: security check to make sure this user has permission to "AddAttachmentInPost" --> + <forums:isAllowed fragment="acl://managePostAttachments"> + <!-- attachment ui --> <tr> <th class="thHead" colspan="2">${resource.Add_attachment_title}</th> </tr> @@ -520,9 +519,9 @@ </span> </td> </tr> - </c:forEach> - + </c:forEach> </c:if> + </forums:isAllowed> <!-- hookup the buttons --> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -34,6 +34,10 @@ <c:choose> <c:when test="#{topic.initialized && topic.topic!=null && topic.topic.id!=-1}"> + <!-- make sure the user is allowed to access both the forum and the category that the specified topic belongs to --> + <forums:isAllowed fragment="acl://readCategory" contextData="#{topic.topic.forum.category}"> + <forums:isAllowed fragment="acl://readForum" contextData="#{topic.topic.forum}"> + <table width="100%" cellspacing="2" cellpadding="2" border="0"> <tr> <td align="left" valign="bottom" colspan="2"> @@ -92,8 +96,7 @@ </c:if> </tr> <tr> - <!-- insert the newTopic and replyTopic buttons here --> - <!-- TODO: insert security check to make sure "posting" is allowed --> + <!-- insert the newTopic and replyTopic buttons here --> <td align="left" valign="bottom" nowrap="nowrap" class="nav" > <c:choose> @@ -109,8 +112,9 @@ </c:when> <c:when test="#{(topic.topic.status == forums:constantInt('TOPIC_LOCKED')) - && (topic.topic.forum.status != forums:constantInt('FORUM_LOCKED'))}"> - + && (topic.topic.forum.status != forums:constantInt('FORUM_LOCKED'))}"> + <forums:isAllowed fragment="acl://newTopic" contextData="#{topic.topic.forum}"> + <!-- new topic --> <h:commandLink id="newTopic" action="#{newTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:verbatim> @@ -119,6 +123,9 @@ alt="${resource.Post_new_topic}"/> </f:verbatim> </h:commandLink> + </forums:isAllowed> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> + <!-- reply --> <h:commandLink id="replyTopic" action="#{replyTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:param name="t" value="#{topic.topic.id}"/> @@ -128,11 +135,12 @@ alt="${resource.Topic_locked}" /> </f:verbatim> </h:commandLink> - + </forums:isAllowed> </c:when> <c:otherwise> - + <!-- new topic --> + <forums:isAllowed fragment="acl://newTopic" contextData="#{topic.topic.forum}"> <h:commandLink id="newTopic" action="#{newTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:verbatim> @@ -141,6 +149,9 @@ alt="${resource.Post_new_topic}"/> </f:verbatim> </h:commandLink> + </forums:isAllowed> + <!-- reply --> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> <h:commandLink id="replyTopic" action="#{replyTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:param name="t" value="#{topic.topic.id}"/> @@ -149,8 +160,8 @@ src="#{forums:themeURL('resourceReplyNewURL')}" alt="${resource.Reply_to_topic}" /> </f:verbatim> - </h:commandLink> - + </h:commandLink> + </forums:isAllowed> </c:otherwise> </c:choose> @@ -261,6 +272,7 @@ <!-- "Quote", "Edit", and "Delete" buttons --> <td valign="top" nowrap=""> <!-- add the quote link --> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> <h:commandLink action="#{replyTopic.startQuote}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:param name="t" value="#{topic.topic.id}"/> @@ -269,14 +281,18 @@ <img border="0" src="#{forums:themeURL('resourceIconQuoteURL')}"/> </f:verbatim> </h:commandLink> + </forums:isAllowed> <!-- add the edit post link --> + <forums:isAllowed fragment="acl://editPost" contextData="#{postrow}"> <h:commandLink action="#{editPost.start}" style="text-decoration: none;"> <f:param name="p" value="#{postrow.id}"/> <f:verbatim> <img border="0" src="#{forums:themeURL('resourceIconEditURL')}"/> </f:verbatim> </h:commandLink> + </forums:isAllowed> <!-- add the delete post link --> + <forums:isAllowed fragment="acl://deletePost" contextData="#{postrow}"> <h:outputLink value="#{forums:outputLink('/views/topics/delete_post.jsf',true)}" style="text-decoration: none;"> <f:param name="p" value="#{postrow.id}"/> <f:param name="t" value="#{topic.topic.id}"/> @@ -285,6 +301,7 @@ <img border="0" src="#{forums:themeURL('resourceIconDelpostURL')}"/> </f:verbatim> </h:outputLink> + </forums:isAllowed> </td> </tr> <tr> @@ -494,9 +511,8 @@ <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <tr> - <!-- insert the newTopic and replyTopic buttons here --> - <!-- TODO: insert security check to make sure "posting" is allowed --> - <td align="left" valign="bottom" nowrap="nowrap"> + <!-- insert the newTopic and replyTopic buttons here --> + <td align="left" valign="bottom" nowrap="nowrap" class="nav" > <c:choose> <c:when test="#{topic.topic.forum.status == forums:constantInt('FORUM_LOCKED')}"> @@ -511,9 +527,10 @@ </c:when> <c:when test="#{(topic.topic.status == forums:constantInt('TOPIC_LOCKED')) - && (topic.topic.forum.status != forums:constantInt('FORUM_LOCKED'))}"> - - <h:commandLink action="#{newTopic.start}" style="text-decoration: none;"> + && (topic.topic.forum.status != forums:constantInt('FORUM_LOCKED'))}"> + <forums:isAllowed fragment="acl://newTopic" contextData="#{topic.topic.forum}"> + <!-- new topic --> + <h:commandLink id="newTopicBelow" action="#{newTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:verbatim> <img border="0" @@ -521,7 +538,10 @@ alt="${resource.Post_new_topic}"/> </f:verbatim> </h:commandLink> - <h:commandLink action="#{replyTopic.start}" style="text-decoration: none;"> + </forums:isAllowed> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> + <!-- reply --> + <h:commandLink id="replyTopicBelow" action="#{replyTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:param name="t" value="#{topic.topic.id}"/> <f:verbatim> @@ -530,12 +550,13 @@ alt="${resource.Topic_locked}" /> </f:verbatim> </h:commandLink> - + </forums:isAllowed> </c:when> - <c:otherwise> - - <h:commandLink action="#{newTopic.start}" style="text-decoration: none;"> + <c:otherwise> + <!-- new topic --> + <forums:isAllowed fragment="acl://newTopic" contextData="#{topic.topic.forum}"> + <h:commandLink id="newTopicBelow" action="#{newTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:verbatim> <img border="0" @@ -543,7 +564,10 @@ alt="${resource.Post_new_topic}"/> </f:verbatim> </h:commandLink> - <h:commandLink action="#{replyTopic.start}" style="text-decoration: none;"> + </forums:isAllowed> + <!-- reply --> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> + <h:commandLink id="replyTopicBelow" action="#{replyTopic.start}" style="text-decoration: none;"> <f:param name="f" value="#{topic.topic.forum.id}"/> <f:param name="t" value="#{topic.topic.id}"/> <f:verbatim> @@ -551,15 +575,15 @@ src="#{forums:themeURL('resourceReplyNewURL')}" alt="${resource.Reply_to_topic}" /> </f:verbatim> - </h:commandLink> - + </h:commandLink> + </forums:isAllowed> </c:otherwise> </c:choose> - <br /> - </td> + + </td> - <td align="left" valign="middle" class="nav" width="100%"> + <td align="left" valign="middle" class="nav" width="100%"> &nbsp;&nbsp;&nbsp; <h:outputLink value="#{forums:outputLink(shared.links['category'],true)}" styleClass="nav"> @@ -661,9 +685,9 @@ <br/> </td> --> - - <!-- instant reply widget --> - <!-- TODO: security check needed here to check if "replying" to this topic is allowed --> + + <!-- instant reply widget --> + <forums:isAllowed fragment="acl://reply" contextData="#{topic.topic}"> <script language='JavaScript' type='text/javascript'> function checkForm() { @@ -705,6 +729,7 @@ </span> </h:form> </td> + </forums:isAllowed> <!-- integrate jumpbox here --> <td align="right" valign="top" nowrap="nowrap"> <ui:include src="/views/jumpbox.xhtml"/> @@ -739,6 +764,8 @@ </td> </tr> </table> + </forums:isAllowed> + </forums:isAllowed> </c:when> <c:otherwise> <table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0"> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_ballot.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_ballot.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_ballot.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -47,11 +47,13 @@ <td align="center"> <table cellspacing="0" cellpadding="2" border="0"> <c:forEach items="#{poll.options}" var="optionrow" varStatus="status"> - <tr> + <tr> + <forums:isAllowed fragment="acl://votePoll" contextData="#{poll}"> <td> <input type="radio" name="vote" value="#{(status.index)-1}"/> &nbsp; </td> + </forums:isAllowed> <td> <span class="gen">#{optionrow.question}</span> </td> @@ -59,12 +61,14 @@ </c:forEach> </table> </td> - </tr> + </tr> + <forums:isAllowed fragment="acl://votePoll" contextData="#{poll}"> <tr> <td align="center"> <h:commandButton action="#{pollController.vote}" value="${resource.Submit_vote}" styleClass="liteoption"/> </td> </tr> + </forums:isAllowed> <tr> <td align="center"><span class="gensmall"> <b> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml 2006-05-26 18:11:29 UTC (rev 4451) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_poll_result.xhtml 2006-05-27 01:27:09 UTC (rev 4452) @@ -87,7 +87,8 @@ <td colspan="4" align="center"> <span class="gen"><b>${resource.Total_votes} : #{poll.votesSum}</b></span> </td> - </tr> + </tr> + <forums:isAllowed fragment="acl://votePoll" contextData="#{poll}"> <!-- switch back to the voting screen --> <tr> <td align="center"><span class="gensmall"> @@ -101,6 +102,7 @@ </span> </td> </tr> + </forums:isAllowed> </table> </td> </tr> |
From: <jbo...@li...> - 2006-05-26 18:11:35
|
Author: adamw Date: 2006-05-26 14:11:29 -0400 (Fri, 26 May 2006) New Revision: 4451 Removed: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/web/FilesFromRepoFilter.java labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/jboss-web.xml Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-36 Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/web/FilesFromRepoFilter.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/web/FilesFromRepoFilter.java 2006-05-26 17:46:03 UTC (rev 4450) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/web/FilesFromRepoFilter.java 2006-05-26 18:11:29 UTC (rev 4451) @@ -16,7 +16,7 @@ * A filter for reading JSP (and html, text etc) files from a file repository * and including them in the response. * - * @author adamw + * @author Adam Warski (ad...@as...) * @author Tomasz Szymanski */ public class FilesFromRepoFilter implements Filter { Deleted: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old 2006-05-26 17:46:03 UTC (rev 4450) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old 2006-05-26 18:11:29 UTC (rev 4451) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<deployments> - <deployment> - <if-exists>overwrite</if-exists> - <instance> - <instance-name>FeedsPortletInstance</instance-name> - <component-ref>feeds.FeedsPortlet</component-ref> - </instance> - </deployment> -</deployments> \ No newline at end of file Modified: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/jboss-web.xml =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/jboss-web.xml 2006-05-26 17:46:03 UTC (rev 4450) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/jboss-web.xml 2006-05-26 18:11:29 UTC (rev 4451) @@ -1,3 +1,4 @@ <?xml version="1.0"?> <jboss-web> + <context-root>feeds</context-root> </jboss-web> Deleted: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old 2006-05-26 17:46:03 UTC (rev 4450) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old 2006-05-26 18:11:29 UTC (rev 4451) @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" - version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> - <portlet> - <description>Forge feeds portlet</description> - <portlet-name>FeedsPortlet</portlet-name> - <display-name>Feeds portlet</display-name> - <portlet-class>org.jboss.forge.feeds.FeedsPortlet</portlet-class> - <supports> - <mime-type>text/html</mime-type> - <portlet-mode>VIEW</portlet-mode> - </supports> - <portlet-info> - <title>Feeds</title> - </portlet-info> - </portlet> - </portlet-app> |
From: <jbo...@li...> - 2006-05-26 17:46:11
|
Author: adamw Date: 2006-05-26 13:46:03 -0400 (Fri, 26 May 2006) New Revision: 4450 Modified: labs/jbosslabs/trunk/portal-extensions/svn-hooks/xml-check.sh Log: http://jira.jboss.com/jira/browse/JBLAB-684 Modified: labs/jbosslabs/trunk/portal-extensions/svn-hooks/xml-check.sh =================================================================== --- labs/jbosslabs/trunk/portal-extensions/svn-hooks/xml-check.sh 2006-05-26 17:16:21 UTC (rev 4449) +++ labs/jbosslabs/trunk/portal-extensions/svn-hooks/xml-check.sh 2006-05-26 17:46:03 UTC (rev 4450) @@ -17,7 +17,7 @@ type=$token else # Only checking a file if it wasn't deleted and is an .xml file - if [ "$type" != "D" -a -n "`echo $token | grep .*\.xml`" ] + if [ "$type" != "D" -a -n "`echo $token | grep .*[.]xml$`" ] then $SVNLOOK cat $OPTS $REPOS $token | xmllint - >/dev/null || { echo "Error parsing XML; aborting commit." >&2 |
From: <jbo...@li...> - 2006-05-26 17:16:24
|
Author: adamw Date: 2006-05-26 13:16:21 -0400 (Fri, 26 May 2006) New Revision: 4449 Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuResourceWatcher.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-83 Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuResourceWatcher.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuResourceWatcher.java 2006-05-26 17:05:40 UTC (rev 4448) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/cache/ShotokuResourceWatcher.java 2006-05-26 17:16:21 UTC (rev 4449) @@ -48,13 +48,17 @@ return ret; } - public ShotokuResourceWatcher() { - super(); + public ShotokuResourceWatcher(long interval) { + super(interval); allStatuses = new ConcurrentHashMap<K, ConcurrentMap<String, ResourceStatus>>(); } + public ShotokuResourceWatcher() { + this(0); + } + /** * Adds a path to the watched resources. * @param key |
From: <jbo...@li...> - 2006-05-26 17:05:46
|
Author: adamw Date: 2006-05-26 13:05:40 -0400 (Fri, 26 May 2006) New Revision: 4448 Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java Log: http://jira.jboss.com/jira/browse/JBLAB-676 Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2006-05-26 15:37:20 UTC (rev 4447) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2006-05-26 17:05:40 UTC (rev 4448) @@ -145,10 +145,12 @@ */ public static String getSelectedProjectId(JBossRenderRequest request, boolean withDefault) { - String projectId = ForgeHelper.getRequestParameter(request, - PROJECT_URL_PARAM); - - if ((withDefault) && ((projectId == null) || ("".equals(projectId)))) { + //String projectId = ForgeHelper.getRequestParameter(request, + // PROJECT_URL_PARAM); + Object projectIdObj = request.getAttribute(PROJECT_URL_PARAM); + String projectId = projectIdObj == null ? null : projectIdObj.toString(); + + if ((withDefault) && ((projectId == null) || ("".equals(projectId)))) { projectId = DEFAULT_PROJECT; } else if ((!withDefault) && (DEFAULT_PROJECT.equals(projectId))) { projectId = null; |
From: <jbo...@li...> - 2006-05-26 15:37:27
|
Author: kev...@jb... Date: 2006-05-26 11:37:20 -0400 (Fri, 26 May 2006) New Revision: 4447 Added: labs/jbosstm/tags/JBOSSTS_4_2_1_BETA/ Log: first cut of 4.2.1 beta Copied: labs/jbosstm/tags/JBOSSTS_4_2_1_BETA (from rev 4446, labs/jbosstm/trunk) |
From: <jbo...@li...> - 2006-05-26 14:54:26
|
Author: kev...@jb... Date: 2006-05-26 10:54:20 -0400 (Fri, 26 May 2006) New Revision: 4445 Modified: labs/jbosstm/trunk/ArjunaJTS/INSTALL Log: updated INSTALL Modified: labs/jbosstm/trunk/ArjunaJTS/INSTALL =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/INSTALL 2006-05-26 14:52:19 UTC (rev 4444) +++ labs/jbosstm/trunk/ArjunaJTS/INSTALL 2006-05-26 14:54:20 UTC (rev 4445) @@ -60,7 +60,7 @@ <!-- JBoss TS interceptor --> <initializer>com.arjuna.ats.jts.orbspecific.jacorb.interceptors.interposition.InterpositionORBInitializerImpl</initializer> -Replace jacorb.jar in client/lib and server/all/lib with the jacorb.jar located http://labs.jboss.com/file-access/default/members/jbosstm/downloads/4.2/binary/jacorb_2_2_1_patch.zip +Replace jacorb.jar in client/lib and server/all/lib with the jacorb.jar located in the jacorb directory. For each deployment of JacORB, you will need to ensure that the jacorb.implname in the jacorb.properties file is unique. @@ -76,4 +76,4 @@ (ii) when running the local JTS transactions part of the trailmap, you will need to start the recovery manager: java com.arjuna.ats.arjuna.recovery.RecoveryManager -test -(iii) you will need a jacorb.properties file to run the distributed JTS tests. \ No newline at end of file +(iii) you will need a jacorb.properties file to run the distributed JTS tests. |
From: <jbo...@li...> - 2006-05-26 14:52:30
|
Author: kev...@jb... Date: 2006-05-26 10:52:19 -0400 (Fri, 26 May 2006) New Revision: 4444 Modified: labs/jbosstm/trunk/ArjunaJTS/trailmap/README.txt Log: modified README Modified: labs/jbosstm/trunk/ArjunaJTS/trailmap/README.txt =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/trailmap/README.txt 2006-05-26 14:44:15 UTC (rev 4443) +++ labs/jbosstm/trunk/ArjunaJTS/trailmap/README.txt 2006-05-26 14:52:19 UTC (rev 4444) @@ -22,10 +22,6 @@ To build the sources files you should follow instructions given below: -- Download the version of JacORB from the JBossTS download page. Place this -in a directory called jacorb_2_1 in the root of your JBossTS installation, i.e., -at the same level as the trailmap directory. - - Ensure you have the Ant build system installed. Ant is a Java build tool, similar to make. It is available for free from http://ant.apache.org/ |
From: <jbo...@li...> - 2006-05-26 14:44:24
|
Author: kev...@jb... Date: 2006-05-26 10:44:15 -0400 (Fri, 26 May 2006) New Revision: 4443 Modified: labs/jbosstm/trunk/ArjunaJTA/jta/build.xml Log: Modify properties to include recovery manager specific settings Modified: labs/jbosstm/trunk/ArjunaJTA/jta/build.xml =================================================================== --- labs/jbosstm/trunk/ArjunaJTA/jta/build.xml 2006-05-26 14:43:08 UTC (rev 4442) +++ labs/jbosstm/trunk/ArjunaJTA/jta/build.xml 2006-05-26 14:44:15 UTC (rev 4443) @@ -62,6 +62,7 @@ <property name="com.hp.mwlabs.ts.jta.propertyfile.tmpl" value="${com.hp.mwlabs.ts.modulename}-properties.xmltmpl"/> <property name="com.hp.mwlabs.ts.jta.propertyfile.src" value="${com.hp.mwlabs.ts.modulename}-properties.xml"/> + <property name="com.hp.mwlabs.ts.jta.recoverymanagerpropertyfile.src" value="RecoveryManager-properties.xml"/> <property name="com.hp.mwlabs.ts.jta.mappingfile" value="${com.hp.mwlabs.ts.modulename}-properties.mappings"/> @@ -278,6 +279,8 @@ <merge-property-files master="${com.hp.mw.propertydirectory}/${com.hp.mwlabs.ts.jta.propertyfile}" merge="${com.hp.mwlabs.ts.jta.etc}/processed-${com.hp.mwlabs.ts.jta.propertyfile.src}"/> + <merge-property-files master="${com.hp.mw.propertydirectory}/${com.hp.mwlabs.ts.jta.propertyfile}" + merge="${com.hp.mwlabs.ts.jta.etc}/default-${com.hp.mwlabs.ts.jta.recoverymanagerpropertyfile.src}"/> </target> |
From: <jbo...@li...> - 2006-05-26 14:43:17
|
Author: kev...@jb... Date: 2006-05-26 10:43:08 -0400 (Fri, 26 May 2006) New Revision: 4442 Modified: labs/jbosstm/trunk/ArjunaCore/build.xml Log: Removed xalan.jar Modified: labs/jbosstm/trunk/ArjunaCore/build.xml =================================================================== --- labs/jbosstm/trunk/ArjunaCore/build.xml 2006-05-26 14:41:56 UTC (rev 4441) +++ labs/jbosstm/trunk/ArjunaCore/build.xml 2006-05-26 14:43:08 UTC (rev 4442) @@ -254,7 +254,6 @@ <exclude name="Readme"/> <exclude name="TestingFramework.jar"/> <exclude name="classes12.jar"/> - <exclude name="xalan.jar"/> </fileset> </copy> <copy todir="${com.hp.mwlabs.installationdirectory}/lib/ext"> |
From: <jbo...@li...> - 2006-05-26 14:42:16
|
Author: kev...@jb... Date: 2006-05-26 10:41:56 -0400 (Fri, 26 May 2006) New Revision: 4441 Removed: labs/jbosstm/trunk/ext/xalan.jar labs/jbosstm/trunk/ext/xercesImpl.jar labs/jbosstm/trunk/ext/xmlParserAPIs.jar Log: Removed extraneous jars Deleted: labs/jbosstm/trunk/ext/xalan.jar =================================================================== (Binary files differ) Deleted: labs/jbosstm/trunk/ext/xercesImpl.jar =================================================================== (Binary files differ) Deleted: labs/jbosstm/trunk/ext/xmlParserAPIs.jar =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2006-05-26 14:40:43
|
Author: kev...@jb... Date: 2006-05-26 10:40:34 -0400 (Fri, 26 May 2006) New Revision: 4440 Modified: labs/jbosstm/trunk/ArjunaJTS/build.xml Log: Added JacORB to install Modified: labs/jbosstm/trunk/ArjunaJTS/build.xml =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/build.xml 2006-05-26 14:39:43 UTC (rev 4439) +++ labs/jbosstm/trunk/ArjunaJTS/build.xml 2006-05-26 14:40:34 UTC (rev 4440) @@ -228,6 +228,7 @@ depends="com.hp.mw.ts.product.install, com.hp.mwlabs.ts.product.htdocs.install, com.hp.mwlabs.ts.product.docs.install, + com.hp.mwlabs.ts.product.jacorb.install, com.hp.mwlabs.ts.product.trailmap.install"/> <target name="com.hp.mwlabs.ts.product.htdocs.install" depends="com.hp.mw.ts.product.htdocs" if="com.hp.mwlabs.ts.build.jts"> @@ -328,6 +329,16 @@ </copy> </target> + <target name="com.hp.mwlabs.ts.product.jacorb.install"> + <echo message="Installing JacORB"/> + + <mkdir dir="${com.hp.mwlabs.installationdirectory}/jacorb"/> + + <copy todir="${com.hp.mwlabs.installationdirectory}/jacorb"> + <fileset dir="jacorb"/> + </copy> + </target> + <target name="com.hp.mw.ts.product.clean" depends="com.hp.mwlabs.ts.product.orbportability.clean, com.hp.mwlabs.ts.product.jts.clean, |
From: <jbo...@li...> - 2006-05-26 14:39:49
|
Author: kev...@jb... Date: 2006-05-26 10:39:43 -0400 (Fri, 26 May 2006) New Revision: 4439 Modified: labs/jbosstm/trunk/ArjunaJTS/trailmap/build.xml labs/jbosstm/trunk/ArjunaJTS/trailmap/docs/part1.xml Log: Updated trailmap Modified: labs/jbosstm/trunk/ArjunaJTS/trailmap/build.xml =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/trailmap/build.xml 2006-05-26 14:38:43 UTC (rev 4438) +++ labs/jbosstm/trunk/ArjunaJTS/trailmap/build.xml 2006-05-26 14:39:43 UTC (rev 4439) @@ -34,7 +34,7 @@ <project name="ArjunaTS_TrailMap" default="buildjar" basedir="."> <!-- Where the transaction has been installed to, this should not need changing by default --> - <property name="arjunahome" value=".."/> + <property name="jbosstshome" value=".."/> <!-- This source code directory for the trailmap --> <property name="src" value="src"/> @@ -46,10 +46,10 @@ <property name="lib" value="lib"/> <!-- The location of JacORB to use. This should not need changing unless a different version of JacORB is used --> - <property name="jacorb-home" value="${arjunahome}/jacorb_2_1"/> + <property name="jacorb-home" value="${jbosstshome}/jacorb"/> <!-- The location of the Arjuna IDL files used by the JTS --> - <property name="arjuna-include" value="${arjunahome}/idl"/> + <property name="jbossts-include" value="${jbosstshome}/idl"/> <!-- The include files required by JacORB --> <property name="jacorb-include" value="${jacorb-home}/idl/omg"/> @@ -60,7 +60,7 @@ ensure that the code has already been built. --> <target name="buildjar" depends="compile"> - <jar basedir="${build}" jarfile="${lib}/arjunats-demo.jar"/> + <jar basedir="${build}" jarfile="${lib}/jbossts-demo.jar"/> </target> @@ -71,8 +71,8 @@ <target name="compile" depends="idl"> <javac srcdir="${src}" destdir="${build}"> <classpath> - <fileset dir="${arjunahome}/lib" includes="*.jar"/> - <fileset dir="${arjunahome}/lib/ext" includes="*.jar"/> + <fileset dir="${jbosstshome}/lib" includes="*.jar"/> + <fileset dir="${jbosstshome}/lib/ext" includes="*.jar"/> <fileset dir="${jacorb-home}/lib" includes="*.jar"/> </classpath> </javac> @@ -90,7 +90,7 @@ <classpath> <fileset dir="${jacorb-home}/lib" includes="*.jar"/> </classpath> - <arg value="-I${arjuna-include}"/> + <arg value="-I${jbossts-include}"/> <arg value="-I${jacorb-include}"/> <arg line="-d ${src}/generated"/> <arg value="${src}/com/arjuna/demo/simple/Hello.idl"/> @@ -101,7 +101,7 @@ <classpath> <fileset dir="${jacorb-home}/lib" includes="*.jar"/> </classpath> - <arg value="-I${arjuna-include}"/> + <arg value="-I${jbossts-include}"/> <arg value="-I${jacorb-include}"/> <arg line="-d ${src}/generated"/> <arg value="${src}/com/arjuna/demo/jts/remotebank/Bank.idl"/> @@ -112,7 +112,7 @@ <classpath> <fileset dir="${jacorb-home}/lib" includes="*.jar"/> </classpath> - <arg value="-I${arjuna-include}"/> + <arg value="-I${jbossts-include}"/> <arg value="-I${jacorb-include}"/> <arg line="-d ${src}/generated"/> <arg value="${src}/com/arjuna/demo/jts/explicitremotebank/Bank.idl"/> @@ -123,7 +123,7 @@ <classpath> <fileset dir="${jacorb-home}/lib" includes="*.jar"/> </classpath> - <arg value="-I${arjuna-include}"/> + <arg value="-I${jbossts-include}"/> <arg value="-I${jacorb-include}"/> <arg line="-d ${src}/generated"/> <arg value="${src}/com/arjuna/demo/jts/txojbank/Bank.idl"/> Modified: labs/jbosstm/trunk/ArjunaJTS/trailmap/docs/part1.xml =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/trailmap/docs/part1.xml 2006-05-26 14:38:43 UTC (rev 4438) +++ labs/jbosstm/trunk/ArjunaJTS/trailmap/docs/part1.xml 2006-05-26 14:39:43 UTC (rev 4439) @@ -61,7 +61,7 @@ to running any applications. </li> <li> - <font face="Courier New,Courier">/jacorb_2_1</font>: If the jacorb installation has been selected during the installation, this directory contains the jacorb distribution. + <font face="Courier New,Courier">/jacorb</font>: This directory contains the jacorb distribution. </li> <li> <font face="Courier New,Courier">/lib</font>: this directory contains the @@ -98,7 +98,7 @@ the directory <font face="Courier New, Courier, mono"><arjunats_install_root>/trail_map/lib</font> </li> <li>Add the generated jar file to the CLASSPATH environment variable.</li> - <li>Ensure that the jacorb (version 2.1) jar files are added in your CLASSPATH. <br/> + <li>Ensure that the jacorb (version 2.2.2) jar files are added in your CLASSPATH. <br/> <b>Ensure that ArjunaTS jar files appear before jacorb jar files. </b></li> </ul> <ul> |
From: <jbo...@li...> - 2006-05-26 14:38:48
|
Author: kev...@jb... Date: 2006-05-26 10:38:43 -0400 (Fri, 26 May 2006) New Revision: 4438 Added: labs/jbosstm/trunk/ArjunaJTS/jacorb/idl/build.xml Log: Added build.xml Added: labs/jbosstm/trunk/ArjunaJTS/jacorb/idl/build.xml =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/jacorb/idl/build.xml 2006-05-26 14:37:46 UTC (rev 4437) +++ labs/jbosstm/trunk/ArjunaJTS/jacorb/idl/build.xml 2006-05-26 14:38:43 UTC (rev 4438) @@ -0,0 +1,730 @@ +<?xml version="1.0"?> + +<!DOCTYPE project [ <!ENTITY common SYSTEM "file:../etc/common.xml"> ]> + +<project name="idl" default="all" basedir=".."> + + <!-- ==================================================== --> + <!-- JacORB idl build file --> + <!-- $Id: build.xml,v 1.50 2004/10/21 14:40:29 francisco Exp $ --> + <!-- ==================================================== --> + + &common; + + <!-- top-level targets --> + + <target name="all" + depends="corba,names,security,events,transactions,concurrency,collections,trading,jacorb,notification" /> + + <target name="services" + depends="events,trading,collections,transactions,concurrency" /> + + + <!-- ==================================================== --> + <!-- CORBA --> + <!-- ==================================================== --> + + <target name="corba" + depends="orb,sysex,dynany,portableserver,iop,rtcorba,etf,iiop,giop,conf,messaging,interceptor,compile"/> + + <target name="compile"> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CORBA/**/*.java,org/omg/DynamicAny/**/*.java"/> + </antcall> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CORBA_2_3/**/*.java,org/omg/CORBA_2_5/**/*.java,org/omg/IOP/**/*.java,org/omg/RTCORBA/**/*.java,org/omg/ETF/**/*.java,org/omg/GIOP/**/*.java,org/omg/IIOP/**/*.java,org/omg/CONV_FRAME/**/*.java,org/omg/Dynamic/**/*.java"/> + </antcall> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/Messaging/**/*.java,org/omg/PortableInterceptor/**/*.java"/> + </antcall> + </target> + + + <!-- standard classes defined by the IDL language mapping --> + <!-- are copied from a directory containing OMG-provided files --> + + <target name="orb" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="omg/Corba.idl" + destdir="${src}/generated"/> + + <delete file="${src}/generated/org/omg/CORBA/Policy.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCode.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodeHelper.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodeHolder.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodePOA.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodePOATie.java"/> + <delete file="${src}/generated/org/omg/CORBA/_TypeCodeStub.java"/> + <delete file="${src}/generated/org/omg/CORBA/PolicyOperations.java"/> + <!-- interface ORB is defined in _orb.idl to provide the wrapping --> + <!-- for the exceptions InvalidName and InvalidTypeCode. Deleting --> + <!-- this here to avoid confusing the compiler. --> + <delete> + <fileset dir="${src}/generated/org/omg/CORBA" + includes="ORB*,_ORBStub.java" /> + </delete> + + <mkdir dir="${src}/generated/org"/> + + <copy todir="${src}/generated"> + <fileset dir="${src}/omg-02-01-02"> + <include name="**/*.java"/> + </fileset> + </copy> + + <delete file="${src}/generated/org/omg/CORBA/ORB.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodePackage/BadKindHolder.java"/> + <delete file="${src}/generated/org/omg/CORBA/TypeCodePackage/BoundsHolder.java"/> + + <copy file="${src}/java_mapping/CORBA/ORB.java" + tofile="${src}/generated/org/omg/CORBA/ORB.java" + /> + <copy file="${src}/java_mapping/CORBA/Any.java" + tofile="${src}/generated/org/omg/CORBA/Any.java" + /> + <copy file="${src}/java_mapping/CORBA/LocalObject.java" + tofile="${src}/generated/org/omg/CORBA/LocalObject.java" + /> + <copy file="${src}/java_mapping/CORBA/ORBPackage/InvalidNameHelper.java" + tofile="${src}/generated/org/omg/CORBA/ORBPackage/InvalidNameHelper.java" + /> + <copy file="${src}/java_mapping/CORBA/ORBPackage/ObjectIdHelper.java" + tofile="${src}/generated/org/omg/CORBA/ORBPackage/ObjectIdHelper.java" + /> + <copy file="${src}/java_mapping/CORBA/ORBPackage/ObjectIdListHelper.java" + tofile="${src}/generated/org/omg/CORBA/ORBPackage/ObjectIdListHelper.java" + /> + <copy file="${src}/java_mapping/CORBA/ORBPackage/ObjectIdListHolder.java" + tofile="${src}/generated/org/omg/CORBA/ORBPackage/ObjectIdListHolder.java" + /> + <copy file="${src}/java_mapping/CORBA/FixedHolder.java" + tofile="${src}/generated/org/omg/CORBA/FixedHolder.java" + /> + <copy file="${src}/java_mapping/CORBA/SetOverrideType.java" + tofile="${src}/generated/org/omg/CORBA/SetOverrideType.java" + overwrite="yes" + /> + <copy file="${src}/java_mapping/CORBA/TRANSACTION_MODE.java" + tofile="${src}/generated/org/omg/CORBA/TRANSACTION_MODE.java" + /> + <copy file="${src}/java_mapping/CORBA/TRANSACTION_UNAVAILABLE.java" + tofile="${src}/generated/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java" + /> + <copy file="${src}/java_mapping/CORBA/CODESET_INCOMPATIBLE.java" + tofile="${src}/generated/org/omg/CORBA/CODESET_INCOMPATIBLE.java" + /> + </target> + + + <!-- System Exceptions are generated separately to obtain their Helper --> + <!-- classes. The Exception classes and Holder classes are discarded. --> + + <target name="sysex" depends="init,load-taskdef"> + <mkdir dir="${src}/generated/temp"/> + + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SystemException.idl" + destdir="${src}/generated/temp"/> + + <copy todir="${src}/generated" overwrite="yes"> + <fileset dir="${src}/generated/temp"> + <include name="**/CompletionStatus*.java"/> + <include name="**/*Helper.java"/> + </fileset> + </copy> + + <delete dir="${src}/generated/temp"/> + + <copy file="${src}/java_mapping/CORBA/SystemExceptionHelper.java" + todir="${src}/generated/org/omg/CORBA" + /> + </target> + + + <!-- the remaining OMG classes are generated by compiling --> + <!-- their original IDL definitions --> + + <target name="iop" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/IOP.idl" + destdir="${src}/generated" + /> + </target> + + <target name="rtcorba" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/RTCORBA.idl" + destdir="${src}/generated" + /> + </target> + + <target name="etf" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/ETF.idl" + destdir="${src}/generated" + /> + </target> + + <target name="iiop" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/IIOP.idl" + destdir="${src}/generated" + /> + </target> + + <target name="giop" depends="init,load-taskdef"> + <!-- Compile two times with different preprocessor flags set, so structs --> + <!-- for both GIOP 1.0 / 1.1 and GIOP 1.2 get generated --> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/GIOP.idl" + destdir="${src}/generated"> + <define key="GIOP_1_1" value=""/> + </jacidl> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/GIOP.idl" + destdir="${src}/generated"> + <define key="GIOP_1_2" value=""/> + </jacidl> + </target> + + <target name="conf" depends="init,load-taskdef"> + <jacidl generateir="true" + noskel="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CONV_FRAME.idl" + destdir="${src}/generated"/> + </target> + + <target name="messaging" depends="init,load-taskdef"> + <jacidl generateir="true" + noskel="true" + nostub="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/Messaging.idl" + destdir="${src}/generated"/> + </target> + + <target name="interceptor" depends="time,messaging"> + <jacidl generateir="true" + noskel="true" + nostub="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/Dynamic.idl,**/omg/PortableInterceptor.idl" + destdir="${src}/generated"/> + </target> + + <target name="portableserver" depends="init,load-taskdef"> + <delete + file="${src}/generated/org/omg/PortableServer/POAOperations.java"/> + <delete + file="${src}/generated/org/omg/PortableServer/POA.java"/> + <delete + file="${src}/generated/org/omg/PortableServer/POAManagerPackage/State.java"/> + <delete + file="${src}/generated/org/omg/PortableServer/CurrentOperations.java"/> + + <jacidl generateir="true" + noskel="true" + srcdir="idl" + omgprefix="true" + forceOverwrite="true" + includepath="${idl}/omg" + includes="omg/PortableServer.idl" + destdir="${src}/generated"/> + + + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + forceOverwrite="true" + includepath="${idl}/omg" + includes="**/omg/BiDirPolicy.idl" + destdir="${src}/generated"/> + + <copy overwrite="yes" file="${src}/java_mapping/PortableServer/_ServantLocatorLocalBase.java" + tofile="${src}/generated/org/omg/PortableServer/_ServantLocatorLocalBase.java"/> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/PortableServer/**/*.java,org/omg/BiDirPolicy/**/*.java"/> + </antcall> + </target> + + + <target name="dynany"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/DynamicAny.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/DynamicAny/**"/> + </antcall> + </target> + + <!-- ==================================================== --> + <!-- OMG Object services --> + <!-- ==================================================== --> + + <!-- name service --> + + <target name="names" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosNaming.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosNaming/**/*.java,org/omg/CosNaming/*.java"/> + </antcall> + </target> + + <!-- --> + <!-- event service --> + <!-- --> + + <target name="events" depends="init,load-taskdef,comm,admin"> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosEventChannelAdmin/**,org/omg/CosEventComm/**"/> + </antcall> + </target> + + <target name="admin"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="omg/CosEventChannelAdmin.idl" + destdir="${src}/generated"/> + </target> + + <target name="comm"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="omg/CosEventComm.idl" + destdir="${src}/generated"/> + </target> + + <!-- --> + <!-- transaction service --> + <!-- --> + + <target name="transactions" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTransactions.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosTransactions/**/*.java,org/omg/CosTransactions/*.java"/> + </antcall> + </target> + + <!-- --> + <!-- collection service --> + <!-- --> + + + <target name="collections" depends="init,load-taskdef"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosCollection.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosCollection/Istring*.java,org/omg/CosCollection/NVPair*.java,org/omg/CosCollection/ParameterList*.java,org/omg/CosCollection/AnySequence*.java,org/omg/CosCollection/_Operations*.java,org/omg/CosCollection/Operations*.java,org/omg/CosCollection/*Invalid*.java,org/omg/CosCollection/*Reason*.java,org/omg/CosCollection/*EmptyCollection*.java,org/omg/CosCollection/*Com*.java,org/omg/CosCollection/Iterator*.java,org/omg/CosCollection/_Iterator*.java, org/omg/CosCollection/Collection*.java, org/omg/CosCollection/_Collection*.java"/> + </antcall> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosCollection/Istring*.java,org/omg/CosCollection/NVPain*.java, org/omg/CosCollection/_Collection*.java"/> + <param name="javac-excludes" value="org/omg/CosCollection/Iterator*.java,org/omg/CosCollection/_Iterator*.java"/> + </antcall> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosCollection/*Operations*.java, org/omg/CosCollection/Collection*.java, org/omg/CosCollection/*Heap*.java, org/omg/CosCollection/*RestrictedAccessCollection*.java, org/omg/CosCollection/*Deque*.java, org/omg/CosCollection/*Queue*.java,org/omg/CosCollection/*Stack*.java,org/omg/CosCollection/*PriorityQueue*.java,org/omg/CosCollection/*CollectionFactor*.java, org/omg/CosCollection/*OrderedCollection*.java, org/omg/CosCollection/*SequentialCollection*.java, org/omg/CosCollection/*CSequence*.java"/> + <param name="javac-excludes" value="org/omg/CosCollection/*Relation*.java, org/omg/CosCollection/*Bag*.java, org/omg/CosCollection/*EqualitySequen*.java, org/omg/CosCollection/*Map*.java,org/omg/CosCollection/*Set*.java, org/omg/CosCollection/*Key*.java"/> + </antcall> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosCollection/*EqualitySequence*.java,org/omg/CosCollection/*Collection*.java"/> + <param name="javac-excludes" value="org/omg/CosCollection/*Bag*.java, org/omg/CosCollection/*Factor*.java, org/omg/CosCollection/*Key*.java, org/omg/CosCollection/*Set*.java"/> + </antcall> + + <antcall target="jacorb-javac"> + <param name="javac-includes" value="org/omg/CosCollection/*Bag*.java, org/omg/CosCollection/*Map*.java,org/omg/CosCollection/*Set*.java, org/omg/CosCollection/*Key*.java"/> + <param name="javac-excludes" value="org/omg/CosCollection/*Factor*.java,org/omg/CosCollection/*Relation*.java"/> + </antcall> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosCollection/*Factor*.java,org/omg/CosCollection/*Relation*.java"/> + </antcall> + </target> + + <!-- --> + <!-- concurrency service --> + <!-- --> + + <target name="concurrency"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosConcurrencyControl.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosConcurrencyControl/**/*.java,org/omg/CosConcurrencyControl/*.java"/> + </antcall> + </target> + + <!-- --> + <!-- trading service --> + <!-- --> + + <target name="trading" depends="init,load-taskdef,basic,repository,dynamic"> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CosTrading/**,org/omg/CosTradingDynamic/**,org/omg/CosTradingRepos/**"/> + </antcall> + </target> + + <target name="basic"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTrading.idl" + destdir="${src}/generated"/> + </target> + + <target name="repository"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTradingRepos.idl" + destdir="${src}/generated"/> + </target> + + <target name="dynamic"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTradingDynamic.idl" + destdir="${src}/generated"/> + </target> + + <!-- --> + <!-- Notification service --> + <!-- --> + + <target name="notification" + depends="init,load-taskdef,notif,typed" + description="Compile Notification Service IDL"> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" + value="org/omg/CosNotification/*.java,org/omg/CosNotify**/*.java,org/omg/CosTyped*/**/*.java"/> + </antcall> + </target> + + <target name="notif"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosNotification.idl,**/omg/CosNotifyChannelAdmin.idl" + destdir="${src}/generated"/> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosNotifyComm.idl,**/omg/CosNotifyFilter.idl" + destdir="${src}/generated"/> + <jacidl + srcdir="${idl}/jacorb" + includepath="${idl}/omg" + includes="notification.idl" + destdir="${src}/generated" /> + </target> + + <target name="typed"> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTypedNotifyChannelAdmin.idl" + destdir="${src}/generated"/> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTypedNotifyComm.idl" + destdir="${src}/generated"/> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTypedEventChannelAdmin.idl" + destdir="${src}/generated"/> + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CosTypedEventComm.idl" + destdir="${src}/generated"/> + </target> + + + <!-- --> + <!-- security service --> + <!-- --> + + <target name="security" + depends="init,load-taskdef,time,secbasic,level1,level2,secadmin,replaceable,ssliop,csi"> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/TimeBase/**,org/omg/Security/**,org/omg/Security**/**,org/omg/SSLIOP/**"/> + </antcall> + </target> + + <target name="secbasic"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/Security.idl" + destdir="${src}/generated"/> + </target> + + <target name="time"> + <jacidl generateir="true" + noskel="true" + nostub="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/TimeBase.idl" + destdir="${src}/generated"/> + </target> + + <target name="level1"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SecurityLevel1.idl" + destdir="${src}/generated"/> + </target> + + <target name="level2"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SecurityLevel2.idl" + destdir="${src}/generated"/> + </target> + + <target name="secadmin"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SecurityAdmin.idl" + destdir="${src}/generated"/> + </target> + + <target name="replaceable"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SecurityReplaceable.idl" + destdir="${src}/generated"/> + </target> + + <target name="ssliop"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/SSLIOP.idl" + destdir="${src}/generated"/> + </target> + + <!-- --> + <!-- CSI v2 --> + <!-- --> + + <target name="csi"> + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CSI.idl" + destdir="${src}/generated"/> + + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/CSIIOP.idl" + destdir="${src}/generated"/> + + <jacidl generateir="true" + srcdir="idl" + noskel="true" + nostub="true" + sloppynames="true" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/GSSUP.idl" + destdir="${src}/generated"/> + + <jacidl generateir="true" + srcdir="idl" + omgprefix="true" + includepath="${idl}/omg" + includes="**/omg/ATLAS.idl" + destdir="${src}/generated"/> + + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/omg/CSI/**,org/omg/CSIIOP/**,org/omg/GSSUP/**,org/omg/ATLAS/**"/> + </antcall> + </target> + + <!-- ==================================================== --> + <!-- CORBA --> + <!-- ==================================================== --> + + <target name="jacorb" depends="imr,proxy,sasPolicy,sslPolicy"/> + + <target name="imr"> + <jacidl srcdir="${idl}/jacorb" + destdir="${src}/generated" + includepath="${idl}/omg" + includes="imr.idl"/> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/jacorb/imr/*.java,org/jacorb/imr/*.java"/> + </antcall> + </target> + + + <target name="proxy"> + <jacidl srcdir="${idl}/jacorb" + destdir="${src}/generated" + sloppynames="true" + includepath="${idl}/omg" + includes="Proxy.idl"/> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/jacorb/proxy/**"/> + </antcall> + </target> + + + <target name="sasPolicy"> + <jacidl srcdir="${idl}/jacorb" + destdir="${src}/generated" + sloppynames="true" + includepath="${idl}/omg" + includes="SASPolicy.idl"/> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/jacorb/sasPolicy/**"/> + </antcall> + </target> + + <target name="sslPolicy"> + <jacidl srcdir="${idl}/jacorb" + destdir="${src}/generated" + sloppynames="true" + includepath="${idl}/omg" + includes="SSLPolicy.idl"/> + <antcall target="jacorb-javac"> + <param name="javac-src" value="${src}/generated"/> + <param name="javac-includes" value="org/jacorb/ssl/**"/> + </antcall> + </target> + +</project> |
From: <jbo...@li...> - 2006-05-26 14:37:49
|
Author: kev...@jb... Date: 2006-05-26 10:37:46 -0400 (Fri, 26 May 2006) New Revision: 4437 Modified: labs/jbosstm/trunk/ArjunaJTS/jacorb/README Log: updated README Modified: labs/jbosstm/trunk/ArjunaJTS/jacorb/README =================================================================== --- labs/jbosstm/trunk/ArjunaJTS/jacorb/README 2006-05-26 14:27:11 UTC (rev 4436) +++ labs/jbosstm/trunk/ArjunaJTS/jacorb/README 2006-05-26 14:37:46 UTC (rev 4437) @@ -1,4 +1,4 @@ This directory contains an extract of the JacORB 2.2.2 distribution. -These files are only used for building orb specific code and are not shipped -as part of the product. +These files are used for building orb specific code and running the +product standalone. |
From: <jbo...@li...> - 2006-05-26 13:43:15
|
Author: szimano Date: 2006-05-26 09:43:10 -0400 (Fri, 26 May 2006) New Revision: 4435 Added: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jsp/ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jsp/normal.jsp Log: freezone tagme jsp JBLAB-674 Added: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jsp/normal.jsp =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jsp/normal.jsp 2006-05-26 13:42:15 UTC (rev 4434) +++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/web/WEB-INF/jsp/normal.jsp 2006-05-26 13:43:10 UTC (rev 4435) @@ -0,0 +1,22 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<%@ page language="java" + extends="org.jboss.portal.core.servlet.jsp.PortalJsp"%> +<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="n"%> +<%@ taglib uri="/WEB-INF/tld/forge.tld" prefix="forge"%> +<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> +<%@ page isELIgnored="false"%> +<portlet:defineObjects /> + +<div id="<%=(String)renderRequest.getAttribute("TAGME_PATH")%>"> + +<forge:tagmeButton div="<%=(String)renderRequest.getAttribute("TAGME_PATH")%>" id="<%=(String)renderRequest.getAttribute("TAGME_PATH")%>" + path="<%=(String)renderRequest.getAttribute("TAGME_PATH")%>" + service="org.jboss.labs.tagme.services.ShotokuTaggingService" + user="<%=(String)renderRequest.getAttribute("TAGME_USER")%>" /> + +</div> + |
From: <jbo...@li...> - 2006-05-26 13:42:30
|
Author: szimano Date: 2006-05-26 09:42:15 -0400 (Fri, 26 May 2006) New Revision: 4434 Modified: labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java Log: freezone JBLAB-674 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-26 13:06:28 UTC (rev 4433) +++ labs/jbosslabs/trunk/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2006-05-26 13:42:15 UTC (rev 4434) @@ -114,7 +114,7 @@ // (possibly) create a new page.ru if (isAllowedToEdit(portalName, request, response)) { response.setContentType(Constants.PAGES_MIME_TYPE); - writeTagmeButton(request, response); + writeTagmeButton(request, response, requestedPath); writeEditLink(portalName, requestedPath, request, response); response.getWriter().println(ERROR_404_MSG); } else { @@ -125,7 +125,7 @@ } response.setContentType(Constants.PAGES_MIME_TYPE); - writeTagmeButton(request, response); + writeTagmeButton(request, response, requestedPath); if (isAllowedToEdit(portalName, request, response)) { writeEditLink(portalName, requestedPath, request, response); Tools.transfer(requestedNode.getContentInputStream(), response @@ -137,11 +137,17 @@ } private void writeTagmeButton(JBossRenderRequest request, - JBossRenderResponse response) throws PortletException, IOException { - PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( - "/WEB-INF/jsp/normal.jsp"); + JBossRenderResponse response, String requestedPath) + throws PortletException, IOException { + if (request.getUser() != null) { + request.setAttribute("TAGME_PATH", requestedPath); + request.setAttribute("TAGME_USER", request.getUser().getUserName()); + + PortletRequestDispatcher rd = getPortletContext() + .getRequestDispatcher("/WEB-INF/jsp/normal.jsp"); - rd.include(request, response); + rd.include(request, response); + } } @SuppressWarnings("unchecked") |