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
|
Author: szimano Date: 2006-05-19 18:05:43 -0400 (Fri, 19 May 2006) New Revision: 4330 Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeClickListener.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagmeSet.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/ShotokuTaggingService.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTagger.java Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html Log: tagme + shotoku Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-19 22:05:43 UTC (rev 4330) @@ -28,8 +28,8 @@ </goal> <goal name="deploy"> - <!--<ant:copy file="target/tagme-servlet.war" toDir="${local.deploy.dir}" />--> - <ant:copy file="target/tagme-servlet.war" toDir="/home/tomek/jboss/park_rozrywki/server/default/deploy" /> + <ant:copy file="target/tagme-servlet.war" toDir="${local.deploy.dir}" /> + <!--<ant:copy file="target/tagme-servlet.war" toDir="/home/tomek/jboss/park_rozrywki/server/default/deploy" />--> </goal> <goal name="clean"> Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -25,6 +25,7 @@ import java.util.Vector; import org.jboss.labs.tagme.gwt.client.TaggingService; +import org.jboss.labs.tagme.services.TagMeTagger; import org.jboss.logging.Logger; import com.google.gwt.user.server.rpc.RemoteServiceServlet; @@ -37,20 +38,49 @@ */ private static final long serialVersionUID = 1L; - public Vector getTags(String path) { - Vector vect = new Vector(); + public Vector getTags(String path, String clas) { + Vector vect = null; - vect.add("piwo"); vect.add("wodka"); vect.add("kefir"); + /*vect.add("piwo"); vect.add("wodka"); vect.add("kefir"); vect.add("słoń"); vect.add("kulfon"); vect.add("kret"); - vect.add("polska"); vect.add("europa"); vect.add("świat"); + vect.add("polska"); vect.add("europa"); vect.add("świat");*/ - Collections.sort(vect); + try { + TagMeTagger tagger = (TagMeTagger)Class.forName(clas).newInstance(); + + vect = tagger.getTags(path); + + Collections.sort(vect); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return vect; } - public void addTag(String user, String path, String tag) { - + public void addTag(String user, String path, String clas, String tag) { + try { + TagMeTagger tagger = (TagMeTagger)Class.forName(clas).newInstance(); + + tagger.addTag(user, path, tag); + log.info("Tag added: User: "+user+" Path: "+path+" Tag: "+tag); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -39,6 +39,18 @@ public class TagMe implements EntryPoint { + private static final String TAG_PREFFIX = "tagMeSet"; + + private static final String DIV_PREFFIX = "tagMeDiv"; + + private static final String PATH_PREFIX = "tagMePath"; + + private static final String USER_PREFIX = "tagMeUser"; + + private static final String CLASS_PREFIX = "tagMeClass"; + + private Vector sets = new Vector(); + /** * Native method in JScript to access gwt:properties (couldn't find anything * in the mans for it) You add this on the page with <meta @@ -49,9 +61,22 @@ * @return value of property */ public static native String getProperty(String name) /*-{ - return parent.__gwt_getMetaProperty(name); + return parent.__gwt_getMetaProperty(name); }-*/; + public static native String getPropertiesUnsplited() /*-{ + var __gwt_all = ''; + + for (var tag in parent.__gwt_metaProps) { + __gwt_all += tag + ';'; + } + return __gwt_all; + }-*/; + + public String[] getPropertyNames() { + return getPropertiesUnsplited().split(";"); + } + /* * (non-Javadoc) * @@ -59,86 +84,43 @@ */ public void onModuleLoad() { // this is executed on the script start + String[] propNames = getPropertyNames(); - RootPanel.get().add(new Button("ClickMe", new ClickListener() { + // find correct props describing where tagme buttons should be placed + for (int i = 0; i < propNames.length; i++) { + //Window.alert(propNames[i]); + if (propNames[i] != null && propNames[i].startsWith(TAG_PREFFIX)) { + //Window.alert("found: "+propNames[i]); + String suff = getProperty(propNames[i]); - public void onClick(Widget sender) { + String div = getProperty(DIV_PREFFIX + suff); + String path = getProperty(PATH_PREFIX + suff); + String user = getProperty(USER_PREFIX + suff); + String clas = getProperty(CLASS_PREFIX + suff); - Window.alert("props: " + getProperty("tomek") + " oraz " - + getProperty("adam")); - VerticalPanel panel = new VerticalPanel(); - - final FlexTable table = new FlexTable(); - - panel.add(table); - - final Vector textBoxes = new Vector(); - - for (int i = 0; i < 3; i++) { - TextBox box = new TextBox(); - textBoxes.add(box); - panel.add(box); + //Window.alert("Added: "+propNames[i]+" div: "+div+" path: "+path+" user: "+user); + if (div != null && path != null && user != null && clas != null) { + TagmeSet set = new TagmeSet(div, path, user, clas); + sets.add(set); } + else { + Window.alert("Wrong set: "+suff+" div= "+div+" path= "+path+" user= "+user+" class= "+clas); + } + } + } - TaggingServiceAsync tagging = (TaggingServiceAsync) GWT - .create(TaggingService.class); + for (int i = 0; i < sets.size(); i++) { + TagmeSet set = (TagmeSet) sets.get(i); + String path = set.getPath(); + String user = set.getUser(); + String clas = set.getClas(); + RootPanel.get(set.getDiv()).add(getButton(path, user, clas)); + } + } - ServiceDefTarget endpoint = (ServiceDefTarget) tagging; - endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); + private Button getButton(String path, String user, String clas) { - AsyncCallback callback = new AsyncCallback() { - public void onSuccess(Object result) { - Vector vect = (Vector) result; - - int cols = (int) Math.sqrt(vect.size()); - - for (int i = 0; i < vect.size(); i++) { - table.setText(i / cols, i % cols, (String) vect - .get(i)); - } - } - - public void onFailure(Throwable caught) { - Window.alert("Error ! " + caught.getMessage()); - } - }; - - // call AJAX methos, after that callback is going to be executed - tagging.getTags("path", callback); - - panel.add(new Button("Save", new ClickListener() { - - public void onClick(Widget sender) { - TaggingServiceAsync tagging = (TaggingServiceAsync) GWT - .create(TaggingService.class); - - ServiceDefTarget endpoint = (ServiceDefTarget) tagging; - endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); - - AsyncCallback callback = new AsyncCallback() { - public void onSuccess(Object result) { - Window.alert(result.toString()); - } - - public void onFailure(Throwable caught) { - Window.alert("Error ! " + caught.getMessage()); - } - }; - - tagging.getTags(((TextBox) textBoxes.get(0)).getText(), - callback); - } - - })); - - PopupPanel popUp = new PopupPanel(true); - - popUp.add(panel); - - popUp.show(); - } - - })); + return new Button("ClickMe", new TagMeShowPopupListener(path, user, clas)); } } Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeClickListener.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeClickListener.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeClickListener.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -0,0 +1,72 @@ +/* + * 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.labs.tagme.gwt.client; + +import java.util.Vector; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.Widget; + +public class TagMeClickListener implements ClickListener { + private String path; + + private String user; + + private Vector textBoxes; + + private String clas; + + public TagMeClickListener(String path, String user, String clas, Vector textBoxes) { + this.path = path; + this.user = user; + this.textBoxes = textBoxes; + this.clas = clas; + } + + public void onClick(Widget sender) { + TaggingServiceAsync tagging = (TaggingServiceAsync) GWT + .create(TaggingService.class); + + ServiceDefTarget endpoint = (ServiceDefTarget) tagging; + endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); + + AsyncCallback callback = new AsyncCallback() { + public void onSuccess(Object result) { + Window.alert(result.toString()); + } + + public void onFailure(Throwable caught) { + Window.alert("Error ! " + caught.getMessage()); + } + }; + + tagging.addTag(user, path, clas, ((TextBox) textBoxes.get(0)).getText(), + callback); + + } + +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMeShowPopupListener.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -0,0 +1,104 @@ +/* + * 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.labs.tagme.gwt.client; + +import java.util.Vector; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.FlexTable; +import com.google.gwt.user.client.ui.PopupPanel; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwt.user.client.ui.Widget; + +public class TagMeShowPopupListener implements ClickListener { + + private String path; + + private String user; + + private String clas; + + public TagMeShowPopupListener(String path, String user, String clas) { + this.path = path; + this.user = user; + this.clas = clas; + } + + public void onClick(Widget sender) { + VerticalPanel panel = new VerticalPanel(); + + final FlexTable table = new FlexTable(); + + panel.add(table); + + Vector textBoxes = new Vector(); + + for (int i = 0; i < 3; i++) { + TextBox box = new TextBox(); + textBoxes.add(box); + panel.add(box); + } + + TaggingServiceAsync tagging = (TaggingServiceAsync) GWT + .create(TaggingService.class); + + ServiceDefTarget endpoint = (ServiceDefTarget) tagging; + endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); + + AsyncCallback callback = new AsyncCallback() { + public void onSuccess(Object result) { + Vector vect = (Vector) result; + + int cols = (int) Math.sqrt(vect.size()); + + for (int i = 0; i < vect.size(); i++) { + table.setText(i / cols, i % cols, (String) vect.get(i)); + } + } + + public void onFailure(Throwable caught) { + Window.alert("Error ! " + caught.getMessage()); + } + }; + + // call AJAX methos, after that callback is going to be executed + tagging.getTags(path, clas, callback); + + panel.add(new Button("Save", new TagMeClickListener(path, user, clas, + textBoxes))); + + PopupPanel popUp = new PopupPanel(true); + + popUp.add(panel); + + popUp.setPopupPosition(10,10); + + popUp.show(); + } + +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -39,14 +39,7 @@ * Path to get tags * @return collection of tags */ - public Vector getTags(String path); + public Vector getTags(String path, String clas); - /** - * Adds tag (not implemented yet) - * - * @param user - * @param path - * @param tag - */ - public void addTag(String user, String path, String tag); + public void addTag(String user, String path, String clas, String tag); } Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -31,8 +31,8 @@ * */ public interface TaggingServiceAsync { - public void getTags(String path, AsyncCallback callback); + public void getTags(String path, String clas, AsyncCallback callback); - public void addTag(String user, String path, String tag, + public void addTag(String user, String path, String clas, String tag, AsyncCallback callback); } Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagmeSet.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagmeSet.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagmeSet.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -0,0 +1,54 @@ +/* + * 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.labs.tagme.gwt.client; + +public class TagmeSet { + + private String div; + private String path; + private String user; + private String clas; + + public TagmeSet(String div, String path, String user, String clas) { + this.div = div; + this.path = path; + this.user = user; + this.clas = clas; + } + + public String getPath() { + return path; + } + + public String getDiv() { + return div; + } + + public String getUser() { + return user; + } + + public String getClas() { + return clas; + } + +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html 2006-05-19 22:05:43 UTC (rev 4330) @@ -1,19 +1,38 @@ <html> - <head> + <head> + <meta name='gwt:property' content='tagMeSetTomek=tomek'> + <meta name='gwt:property' content='tagMeDivtomek=tomek'> + <meta name='gwt:property' content='tagMePathtomek=/tagme/tomek'> + <meta name='gwt:property' content='tagMeUsertomek=kulfon'> + <meta name='gwt:property' content='tagMeClasstomek=org.jboss.labs.tagme.services.ShotokuTaggingService'> + + <meta name='gwt:property' content='tagMeSetAdam=adam'> + <meta name='gwt:property' content='tagMeDivadam=adam'> + <meta name='gwt:property' content='tagMePathadam=/tagme/adam'> + <meta name='gwt:property' content='tagMeUseradam=monika'> + <meta name='gwt:property' content='tagMeClassadam=org.jboss.labs.tagme.services.ShotokuTaggingService'> + + <meta name='gwt:property' content='tomek=ziomek'> + <meta name='gwt:module' content='org.jboss.labs.tagme.gwt.TagMe'> - <meta name='gwt:property' content='tomek=ziomek'> + <title>Hello</title> </head> <body bgcolor="white"> - <meta name='gwt:property' content='adam=siadam'> - <script language="javascript" src="/tagme-servlet/www/org.jboss.labs.tagme.gwt.TagMe/gwt.js"></script> + <script language="javascript" src="/tagme-servlet/www/org.jboss.labs.tagme.gwt.TagMe/gwt.js"></script> Pod tym <br /> - <div id="TopMenu"> + <div id="tomek"> </div> <br /> ale nad tym + + + <div id="adam"> + + </div> + </body> </html> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/ShotokuTaggingService.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/ShotokuTaggingService.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/ShotokuTaggingService.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -0,0 +1,104 @@ +/* + * 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.labs.tagme.services; + +import java.util.Iterator; +import java.util.Map; +import java.util.Vector; + +import org.jboss.logging.Logger; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.Node; +import org.jboss.shotoku.exceptions.RepositoryException; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; +import org.jboss.shotoku.exceptions.SaveException; + +public class ShotokuTaggingService implements TagMeTagger { + + private static final String SHOTOKU_TAG = "tag"; + + private static final Logger log = Logger.getLogger(ShotokuTaggingService.class); + + public Vector getTags(String path) { + log.info("Getting tags for: "+path); + ContentManager manager = ContentManager.getContentManager(); + + Vector<String> tags = new Vector<String>(); + + Node node; + try { + node = manager.getNode(path); + + Map<String, String> map = node.getProperties(); + + for (String key : map.keySet()) { + log.info(key); + if (key.startsWith(SHOTOKU_TAG)) { + tags.add(map.get(key)); + } + } + } catch (RepositoryException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ResourceDoesNotExist e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return tags; + } + + public void addTag(String user, String path, String tag) { + log.info("Adding tag: "+tag+" for node: "+path); + ContentManager manager = ContentManager.getContentManager(); + + Node node; + + try { + node = manager.getNode(path); + + if (!getTags(path).contains(tag)) { + int i = 0; + while (node.getProperty(SHOTOKU_TAG + ":" + user + ":" + i) != null) { + i++; + } + + node.setProperty(SHOTOKU_TAG + ":" + user + ":" + i, tag); + + try { + node.save("Saving tag: "+tag+" by: "+user); + } catch (SaveException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } catch (RepositoryException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ResourceDoesNotExist e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTagger.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTagger.java 2006-05-19 19:18:58 UTC (rev 4329) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/services/TagMeTagger.java 2006-05-19 22:05:43 UTC (rev 4330) @@ -0,0 +1,31 @@ +/* + * 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.labs.tagme.services; + +import java.util.Vector; + +public interface TagMeTagger { + public Vector getTags(String path); + + + public void addTag(String user, String path, String tag); +} |
From: <jbo...@li...> - 2006-05-19 19:19:09
|
Author: wrzep Date: 2006-05-19 15:18:58 -0400 (Fri, 19 May 2006) New Revision: 4329 Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/IssueTracker.java Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/Tags.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java Log: JBLAB-603 Consistent project issue tracker location handling. Pawel Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/IssueTracker.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/IssueTracker.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/IssueTracker.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -0,0 +1,66 @@ + +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.common.projects; + +import org.jboss.forge.common.XmlTools; +import org.w3c.dom.Node; + +/** + * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com) + */ + +public class IssueTracker { + + public static final String ISSUE_TRACKER_ELEMENT = "issue-tracker"; + + public static final short JIRA_ISSUE_TRACKER = 0; + public static final short OTHER_ISSUE_TRACKER = 1; + + private static final String TYPE_ATTRIBUTE = "type"; + + private static final String OTHER_ISSUE_TRACKER_STRING = "other"; + + private String location; + private short type; + + public IssueTracker(Node root) { + + location = XmlTools.unmarshallText(root); + + String typeString = XmlTools.getAttributeValue(root, TYPE_ATTRIBUTE); + + type = JIRA_ISSUE_TRACKER; + if (typeString.equalsIgnoreCase(OTHER_ISSUE_TRACKER_STRING)) { + type = OTHER_ISSUE_TRACKER; + } + } + + public short getType() { + return type; + } + + public String getLocation() { + return location; + } +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -63,6 +63,9 @@ private Node repositoryNode; private Repository repository; + + private Node issueTrackerNode; + private IssueTracker issueTracker; /** * Reads information about a project from an xml file. @@ -132,6 +135,10 @@ if (repositoryNode != null) { repository = new Repository(repositoryNode); } + + if (issueTrackerNode != null) { + issueTracker = new IssueTracker(issueTrackerNode); + } } /** @@ -198,6 +205,9 @@ if (Repository.REPOSITORY_ELEMENT.equals(node.getNodeName())) { setRepositoryNode(node); } + if (IssueTracker.ISSUE_TRACKER_ELEMENT.equals(node.getNodeName())) { + setIssueTrackerNode(node); + } } public void collect(PropertiesMap properties, Object data, @@ -392,6 +402,10 @@ repositoryNode = node; } + private void setIssueTrackerNode(Node node) { + issueTrackerNode = node; + } + /** * Gets a repository for this project. * @return An object representing this project's repository. @@ -399,4 +413,12 @@ public Repository getProjectRepository() { return repository; } + + /** + * Gets an issue tracker for this project. + * @return An object representing this project's issue tracker. + */ + public IssueTracker getProjectIssueTracker() { + return issueTracker; + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -265,4 +265,11 @@ public Repository getProjectRepository(String projectId) { return getProjectsDescriptor().getProjectRepository(projectId); } + + /** + * For the given project id, returns project issue tracker. + */ + public IssueTracker getProjectIssueTracker(String projectId) { + return getProjectsDescriptor().getProjectIssueTracker(projectId); + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -709,4 +709,26 @@ return pd.getProjectRepository(); } + + /** + * For the given project id, returns project issue tracker. + * + * @param projectId + * Id of the project. + * @return project issue tracker or null if no such project exists. + */ + public IssueTracker getProjectIssueTracker(String projectId) { + + if (!projectAdmissable(projectId)) { + return null; + } + + ProjectDescriptor pd = projects.get(projectId); + + if (pd == null) { + return null; + } + + return pd.getProjectIssueTracker(); + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -36,14 +36,14 @@ public static final short SVN_REPOSITORY = 0; public static final short CVS_REPOSITORY = 1; - public static final short UNKNOWN_REPOSITORY = 2; + public static final short OTHER_REPOSITORY = 2; private static final String TYPE_ATTRIBUTE = "type"; private static final String USERNAME_ATTRIBUTE = "username"; private static final String PASSWORD_ATTRIBUTE = "password"; - private static final String SVN_REPOSITORY_STRING = "svn"; private static final String CVS_REPOSITORY_STRING = "cvs"; + private static final String OTHER_REPOSITORY_STRING = "other"; private String location; private String username; @@ -58,13 +58,14 @@ String typeString = XmlTools.getAttributeValue(root, TYPE_ATTRIBUTE); - type = UNKNOWN_REPOSITORY; - if (typeString.equalsIgnoreCase(SVN_REPOSITORY_STRING)) { - type = SVN_REPOSITORY; - } + type = SVN_REPOSITORY; // default type is SVN + if (typeString.equalsIgnoreCase(CVS_REPOSITORY_STRING)) { type = SVN_REPOSITORY; } + if (typeString.equalsIgnoreCase(OTHER_REPOSITORY_STRING)) { + type = OTHER_REPOSITORY; + } } public short getType() { Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -30,7 +30,6 @@ import org.jboss.forge.common.projects.Projects; import org.jboss.forge.common.projects.ProjectsHelper; -import org.jboss.forge.common.projects.Repository; import org.jboss.forge.common.projects.permissions.NullPermissionsChecker; import org.jboss.forge.common.projects.permissions.PermissionsChecker; Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/Tags.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/Tags.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/common/Tags.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -66,17 +66,11 @@ public final static String PLUGIN_CLASS_ELEMENT = "class"; public final static String PLUGIN_PROPERTIES_ELEMENT = "properties"; - /* project.xml files tags */ public static final String JIRA_SERVICE_PROPERTY = "jira-service"; - public static final String JIRA_ADRESS_TAG = "jira-address"; public static final String SVN_SERVICE_PROPERTY = "svn-service"; - public static final String CC_SERVICE_PROPERTY = "cc-service"; - public static final String CC_ADRESS_TAG = "cc-address"; - public static final String SVN_REPO_ADRESS_TAG = "svn-repo"; - public static final String SVN_USERNAME_TAG = "svn-username"; - public static final String SVN_PASSWD_TAG = "svn-passwd"; + public static final String CC_ADRESS_TAG = "cc-address"; public static final String STATUS_SERVICE_NAME = "status:service=scores"; Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java 2006-05-19 18:02:13 UTC (rev 4328) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/jira/JiraStatusPlugin.java 2006-05-19 19:18:58 UTC (rev 4329) @@ -25,6 +25,7 @@ import java.util.List; import java.net.MalformedURLException; +import org.jboss.forge.common.projects.IssueTracker; import org.jboss.forge.status.common.Tags; import org.jboss.forge.status.plugins.KosmosStatusPlugin; import org.jboss.logging.Logger; @@ -95,8 +96,14 @@ private String getJiraURL(String projectId) { - String jiraURL = projects.getProjectProperty(projectId, Tags.JIRA_ADRESS_TAG); - return (jiraURL == "" ? null : jiraURL); + IssueTracker it = projects.getProjectIssueTracker(projectId); + + if ((it == null) + || (it.getType() != IssueTracker.JIRA_ISSUE_TRACKER)) { + return null; + } + + return it.getLocation(); } @Override |
From: <jbo...@li...> - 2006-05-19 18:02:26
|
Author: wrzep Date: 2006-05-19 14:02:13 -0400 (Fri, 19 May 2006) New Revision: 4328 Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/codelines/CodeLinesPlugin.java labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: JBLAB-603 Consistent project repository location handling. Pawel Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -60,6 +60,9 @@ private Node menuNode; private Menu menu; + + private Node repositoryNode; + private Repository repository; /** * Reads information about a project from an xml file. @@ -125,6 +128,10 @@ if (menuNode != null) { menu = new Menu(portalName, menuNode, this); } + + if (repositoryNode != null) { + repository = new Repository(repositoryNode); + } } /** @@ -188,6 +195,9 @@ if (Menu.MENU_ELEMENT.equals(node.getNodeName())) { setMenuNode(node); } + if (Repository.REPOSITORY_ELEMENT.equals(node.getNodeName())) { + setRepositoryNode(node); + } } public void collect(PropertiesMap properties, Object data, @@ -202,7 +212,7 @@ private void setMenuNode(Node n) { menuNode = n; } - + /** * Gets a menu for this project. * @return An object representing this project's menu. @@ -211,6 +221,8 @@ return menu; } + + /* private PropertiesHandler getFreezonePropertiesHandler() { PropertiesHandlerStack ph = new PropertiesHandlerStack(); @@ -375,4 +387,16 @@ public boolean editPermissionAllowed(PermissionsChecker pc) { return thisProject.editPermissionAllowed(pc); } + + private void setRepositoryNode(Node node) { + repositoryNode = node; + } + + /** + * Gets a repository for this project. + * @return An object representing this project's repository. + */ + public Repository getProjectRepository() { + return repository; + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Projects.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -258,4 +258,11 @@ public String getLevelLink(String levelId) { return getProjectsDescriptor().getLevelLink(levelId); } + + /** + * For the given project id, returns project repository. + */ + public Repository getProjectRepository(String projectId) { + return getProjectsDescriptor().getProjectRepository(projectId); + } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -687,4 +687,26 @@ return link; } + + /** + * For the given project id, returns project repository. + * + * @param projectId + * Id of the project. + * @return project repository or null if no such project exists. + */ + public Repository getProjectRepository(String projectId) { + + if (!projectAdmissable(projectId)) { + return null; + } + + ProjectDescriptor pd = projects.get(projectId); + + if (pd == null) { + return null; + } + + return pd.getProjectRepository(); + } } Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Repository.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -0,0 +1,86 @@ + +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.common.projects; + +import org.jboss.forge.common.XmlTools; +import org.w3c.dom.Node; + +/** + * @author Pawel Wrzeszcz (pawel.wrzeszcz [at] gmail.com) + */ + +public class Repository { + + public static final String REPOSITORY_ELEMENT = "repository"; + + public static final short SVN_REPOSITORY = 0; + public static final short CVS_REPOSITORY = 1; + public static final short UNKNOWN_REPOSITORY = 2; + + private static final String TYPE_ATTRIBUTE = "type"; + private static final String USERNAME_ATTRIBUTE = "username"; + private static final String PASSWORD_ATTRIBUTE = "password"; + + private static final String SVN_REPOSITORY_STRING = "svn"; + private static final String CVS_REPOSITORY_STRING = "cvs"; + + private String location; + private String username; + private String password; + private short type; + + public Repository(Node root) { + + location = XmlTools.unmarshallText(root); + username = XmlTools.getAttributeValue(root, USERNAME_ATTRIBUTE); + password = XmlTools.getAttributeValue(root, PASSWORD_ATTRIBUTE); + + String typeString = XmlTools.getAttributeValue(root, TYPE_ATTRIBUTE); + + type = UNKNOWN_REPOSITORY; + if (typeString.equalsIgnoreCase(SVN_REPOSITORY_STRING)) { + type = SVN_REPOSITORY; + } + if (typeString.equalsIgnoreCase(CVS_REPOSITORY_STRING)) { + type = SVN_REPOSITORY; + } + } + + public short getType() { + return type; + } + + public String getLocation() { + return location; + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + +} Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -30,6 +30,7 @@ import org.jboss.forge.common.projects.Projects; import org.jboss.forge.common.projects.ProjectsHelper; +import org.jboss.forge.common.projects.Repository; import org.jboss.forge.common.projects.permissions.NullPermissionsChecker; import org.jboss.forge.common.projects.permissions.PermissionsChecker; Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/codelines/CodeLinesPlugin.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/codelines/CodeLinesPlugin.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/codelines/CodeLinesPlugin.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -25,7 +25,7 @@ import java.util.Map; import java.util.HashMap; -import org.jboss.forge.status.common.Tags; +import org.jboss.forge.common.projects.Repository; import org.jboss.forge.status.plugins.Plugin; /** @@ -61,24 +61,19 @@ long cl = 0; - String url = getProperty(projectId, Tags.SVN_REPO_ADRESS_TAG); + Repository repo = projects.getProjectRepository(projectId); - if (url != null) { + if (repo != null) { - String userName = getProperty(projectId, Tags.SVN_USERNAME_TAG); - String password = getProperty(projectId, Tags.SVN_PASSWD_TAG); + String url = repo.getLocation(); + String userName = repo.getUsername(); + String password = repo.getPassword(); cl = getValue(url, userName, password); + cashedValues.put(projectId, new Long(cl)); } - - cashedValues.put(projectId, new Long(cl)); } return cashedValues.get(projectId).longValue(); } - - private String getProperty(String projectId, String propertyName) { - String prop = projects.getProjectProperty(projectId, propertyName); - return (prop == "" ? null : prop); - } } Modified: labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-05-19 15:58:33 UTC (rev 4327) +++ labs/jbosslabs/trunk/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-05-19 18:02:13 UTC (rev 4328) @@ -25,6 +25,7 @@ import java.util.List; import java.net.MalformedURLException; +import org.jboss.forge.common.projects.Repository; import org.jboss.forge.status.common.Tags; import org.jboss.forge.status.plugins.KosmosStatusPlugin; import org.jboss.logging.Logger; @@ -62,7 +63,7 @@ String repoURL = getRepoURL(projectId); if (repoURL == null) { - return null; + return null; } SvnRepository repository = null; @@ -95,9 +96,23 @@ return repository; } + + /** + * For the given project id, returns project SVN repository location or + * null if no such project exist or its repository is not SVN repository. + */ private String getRepoURL(String projectId) { - String repoURL = projects.getProjectProperty(projectId, Tags.SVN_REPO_ADRESS_TAG); - return (repoURL == "" ? null : repoURL); + + Repository repository = projects.getProjectRepository(projectId); + if (repository == null) { + return null; + } + + if (repository.getType() == Repository.SVN_REPOSITORY) { + return repository.getLocation(); + } else { + return null; + } } @Override |
From: <jbo...@li...> - 2006-05-19 15:58:40
|
Author: jfr...@jb... Date: 2006-05-19 11:58:33 -0400 (Fri, 19 May 2006) New Revision: 4327 Modified: labs/jbossweb/trunk/src/share/native/build/buildphp.sh Log: Add build of libjpeg... And arrange java includes. Modified: labs/jbossweb/trunk/src/share/native/build/buildphp.sh =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildphp.sh 2006-05-19 12:20:23 UTC (rev 4326) +++ labs/jbossweb/trunk/src/share/native/build/buildphp.sh 2006-05-19 15:58:33 UTC (rev 4327) @@ -24,6 +24,9 @@ LPNGVER="1.2.10" LPNGURL=http://kent.dl.sourceforge.net/sourceforge/libpng/libpng-${LPNGVER}.tar.gz +JPEGVER="6b" +JPEGURL=http://www.ijg.org/files/jpegsrc.v${JPEGVER}.tar.gz + # Platfrom directory and cache TOOLS=$HOME/`uname -s`_`uname -p`_tools CACHE=`uname -s`_`uname -p`_cache @@ -33,6 +36,7 @@ BUILDPSQL=false BUILDOSSL=false BUILDLPNG=false +BUILDJPEG=false CC=gcc COMPILER="" @@ -67,12 +71,14 @@ # configure and install # $1 : Source base directory # $2 : Install directory -# $2 : Additional parameters for that machines/product. +# $3 : Additional parameters for that machines/product. +# $4 : Additional make command Build() { SRCDIR=$1 INSDIR=$2 ADDCON=$3 +ADDINS=$4 (cd ${SRCDIR} if [ ${CC} = "cc" ] then @@ -104,6 +110,15 @@ echo "Make install in ${SRCDIR} failed" exit 1 fi + if [ ! -z $ADDINS ] + then + make $ADDINS + if [ $? -ne 0 ] + then + echo "Make $ADDINS in ${SRCDIR} failed" + exit 1 + fi + fi ) } @@ -222,13 +237,14 @@ BUILDPSQL=true BUILDOSSL=true BUILDLPNG=true + BUILDJPEG=true CC=cc export CC COMPILER=solaris-x86-cc ADDCONF="\ --with-iconv-dir=/usr/local \ --with-libxml-dir=$TOOLS/LIBXML2 \ - --with-jpeg-dir=no \ + --with-jpeg-dir=$TOOLS/JPEG \ --with-png-dir=$TOOLS/LPNG \ --with-freetype-dir=/usr/sfw \ --with-t1lib \ @@ -243,6 +259,7 @@ --with-imap=no \ --with-pspell=no \ " + ADDFLAGS="-I $JAVA_HOME/include/solaris" ;; *) EXTTYPE=static @@ -261,6 +278,14 @@ # # build lib png if required +if ${BUILDJPEG} +then + Extract jpeg ${JPEGURL} ${JPEGVER} + Build jpeg-${JPEGVER} ${TOOLS}/JPEG "--enable-shared" +fi + +# +# build lib png if required if ${BUILDLPNG} then Extract libpng ${LPNGURL} ${LPNGVER} @@ -438,7 +463,7 @@ if [ ${CC} = "cc" ] then # Sun Studio - ADDFLAGS="$ADDFLAGS -I/opt/SUNWspro/prod/include/CC/Cstd/rw -I/opt/SUNWspro/prod/include/CC/Cstd -DHUGE_VAL=__builtin_huge_val" + ADDFLAGS="${ADDFLAGS} -I/opt/SUNWspro/prod/include/CC/Cstd/rw -I/opt/SUNWspro/prod/include/CC/Cstd -DHUGE_VAL=__builtin_huge_val" fi (cd ../php5servlet $CC -c $ADDFLAGS \ |
From: <jbo...@li...> - 2006-05-19 12:20:31
|
Author: tirelli Date: 2006-05-19 08:20:23 -0400 (Fri, 19 May 2006) New Revision: 4326 Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java Log: Adding warning to the API Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-19 12:13:49 UTC (rev 4325) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-19 12:20:23 UTC (rev 4326) @@ -21,6 +21,8 @@ /** * RuleBaseConfiguration * A class to store RuleBase related configuration + * + * IMPORTANT NOTE: This API is under review and may change in the future. * * Created: 16/05/2006 * @author <a href="mailto:ti...@po...">Edson Tirelli</a> @@ -48,19 +50,6 @@ * Defaults to false */ public static final String PROPERTY_HASH_ALPHA_NODES = "org.drools.reteoo.alpha.hash-alpha-node"; - /** - * Property to define working memory assert behavior. Valid values are "identity" or "equals". - * Defaults to identity - */ - public static final String PROPERTY_ASSERT_BEHAVIOR = "org.drools.wm.assert-behavior"; - /** - * Property to define working memory logical assert behavior. Valid values are "identity" or "equals". - * Defaults to identity - */ - public static final String PROPERTY_LOGICAL_ASSERT_BEHAVIOR = "org.drools.wm.logical-assert-behavior"; - - public static final String WM_BEHAVIOR_IDENTITY = "identity"; - public static final String WM_BEHAVIOR_EQUALS = "equals"; // a generated serial version id private static final long serialVersionUID = 2989084670778336973L; @@ -75,10 +64,6 @@ System.getProperty( PROPERTY_HASH_OBJECT_TYPE_NODES, "true" ) ); this.setProperty( PROPERTY_HASH_ALPHA_NODES, System.getProperty( PROPERTY_HASH_ALPHA_NODES, "false" ) ); - this.setProperty( PROPERTY_ASSERT_BEHAVIOR, - System.getProperty( PROPERTY_ASSERT_BEHAVIOR, WM_BEHAVIOR_IDENTITY ) ); - this.setProperty( PROPERTY_LOGICAL_ASSERT_BEHAVIOR, - System.getProperty( PROPERTY_LOGICAL_ASSERT_BEHAVIOR, WM_BEHAVIOR_EQUALS ) ); } public boolean getBooleanProperty(String prop) { |
From: <jbo...@li...> - 2006-05-19 12:13:57
|
Author: jfr...@jb... Date: 2006-05-19 08:13:49 -0400 (Fri, 19 May 2006) New Revision: 4325 Modified: labs/jbossweb/trunk/src/share/native/build/buildphp.sh Log: Now builds on Solaris10, i386 with SunStudio. Modified: labs/jbossweb/trunk/src/share/native/build/buildphp.sh =================================================================== --- labs/jbossweb/trunk/src/share/native/build/buildphp.sh 2006-05-19 09:16:42 UTC (rev 4324) +++ labs/jbossweb/trunk/src/share/native/build/buildphp.sh 2006-05-19 12:13:49 UTC (rev 4325) @@ -16,7 +16,7 @@ XML2URL=ftp://xmlsoft.org/libxml2/libxml2-${XML2VER}.tar.gz PSQLVER=8.1.3 -PSQLURL=http://wwwmaster.postgresql.org/redir?ftp%3A%2F%2Fftp2.ch.postgresql.org%2Fpub%2Fpostgresql%2Fsource%2Fv${PSQLVER}%2Fpostgresql-${PSQLVER}.tar.gz +PSQLURL=http://wwwmaster.postgresql.org/redir?ftp://ftp2.ch.postgresql.org/pub/postgresql/source/v${PSQLVER}/postgresql-${PSQLVER}.tar.gz OSSLVER="0.9.8b" OSSLURL=http://www.openssl.org/source/openssl-${OSSLVER}.tar.gz @@ -217,6 +217,7 @@ ADDFLAGS="-I $JAVA_HOME/include/linux" ;; dev13*) + EXTTYPE=shared BUILDXML2=true BUILDPSQL=true BUILDOSSL=true @@ -225,8 +226,9 @@ export CC COMPILER=solaris-x86-cc ADDCONF="\ + --with-iconv-dir=/usr/local \ --with-libxml-dir=$TOOLS/LIBXML2 \ - --with-jpeg-dir \ + --with-jpeg-dir=no \ --with-png-dir=$TOOLS/LPNG \ --with-freetype-dir=/usr/sfw \ --with-t1lib \ @@ -324,6 +326,14 @@ rm -f php-${PHPVER}/$CACHE # configure php +if [ ${CC} = "cc" ] +then + # Sun Studio + CC=cc + export CC + CPPFLAGS="-I/opt/SUNWspro/prod/include/CC/Cstd/rw -I/opt/SUNWspro/prod/include/CC/Cstd -DHUGE_VAL=__builtin_huge_val" + export CPPFLAGS +fi (cd php-${PHPVER} ./configure --prefix=$TOOLS/PHP \ --cache-file=$CACHE \ @@ -355,6 +365,7 @@ --enable-wddx \ --with-xmlrpc \ \ + --without-pear \ --with-ncurses=no \ --with-fbsql=no \ --with-fdftk=no \ @@ -424,8 +435,13 @@ #-DPTHREADS to use pthreads. # +if [ ${CC} = "cc" ] +then + # Sun Studio + ADDFLAGS="$ADDFLAGS -I/opt/SUNWspro/prod/include/CC/Cstd/rw -I/opt/SUNWspro/prod/include/CC/Cstd -DHUGE_VAL=__builtin_huge_val" +fi (cd ../php5servlet - gcc -c $ADDFLAGS \ + $CC -c $ADDFLAGS \ -I $JAVA_HOME/include \ -I $TOOLS/PHP/include/php/main \ -I $TOOLS/PHP/include/php/Zend \ |
From: <jbo...@li...> - 2006-05-19 09:16:51
|
Author: mar...@jb... Date: 2006-05-19 05:16:42 -0400 (Fri, 19 May 2006) New Revision: 4324 Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rules.xml Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Rule_Engine.vsd labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-What_is_a_Rule_Engine.xml labs/jbossrules/trunk/documentation/manual/en/master.xml Log: Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.svg =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.svg 2006-05-19 01:11:06 UTC (rev 4323) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Male_People.svg 2006-05-19 09:16:42 UTC (rev 4324) @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 Male_People.svg Page-1 --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="6.52453in" + height="3.99817in" viewBox="0 0 469.766 287.869" xml:space="preserve" color-interpolation-filters="sRGB" class="st10"> + <v:documentProperties v:langID="1033" v:metric="true" v:viewMarkup="false"/> + + <style type="text/css"> + <![CDATA[ + .st1 {fill:#ffffff} + .st2 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.72} + .st3 {fill:#000000;font-family:Arial;font-size:1.5em} + .st4 {font-size:1em} + .st5 {fill:#000000;font-family:Arial;font-size:1.66667em} + .st6 {fill:#ffffff;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st7 {marker-end:url(#mrkr13-24);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st8 {fill:#4677bf;fill-opacity:1;stroke:#4677bf;stroke-opacity:1;stroke-width:0.08695652173913} + .st9 {marker-end:url(#mrkr4-35);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st10 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} + ]]> + </style> + + <defs id="Markers"> + <g id="lend13"> + <path d="M 3 1 L 0 0 L 3 -1 L 3 1 " style="stroke:none"/> + </g> + <marker id="mrkr13-24" class="st8" v:arrowType="13" v:arrowSize="2" v:setback="34.5" refX="-34.5" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend13" transform="scale(-11.5,-11.5) "/> + </marker> + <g id="lend4"> + <path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"/> + </g> + <marker id="mrkr4-35" class="st8" v:arrowType="4" v:arrowSize="2" v:setback="23" refX="-23" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend4" transform="scale(-11.5,-11.5) "/> + </marker> + </defs> + <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> + <title>Page-1</title> + <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" + v:shadowOffsetY="-8.50394"/> + <v:layer v:name="Network" v:index="0"/> + <v:layer v:name="Connector" v:index="1"/> + <g id="shape1-1" v:mID="1" v:groupContext="shape" v:layerMember="0" transform="translate(0.72,-187.327)"> + <title>Datastore.12</title> + <desc>People.sex == “male”</desc> + <v:custProps> + <v:cp v:nameU="Manufacturer" v:lbl="Manufacturer" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductNumber" v:lbl="Product Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="PartNumber" v:lbl="Part Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductDescription" v:lbl="Product Description" v:type="0" v:sortKey="1" v:invis="false" + v:ask="false" v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="AssetNumber" v:lbl="Asset Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="SerialNumber" v:lbl="Serial Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="Location" v:lbl="Location" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Building" v:lbl="Building" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Room" v:lbl="Room" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Department" v:lbl="Department" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visDescription" + v:val="VT4(Use to add a a database, data source, or data storage device to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(0,0,0,0)" v:tabSpace="42.5197"/> + <v:textRect cx="49.9109" cy="244.196" width="99.83" height="62.3887"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52 Z" + class="st1"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52" + class="st2"/> + <path d="M0 200.52 A49.9109 12.4777 -180 0 0 99.82 200.52" class="st2"/> + <text x="5.37" y="238.8" class="st3" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>People.sex <tspan + x="11.39" dy="1.2em" class="st4">== </tspan>“male”</text> </g> + <g id="shape2-7" v:mID="2" v:groupContext="shape" v:layerMember="0" transform="translate(369.224,-187.327)"> + <title>Datastore.13</title> + <desc>People</desc> + <v:custProps> + <v:cp v:nameU="Manufacturer" v:lbl="Manufacturer" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductNumber" v:lbl="Product Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="PartNumber" v:lbl="Part Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductDescription" v:lbl="Product Description" v:type="0" v:sortKey="1" v:invis="false" + v:ask="false" v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="AssetNumber" v:lbl="Asset Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="SerialNumber" v:lbl="Serial Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="Location" v:lbl="Location" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Building" v:lbl="Building" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Room" v:lbl="Room" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Department" v:lbl="Department" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visDescription" + v:val="VT4(Use to add a a database, data source, or data storage device to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(0,0,0,0)" v:tabSpace="42.5197"/> + <v:textRect cx="49.9109" cy="244.196" width="99.83" height="62.3887"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52 Z" + class="st1"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52" + class="st2"/> + <path d="M0 200.52 A49.9109 12.4777 -180 0 0 99.82 200.52" class="st2"/> + <text x="18.76" y="250.2" class="st5" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>People</text> </g> + <g id="shape3-12" v:mID="3" v:groupContext="shape" transform="translate(161.182,-138.464)"> + <title>Rectangle.18</title> + <desc>Inference Engine</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197" v:verticalAlign="0"/> + <v:textRect cx="73.7008" cy="259.522" width="147.41" height="56.6929"/> + <rect x="0" y="231.176" width="147.402" height="56.6929" class="st6"/> + <text x="32.01" y="253.18" class="st5" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Inference <tspan + x="42.56" dy="1.2em" class="st4">Engine</tspan></text> </g> + <g id="shape4-16" v:mID="4" v:groupContext="shape" transform="translate(164.017,-0.24)"> + <title>Rectangle.22</title> + <desc>Results</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="70.8661" cy="262.357" width="141.74" height="51.0236"/> + <rect x="0" y="236.845" width="141.732" height="51.0236" class="st6"/> + <text x="37.53" y="268.36" class="st5" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Results</text> </g> + <g id="shape5-19" v:mID="5" v:groupContext="shape" v:layerMember="1" transform="translate(100.542,-237.238)"> + <title>Dynamic connector.18</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 287.87 L10.63 287.87 A10.6299 10.6299 0 0 1 21.26 298.5 L21.26 338.61 A19.6902 19.6902 -180 0 0 40.95 358.3 + L52.36 358.3" class="st7"/> + </g> + <g id="shape6-25" v:mID="6" v:groupContext="shape" v:layerMember="1" transform="translate(369.224,-237.238)"> + <title>Dynamic connector.19</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 287.87 L-10.63 287.87 A10.6299 10.6299 -180 0 0 -21.26 298.5 L-21.26 338.61 A19.6902 19.6902 0 0 1 -40.95 + 358.3 L-52.36 358.3" class="st7"/> + </g> + <g id="shape7-30" v:mID="7" v:groupContext="shape" v:layerMember="1" transform="translate(227.796,-138.464)"> + <title>Dynamic connector.6</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M7.09 287.87 L7.09 369.55" class="st9"/> + </g> + </g> +</svg> Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Rule_Engine.vsd =================================================================== (Binary files differ) Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rules.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rules.xml 2006-05-19 01:11:06 UTC (rev 4323) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rules.xml 2006-05-19 09:16:42 UTC (rev 4324) @@ -0,0 +1,311 @@ +<?xml version="1.0" encoding="UTF-8"?> +<section> + <title>Rules</title> + + <section> + <title>Production Rules</title> + + <para>A <indexterm> + <primary>Production Rule</primary> + </indexterm>Production Rule, or Rule, in Drools is a two part structure + with a Left Hand Side (LHS) and a Right Hand Side (RHS) additionally a + Rule may have the following attributes:</para> + + <itemizedlist> + <listitem> + <para>salience</para> + </listitem> + + <listitem> + <para>activation-group</para> + </listitem> + + <listitem> + <para>no-loop</para> + </listitem> + + <listitem> + <para>auto-focus</para> + </listitem> + + <listitem> + <para>duration</para> + </listitem> + </itemizedlist> + + <programlisting>rule “<name>” + <attribute> <value> + when + <LHS> + then + <RHS> +end +</programlisting> + + <para>The LHS of a Rule consists of <indexterm> + <primary>Conditional Element</primary> + </indexterm>Conditional Elements (CE) and Columns; to facilate the + encoding of propositional and first order logic. The term <indexterm> + <primary>Column</primary> + </indexterm>Column is used to indicate <indexterm> + <primary>Field Constraint</primary> + </indexterm>Field Constraints on a Fact.</para> + + <para>Drools currently supports the follows CEs:</para> + + <itemizedlist> + <listitem> + <para>'and'</para> + </listitem> + + <listitem> + <para>'or',</para> + </listitem> + + <listitem> + <para>'not',</para> + </listitem> + + <listitem> + <para>'exists'</para> + </listitem> + </itemizedlist> + + <para>'forall' and 'accumulate' will be added shortley. The following + Field Constraints are allowed:</para> + + <itemizedlist> + <listitem> + <para>Literal Constraint</para> + </listitem> + + <listitem> + <para>Bound Variable Constraint</para> + </listitem> + + <listitem> + <para>Return Value</para> + </listitem> + + <listitem> + <para>Predicate</para> + </listitem> + </itemizedlist> + + <para>The Language Guide chapter provides more indepth information for + each of these.</para> + + <para>As facts are asserted and modified in the Working Memory it matches + the facts against the LHS conditions, when all the conditions are met and + true the Rule plus those match facts are activated. When a Rule is + activated it is placed onto the Agenda for potential execution, where the + actions of RHS, called t he <indexterm> + <primary>Consequence</primary> + </indexterm>Consequence, are executed. The LHS and the RHS is analogous + to:</para> + + <programlisting>if ( <LHS> ) { + <RHS> +}</programlisting> + + <para>However 'if' is considered procedural in that it is one part of a + possible execution flow - if this.... else if.... else ..... Rules use + 'when' to more semantically recognise that the rule will activate when, + and only when, its LHS is matched.</para> + + <para>Rules are associated with a namespace via the + <literal>package</literal> keyword; other Rule Engines may call this a + <indexterm> + <primary>Rule Set</primary> + </indexterm>Rule Set. A Package declares imports, global variables, + functions and rules.</para> + + <programlisting>package com.sample + +import java.util.List +import com.sample.Cheese + +global List cheeses + +function void exampleFunction(Cheese cheese) { + System.out.println( cheese ); +} + +rule “A Cheesey Rule” + when + cheese : Cheese( type == "stilton" ) + then + exampleFunction( cheese ); + cheeses.add( cheese ); +end</programlisting> + + <para> The following example shows a LHS with a single Column that has a + single <indexterm> + <primary>Literal Field Constraint</primary> + </indexterm>Literal Field Constraint used with a Cheese Fact:</para> + + <programlisting>rule "Cheddar Cheese" + when + Cheese( type == "cheddar" ) + then + System.out.println( "cheddar" ); +end</programlisting> + + <para>The example above is analogous to :</para> + + <programlisting>public void cheddarCheese(Cheese cheese) { + if ( cheese.getType().equals("cheddar") { + System.out.println( "cheddar" ); + } +}</programlisting> + + <para>Rule engines are a complete de-coupling of data from the logic. + Rules cannot be called directly as they are not methods or functions + instead Rules fire in response to changes in Working Memory's data.</para> + </section> + + <section> + <title>First Order Logic</title> + + <para>Rules are written using First Order Logic, or predicate logic, which + extends Propositional Logic. <ulink + url="http://en.wikipedia.org/wiki/Emil_Leon_Post">Emil Leon Post</ulink> + was the first to develop an inference based system using symbols to + express logic - as a consequence of this he was able to prove that any + logical system (including mathematics) could be expressed with such a + system.</para> + + <para>A proposition is a statement that can be classified as true or + false. If the truth can be determined from statement alone it is said to + be a "closed statement". In programming terms this is an expression that + does not reference any variables:</para> + + <para>10 = = 2 * 5</para> + + <para>Expressions that evaluate against one or more variables, facts, are + "open statements", in that we cannot determine whether the statement is + true until we have a variable instance to evaluate against:</para> + + <para>Person.sex == "male"</para> + + <para>With SQL if we look at the conclusion's action as simply returning + the matched fact to the user:</para> + + <para>select * from People where People.sex == "male"</para> + + <para>For any rows, which represent our facts, that are returned we have + inferred that those facts are male people. The following diagram shows how + the above SQL statement and People table can be represented in terms of an + Inference Engine.</para> + + <figure> + <title>SQL as a simplistic Inference Engine</title> + + <mediaobject> + <imageobject> + <imagedata align="center" fileref="Male_People.svg" format="SVG" /> + </imageobject> + + <imageobject> + <imagedata align="center" fileref="Male_People.png" format="PNG" /> + </imageobject> + </mediaobject> + </figure> + + <para>So in java we can say that a simple proposition is of the form + 'variable' 'operator' 'value' - where we often refer to 'value' as being a + literal value - a proposition can be thought as a field constraint. + Further to this propositions can be combined with conjuntive and + disjuntive connectives, which is the logic theorists way of saying + '&&' and '||'. The following shows two open propositional + statements connected together with a single disjunctive connective.</para> + + <programlisting>person.getEyeColor().equals("blue") || person.getEyeColor().equals("green") </programlisting> + + <para>This can be expressed using a disjunctive Conditional Element + connective - which actually results in the generation of two rules, to + represent the two possible logic outcomes.</para> + + <programlisting>Person( eyeColour == "blue" ) || Person( eyeColor == "green" )</programlisting> + + <para>Disjunctive field constraints connectives could also be used - + although they are not currently supported in Drools 3.0 - and would not + result in multiple rule generation.</para> + + <programlisting>Person( eyeColour == "blue"||"green" )</programlisting> + + <para>However Propositional Logic is not Turing complete in that you are + limited to the problems you can define because it cannot express criteria + for the structure of data. First Order Logic (FOL), or Predicate Logic, + extends Propositional Logic with two new quantifier concepts to allow + expressions defining structure - specifically universal and existential + quantifiers. Universal quantifiers allow you to check that something is + true for everything; normally supported by the 'forall' conditional + element, but not yet implemented in Drools 3.0. Existential quantifiers + check for the existence of something, in that it occurs at least once - + this is supported with 'not' and 'exists' conditional elements.</para> + + <para>Imagine we have two classes - Student and Module. Module represents + each of the courses the Student attended for that semester, referenced by + the List collection. At the end of the semester each Module has a score. + If the Student has a Module score below 40 then they will fail that + semester - the existential quantifier can be used used with the "less than + 40" open proposition to check for the existence of a Module that is true + for the specified criteria.</para> + + <programlisting>public class Student { + private String name; + private List modules; + + ... +}</programlisting> + + <programlisting>public Class Module { + private String name; + private String studentName; + private int score;</programlisting> + + <para>Java is Turing complete in that you can write code, among other + things, to iterate data structures to check for existence. The following + should return a List of students who have failed the semester.</para> + + <programlisting>List failedStudents = new ArrayList(); + +for ( Iterator studentIter = students.iterator(); studentIter.hasNext() { + Student student = ( Student ) studentIter.next(); + for ( Iterator it = student.getModules.iterator(); it.hasNext(); ) { + Module module = ( Module ) it.next(); + if ( module.getScore() < 40 ) { + failedStudents.add( student ) ; + break; + } + } +}</programlisting> + + <para>Early SQL implementations where not Turing complete as they did not + provide quantifiers to asses the structure of data. However modern SQL + engines allow nesting of SQL which can be combined with keywords like + 'exists' and 'in': The following query would return a set of Students who + have failed the semester.</para> + + <programlisting>select + * +from + Students s +where exists ( + select + * + from + Modules m + where + m.student_name = s.name and + m.score < 40 +)</programlisting> + + <programlisting>rule + when + exists( $student : Student() && Module( student == $student, score < 40 ) )</programlisting> + + <para></para> + </section> +</section> \ No newline at end of file Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-What_is_a_Rule_Engine.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-What_is_a_Rule_Engine.xml 2006-05-19 01:11:06 UTC (rev 4323) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-What_is_a_Rule_Engine.xml 2006-05-19 09:16:42 UTC (rev 4324) @@ -3,119 +3,64 @@ <title>What is a Rule Engine</title> <section> - <title>Background</title> + <title>Introduction and Background</title> - <para>A rule engine like Drools is centred around the concept of - production rules (IF conditions THEN actions). Emil Leon Post - (http://en.wikipedia.org/wiki/Emil_Leon_Post) was the first to use - production systems in logic - as a consequence of this he was able to - prove that any logical system (including mathematics) could be written - with production rules. Quite an amazing proof, this essentially means that - you can represent any system/problem with production rules (back in the - real world there are constraints of processing power and efficiency of - course !).</para> + <para>Artificial Intelligence (A.I.) is a very broad research area that + focuses on "Making computers think like people" and includes disciplines + like Neural Networks, Genetic Algorithms, Decision Trees, Frame Systems + and Expert Systems. Knowledge representation is the area of A.I. concerned + with how knowledge is represented and manipulated. Expert Systems use + Knowledge representation to facilitate the codification of knowledge into + a knowledge base which can be used for reasoning - i.e. we can process + data with this knowledge base to infer conclusions. Expert Systems are + also known as Knowledge-based Systems and Knowledge-based Expert System + and are considered 'applied artificial intelligence'; the process of + developing with an Expert System is Knowledge Engineering. EMYCIN was one + of the first "shells" for an Expert System, which was created from the + MYCIN medical diagnosis Expert System. Where early Expert Systems had + their logic hard coded "shells" separated the logic from the system, + providing an easy to use environment for user input. Drools is a Rule + Engine that uses the Rule Based approached to implement an Expert System + and is more correctly classified as a Production Rules System.</para> - <para>You may also have heard of "Expert Systems" in the context of rule - engines. You can think of expert systems as a rule engine + the - codification of knowledge for a specific problem domain (+ a user - interface !). In that sense, Drools is a platform for expert systems. - Historically, rule engines popularity grew out of expert systems success - (for example, EMYCIN was one of the first "shells" for an expert system, - which was created from the MYCIN medical diagnosis expert system).</para> - </section> + <para>Business Rule Management Systems build value on top of an Rule + Engine providing systems for rule management, deployment, collaboration, + analysis and end user tools for business users. Further to this the + "Business Rules Approach" is a fast evolving and popular methodology + helping to formalise the role of Rule Engines in the enterprise.</para> - <section> - <title>Rules</title> + <para>The term Rule Engine is quite ambiguous in that it can be any system + that uses rules, in any form, that can be applied to data to produce + outcomes; which includes simple systems like form validation; "How to + Build a Business Rules Engine (2004)" by Malcolm Chisholm exemplifies this + ambiguity. The book is actually about how to build and alter a database + schema to hold validation rules which it then shows how to generate VB + code from those validation rules to validate data entry - while a very + valid and usefil topic for some some, it caused quite a suprise to this + author, unaware at the time in the subtleties of Rules Engines + differences, who was hoping to find some hidden secrets to help improve + the Drools engine. While a Production Rule System is a kinda of Rule + Engine and also Expert System, the validation Rule Engine mention + previously obviously isn't an Expert System.</para> - <para>A <indexterm> - <primary>Rule</primary> - </indexterm>Rule is the codification of business knowledge. A Rule has - attributes, a Left Hand Side (LHS) and a Right Hand Side (RHS). Drools - allows the following attributes:</para> + <para>The brain of a Production Rule System is an Inference Engine which + matches facts, the data, against Production Rules, also called + Productions, to infer conclusions which result in actions. A Production + Rule is a two-part structure using First Order Logic for knowledge + representation.</para> - <itemizedlist> - <listitem> - <para>salience</para> - </listitem> + <programlisting>when + <conditions> +then + <actions></programlisting> - <listitem> - <para>agenda-group</para> - </listitem> - - <listitem> - <para>no-loop</para> - </listitem> - - <listitem> - <para>auto-focus</para> - </listitem> - - <listitem> - <para>duration</para> - </listitem> - </itemizedlist> - - <programlisting>rule “<name>” - <attribute> <value> - when - <LHS> - then - <RHS> -end -</programlisting> - - <para>The LHS of the Rule consists of one or more Conditions. As the Rule - Engine is made aware of new data or changes to existing data it matches - the data against the Conditions, when all the Conditions are met and true - the RHS, and its actions, are executed; the RHS, called the <indexterm> - <primary>Consequence</primary> - </indexterm>Consequence. The LHS and the RHS is analogous to:</para> - - <programlisting>if ( <LHS> ) { - <RHS> -}</programlisting> - - <para>Rules are associated with a namespace via the - <literal>package</literal> keyword; other Rule Engines may call this a - <indexterm> - <primary>Rule Set</primary> - </indexterm>Rule Set. A Package declares imports, global variables, - functions and rules.</para> - - <programlisting>package com.sample - -import java.util.List -import com.sample.Cheese - -global List cheeses - -function void exampleFunction(Cheese cheese) { - System.out.println( cheese ); -} - -rule “A Cheesy Rule” - when - cheese : Cheese( type == "stilton" ) - then - exampleFunction( cheese ); - cheeses.add( cheese ); -end</programlisting> - - <para>The process of matching the new or existing modified data against - rules is called <indexterm> + <para>The process of matching the new or existing facts against Production + Rules is called <indexterm> <primary>Pattern Matching</primary> - </indexterm> Pattern Matching, the engine which does this matching is - the <indexterm> + </indexterm> Pattern Matching, which is performed by the <indexterm> <primary>Inference Engine</primary> - </indexterm>Inference Engine. The Rule's are referred to as the - <indexterm> - <primary>Production Memory</primary> - </indexterm>Production Memory and the data that the Inference Engine - matches against is the <indexterm> - <primary>WorkingMemory</primary> - </indexterm>Working Memory. the Agenda manages the execution of the - matched Rules. There are a number of algorithms used for Pattern Matching - by Inference Engines including:</para> + </indexterm>Inference Engine. There are a number of algorithms used for + Pattern Matching by Inference Engines including:</para> <itemizedlist> <listitem> @@ -135,14 +80,34 @@ </listitem> </itemizedlist> - <para>Drools has implementations for both Rete and Leaps; Leaps is still - considered experiment. The Drools <indexterm> + <para>Drools has implementations for both <indexterm> <primary>Rete</primary> - </indexterm>Rete implementation is called ReteOO signifying that this - Drools has an enhanced and optimised implementation of the Rete algorithm. - Other Rete based engines also have marketting terms for their prioprietary - enhancements to Rete, like RetePlus and Rete III,</para> + </indexterm>Rete and <indexterm> + <primary>Leaps</primary> + </indexterm>Leaps; Leaps is still considered experiment. The Drools + <indexterm> + <primary>Rete</primary> + </indexterm>Rete implementation is called ReteOO signifying that Drools + has an enhanced and optimised implementation of the Rete algorithm. Other + Rete based engines also have marketing terms for their proprietary + enhancements to Rete, like RetePlus and Rete III. It is important to + understand that names like Rete III are purely marketing where, unlike the + original published Rete Algorithm, no details of implementation are + published; thus asking a question like "Does Drools implement Rete III" is + nonsensical.</para> + <para>The Production Rules are referred to as the <indexterm> + <primary>Production Memory</primary> + </indexterm>Production Memory and the facts that the Inference Engine + matches against the <indexterm> + <primary>WorkingMemory</primary> + </indexterm>Working Memory. Facts are asserted into the Working Memory + where they may then be modiied or retracted. A system with a large number + of rules and facts may result in many rules being true for the same fact + assertion, these rules are said to be in conflict. The Agenda manages the + execution order of these conflicuting rules using a Conflict Resolution + stategy. </para> + <figure> <title>A Basic Rete network</title> @@ -157,145 +122,39 @@ </mediaobject> </figure> - <para>The LHS of a rule is made up of <indexterm> - <primary>Conditional Element</primary> - </indexterm>iConditional Elements and <indexterm> - <primary>Field Constraint</primary> - </indexterm>iField Constraints. The following example shows a <indexterm> - <primary>Literal Field Constraint</primary> - </indexterm>iLiteral Field Constraint used with a Cheese Fact; the - combination of Field Constraints on a Fact is known as a <indexterm> - <primary>Column</primary> - </indexterm>Column.</para> + <para>A Production Rule System's Inference Engine is stateful and able to + enforce truthfulness - called Truth Maintence. A logical relationship can + be declared by actions which means the action's state depends on the + inference remaining true; when it is no longer true the logical dependant + action is undone. The "Honest Politician" is an example of Truth + Maintenance, which always ensures that hope can only exist for a + decomcracy while we have honest politicians.</para> - <programlisting>rule "Cheddar Cheese" - when - Cheese( type == "cheddar" ) - then - System.out.println( "cheddar" ); -end</programlisting> + <programlisting>when + an honest Politician exists +then + logically assert Hope - <para>The example above is similar to :</para> +when + Hope exists +then + print "Hurrah!!! Democracy Lives" - <programlisting>public void cheddarCheese(Cheese cheese) { - if ( cheese.getType().equals("cheddar") { - System.out.println( "cheddar" ); - } -}</programlisting> +when + Hope does not exist +then + print "Democracy is Doomed" +</programlisting> - <para>Rule engines are a complete de-coupling of data from the logic. - Rules cannot be called directly as they are not methods or functions - instead Rules fire in response to changes in Working Memory's data, It may - help to think of this de-coupling as a specialised event sytem. The - Consequence is the Listener to the full matching of the LHS events.</para> - - <para>Rule Engines are much like a database where Rule's LHS define the - queries on the Working Memory. The previous rule can be expressed in - <indexterm> - <primary>SQL</primary> - </indexterm>SQL as:</para> - - <programlisting> select * from Cheese where type == "cheddar"</programlisting> - - <para>A <indexterm> - <primary>DataBase</primary> - </indexterm>Database executes SQL, on request, where as a Rule Engine - will process data against its rules, its Production Memory, as it's - asserted; this process is known as <indexterm> - <primary>Pattern Matching</primary> - </indexterm>Pattern Matching. When added to the Production Memory, - Rule's are decomposed into a graph using the <indexterm> - <primary>Rete</primary> - </indexterm>Rete algorithm. Rete is one of the standard Rule Engine - algorithms developed by <indexterm> - <primary>Charles Forgey</primary> - </indexterm>Charles Forgey in 1979 which is covered in greater detail in - a Rete Algorithm chapter.</para> - - <figure> - <title>A Basic Rete network</title> - - <mediaobject> - <imageobject> - <imagedata align="center" fileref="A_Basic_Rete_Network.svg" - format="SVG" /> - </imageobject> - - <imageobject> - <imagedata align="center" fileref="A_Basic_Rete_Network.png" - format="PNG" /> - </imageobject> - </mediaobject> - </figure> - - <para>Each Fact type in our Working Memory, such as <code>Cheese</code>, - is represented by an <indexterm> - <primary>Object Type</primary> - </indexterm>Object Type class, shown as the root node in our graph. When - Facts are asserted into the Working Memory the Rule Engine finds the - matching Object Type node and propagates the asserted Fact onto the next - node. The Object Type node maintains a memory of all matched Facts. in our - example the next node in the graph is a <indexterm> - <primary>Field Constraint</primary> - </indexterm>Field Constraint, <code>type == "cheddar", </code>its job is - to filter Facts using the given constraint; if the type of - <code>Cheese</code> is not "cheddar" the Fact progresses no further in the - network, if it is "cheddar" it is rememebered in the <indexterm> - <primary>Alpha Node</primary> - </indexterm>Alpha Node's memory and propagated onto the next node in the - network.. Alpha Node is classic Rete terminology for single input/single - output nodes, in that it receives a single Fact of a specified Object Type - and propates a single Fact of specified Object Type.</para> - - <para>At this point we have what is known as a <indexterm> - <primary>Partial Match</primary> - </indexterm>Partial Match, in that we have matched facts against some, - but not all, of the Rule's nodes. <indexterm> - <primary>Left Input Adapter Node</primary> - </indexterm>s will be explained later, suffice to say it always - propagetes onto the next node, in this case a <indexterm> - <primary>Terminal Node</primary> - </indexterm>Terminal Node. The Terminal Node is our end node, now we say - the Rule is Fully Matched and ready to fire.</para> - - <para>Earlier we mentioned that a Rule Engine is much like a Database, we - can prove this by using a <indexterm> - <primary>Query</primary> - </indexterm>Query construct. A Query is Rule with a special Terminal - node; instead of executing a Consequence the Terminal node stores matching - Facts in a list, which is returned as the result. Lets prove this</para> - - <programlisting>query "Find cheeses with a cost of 5" - Cheese( price == 5 ) -end</programlisting> - - <programlisting>// First create the facts -Cheese stilton = new Cheese("stilton", 8); // type, price -Cheese cheddar = new Cheese("cheddar", 5); // type, price -Cheese mozarella = new Cheese("mozarella", 5); // type, price - -// Now assert them into the Working Memory -workingMemory.assertObject( stilton ); -workingMemory.assertObject( cheddar ); -workingMemory.assertObject( mozarella ); - -List results = workingMemory.getQueryResults( "Find cheeses with a cost of 5" );</programlisting> - - <para>When we get the Query Results the List has a size of two and - references "cheddar" and "mozarella", as expected. If we had used a Rule - construct instead of a Query the Terminal Node's Consequence would have - attempted to fire twice, once for "cheddar" and once for - "mozarella".</para> - - <para>When a Rule is Fully Matched it does not fire immediately (in Rete, - but in Leaps it does !). Instead the Rule plus the matched Facts are - <indexterm> - <primary>Activated</primary> - </indexterm>Activated placed onto the <indexterm> - <primary>Agenda</primary> - </indexterm>Agenda; which is responsible for the scheduling and firing - <indexterm> - <primary>Activation</primary> - </indexterm>Activations.</para> + <para>There are two general approaches to Rule Engines implementation - + forward chaing and backward chaining. Forward chaing is 'data-driven' and + thus reactionary - facts are asserted into the working memory which + results in rules firing - we start with a fact, it propagates and we end + in a conclusion. Drools is a forward chaining engine. Backward chaining is + 'goal-driven', we start with a conclusion which the engine tries to + satisfy. If it can't it searches for conclusions, 'sub goals', that helps + satisfy an unknown part fo the current goal - it continues this process + untill either the initial conclusion is proven or there are no more sub + goals.</para> </section> </section> \ No newline at end of file Modified: labs/jbossrules/trunk/documentation/manual/en/master.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/master.xml 2006-05-19 01:11:06 UTC (rev 4323) +++ labs/jbossrules/trunk/documentation/manual/en/master.xml 2006-05-19 09:16:42 UTC (rev 4324) @@ -58,6 +58,8 @@ <xi:include href="Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml" /> + <xi:include href="Chapter-Rule_Engine/Section-Rules.xml" /> + <xi:include href="Chapter-Rule_Engine/Section-Rete_Algorithm.xml" /> <xi:include href="Chapter-Rule_Engine/Section-Leaps_Algorithm.xml" /> |
From: <jbo...@li...> - 2006-05-19 01:11:17
|
Author: tirelli Date: 2006-05-18 21:11:06 -0400 (Thu, 18 May 2006) New Revision: 4323 Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java Log: Improving constant literals Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-18 22:40:30 UTC (rev 4322) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-19 01:11:06 UTC (rev 4323) @@ -32,36 +32,53 @@ * Property to enable/disable left beta memory indexing * Defaults to false */ - public static final String INDEX_LEFT_BETA_MEMORY = "org.drools.reteoo.beta.index-left"; + public static final String PROPERTY_INDEX_LEFT_BETA_MEMORY = "org.drools.reteoo.beta.index-left"; /** * Property to enable/disable right beta memory indexing * Defaults to true */ - public static final String INDEX_RIGHT_BETA_MEMORY = "org.drools.reteoo.beta.index-right"; + public static final String PROPERTY_INDEX_RIGHT_BETA_MEMORY = "org.drools.reteoo.beta.index-right"; /** * Property to enable/disable alpha node hashing inside object type nodes * Defaults to true */ - public static final String HASH_OBJECT_TYPE_NODES = "org.drools.reteoo.alpha.hash-type-node"; + public static final String PROPERTY_HASH_OBJECT_TYPE_NODES = "org.drools.reteoo.alpha.hash-type-node"; /** * Property to enable/disable alpha node hashing inside alpha nodes * Defaults to false */ - public static final String HASH_ALPHA_NODES = "org.drools.reteoo.alpha.hash-alpha-node"; + public static final String PROPERTY_HASH_ALPHA_NODES = "org.drools.reteoo.alpha.hash-alpha-node"; + /** + * Property to define working memory assert behavior. Valid values are "identity" or "equals". + * Defaults to identity + */ + public static final String PROPERTY_ASSERT_BEHAVIOR = "org.drools.wm.assert-behavior"; + /** + * Property to define working memory logical assert behavior. Valid values are "identity" or "equals". + * Defaults to identity + */ + public static final String PROPERTY_LOGICAL_ASSERT_BEHAVIOR = "org.drools.wm.logical-assert-behavior"; + + public static final String WM_BEHAVIOR_IDENTITY = "identity"; + public static final String WM_BEHAVIOR_EQUALS = "equals"; // a generated serial version id private static final long serialVersionUID = 2989084670778336973L; public RuleBaseConfiguration() { // default values - this.setProperty( INDEX_LEFT_BETA_MEMORY, - System.getProperty( INDEX_LEFT_BETA_MEMORY, "false" ) ); - this.setProperty( INDEX_RIGHT_BETA_MEMORY, - System.getProperty( INDEX_RIGHT_BETA_MEMORY, "true" ) ); - this.setProperty( HASH_OBJECT_TYPE_NODES, - System.getProperty( HASH_OBJECT_TYPE_NODES, "true" ) ); - this.setProperty( HASH_ALPHA_NODES, - System.getProperty( HASH_ALPHA_NODES, "false" ) ); + this.setProperty( PROPERTY_INDEX_LEFT_BETA_MEMORY, + System.getProperty( PROPERTY_INDEX_LEFT_BETA_MEMORY, "false" ) ); + this.setProperty( PROPERTY_INDEX_RIGHT_BETA_MEMORY, + System.getProperty( PROPERTY_INDEX_RIGHT_BETA_MEMORY, "true" ) ); + this.setProperty( PROPERTY_HASH_OBJECT_TYPE_NODES, + System.getProperty( PROPERTY_HASH_OBJECT_TYPE_NODES, "true" ) ); + this.setProperty( PROPERTY_HASH_ALPHA_NODES, + System.getProperty( PROPERTY_HASH_ALPHA_NODES, "false" ) ); + this.setProperty( PROPERTY_ASSERT_BEHAVIOR, + System.getProperty( PROPERTY_ASSERT_BEHAVIOR, WM_BEHAVIOR_IDENTITY ) ); + this.setProperty( PROPERTY_LOGICAL_ASSERT_BEHAVIOR, + System.getProperty( PROPERTY_LOGICAL_ASSERT_BEHAVIOR, WM_BEHAVIOR_EQUALS ) ); } public boolean getBooleanProperty(String prop) { Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java 2006-05-18 22:40:30 UTC (rev 4322) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java 2006-05-19 01:11:06 UTC (rev 4323) @@ -34,10 +34,10 @@ } public final ObjectSinkList newObjectSinkList(Class owner) { - if ( config.getBooleanProperty( RuleBaseConfiguration.HASH_OBJECT_TYPE_NODES) && + if ( config.getBooleanProperty( RuleBaseConfiguration.PROPERTY_HASH_OBJECT_TYPE_NODES) && (ObjectTypeNode.class.isAssignableFrom( owner )) ) { return new HashedObjectSinkList(); - } else if ( config.getBooleanProperty( RuleBaseConfiguration.HASH_ALPHA_NODES ) && + } else if ( config.getBooleanProperty( RuleBaseConfiguration.PROPERTY_HASH_ALPHA_NODES ) && (AlphaNode.class.isAssignableFrom( owner )) ) { return new HashedObjectSinkList(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java 2006-05-18 22:40:30 UTC (rev 4322) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java 2006-05-19 01:11:06 UTC (rev 4323) @@ -50,7 +50,7 @@ BetaLeftMemory memory = null; BetaLeftMemory innerMostMemory = null; FieldConstraint[] constraints = (binder != null) ? binder.getConstraints() : null; - if ( (constraints != null) && (config.getBooleanProperty( RuleBaseConfiguration.INDEX_LEFT_BETA_MEMORY ))) { + if ( (constraints != null) && (config.getBooleanProperty( RuleBaseConfiguration.PROPERTY_INDEX_LEFT_BETA_MEMORY ))) { for ( int i = 0; i < constraints.length; i++ ) { if ( constraints[i] instanceof BoundVariableConstraint ) { BoundVariableConstraint bvc = (BoundVariableConstraint) constraints[i]; @@ -113,7 +113,7 @@ BetaRightMemory memory = null; BetaRightMemory innerMostMemory = null; FieldConstraint[] constraints = (binder != null) ? binder.getConstraints() : null; - if ( (constraints != null) && ( config.getBooleanProperty( RuleBaseConfiguration.INDEX_RIGHT_BETA_MEMORY ))) { + if ( (constraints != null) && ( config.getBooleanProperty( RuleBaseConfiguration.PROPERTY_INDEX_RIGHT_BETA_MEMORY ))) { for ( int i = 0; i < constraints.length; i++ ) { if ( constraints[i] instanceof BoundVariableConstraint ) { BoundVariableConstraint bvc = (BoundVariableConstraint) constraints[i]; |
From: <jbo...@li...> - 2006-05-18 22:40:36
|
Author: KrisVerlaenen Date: 2006-05-18 18:40:30 -0400 (Thu, 18 May 2006) New Revision: 4322 Modified: labs/jbossrules/trunk/drools-ide/build.properties Log: generating eclipse help Modified: labs/jbossrules/trunk/drools-ide/build.properties =================================================================== --- labs/jbossrules/trunk/drools-ide/build.properties 2006-05-18 22:05:22 UTC (rev 4321) +++ labs/jbossrules/trunk/drools-ide/build.properties 2006-05-18 22:40:30 UTC (rev 4322) @@ -3,7 +3,6 @@ lib/,\ icons/,\ plugin.xml,\ - help/,\ - toc.xml + help/ source.ide.jar = src/main/java/ output.ide.jar = bin/ |
From: <jbo...@li...> - 2006-05-18 22:05:27
|
Author: mar...@jb... Date: 2006-05-18 18:05:22 -0400 (Thu, 18 May 2006) New Revision: 4321 Added: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/HonestPoliticianExample.java labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/HonestPolitician.drl Log: JBRULES-270 Honest Politician -Thanks to Peter Lin for this logical assertion and not example Added: labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/HonestPoliticianExample.java =================================================================== --- labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/HonestPoliticianExample.java 2006-05-18 21:50:42 UTC (rev 4320) +++ labs/jbossrules/trunk/drools-examples/src/main/java/org/drools/examples/HonestPoliticianExample.java 2006-05-18 22:05:22 UTC (rev 4321) @@ -0,0 +1,73 @@ +package org.drools.examples; + +import java.io.InputStreamReader; + +import org.drools.FactHandle; +import org.drools.RuleBase; +import org.drools.RuleBaseFactory; +import org.drools.WorkingMemory; +import org.drools.audit.WorkingMemoryFileLogger; +import org.drools.compiler.PackageBuilder; + +public class HonestPoliticianExample { + + /** + * @param args + */ + public static void main(final String[] args) throws Exception { + + final PackageBuilder builder = new PackageBuilder(); + builder.addPackageFromDrl( new InputStreamReader( HonestPoliticianExample.class.getResourceAsStream( "HonestPolitician.drl" ) ) ); + + final RuleBase ruleBase = RuleBaseFactory.newRuleBase(); + ruleBase.addPackage( builder.getPackage() ); + + final WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + + final WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger( workingMemory ); + logger.setFileName( "log/honest-politician" ); + + final Politician blair = new Politician("blair", true); + final Politician bush = new Politician("bush", true); + final Politician chirac = new Politician("chirac", true); + final Politician schroder = new Politician("schroder", true); + + workingMemory.assertObject( blair ); + workingMemory.assertObject( bush ); + workingMemory.assertObject( chirac ); + workingMemory.assertObject( schroder ); + + workingMemory.fireAllRules(); + + logger.writeToDisk(); + } + + public static class Politician { + private String name; + + private boolean honest; + + public Politician(String name, boolean honest) { + super(); + this.name = name; + this.honest = honest; + } + + public boolean isHonest() { + return honest; + } + + public void setHonest(boolean honest) { + this.honest = honest; + } + + public String getName() { + return name; + } + } + + public static class Hope { + + } + +} Added: labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/HonestPolitician.drl =================================================================== --- labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/HonestPolitician.drl 2006-05-18 21:50:42 UTC (rev 4320) +++ labs/jbossrules/trunk/drools-examples/src/main/rules/org/drools/examples/HonestPolitician.drl 2006-05-18 22:05:22 UTC (rev 4321) @@ -0,0 +1,38 @@ +package org.drools.examples + +import org.drools.examples.HonestPolitician.Politician; +import org.drools.examples.HonestPolitician.Hope; + +rule "We have an honest Politician" + when + exists( Politician( honest == true ) ) + then + assertLogical( new Hope() ); +end + +rule "Hope Lives" + salience 10 + when + exists( Hope() ) + then + System.out.println("Hurrah!!! Democracy Lives"); +end + +rule "Hope is Dead" + when + not( Hope() ) + then + System.out.println( "We are all Doomed!!! Democracy is Dead" ); +end + +rule "Currupt the Honest" + salience 5 + when + politician : Politician( honest == true ) + exists( Hope() ) + then + System.out.println( "I'm an evil corporation and I have corrupted " + politician.getName() ); + politician.setHonest( false ); + modify( politician ); +end + |
From: <jbo...@li...> - 2006-05-18 21:50:48
|
Author: conkan Date: 2006-05-18 17:50:42 -0400 (Thu, 18 May 2006) New Revision: 4320 Added: labs/portletswap/imagegalleryportlet/trunk/portal_2.2/ Removed: labs/portletswap/imagegalleryportlet/portal_2.2/ Log: Copied: labs/portletswap/imagegalleryportlet/trunk/portal_2.2 (from rev 4319, labs/portletswap/imagegalleryportlet/portal_2.2) |
From: <jbo...@li...> - 2006-05-18 21:50:10
|
Author: conkan Date: 2006-05-18 17:49:59 -0400 (Thu, 18 May 2006) New Revision: 4319 Added: labs/portletswap/imagegalleryportlet/trunk/portal_2.0/ Removed: labs/portletswap/imagegalleryportlet/portal_2.0/ Log: Copied: labs/portletswap/imagegalleryportlet/trunk/portal_2.0 (from rev 4318, labs/portletswap/imagegalleryportlet/portal_2.0) |
Author: szimano Date: 2006-05-18 16:49:29 -0400 (Thu, 18 May 2006) New Revision: 4318 Added: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/ labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/ labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-user.jar labs/jbosslabs/trunk/portal-extensions/forge-tagme/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.properties labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.xml labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/TagMe.gwt.xml labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/server/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/servlet/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/jsp/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/jsp/normal.jsp labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/web.xml Modified: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/TitleChangeFilter.java labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/WEB-INF/layout/portal-strategies.xml labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/layouts/jbossForge.jsp labs/jbosslabs/trunk/portal-extensions/forge-theme/src/java/org/jboss/portal/core/theme/render/impl/JBFStrategyImpl.java Log: gwt base classes JBLAB-674 Added: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar =================================================================== (Binary files differ) Property changes on: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Added: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-user.jar =================================================================== (Binary files differ) Property changes on: labs/jbosslabs/trunk/portal-extensions/binaries/maven-repo-addons/google/jars/gwt-user.jar ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Modified: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/TitleChangeFilter.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/TitleChangeFilter.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/TitleChangeFilter.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -68,7 +68,7 @@ (HttpServletResponse) response); chain.doFilter(request, wrapper); - if (wrapper.getContentType().startsWith("text/html")) { + if (wrapper.getContentType() != null && wrapper.getContentType().startsWith("text/html")) { PrintWriter out = response.getWriter(); Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/maven.xml 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,38 @@ +<!-- + 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="all"> + <attainGoal name="prj-all" /> + </goal> + + <goal name="buildGWT"> + <ant:exec executable="java" > + <ant:arg value="-cp" /> + <ant:arg value="src/java:../binaries/maven-repo-addons/google/jars/gwt-user.jar:../binaries/maven-repo-addons/google/jars/gwt-dev-linux.jar" /> + <ant:arg value="com.google.gwt.dev.GWTCompiler" /> + <ant:arg value="-out" /> + <ant:arg value="target/tagme-servlet/www" /> + <ant:arg value="org.jboss.labs.tagme.gwt.TagMe" /> + </ant:exec> + </goal> + + <goal name="build"> + <attainGoal name="buildGWT" /> + + <attainGoal name="prj-war-build" /> + </goal> + + <goal name="deploy"> + <!--<ant:copy file="target/tagme-servlet.war" toDir="${local.deploy.dir}" />--> + <ant:copy file="target/tagme-servlet.war" toDir="/home/tomek/jboss/park_rozrywki/server/default/deploy" /> + </goal> + + <goal name="clean"> + <attainGoal name="prj-clean" /> + </goal> +</project> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.properties =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.properties 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.properties 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,3 @@ +maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/ +maven.junit.fork=yes +maven.war.src=${basedir}/src/web Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.xml 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/project.xml 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,40 @@ +<?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>../common.xml</extend> + <id>tagme-servlet</id> + <name>TagMe servlet</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Tomasz Szymanski</name> + <url>http://mamut.net.pl</url> + </organization> + <description></description> + <dependencies> + <dependency> + <groupId>jboss-forge</groupId> + <artifactId>forge-common</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>google</groupId> + <artifactId>gwt-user</artifactId> + <version>1.0</version> + <jar>gwt-user.jar</jar> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>google</groupId> + <artifactId>gwt-dev-linux</artifactId> + <version>1.0</version> + <jar>gwt-dev-linux.jar</jar> + </dependency> + </dependencies> +</project> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/TagMeServlet.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,56 @@ +/* + * 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.labs.tagme; + +import java.util.Collections; +import java.util.Vector; + +import org.jboss.labs.tagme.gwt.client.TaggingService; +import org.jboss.logging.Logger; + +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +public class TagMeServlet extends RemoteServiceServlet implements TaggingService { + + private final static Logger log = Logger.getLogger(TagMeServlet.class); + /** + * + */ + private static final long serialVersionUID = 1L; + + public Vector getTags(String path) { + Vector vect = new Vector(); + + vect.add("piwo"); vect.add("wodka"); vect.add("kefir"); + vect.add("słoń"); vect.add("kulfon"); vect.add("kret"); + vect.add("polska"); vect.add("europa"); vect.add("świat"); + + Collections.sort(vect); + + return vect; + } + + public void addTag(String user, String path, String tag) { + + } + +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/TagMe.gwt.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/TagMe.gwt.xml 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/TagMe.gwt.xml 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,4 @@ +<module> + <inherits name="com.google.gwt.user.User"/> + <entry-point class="org.jboss.labs.tagme.gwt.client.TagMe"/> +</module> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TagMe.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,144 @@ +/* + * 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.labs.tagme.gwt.client; + +import java.util.Vector; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.ServiceDefTarget; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.FlexTable; +import com.google.gwt.user.client.ui.PopupPanel; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.gwt.user.client.ui.Widget; + +public class TagMe implements EntryPoint { + + /** + * Native method in JScript to access gwt:properties (couldn't find anything + * in the mans for it) You add this on the page with <meta + * name="gwt:property" value="key=value" /< + * + * @param name + * Name of property + * @return value of property + */ + public static native String getProperty(String name) /*-{ + return parent.__gwt_getMetaProperty(name); + }-*/; + + /* + * (non-Javadoc) + * + * @see com.google.gwt.core.client.EntryPoint#onModuleLoad() + */ + public void onModuleLoad() { + // this is executed on the script start + + RootPanel.get().add(new Button("ClickMe", new ClickListener() { + + public void onClick(Widget sender) { + + Window.alert("props: " + getProperty("tomek") + " oraz " + + getProperty("adam")); + VerticalPanel panel = new VerticalPanel(); + + final FlexTable table = new FlexTable(); + + panel.add(table); + + final Vector textBoxes = new Vector(); + + for (int i = 0; i < 3; i++) { + TextBox box = new TextBox(); + textBoxes.add(box); + panel.add(box); + } + + TaggingServiceAsync tagging = (TaggingServiceAsync) GWT + .create(TaggingService.class); + + ServiceDefTarget endpoint = (ServiceDefTarget) tagging; + endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); + + AsyncCallback callback = new AsyncCallback() { + public void onSuccess(Object result) { + Vector vect = (Vector) result; + + int cols = (int) Math.sqrt(vect.size()); + + for (int i = 0; i < vect.size(); i++) { + table.setText(i / cols, i % cols, (String) vect + .get(i)); + } + } + + public void onFailure(Throwable caught) { + Window.alert("Error ! " + caught.getMessage()); + } + }; + + // call AJAX methos, after that callback is going to be executed + tagging.getTags("path", callback); + + panel.add(new Button("Save", new ClickListener() { + + public void onClick(Widget sender) { + TaggingServiceAsync tagging = (TaggingServiceAsync) GWT + .create(TaggingService.class); + + ServiceDefTarget endpoint = (ServiceDefTarget) tagging; + endpoint.setServiceEntryPoint("/tagme-servlet/tag/"); + + AsyncCallback callback = new AsyncCallback() { + public void onSuccess(Object result) { + Window.alert(result.toString()); + } + + public void onFailure(Throwable caught) { + Window.alert("Error ! " + caught.getMessage()); + } + }; + + tagging.getTags(((TextBox) textBoxes.get(0)).getText(), + callback); + } + + })); + + PopupPanel popUp = new PopupPanel(true); + + popUp.add(panel); + + popUp.show(); + } + + })); + } + +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingService.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,52 @@ +/* + * 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.labs.tagme.gwt.client; + +import java.util.Vector; + +import com.google.gwt.user.client.rpc.RemoteService; + +/** + * This interface is implemented by Servlet + * + * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> + * + */ +public interface TaggingService extends RemoteService { + /** + * Get all tags for given "path" + * + * @param path + * Path to get tags + * @return collection of tags + */ + public Vector getTags(String path); + + /** + * Adds tag (not implemented yet) + * + * @param user + * @param path + * @param tag + */ + public void addTag(String user, String path, String tag); +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/client/TaggingServiceAsync.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,38 @@ +/* + * 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.labs.tagme.gwt.client; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * This interface is made for asynch calls (+- copies TaggingService). Needed by + * GWT framework (and actually used inside your code) + * + * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> + * + */ +public interface TaggingServiceAsync { + public void getTags(String path, AsyncCallback callback); + + public void addTag(String user, String path, String tag, + AsyncCallback callback); +} Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/java/org/jboss/labs/tagme/gwt/public/TagMe.html 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,19 @@ +<html> + <head> + <meta name='gwt:module' content='org.jboss.labs.tagme.gwt.TagMe'> + <meta name='gwt:property' content='tomek=ziomek'> + <title>Hello</title> + </head> + <body bgcolor="white"> + <meta name='gwt:property' content='adam=siadam'> + <script language="javascript" src="/tagme-servlet/www/org.jboss.labs.tagme.gwt.TagMe/gwt.js"></script> + + Pod tym + <br /> + <div id="TopMenu"> + + </div> + <br /> + ale nad tym + </body> +</html> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/jsp/normal.jsp =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/jsp/normal.jsp 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/jsp/normal.jsp 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,17 @@ +<!-- + 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" %> + <%@ page isELIgnored ="false" %> + <portlet:defineObjects/> + +<div id="TagMe"> +<script language="javascript" src="gwt.js"></script> + +</div> + + \ No newline at end of file Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/tld/forge.tld 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,139 @@ +<taglib 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 web-jsptaglibrary_2_0.xsd" + version="2.0"> + <!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> + <tlib-version>1.1</tlib-version> + <jsp-version>2.0</jsp-version> + <shortname>forge</shortname> + <info>Forge tags</info> + + <tag> + <name>pageURL</name> + <tagclass>org.jboss.forge.common.taglib.PageURLTag</tagclass> + <attribute> + <name>page</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>param</name> + <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>wikiURL</name> + <tagclass>org.jboss.forge.common.taglib.WikiURLTag</tagclass> + <attribute> + <name>page</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>freezoneURL</name> + <tagclass>org.jboss.forge.common.taglib.FreezoneURLTag</tagclass> + <attribute> + <name>page</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>projectURL</name> + <tagclass>org.jboss.forge.common.taglib.ProjectURLTag</tagclass> + <attribute> + <name>project</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>page</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>categoryURL</name> + <tagclass>org.jboss.forge.common.taglib.CategoryURLTag</tagclass> + <attribute> + <name>category</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>selectedProject</name> + <tagclass>org.jboss.forge.common.taglib.SelectedProjectTag</tagclass> + </tag> + + <tag> + <name>imagePath</name> + <tagclass>org.jboss.forge.common.taglib.ImagePathTag</tagclass> + <attribute> + <name>src</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>project</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>attrValue</name> + <tagclass>org.jboss.forge.common.taglib.AttrValueTag</tagclass> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>attrIf</name> + <tagclass>org.jboss.forge.common.taglib.AttrIfTag</tagclass> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> +</taglib> Added: labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/web.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/web.xml 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-tagme/src/web/WEB-INF/web.xml 2006-05-18 20:49:29 UTC (rev 4318) @@ -0,0 +1,16 @@ +<?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> + <servlet> + <servlet-name>TagMe Servlet</servlet-name> + <servlet-class>org.jboss.labs.tagme.TagMeServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>TagMe Servlet</servlet-name> + <url-pattern>/tag/*</url-pattern> + </servlet-mapping> +</web-app> Modified: labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/WEB-INF/layout/portal-strategies.xml =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/WEB-INF/layout/portal-strategies.xml 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/WEB-INF/layout/portal-strategies.xml 2006-05-18 20:49:29 UTC (rev 4318) @@ -2,7 +2,7 @@ <portal-strategies> <set name="jbfStrategy"> <strategy content-type="text/html"> - <implementation>org.jboss.portal.theme.impl.strategy.JBFStrategyImpl</implementation> + <implementation>org.jboss.portal.core.theme.render.impl.JBFStrategyImpl</implementation> </strategy> </set> </portal-strategies> Modified: labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/layouts/jbossForge.jsp =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/layouts/jbossForge.jsp 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-theme/jbossForgeLayout.war/layouts/jbossForge.jsp 2006-05-18 20:49:29 UTC (rev 4318) @@ -8,6 +8,7 @@ --> <head><title>JBoss.ORG</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<meta name="gwt:module" content="/tagme-servlet/www/org.jboss.labs.tagme.gwt.TagMe/org.jboss.labs.tagme.gwt.TagMe" /> <!-- changed to local CSS for now <link rel="stylesheet" href="http://www.jboss.com/themes/jbosstheme/style/screen.css" type="text/css" media="screen"> @@ -37,13 +38,19 @@ <script type='text/javascript' language='JavaScript' src='/file-access/default/theme/js/speller.js'></script> <!-- end speller script --> + </head> + <body> <!-- HEADER START --> <!-- this image creates IE problems --> <!-- <img src="/jbossForge/images/svrGP.gif" border="0" height="1" width="1"> --> +<!-- GWT script --> +<script language="javascript" src="/tagme-servlet/www/org.jboss.labs.tagme.gwt.TagMe/gwt.js"></script> + + <div class="brand_FED" id="container"> <div id="TopLogo"> Modified: labs/jbosslabs/trunk/portal-extensions/forge-theme/src/java/org/jboss/portal/core/theme/render/impl/JBFStrategyImpl.java =================================================================== --- labs/jbosslabs/trunk/portal-extensions/forge-theme/src/java/org/jboss/portal/core/theme/render/impl/JBFStrategyImpl.java 2006-05-18 20:33:34 UTC (rev 4317) +++ labs/jbosslabs/trunk/portal-extensions/forge-theme/src/java/org/jboss/portal/core/theme/render/impl/JBFStrategyImpl.java 2006-05-18 20:49:29 UTC (rev 4318) @@ -19,7 +19,7 @@ * 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.portal.theme.impl.strategy; +package org.jboss.portal.core.theme.render.impl; import org.apache.log4j.Logger; import org.jboss.portal.WindowState; |
From: <jbo...@li...> - 2006-05-18 20:33:46
|
Author: adamw Date: 2006-05-18 16:33:34 -0400 (Thu, 18 May 2006) New Revision: 4317 Added: 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 Removed: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsCache.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-36 Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsCache.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsCache.java 2006-05-18 18:12:04 UTC (rev 4316) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/FeedsCache.java 2006-05-18 20:33:34 UTC (rev 4317) @@ -30,8 +30,8 @@ } public void update(Pair<String, String> key, FeedsDescriptor currentObject) { - put(key, getDesc(key.getFirst(), key.getSecond())); - currentObject.release(); + //put(key, getDesc(key.getFirst(), key.getSecond())); + //currentObject.release(); } public FeedsDescriptor init(Pair<String, String> key) { Deleted: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml 2006-05-18 18:12:04 UTC (rev 4316) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml 2006-05-18 20:33:34 UTC (rev 4317) @@ -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 Copied: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old (from rev 4110, labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml) =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml 2006-05-06 15:51:26 UTC (rev 4110) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/feeds-object.xml-old 2006-05-18 20:33:34 UTC (rev 4317) @@ -0,0 +1,10 @@ +<?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 Deleted: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml 2006-05-18 18:12:04 UTC (rev 4316) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml 2006-05-18 20:33:34 UTC (rev 4317) @@ -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> Copied: labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old (from rev 4110, labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml) =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml 2006-05-06 15:51:26 UTC (rev 4110) +++ labs/shotoku/trunk/shotoku-feeds/src/web/WEB-INF/portlet.xml-old 2006-05-18 20:33:34 UTC (rev 4317) @@ -0,0 +1,18 @@ +<?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-18 18:12:12
|
Author: adamw Date: 2006-05-18 14:12:04 -0400 (Thu, 18 May 2006) New Revision: 4316 Modified: labs/shotoku/trunk/shotoku-feeds/maven.xml Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-36 Modified: labs/shotoku/trunk/shotoku-feeds/maven.xml =================================================================== --- labs/shotoku/trunk/shotoku-feeds/maven.xml 2006-05-18 17:38:01 UTC (rev 4315) +++ labs/shotoku/trunk/shotoku-feeds/maven.xml 2006-05-18 18:12:04 UTC (rev 4316) @@ -7,6 +7,7 @@ <!-- Default war-project goals --> <goal name="build"> + <attainGoal name="jar" /> <attainGoal name="war" /> </goal> |
From: <jbo...@li...> - 2006-05-18 17:38:17
|
Author: adamw Date: 2006-05-18 13:38:01 -0400 (Thu, 18 May 2006) New Revision: 4315 Removed: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/DomToXmlTransformer.java labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesElementValue.java labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesMap.java labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/XmlTools.java Modified: labs/shotoku/trunk/project.properties labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/MultiValueVariableResolver.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/Substitution.java labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java labs/shotoku/trunk/shotoku-test/src/java/org/jboss/shotoku/test/embedded/TomekTest.java Log: http://jira.jboss.com/jira/browse/JBSHOTOKU-36 Modified: labs/shotoku/trunk/project.properties =================================================================== --- labs/shotoku/trunk/project.properties 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/project.properties 2006-05-18 17:38:01 UTC (rev 4315) @@ -5,7 +5,7 @@ shotoku.sar.dir=shotoku.sar shotoku.subprojects.cms=base,files,jcr,svn -shotoku.subprojects=${shotoku.subprojects.cms},aop,test,web,portal,admin +shotoku.subprojects=${shotoku.subprojects.cms},aop,test,web,admin,feeds,portal maven.final.name=${pom.artifactId} Deleted: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/DomToXmlTransformer.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/DomToXmlTransformer.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/DomToXmlTransformer.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -1,60 +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.shotoku.tools; - -import java.io.ByteArrayOutputStream; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Node; - -/** - * @author adamw - * @author Ryszard Kozmik - * A helper class to transform DOM nodes to their string representations - * in XML. - */ -public class DomToXmlTransformer { - /** - * Creates a string-xml representation of the given node. - * @param root Node to transform - * @return A string contating data from the given node in a XML format. - * @throws TransformerException - */ - public String transformNode(Node root) throws TransformerException { - TransformerFactory tFactory = TransformerFactory.newInstance(); - Transformer transformer = tFactory.newTransformer();; - transformer.setOutputProperty(OutputKeys.INDENT,"yes"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - transformer.transform(new DOMSource(root), new StreamResult(bos)); - - return bos.toString(); - } -} Deleted: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesElementValue.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesElementValue.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesElementValue.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -1,133 +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.shotoku.tools; - -import java.util.List; -import java.util.ArrayList; - -/** - * A class for holding single or multiple values. - * - * @author adamw - */ -public class PropertiesElementValue { - private String single; - private List<String> multi; - - /** - * Creates a new instance with no values. - */ - public PropertiesElementValue() { - single = null; - multi = null; - } - - /** - * Crates a new instance with an initial single value. - * - * @param initialValue - * Initial value to hold. - */ - public PropertiesElementValue(String initialValue) { - this(); - add(initialValue); - } - - /** - * Crates a new instance with values copied from the given - * element values. - * - * @param initialValues - * Initial values to add. - */ - public PropertiesElementValue(PropertiesElementValue initialValues) { - this(); - add(initialValues); - } - - private void singleToMulti() { - multi = new ArrayList<String>(); - - if (single != null) { - multi.add(single); - single = null; - } - } - - /** - * Adds all values from the given element values. - * - * @param ev - * Values to add. - */ - public void add(PropertiesElementValue ev) { - // Converting our values to a list of values. - singleToMulti(); - multi.addAll(ev.getAllValues()); - } - - /** - * Adds a value. - * - * @param value - * Value to add. - */ - public void add(String value) { - if ((single == null) && (multi == null)) - single = value; - else if (multi != null) - multi.add(value); - else { - singleToMulti(); - multi.add(value); - } - } - - /** - * Gets the first held value. - * - * @return First held value or null, if no value is held. - */ - public String getFirstValue() { - if (single == null) { - if (multi == null) - return null; - - return multi.get(0); - } - - return single; - } - - /** - * Gets all held values. - * - * @return A list of held values or null, if no values are held. - */ - public List<String> getAllValues() { - if (single != null) { - singleToMulti(); - } - - return multi; - } -} Deleted: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesMap.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesMap.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/PropertiesMap.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -1,136 +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.shotoku.tools; - -import java.util.Map; -import java.util.HashMap; -import java.util.Set; - -/** - * A class describing properties with multiple or single values. - * - * @author adamw - */ -public class PropertiesMap { - private Map<String, PropertiesElementValue> properties; - - /** - * Creates an empty properties map, with no bindings. - */ - public PropertiesMap() { - properties = new HashMap<String, PropertiesElementValue>(); - } - - /** - * Binds with the given key, the given value. - * - * @param key - * Key which to bind. - * @param value - * Value which should be added to the currently held values under - * the given key. - */ - public void add(String key, String value) { - PropertiesElementValue ev = properties.get(key); - if (ev == null) - properties.put(key, new PropertiesElementValue(value)); - else - ev.add(value); - } - - /** - * Binds with the given key the given values. - * - * @param key - * Key of the values. - * @param ev - * Value representation. - */ - public void put(String key, PropertiesElementValue ev) { - properties.put(key, ev); - } - - /** - * Gets the values that are bound to the given key. If no values are bound, - * a single-value "null" is returned. - * - * @param key - * Key to look for. - * @return Values corresponding to this key or a value "" if no values - * are bound. - */ - public PropertiesElementValue get(String key) { - PropertiesElementValue ev = properties.get(key); - if (ev == null) - return new PropertiesElementValue(""); - - return ev; - } - - /** - * Checks if there are any value bound to the given key. - * @param key Key to check. - * @return True iff any values are bound with the given key. - */ - public boolean hasValues(String key) { - return properties.containsKey(key); - } - - /** - * Binds with the given key, the given element values. - * - * @param key - * Key which to bind. - * @param value - * Values which should be added to the currently held values under - * the given key. - */ - public void add(String key, PropertiesElementValue value) { - PropertiesElementValue ev = properties.get(key); - if (ev == null) - properties.put(key, new PropertiesElementValue(value)); - else - ev.add(value); - } - - /** - * Adds all properties from the given properties map to this properties - * map. - * @param pm A properties map from which to add all the properties. - */ - public void add(PropertiesMap pm, boolean overwrite) { - for (String key : pm.properties.keySet()) { - if (overwrite) - properties.remove(key); - - add(key, pm.properties.get(key)); - } - } - - /** - * Gets a set of all keys held in this map. - * @return A set of all keys in this map. - */ - public Set<String> getKeySet() { - return properties.keySet(); - } -} Modified: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/Tools.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -26,15 +26,18 @@ import java.nio.charset.Charset; import java.nio.channels.FileChannel; import java.util.Random; +import java.util.Map; +import java.util.HashMap; import org.jboss.shotoku.ContentManager; import org.jboss.shotoku.service.ShotokuService; import org.jboss.shotoku.service.ShotokuServiceImpl; -import org.jboss.shotoku.service.AdministratedService; import org.jboss.shotoku.exceptions.RepositoryException; import org.jboss.shotoku.exceptions.NameFormatException; import org.jboss.mx.util.MBeanProxyExt; import org.jboss.mx.util.MBeanServerLocator; +import org.w3c.dom.Node; +import org.w3c.dom.NamedNodeMap; import javax.activation.MimetypesFileTypeMap; @@ -115,7 +118,30 @@ return unmarshallText(n); } + /** + * Reads all attributes of the given node and returns them as a map. Only + * signle-value attributes are supported. + * @param root Node from which to read the attributes. + * @return A map holding all attributes of the given node. + */ + public static Map<String, String> getMapFromNodeAttributes(Node root) { + Map<String, String> properties = new HashMap<String, String>(); + NamedNodeMap nnm = root.getAttributes(); + if (nnm != null) { + Node n; + + for (int i=0; i<nnm.getLength(); i++) { + n = nnm.item(i); + if (n.getNodeType() == Node.ATTRIBUTE_NODE) { + properties.put(n.getNodeName(), Tools.unmarshallText(n)); + } + } + } + + return properties; + } + /** * From the given string, removes unnecessary / in the middle and * ending. If startingSlash = true, ensures that the returned string Deleted: labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/XmlTools.java =================================================================== --- labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/XmlTools.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-base/src/java/org/jboss/shotoku/tools/XmlTools.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -1,266 +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.shotoku.tools; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.transform.TransformerException; - -import org.jboss.shotoku.tools.DomToXmlTransformer; -import org.jboss.shotoku.tools.PropertiesMap; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * Common helper xml parsing functions. - * - * @author adamw - * @author Pawel Wrzeszcz - */ -public class XmlTools { - /** - * This class cannot be instatiated. - */ - private XmlTools() { - - } - - /** - * Reads all attributes of the given node and returns them as a properties map. - * @param root Node from which to read the attributes. - * @return A properties map holding all attributes of the given node. - */ - public static PropertiesMap getPropertiesFromNodeAttributes(Node root) { - PropertiesMap properties = new PropertiesMap(); - NamedNodeMap nnm = root.getAttributes(); - - if (nnm != null) { - Node n; - - for (int i=0; i<nnm.getLength(); i++) { - n = nnm.item(i); - if (n.getNodeType() == Node.ATTRIBUTE_NODE) { - properties.add(n.getNodeName(), XmlTools.unmarshallText(n)); - } - } - } - - return properties; - } - - /** - * Reads all attributes of the given node and returns them as a map. Only - * signle-value attributes are supported. - * @param root Node from which to read the attributes. - * @return A map holding all attributes of the given node. - */ - public static Map<String, String> getMapFromNodeAttributes(Node root) { - Map<String, String> properties = new HashMap<String, String>(); - NamedNodeMap nnm = root.getAttributes(); - - if (nnm != null) { - Node n; - - for (int i=0; i<nnm.getLength(); i++) { - n = nnm.item(i); - if (n.getNodeType() == Node.ATTRIBUTE_NODE) { - properties.put(n.getNodeName(), XmlTools.unmarshallText(n)); - } - } - } - - return properties; - } - - /** - * Reads all child nodes of the given node and returns them as a map. - * - * @param root Node from which to read the child nodes. - * @return A map binding child nodes names with their values. - */ - public static Map<String, String> getMapFromNodeElements(Node root) { - Map<String,String> properties = new HashMap<String,String>(); - NodeList list = root.getChildNodes(); - - for (int i = 0; i < list.getLength(); i++) { - Node n = list.item(i); - if (n.getNodeType() == Node.ELEMENT_NODE) { - properties.put(n.getNodeName(), XmlTools.unmarshallText(n)); - } - } - - return properties; - } - - /** - * Reads all child nodes of the given node and returns them as a map. - * - * @param root Node from which to read the child nodes. - * @return A map binding child nodes names with appropriate nodes. - */ - public static Map<String, Node> getNodeMapFromNodeElements(Node root) { - Map<String, Node> properties = new HashMap<String, Node>(); - NodeList list = root.getChildNodes(); - - for (int i = 0; i < list.getLength(); i++) { - Node n = list.item(i); - if (n.getNodeType() == Node.ELEMENT_NODE) { - properties.put(n.getNodeName(), n); - } - } - - return properties; - } - - /** - * From the given node, gets the value of the specified attribute. - * @param root Node to read the attribute from. - * @param attrName Name of the attribute to read. - * @return Value of the given attribute or null, if no such attribute - * is present. - */ - public static String getAttributeValue(Node root, String attrName) { - NamedNodeMap attrMap = root.getAttributes(); - if (attrMap == null) return null; - - Node n = attrMap.getNamedItem(attrName); - if (n == null) return null; - - return unmarshallText(n); - } - - /** - * Reads and returns a HTML block contained in the children of the specified - * node. - * @param root Node from which's children to get the HTML block. - * @param xht An instance of a dom to xml transformer. - * @return A string representation of the html contained in the given - * node. - */ - public static String unmarshallHtml(Node root, DomToXmlTransformer xht) { - StringBuffer buf = new StringBuffer(); - - Node n; - NodeList nodes = root.getChildNodes(); - - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - - try { - buf.append(xht.transformNode(n)); - } catch (TransformerException e) { - return "Transformation error"; - } - } - - return buf.toString(); - } - - /** - * Reads and returns a HTML block contained in the children of the specified - * node with a default xml -> html transformer. - * @param root Node from which's children to get the HTML block. - * @return A string representation of the html contained in the given - * node. - */ - public static String unmarshallHtml(Node root) { - return unmarshallHtml(root, new DomToXmlTransformer()); - } - - /** - * Reads and returns a xml block contained in the entire specified - * node. - * @param root Node from which's to get the xml block. - * @return A string representation of the xml contained in the given - * node, including this node's representation. - */ - public static String unmarshallXml(Node root) { - try { - return new DomToXmlTransformer().transformNode(root); - } catch (TransformerException e) { - return ""; - } - } - - /** - * Gets a node that is a child node of the given one and has the given - * name. - * @param root Node which children are to be searched. - * @param name Name of the searched node. - * @return A child node with the given name or null, if no such node - * exists. - */ - public static Node getFirstNodeWithName(Node root, String name) { - NodeList children = root.getChildNodes(); - - for (int i = 0; i < children.getLength(); i++) { - Node n = children.item(i); - if (name.equalsIgnoreCase(n.getNodeName())) - return n; - } - - return null; - } - - /** - * Gets value of a node that is a child node of the given one and has the - * given name - * - * @param root Node which children are to be searched. - * @param childNodeName Name of the searched node. - * @return A value of child node with the given ame or null, if no such - * node exists. - */ - public static String getChildNodeValue(Node root, String childNodeName) { - Node node = getFirstNodeWithName(root, childNodeName); - - if (node != null) { - return unmarshallText(node); - } - - return null; - } - - /** - * Reads text contained in a tag of the form <tag>text</tag>. - * @param textNode Node to read text from. - * @return Text contained in the given node. - */ - public static String unmarshallText(Node textNode) { - StringBuffer buf = new StringBuffer(); - - Node n; - NodeList nodes = textNode.getChildNodes(); - - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - - if (n.getNodeType() == Node.TEXT_NODE) { - buf.append(n.getNodeValue()); - } - } - - return buf.toString(); - } -} Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/FeedTagHandlerManager.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -67,7 +67,7 @@ Matcher m = variablesPattern.matcher(text); while (m.find()) { - toFill.add(text.substring(m.start(), m.end()+1)); + toFill.add(text.substring(m.start(), m.end())); } } } @@ -86,7 +86,6 @@ // Getting an appropriate construtor to the given feed tag type. Constructor handlerConstr = handlers.get(definition.getNodeName()); if (handlerConstr == null) { - log.error("Unknown feed tag: " + definition.getNodeName() + "."); return; } @@ -112,6 +111,7 @@ // For each substitution, adding a tag handler to FeedsDescriptor. for (Substitution s : substitutions) { String feedName = s.make(feedNameAttr); + try { fd.addFeedTagHandler(feedName, s.getSubstitutionFor(Constants.TYPE_VARIABLE), (FeedTagHandler) handlerConstr.newInstance(feedName, group, definition, s)); Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/RemoteFeedTagHandler.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -35,7 +35,7 @@ feed.generate(new URL(address)); fd.addFeed(feedName, feedType, feed); } catch (Exception e) { - log.debug("Can't add feed " + address + " : " + feedType + ".", e); + log.error("Can't add feed " + address + " : " + feedType + ".", e); return false; } Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/tag/ShotokuFeedTagHandler.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -57,16 +57,17 @@ addParamSimple("and", AndNodeFilter.class); addParamSimple("or", OrNodeFilter.class); - addParamSimple("property-value", PropertyValueParameter.class); addParamSimple("search", Search.class); addParamSimple("shotoku-feed", Search.class); + addParamSimple("date-sort", DateSortParameter.class); + + addParamParametrized("property-value", PropertyValueParameter.class); addParamParametrized("directory", DirectoryIncludeParameter.class); addParamParametrized("history", HistoryIncludeParameter.class); addParamParametrized("limit", LimitParameter.class); addParamParametrized("property-sort", PropertySortParameter.class); - addParamParametrized("date-sort", DateSortParameter.class); } /** @@ -156,6 +157,8 @@ } vc.put(searchNameAttr, list); + + break; } catch (Exception e) { log.error("Error generating shotoku feed " + getFeedName() + ".", e); Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/MultiValueVariableResolver.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/MultiValueVariableResolver.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/MultiValueVariableResolver.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -1,5 +1,7 @@ package org.jboss.shotoku.feeds.variables; +import org.jboss.shotoku.feeds.Constants; + import java.util.Set; import java.util.HashSet; Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/Substitution.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/Substitution.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/Substitution.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -66,6 +66,7 @@ ret = (Substitution) super.clone(); ret.substitutions = new HashMap<Pattern, String>(substitutions); + ret.substitutionsSource = new HashMap<String, String>(substitutionsSource); return ret; } catch (CloneNotSupportedException e) { Modified: labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java =================================================================== --- labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-feeds/src/java/org/jboss/shotoku/feeds/variables/VariableResolverManager.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -42,7 +42,7 @@ try { varResolversEmptyConstructor.put(variable, varResolverClass.getConstructor()); } catch (NoSuchMethodException e1) { - log.error("No (org.w3c.dom.Node) or () constructor foound for variable " + + log.error("No (org.w3c.dom.Node) or () constructor found for variable " + props.getProperty(id + Constants.ONE_VAR + variable) + " resolver " + varResolverClass.getName() + ".", e); } Modified: labs/shotoku/trunk/shotoku-test/src/java/org/jboss/shotoku/test/embedded/TomekTest.java =================================================================== --- labs/shotoku/trunk/shotoku-test/src/java/org/jboss/shotoku/test/embedded/TomekTest.java 2006-05-18 14:57:13 UTC (rev 4314) +++ labs/shotoku/trunk/shotoku-test/src/java/org/jboss/shotoku/test/embedded/TomekTest.java 2006-05-18 17:38:01 UTC (rev 4315) @@ -2,6 +2,8 @@ import java.util.Set; import java.util.HashSet; +import java.util.regex.Pattern; +import java.util.regex.Matcher; /** * @author Adam Warski (ad...@as...) @@ -20,10 +22,26 @@ a[2] = 10; } + /** + * A pattern which matcher variables of the form "${text with numbers}". + */ + private final static Pattern variablesPattern = Pattern.compile( + Pattern.quote("${") + "[a-zA-Z0-9]*" + Pattern.quote("}")); + + private static void addVariablesFromNode(String text) { + Matcher m = variablesPattern.matcher(text); + + while (m.find()) { + System.out.println(text.substring(m.start(), m.end())); + } + } + public static void main(String[] args) { - int[] t = {1, 2, 3}; + /*int[] t = {1, 2, 3}; System.out.println(t[2]); x(t); - System.out.println(t[2]); + System.out.println(t[2]);*/ + + addVariablesFromNode("templates/${type}-normal.vm"); } } |
From: <jbo...@li...> - 2006-05-18 11:16:44
|
Author: mic...@jb... Date: 2006-05-18 07:16:31 -0400 (Thu, 18 May 2006) New Revision: 4312 Modified: labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java labs/jbossrules/trunk/drools-ide/src/test/java/org/drools/ide/editors/completion/ContextScanningTest.java Log: improved LHS RHS detection 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-18 04:06:13 UTC (rev 4311) +++ labs/jbossrules/trunk/drools-ide/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java 2006-05-18 11:16:31 UTC (rev 4312) @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.StringTokenizer; import java.util.regex.Pattern; import org.drools.compiler.DrlParser; @@ -35,8 +36,6 @@ */ public class RuleCompletionProcessor extends DefaultCompletionProcessor { - private static final Pattern condition = Pattern.compile(".*\\Wwhen\\W.*", Pattern.DOTALL); - private static final Pattern consequence = Pattern.compile(".*\\Wthen\\W.*", Pattern.DOTALL); 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 ); @@ -65,9 +64,9 @@ return list; } - if (query.matcher(backText).matches()) { + if (query(backText)) { list.addAll(adapter.listConditionItems()); - } else if (consequence.matcher(backText).matches()) { + } else if (consequence(backText)) { List dslConsequences = adapter.listConsequenceItems(); addDSLProposals( list, prefix, @@ -82,40 +81,12 @@ list, prefix ); } - } else if (condition.matcher(backText).matches()) { + } else if (condition(backText)) { List dslConditions = adapter.listConditionItems(); - Iterator iterator; addDSLProposals( list, prefix, dslConditions ); - Image droolsIcon = DroolsPluginImages.getImage(DroolsPluginImages.DROOLS); - if (!adapter.hasConditions()) { - list.add( new RuleCompletionProposal(prefix.length(), "exists", "exists ", droolsIcon)); - list.add( new RuleCompletionProposal(prefix.length(), "not", "not ", droolsIcon)); - list.add( new RuleCompletionProposal(prefix.length(), "and", "and ", droolsIcon)); - list.add( new RuleCompletionProposal(prefix.length(), "or", "or ", droolsIcon)); - RuleCompletionProposal prop = new RuleCompletionProposal(prefix.length(), "eval", "eval()", 5); - prop.setImage(droolsIcon); - list.add(prop); - - List imports = getImports(viewer); - iterator = imports.iterator(); - while (iterator.hasNext()) { - String name = (String) iterator.next(); - int index = name.lastIndexOf("."); - if (index != -1) { - String className = name.substring(index + 1); - RuleCompletionProposal p = new RuleCompletionProposal(prefix.length(), className, className + "()", className.length() + 1); - p.setPriority(-1); - p.setImage(classIcon); - list.add(p); - } - } - - } - RuleCompletionProposal prop = new RuleCompletionProposal(prefix.length(), "then", "then\n\t"); - prop.setImage(droolsIcon); - list.add(prop); + addLHSCompletionProposals(viewer, list, adapter, prefix); } else { @@ -132,6 +103,63 @@ return null; } + private void addLHSCompletionProposals(ITextViewer viewer, final List list, DSLAdapter adapter, final String prefix) throws CoreException, DroolsParserException { + Iterator iterator; + Image droolsIcon = DroolsPluginImages.getImage(DroolsPluginImages.DROOLS); + if (!adapter.hasConditions()) { + list.add( new RuleCompletionProposal(prefix.length(), "exists", "exists ", droolsIcon)); + list.add( new RuleCompletionProposal(prefix.length(), "not", "not ", droolsIcon)); + list.add( new RuleCompletionProposal(prefix.length(), "and", "and ", droolsIcon)); + list.add( new RuleCompletionProposal(prefix.length(), "or", "or ", droolsIcon)); + RuleCompletionProposal prop = new RuleCompletionProposal(prefix.length(), "eval", "eval()", 5 ); + prop.setImage(droolsIcon); + list.add(prop); + + List imports = getImports(viewer); + iterator = imports.iterator(); + while (iterator.hasNext()) { + String name = (String) iterator.next(); + int index = name.lastIndexOf("."); + if (index != -1) { + String className = name.substring(index + 1); + RuleCompletionProposal p = new RuleCompletionProposal(prefix.length(), className, className + "()", className.length() + 1); + p.setPriority(-1); + p.setImage(classIcon); + list.add(p); + } + } + + } + RuleCompletionProposal prop = new RuleCompletionProposal(prefix.length(), "then", "then\n\t"); + prop.setImage(droolsIcon); + list.add(prop); + } + + private boolean consequence(String backText) { + return isKeywordOnLine(backText, "then"); + } + + private boolean condition(String backText) { + return isKeywordOnLine(backText, "when"); + } + + boolean query(String backText) { + return query.matcher(backText).matches(); + } + + /** + * Check to see if the keyword appears on a line by itself. + */ + private boolean isKeywordOnLine(String chunk, String keyword) { + StringTokenizer st = new StringTokenizer(chunk, "\n\t"); + while(st.hasMoreTokens()) { + if (st.nextToken().trim().equals(keyword)) { + return true; + } + } + return false; + } + private void addRHSFunctionCompletionProposals(ITextViewer viewer, final List list, final String prefix) throws CoreException, Modified: labs/jbossrules/trunk/drools-ide/src/test/java/org/drools/ide/editors/completion/ContextScanningTest.java =================================================================== --- labs/jbossrules/trunk/drools-ide/src/test/java/org/drools/ide/editors/completion/ContextScanningTest.java 2006-05-18 04:06:13 UTC (rev 4311) +++ labs/jbossrules/trunk/drools-ide/src/test/java/org/drools/ide/editors/completion/ContextScanningTest.java 2006-05-18 11:16:31 UTC (rev 4312) @@ -1,8 +1,11 @@ package org.drools.ide.editors.completion; +import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.drools.ide.editors.DRLRuleEditor; + import junit.framework.TestCase; public class ContextScanningTest extends TestCase { @@ -27,5 +30,8 @@ } + + + } |
From: <jbo...@li...> - 2006-05-18 04:06:18
|
Author: conkan Date: 2006-05-18 00:06:13 -0400 (Thu, 18 May 2006) New Revision: 4311 Added: labs/portletswap/imagegalleryportlet/portal_2.2/ Log: |
Author: conkan Date: 2006-05-18 00:03:39 -0400 (Thu, 18 May 2006) New Revision: 4310 Added: labs/portletswap/imagegalleryportlet/portal_2.0/.classpath labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore labs/portletswap/imagegalleryportlet/portal_2.0/.project labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt labs/portletswap/imagegalleryportlet/portal_2.0/README.txt labs/portletswap/imagegalleryportlet/portal_2.0/build.bat labs/portletswap/imagegalleryportlet/portal_2.0/build.log labs/portletswap/imagegalleryportlet/portal_2.0/build.sh labs/portletswap/imagegalleryportlet/portal_2.0/build.xml labs/portletswap/imagegalleryportlet/portal_2.0/gallery/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/ labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg labs/portletswap/imagegalleryportlet/portal_2.0/src/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/ labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/ labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf labs/portletswap/imagegalleryportlet/portal_2.0/src/main/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageCollectionImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageDetailImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/impl/ImageGalleryModuleImpl.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ImageCollection.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/model/ImageDetail.java labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/imagegallery/ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/test/imagegallery/ImageGalleryPortletTestCase.java labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/application.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-ear/META-INF/jboss-app.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/META-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/META-INF/jboss-service.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/hibernate.cfg.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-sar/conf/hibernate/setup.txt labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/Resource.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/classes/Resource_en.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/imagegallery-pages.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-app.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-portlet.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jboss-web.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionAdd.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionDelete.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionEdit.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collectionView.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/collections.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailAdd.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailDelete.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailEdit.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/detailView.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/details.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/jsp/imagedetail.jsp labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portal-lib.tld labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portlet-instances.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/portlet.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/portal-imagegallery-war/WEB-INF/web.xml labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/setup/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/setup/setup.sql labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/ labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/hibernate.properties labs/portletswap/imagegalleryportlet/portal_2.0/src/resources/test/log4j.properties Log: Added: labs/portletswap/imagegalleryportlet/portal_2.0/.classpath =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.classpath 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.classpath 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-server/lib/jboss.jar"/> + <classpathentry kind="src" path="/portal-core"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-system.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-jmx.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-system/lib/jboss-common.jar"/> + <classpathentry kind="src" path="/portal-api"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-j2ee/lib/jboss-j2ee.jar"/> + <classpathentry kind="src" path="/portal-portlet"/> + <classpathentry kind="lib" path="/portal-thirdparty/sun-servlet/lib/jsp-api.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/sun-servlet/lib/servlet-api.jar"/> + <classpathentry kind="src" path="/portal-server"/> + <classpathentry kind="src" path="/portal-common"/> + <classpathentry kind="lib" path="/portal-thirdparty/jakarta-log4j/lib/log4j.jar"/> + <classpathentry kind="src" path="/portal-format"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-hibernate/lib/hibernate2.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jakarta-lucene/lib/lucene.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/oswego-concurrent/lib/concurrent.jar"/> + <classpathentry kind="lib" path="/portal-thirdparty/jboss-hibernate/lib/jboss-hibernate.jar"/> + <classpathentry kind="output" path="bin"/> +</classpath> Added: labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.cvsignore 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,2 @@ +output +build.log Added: labs/portletswap/imagegalleryportlet/portal_2.0/.project =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/.project 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/.project 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>portal-ron</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> Added: labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/LICENSE.txt 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,8 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/README.txt =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/README.txt 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/README.txt 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,6 @@ +The Image Gallery Portlet is great for showing images on the web. +It uses the JBoss Portal CMS. +The images can be loaded to the CMS using the JBoss CMS or Windows "My Network Places" useing webdav. +The sample gallery images must be loaded to the JBoss CMS under the "default" directory. +If My Network Places is used, the whole gallery directory structure can be moved under default with one directory move, +All that is needed after that is a build and a build deploy to get up and running. \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.bat =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.bat 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.bat 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,54 @@ +@echo off +rem +rem Invokes a script of the same name in the 'tools' module. +rem +rem The 'tools' module is expected to be a peer directory of the directory +rem in which this script lives. +rem +rem @author Jason Dillon <ja...@pl...> +rem + +rem $Id: build.bat,v 1.1.1.1 2005/01/14 23:12:37 vietj Exp $ + +setlocal + +set PROGNAME=%~nx0 +set DIRNAME=%~dp0 + +rem Legacy shell support +if x%PROGNAME%==x set PROGNAME=build.bat +if x%DIRNAME%==x set DIRNAME=.\ + +set MODULE_ROOT=%DIRNAME% +if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools +set TARGET=%TOOLS_ROOT%\bin\build.bat +set ARGS=%* + +rem Start'er up yo +goto main + +:debug +if not x%DEBUG%==x echo %PROGNAME%: %* +goto :EOF + +:main +call :debug PROGNAME=%PROGNAME% +call :debug DIRNAME=%DIRNAME% +call :debug TOOLS_ROOT=%TOOLS_ROOT% +call :debug TARGET=%TARGET% + +if exist %TARGET% call :call-script & goto :EOF +rem else fail, we can not go on + +echo %PROGNAME%: *ERROR* The target executable does not exist: +echo %PROGNAME%: +echo %PROGNAME%: %TARGET% +echo %PROGNAME%: +echo %PROGNAME%: Please make sure you have checked out the 'tools' module +echo %PROGNAME%: and make sure it is up to date. +goto :EOF + +:call-script +call :debug Executing %TARGET% %ARGS% +call %TARGET% %ARGS% +goto :EOF Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.log =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.log 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.log 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,61 @@ + +configure: + +configure-libraries: + +configure-modules: + +configure-defaults: + +configure-tools: + +_configure:explode:task: + +_configure:jflex:task: + +_configure:xdoclet:task: + +_configure:xdoclet:ejbdoclet: + +_configure:xdoclet:jmxdoclet: + +_configure:xdoclet:hibernatedoclet: + +_configure:xdoclet:webdoclet: + +_configure:cactus:cactus: + [echo] D:\portal-2.0/thirdparty/junit-junit/lib + +init: + +generate-classes: + +_default:compile-classes: + [depend] Deleted 0 out of date files in 0 seconds + +_default:check-exists-etc: + +_default:compile-etc: + +_default:check-exists-resources: + +_default:compile-resources: + +compile: +[jmxdoclet] Oct 24, 2005 10:51:06 PM xdoclet.XDocletMain start +[jmxdoclet] INFO: Running <jbossxmbean/> +[jmxdoclet] WARNING: Some classes refer to other classes that were not found among the sources or on the classpath. +[jmxdoclet] (Perhaps the referred class doesn't exist? Hasn't been generated yet?) +[jmxdoclet] The referring classes do not import any fully qualified classes matching these classes. +[jmxdoclet] Since at least one package is imported, it is impossible for xjavadoc to figure out +[jmxdoclet] what package the referred classes belong to. The classes are: +[jmxdoclet] D:\portal-2.0\imagegallery\src\main\org\jboss\portlet\imagegallery\ImageGalleryPortlet.java --> JBossPortlet qualified to org.jboss.portlet.imagegallery.JBossPortlet +[hibernatedoclet] Oct 24, 2005 10:51:07 PM xdoclet.XDocletMain start +[hibernatedoclet] INFO: Running <hibernate/> + +output: + +deploy: + [copy] Copying 1 file to D:\jboss\jboss-4.0.2\server\default\deploy + +BUILD SUCCESSFUL Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.sh =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.sh 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.sh 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,49 @@ +#!/bin/sh +## +## Invokes a script of the same name in the 'tools' module. +## +## The 'tools' module is expected to be a peer directory of the directory +## in which this script lives. +## +## @author Jason Dillon <ja...@pl...> +## + +# $Id: build.sh,v 1.1.1.1 2005/01/14 23:12:37 vietj Exp $ + +PROGNAME=`basename $0` +DIRNAME=`dirname $0` + +# Buss it yo +main() { + if [ "x$TOOLS_ROOT" = "x" ]; then + TOOLS_ROOT=`cd $DIRNAME/../tools && pwd` + fi + + MODULE_ROOT=`cd $DIRNAME; pwd` + export TOOLS_ROOT MODULE_ROOT DEBUG TRACE + + # Where is the target script? + target="$TOOLS_ROOT/bin/$PROGNAME" + if [ ! -f "$target" ]; then + echo "${PROGNAME}: *ERROR* The target executable does not exist:" + echo "${PROGNAME}:" + echo "${PROGNAME}: $target" + echo "${PROGNAME}:" + echo "${PROGNAME}: Please make sure you have checked out the 'tools' module" + echo "${PROGNAME}: and make sure it is up to date." + exit 2 + fi + + # Get busy yo! + if [ "x$DEBUG" != "x" ]; then + echo "${PROGNAME}: Executing: /bin/sh $target $@" + fi + if [ "x$TRACE" = "x" ]; then + exec /bin/sh $target "$@" + else + exec /bin/sh -x $target "$@" + fi +} + +# Lets get ready to rumble! +main "$@" Added: labs/portletswap/imagegalleryportlet/portal_2.0/build.xml =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/build.xml 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/build.xml 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,300 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project [ + <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent"> +<!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent"> +<!ENTITY libraries SYSTEM "../tools/etc/buildfragments/libraries.ent"> +<!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent"> +<!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent"> +<!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent"> +]> + +<!-- $Id: build.xml,v 1.9 2005/05/16 22:45:17 julien Exp $ --> + +<!--+======================================================================+--> +<!--| JBoss Portal (The OpenSource Portal) Build File |--> +<!--| |--> +<!--| Distributable under LGPL license. |--> +<!--| See terms of license at http://www.gnu.org. |--> +<!--| |--> +<!--| This file has been designed to work with the 'tools' module and |--> +<!--| Buildmagic extentions. |--> +<!--+======================================================================+--> + +<project default="main" name="JBoss Portal imagegallery"> + + <!--+====================================================================+--> + <!--| Setup |--> + <!--| |--> + <!--| Include the common build elements. |--> + <!--| |--> + <!--| This defines several different targets, properties and paths. |--> + <!--| It also sets up the basic extention tasks amoung other things. |--> + <!--+====================================================================+--> + + &buildmagic; + &libraries; + &modules; + &defaults; + &tools; + &targets; + + <!-- ================================================================== --> + <!-- Initialization --> + <!-- ================================================================== --> + + <!-- + | Initialize the build system. Must depend on '_buildmagic:init'. + | Other targets should depend on 'init' or things will mysteriously fail. + --> + + <target name="init" unless="init.disable" depends="_buildmagic:init"> + </target> + + <!--+====================================================================+--> + <!--| Configuration |--> + <!--| |--> + <!--| This target is invoked by the Buildmagic initialization logic |--> + <!--| and should contain module specific configuration elements. |--> + <!--+====================================================================+--> + + <target name="configure" unless="configure.disable"> + + <!-- Configure some properties --> + <property name="jndi-root" value="portal" /> + + <!-- Configure thirdparty libraries --> + <call target="configure-libraries" /> + <path id="library.classpath"> + <path refid="oswego.concurrent.classpath" /> + <path refid="jboss.system.classpath" /> + <path refid="jboss.j2ee.classpath" /> + <path refid="jboss.server.classpath" /> + <path refid="jakarta.log4j.classpath" /> + <path refid="junit.junit.classpath" /> + <path refid="sun.servlet.classpath" /> + <path refid="jakarta.cactus.classpath" /> + <path refid="jakarta.lucene.classpath" /> + <path refid="jakarta.fileupload.classpath"/> + <path refid="jakarta.slide.classpath"/> + <path refid="jwebunit.jwebunit.classpath" /> + <path refid="dbunit.dbunit.classpath" /> + </path> + + <!-- Configure modules --> + <call target="configure-modules" /> + <path id="dependentmodule.classpath"> + <path refid="jboss.portal-core.classpath" /> + <path refid="jboss.portal-format.classpath" /> + <path refid="jboss.portal-common.classpath" /> + <path refid="jboss.portal-portlet.classpath" /> + <path refid="jboss.portal-server.classpath" /> + <path refid="jboss.portlet-api.classpath" /> + <path refid="jboss.hibernate.classpath" /> + </path> + + <!--+=======================================+--> + <!--| Override any default properties here. |--> + <!--+=======================================+--> + + <!-- Configure defaults & build tools --> + <call target="configure-defaults" /> + <call target="configure-tools" /> + + <!--+=======================================+--> + <!--| Define module specific elements here. |--> + <!--+=======================================+--> + <property name="javadoc.private" value="true" /> + <property name="javadoc.protected" value="false" /> + + </target> + + + + <!--+====================================================================+--> + <!--| Compile |--> + <!--| |--> + <!--| This target should depend on other compile-* targets for each |--> + <!--| different type of compile that needs to be performed, short of |--> + <!--| documentation compiles. |--> + <!--+====================================================================+--> + + <target name="compile" description="Compile all source files." depends="generate-classes, + _default:compile-classes, + _default:compile-etc, + _default:compile-resources"> + <!-- Add module specific elements here. --> + <jmxdoclet + destDir="${build.classes}"> + <fileset dir="${jboss.portal-server.root}/../src/main"> + <include name="org/jboss/portal/server/util/Service.java" /> + <include name="org/jboss/portal/server/deployment/AbstractWebAppListener.java" /> + </fileset> + <fileset dir="${source.classes}" includes="**/*.java" /> + <jbossxmbean /> + </jmxdoclet> + <hibernatedoclet + destDir="${build.resources}/portal-imagegallery-sar"> + <fileset dir="${source.java}"> + <include name="**/impl/*Impl.java" /> + </fileset> + <hibernate + version="3.0" + destDir="${build.resources}/portal-imagegallery-sar"/> + </hibernatedoclet> + </target> + + <!-- Generate all class files --> + <target name="generate-classes" depends="init"> + </target> + + <!-- Remove or change the delimiter in hibernate-export if your database has a different deliniter --> + <target name="ddl" depends="output"> + <taskdef classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" name="hibernate-export"> + <classpath> + <path refid="javac.classpath" /> + <pathelement location="${build.resources}/test" /> + <fileset dir="${build.lib}" includes="portal-imagegallery-lib.jar" /> + <fileset dir="${jboss.home}/lib" includes="dom4j.jar,commons-logging.jar" /> + <fileset dir="${jboss.hibernate.lib}" includes="commons-collections.jar,odmg.jar" /> + </classpath> + </taskdef> + <mkdir dir="${build.resources}/setup/" /> + <hibernate-export properties="${hibernate.properties}" text="true" quiet="true" delimiter=";" output="${build.resources}/setup/setup.ddl"> + <fileset dir="${build.resources}/portal-imagegallery-sar" includes="**/*.hbm.xml" /> + </hibernate-export> + </target> + + <!--+====================================================================+--> + <!--| Generate Output |--> + <!--| |--> + <!--| Generates the target output for this module. Target output is |--> + <!--| the output which is ment to be released or used by external |--> + <!--| modules. |--> + <!--+====================================================================+--> + + <target name="output" description="Generate all target output." depends="compile"> + + <mkdir dir="${build.lib}" /> + + <!-- portal-imagegallery-lib.jar --> + <jar jarfile="${build.lib}/portal-imagegallery-lib.jar"> + <fileset dir="${build.classes}" /> + </jar> + + <!-- portal-imagegallery.war --> + <jar jarfile="${build.lib}/portal-imagegallery.war" manifest="${build.etc}/portal-imagegallery-war.mf"> + <fileset dir="${build.resources}/portal-imagegallery-war" /> + <fileset dir="${source.bin}/portal-imagegallery-war" /> + </jar> + + <!-- portal-imagegallery.sar --> + <jar jarfile="${build.lib}/portal-imagegallery.sar"> + <fileset dir="${build.resources}/portal-imagegallery-sar" includes="**/*" /> + </jar> + + <!-- portal-imagegallery.ear --> + <copy todir="${build.resources}/portal-imagegallery-ear"> + <fileset dir="${jakarta.lucene.root}/lib" includes="lucene-1.4-final.jar" /> + <fileset dir="${build.lib}" includes="portal-imagegallery.war,portal-imagegallery-lib.jar,portal-imagegallery.sar" /> + </copy> + <jar jarfile="${build.lib}/portal-imagegallery.ear"> + <fileset dir="${build.resources}/portal-imagegallery-ear" includes="**/*" /> + </jar> + </target> + + <target name="explode" depends="init"> + <explode file="${build.lib}/portal-imagegallery.ear" todir="${build.lib}" name="portal-imagegallery-exploded.ear" /> + </target> + + <!-- ================================================================== --> + <!-- Cleaning --> + <!-- ================================================================== --> + + <!-- Clean up all build output --> + <target name="clean" depends="_default:clean"> + <!-- Add module specific elements here. --> + </target> + + <!--+====================================================================+--> + <!--| Documents |--> + <!--| |--> + <!--| Generate all documentation for this module. |--> + <!--+====================================================================+--> + + <target name="docs" depends="_default:docs"> + <!-- Add module specific elements here. --> + </target> + + <!-- ================================================================== --> + <!-- Misc. --> + <!-- ================================================================== --> + + <target name="main" depends="most" /> + <target name="all" depends="_default:all" /> + <target name="most" depends="_default:most" /> + <target name="help" depends="_default:help" /> + + <!-- ================================================================== --> + <!-- Deployment --> + <!-- ================================================================== --> + + <!-- + | Deploy the application + --> + <target name="deploy" description="Deploy." depends="output"> + <require file="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + <copy file="${build.lib}/portal-imagegallery.ear" todir="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + </target> + + <!-- + | Undeploy the application + --> + <target name="undeploy" description="Undeploy." depends="init"> + <require file="${jboss.home}/server/${portal.deploy.dir}/deploy" /> + <delete file="${jboss.home}/server/${portal.deploy.dir}/deploy/portal-imagegallery.ear" /> + </target> + + <target name="test" depends="init"> + + <property name="build.testlog" value="${module.output}/log" /> + + <echo> + <![CDATA[ + ${build.reports} + ${build.testlog} + ${module.output} + ${junit.printsummary} + ${junit.batchtest.haltonerror} + ${junit.batchtest.haltonfailure} + ${junit.batchtest.fork} + ${junit.timeout} + ${junit.jvm} + ]]> + </echo> + + <mkdir dir="${build.reports}" /> + <mkdir dir="${build.testlog}" /> + + <junit dir="${module.output}" printsummary="${junit.printsummary}" haltonerror="${junit.haltonerror}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" timeout="${junit.timeout}" jvm="${junit.jvm}"> + <formatter type="plain" usefile="false" /> + <sysproperty key="build.testlog" value="${build.testlog}" /> + <sysproperty key="build.resources" value="${build.resources}" /> + <test name="org.jboss.portlet.test.imagegallery.imagegalleryPortletTestCase" /> + <classpath> + <pathelement location="${build.classes}" /> + <pathelement location="${build.resources}/portal-core-sar" /> + <pathelement location="${jboss.home}/lib/dom4j.jar" /> + <pathelement location="${jboss.config}/lib/hsqldb.jar" /> + <pathelement location="${jboss.config}/lib/jgroups.jar" /> + <pathelement location="${jboss.config}/lib/cglib-full-2.0.1.jar" /> + <path refid="jboss.hibernate.classpath" /> + <path refid="library.classpath" /> + <path refid="dependentmodule.classpath" /> + <pathelement location="${jwebunit.jwebunit.lib}/nekohtml.jar" /> + <pathelement location="${dbunit.dbunit.lib}/dbunit.jar" /> + <pathelement location="${jdbc.connectors.lib}/mysql-connector-java.jar" /> + </classpath> + </junit> + + </target> +</project> Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/bufo.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/desert.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/fan.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/rana.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/images/xen.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/bufo.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/desert.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/fan.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/rana.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/gallery/thumbnails/xen.jpg ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/Thumbs.db ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/add.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/back.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/delete.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/edit.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/next.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/previous.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif =================================================================== (Binary files differ) Property changes on: labs/portletswap/imagegalleryportlet/portal_2.0/src/bin/portal-imagegallery-war/images/view.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/etc/portal-imagegallery-war.mf 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Created-By: @java.vm.version@ (@java.vm.vendor@) +Specification-Title: @specification.title@ +Specification-Version: @specification.version@ +Specification-Vendor: @specification.vendor@ +Implementation-Title: @implementation.title@ +Implementation-URL: @implementation.url@ +Implementation-Version: @implementation.version@ +Implementation-Vendor: @implementation.vendor@ +Implementation-Vendor-Id: @implementation.vendor.id@ +Class-Path: ./portal-imagegallery-lib.jar Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryModule.java 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,107 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.portlet.imagegallery; + +import org.jboss.portlet.imagegallery.model.*; +import org.jboss.portal.core.modules.ModuleException; + +import java.util.List; + +/** + * @author <a href="mailto:im...@ho...">Ron & Conrad Kanengieter</a> + * @version $Revision: 1.0 $ + */ +public interface ImageGalleryModule +{ + /** + * Retrieves a imagecollection by its numerical id. + * + * @param id the imagecollection id + * @return the imagecollection + */ + ImageCollection findImageCollectionByID(Integer id) throws IllegalArgumentException, ModuleException; + + + /** + * Create a new imagecollection with the specified name. + * + * @param name the imagecollection name + * @param description the imagecollection description + * @param thumbnailPath the imagecollection thumbnailPath + * @param featuredFlag the imagecollection featuredFlag + * @return the imagecollection + */ + ImageCollection createImageCollection(String name, String description, String thumbnailPath, Boolean featuredFlag) throws ModuleException; + + + /** + * Remove a imagecollection. + * + * @param id the imagecollection id + */ + void removeImageCollection(Integer id) throws IllegalArgumentException, ModuleException; + + /** + * Returns the number of imagecollections. + * + * @return the number of imagecollections + */ + int getImageCollectionsCount() throws ModuleException; + + /** + * Get all the imagecollections + * + * @return the imagecollections + */ + List findImageCollections() throws ModuleException; + +//****************************************************************************************** + + /** + * Remove a imagedetail. + * + * @param id the imagedetail id + */ + void removeImageDetail(Integer id) throws IllegalArgumentException, ModuleException; + + + /** + * Get all the imagedetails + * + * @return the imagedetails + */ + List findImageDetails() throws ModuleException; + + + List findDetailsByCollectionID(Integer collectionID) + throws ModuleException; + + ImageDetail findImageDetailByID(Integer id) throws IllegalArgumentException, ModuleException; + + /** + * Create a new imagecollection with the specified name. + * + * @param imagecollection the parent imagecollection + * @param name the imagedetail name + * @param description the imagedetail description + * @param thumbnailPath the imagedetail thumbnailPath + * @param imagePath the imagedetail imagePath + * @param photographer the imagedetail photographer + * @return the imagedetail + */ + ImageDetail createImageDetail( + ImageCollection imagecollection, + String name, + String description, + String thumbnailPath, + String imagePath, + String photographer) + throws ModuleException; + +} \ No newline at end of file Added: labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java =================================================================== --- labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java 2006-05-18 03:59:52 UTC (rev 4309) +++ labs/portletswap/imagegalleryportlet/portal_2.0/src/main/org/jboss/portlet/imagegallery/ImageGalleryPortlet.java 2006-05-18 04:03:39 UTC (rev 4310) @@ -0,0 +1,601 @@ +/***************************************** + * * + * The Image Gallery Portlet * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.portlet.imagegallery; + +import org.jboss.logging.Logger; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.portal.common.value.BooleanValue; +import org.jboss.portlet.imagegallery.model.*; +import org.jboss.portlet.imagegallery.impl.ImageGalleryModuleImpl; +import org.jboss.portal.core.modules.ModuleException; +import org.jboss.portal.core.portlet.PortletHelper; +import org.jboss.portal.core.servlet.jsp.PortalJsp; +import org.jboss.portlet.*; + +import org.apache.webdav.lib.WebdavResource; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.fileupload.portlet.PortletFileUpload; +import org.apache.commons.httpclient.HttpURL; +import java.io.File; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.portlet.*; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.List; + +/** + * This portlet aims at managing imagegallerys. + * + * @author <a href="mailto:im...@ho...">Ron & Conrad Kanengieter</a> + * @version $Revision: 1.0 $ + */ +public class ImageGalleryPortlet + extends JBossPortlet +{ + /** + * the class logger + */ + public static final Logger log = Logger.getLogger(JBossPortlet.class); + + public static final String IMAGEGALLERYMODULE_JNDINAME = "java:portal/ImageGalleryModule"; + + private PortletHelper portletHelper; + + // Render op + + private ImageGalleryModule imagegalleryModule; + + public static final String OP_COLLECTIONVIEW = "collectionView"; + public static final String OP_COLLECTIONEDIT = "collectionEdit"; + public static final String OP_COLLECTIONDELETE = "collectionDelete"; + public static final String OP_COLLECTIONADD = "collectionAdd"; + public static final String OP_COLLECTIONS = "collections"; + + public static final String OP_DETAILVIEW = "detailView"; + public static final String OP_DETAILEDIT = "detailEdit"; + public static final String OP_DETAILDELETE = "detailDelete"; + public static final String OP_DETAILADD = "detailAdd"; + public static final String OP_DETAILS = "details"; + public static final String OP_IMAGEDETAIL = "imagedetail"; + + public void init() throws PortletException + { + super.init(); + imagegalleryModule = new ImageGalleryModuleImpl(); + getPortletContext().setAttribute("imagegalleryModule", imagegalleryModule); + portletHelper = new PortletHelper(this); + } + + public String getDefaultOperation() + { + return OP_COLLECTIONS; + } + + protected void doView(JBossRenderRequest req, JBossRenderResponse resp) + throws PortletException, PortletSecurityException, IOException + { + + resp.setContentType("text/html"); + PrintWriter writer = resp.getWriter(); + + String op; + if(req.getWindowState() != WindowState.MAXIMIZED) + op = getDefaultOperation(); + else + op = req.getParameters().get(getOperationName(), getDefaultOperation()); + + Locale locale = req.getLocale(); + ResourceBundle bundle = getResourceBundle(locale); + +// Collections + if(OP_COLLECTIONS.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + List imagecollections = imagegalleryModule.findImageCollections(); + DelegateContext ctx = new DelegateContext(); + DelegateContext rowCtx = null; + Iterator i = imagecollections.iterator(); + while(i.hasNext()) + { + ImageCollection imagecollection = (ImageCollection) i.next(); + rowCtx = ctx.next("imagecollections"); + rowCtx.put("ID", imagecollection.getID().toString()); + rowCtx.put("Name", imagecollection.getName()); + rowCtx.put("ThumbnailPath", imagecollection.getThumbnailPath()); + } + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collections.jsp"); + rd.include(req, resp); + } +// Details + else if(OP_DETAILS.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + Integer id = req.getParameters().getIntObject("collectionID"); + List imagedetails = imagegalleryModule.findDetailsByCollectionID(id); + DelegateContext ctx = new DelegateContext(); + DelegateContext rowCtx = null; + ctx.put("CollectionID", (id.toString())); + StringBuffer idString = new StringBuffer(";"); + Iterator i = imagedetails.iterator(); + while(i.hasNext()) + { + ImageDetail imagedetail = (ImageDetail) i.next(); + rowCtx = ctx.next("imagedetails"); + String ic_Id = imagedetail.getID().toString(); + idString.append(";" + ic_Id + ";"); + rowCtx.put("ID", ic_Id); + rowCtx.put("Name", imagedetail.getName()); + rowCtx.put("ThumbnailPath", imagedetail.getThumbnailPath()); + } + idString.append(";"); + req.getPortletSession().setAttribute("idString", (idString.toString())); + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/details.jsp"); + rd.include(req, resp); + } +// ImageDetail + else if(OP_IMAGEDETAIL.equals(op)) + { + if(req.hasPermission("Admin")) + req.setAttribute("user", "admin"); + else + req.setAttribute("user", "public"); + + try + { + Integer collectionID = req.getParameters().getIntObject("collectionID"); + Integer detailID = req.getParameters().getIntObject("detailID"); + String idString = (String)req.getPortletSession().getAttribute("idString"); + + + int result, pStart, pEnd, nStart, nEnd; + int index = 0; + int saveIndex = 0; + int imageCount = 0; + int saveCount = 0; + + Integer nextID = new Integer(0); + Integer previousID = new Integer(0); + + if (idString != null) + { + result = idString.indexOf(";" + detailID + ";"); + + pEnd = result - 1; + pStart = idString.lastIndexOf(";;", (pEnd - 1)) + 2; + + nStart = idString.indexOf(";;", result) + 2; + nEnd = idString.indexOf(";;", nStart); + + if (pEnd > 0) + previousID = new Integer(idString.substring(pStart,pEnd)); + + if (nEnd > 0) + nextID = new Integer(idString.substring(nStart,nEnd)); + + result = result + 2; + while (index >= 0) + { + index = idString.indexOf(";;", saveIndex); + if (index == result) + saveCount = imageCount; + imageCount++; + saveIndex = index + 2; + } + + imageCount = imageCount - 2; + } + else + imageCount = saveCount = 1; + + Integer IDindex = new Integer(saveCount); + Integer IDcount = new Integer(imageCount); + + + ImageDetail imagedetail = imagegalleryModule.findImageDetailByID(detailID); + + DelegateContext ctx = new DelegateContext(); + + ctx.put("CollectionID", (collectionID.toString())); + ctx.put("DetailID", (detailID.toString())); + ctx.put("Name", imagedetail.getName()); + ctx.put("Description", imagedetail.getDescription()); + ctx.put("ImagePath", imagedetail.getImagePath()); + ctx.put("Photographer", imagedetail.getPhotographer()); + + ctx.put("CollectionID", (collectionID.toString())); + + if (previousID.intValue() > 0) + { + DelegateContext previousCtx = ctx.next("PreviousID"); + previousCtx.put("ID", (previousID.toString())); + } + if (nextID.intValue() > 0) + { + DelegateContext nextCtx = ctx.next("NextID"); + nextCtx.put("ID", (nextID.toString())); + } + + ctx.put("IDindex", (IDindex.toString())); + ctx.put("IDcount", (IDcount.toString())); + + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/imagedetail.jsp"); + rd.include(req, resp); + } +// CollectionAdd + else if (OP_COLLECTIONADD.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionAdd.jsp"); + rd.include(req, resp); + } +// CollectionView +// CollectionDelete +// CollectionEdit + else if ((OP_COLLECTIONVIEW.equals(op)) + || (OP_COLLECTIONDELETE.equals(op)) + || (OP_COLLECTIONEDIT.equals(op))) + { + + Integer id = req.getParameters().getIntObject("ID"); + ImageCollection imagecollection = null; + DelegateContext ctx = new DelegateContext(); + + try + { + imagecollection = imagegalleryModule.findImageCollectionByID(id); + + ctx.put("ID", imagecollection.getID().toString()); + ctx.put("Name", imagecollection.getName()); + ctx.put("Description", imagecollection.getDescription()); + ctx.put("ThumbnailPath", imagecollection.getThumbnailPath()); + if (imagecollection.getFeaturedFlag().booleanValue() == true) + ctx.put("FeaturedFlag", "checked"); + else + ctx.put("FeaturedFlag", ""); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + if (OP_COLLECTIONVIEW.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionView.jsp"); + rd.include(req, resp); + } + else if (OP_COLLECTIONDELETE.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionDelete.jsp"); + rd.include(req, resp); + } + else if (OP_COLLECTIONEDIT.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/collectionEdit.jsp"); + rd.include(req, resp); + } + + } +// DetailAdd + else if (OP_DETAILADD.equals(op)) + { + Integer collectionID = req.getParameters().getIntObject("collectionID"); + + DelegateContext ctx = new DelegateContext(); + ctx.put("CollectionID", (collectionID.toString())); + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailAdd.jsp"); + rd.include(req, resp); + } +// DetailView +// DetailDelete +// DetailEdit + else if ((OP_DETAILVIEW.equals(op)) + || (OP_DETAILDELETE.equals(op)) + || (OP_DETAILEDIT.equals(op))) + { + + Integer collectionID = req.getParameters().getIntObject("collectionID"); + Integer detailID = req.getParameters().getIntObject("detailID"); + String redirect = req.getParameter("redirect"); + ImageDetail imagedetail = null; + DelegateContext ctx = new DelegateContext(); + + try + { + imagedetail = imagegalleryModule.findImageDetailByID(detailID); + + ctx.put("CollectionID", (collectionID.toString())); + ctx.put("DetailID", (detailID.toString())); + ctx.put("Redirect", redirect); + ctx.put("Name", imagedetail.getName()); + ctx.put("Description", imagedetail.getDescription()); + ctx.put("ThumbnailPath", imagedetail.getThumbnailPath()); + ctx.put("ImagePath", imagedetail.getImagePath()); + ctx.put("Photographer", imagedetail.getPhotographer()); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + + req.setAttribute(PortalJsp.CTX_REQUEST, ctx); + + if (OP_DETAILVIEW.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailView.jsp"); + rd.include(req, resp); + } + else if (OP_DETAILDELETE.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailDelete.jsp"); + rd.include(req, resp); + } + else if (OP_DETAILEDIT.equals(op)) + { + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/detailEdit.jsp"); + rd.include(req, resp); + } + } + else + log.error("This operation does not exist: " + op); + + writer.close(); + } + + + /** + * Action to add a imagecollection + * + * @param req + * @param resp + */ + public void addCollection(JBossActionRequest req, JBossActionResponse resp) + { + + String name = req.getParameter("Name"); + String description = req.getParameter("Description"); + String thumbnailPath = req.getParameter("ThumbnailPath"); + String SfeaturedFlag = req.getParameter("FeaturedFlag"); + String submit = req.getParameter("submit"); + + boolean checked = false; + if (SfeaturedFlag != null) + if (SfeaturedFlag.equals("true")) + checked = true; + Boolean featuredFlag = new Boolean(checked); + + if(submit.equals("ADD") && req.hasPermission("Admin")) + { + try + { + imagegalleryModule.createImageCollection(name, description, thumbnailPath, featuredFlag); + } + catch(ModuleException e) + { + e.printStackTrace(); + } + } + resp.setRenderParameter("op", OP_COLLECTIONS); + } + + ... [truncated message content] |
From: <jbo...@li...> - 2006-05-18 03:59:56
|
Author: conkan Date: 2006-05-17 23:59:52 -0400 (Wed, 17 May 2006) New Revision: 4309 Added: labs/portletswap/imagegalleryportlet/portal_2.0/ Log: |
From: <jbo...@li...> - 2006-05-18 01:51:31
|
Author: mic...@jb... Date: 2006-05-17 21:28:50 -0400 (Wed, 17 May 2006) New Revision: 4308 Added: labs/jbossrules/updates/drools-ide-update/features/org.drools.ide_3.0.0.jar labs/jbossrules/updates/drools-ide-update/plugins/org.drools.ide_3.0.0.jar Removed: labs/jbossrules/updates/drools-ide-update/features/org.drools.ide_1.0.2.jar labs/jbossrules/updates/drools-ide-update/plugins/org.drools.ide_1.0.0.jar Modified: labs/jbossrules/updates/drools-ide-update/site.xml Log: RC3 Deleted: labs/jbossrules/updates/drools-ide-update/features/org.drools.ide_1.0.2.jar =================================================================== (Binary files differ) Added: labs/jbossrules/updates/drools-ide-update/features/org.drools.ide_3.0.0.jar =================================================================== (Binary files differ) Property changes on: labs/jbossrules/updates/drools-ide-update/features/org.drools.ide_3.0.0.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: labs/jbossrules/updates/drools-ide-update/plugins/org.drools.ide_1.0.0.jar =================================================================== (Binary files differ) Added: labs/jbossrules/updates/drools-ide-update/plugins/org.drools.ide_3.0.0.jar =================================================================== (Binary files differ) Property changes on: labs/jbossrules/updates/drools-ide-update/plugins/org.drools.ide_3.0.0.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: labs/jbossrules/updates/drools-ide-update/site.xml =================================================================== --- labs/jbossrules/updates/drools-ide-update/site.xml 2006-05-18 00:53:39 UTC (rev 4307) +++ labs/jbossrules/updates/drools-ide-update/site.xml 2006-05-18 01:28:50 UTC (rev 4308) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/org.drools.ide_1.0.2.jar" id="org.drools.ide" version="1.0.2"> + <feature url="features/org.drools.ide_3.0.0.jar" id="org.drools.ide" version="3.0.0"> <category name="JBossRules"/> </feature> <category-def name="JBossRules" label="JBoss Rules"/> |
From: <jbo...@li...> - 2006-05-18 00:53:45
|
Author: mic...@jb... Date: 2006-05-17 20:53:39 -0400 (Wed, 17 May 2006) New Revision: 4307 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml Log: typo fix Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml 2006-05-18 00:34:24 UTC (rev 4306) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml 2006-05-18 00:53:39 UTC (rev 4307) @@ -227,7 +227,7 @@ rules, you are effectively calling rules directly) and this may cause more difficulty in future maintenance, as they tend to grow in complexity over time. The upside of scripting engines is they can be easier to implement - at first, and you can get quite results (and conceptually simpler for + at first, and you can get quick results (and conceptually simpler for imperative programmers !).</para> <para>Many people have also implemented data-driven systems successfully |
Author: tirelli Date: 2006-05-17 20:34:24 -0400 (Wed, 17 May 2006) New Revision: 4306 Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NodeMemory.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/Rete.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleBaseImpl.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TerminalNode.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/WorkingMemoryImpl.java labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/beta/BetaMemoryFactoryTest.java Log: Partial implementation for JBRULES-233 and JBRULES-266 Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -0,0 +1,71 @@ +/* + * Copyright 2005 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.drools; + +import java.util.Properties; + +/** + * RuleBaseConfiguration + * A class to store RuleBase related configuration + * + * Created: 16/05/2006 + * @author <a href="mailto:ti...@po...">Edson Tirelli</a> + * + * @version $Id$ + */ +public class RuleBaseConfiguration extends Properties { + /** + * Property to enable/disable left beta memory indexing + * Defaults to false + */ + public static final String INDEX_LEFT_BETA_MEMORY = "org.drools.reteoo.beta.index-left"; + /** + * Property to enable/disable right beta memory indexing + * Defaults to true + */ + public static final String INDEX_RIGHT_BETA_MEMORY = "org.drools.reteoo.beta.index-right"; + /** + * Property to enable/disable alpha node hashing inside object type nodes + * Defaults to true + */ + public static final String HASH_OBJECT_TYPE_NODES = "org.drools.reteoo.alpha.hash-type-node"; + /** + * Property to enable/disable alpha node hashing inside alpha nodes + * Defaults to false + */ + public static final String HASH_ALPHA_NODES = "org.drools.reteoo.alpha.hash-alpha-node"; + + // a generated serial version id + private static final long serialVersionUID = 2989084670778336973L; + + public RuleBaseConfiguration() { + // default values + this.setProperty( INDEX_LEFT_BETA_MEMORY, + System.getProperty( INDEX_LEFT_BETA_MEMORY, "false" ) ); + this.setProperty( INDEX_RIGHT_BETA_MEMORY, + System.getProperty( INDEX_RIGHT_BETA_MEMORY, "true" ) ); + this.setProperty( HASH_OBJECT_TYPE_NODES, + System.getProperty( HASH_OBJECT_TYPE_NODES, "true" ) ); + this.setProperty( HASH_ALPHA_NODES, + System.getProperty( HASH_ALPHA_NODES, "false" ) ); + } + + public boolean getBooleanProperty(String prop) { + return Boolean.valueOf( prop ).booleanValue(); + } + +} Property changes on: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java ___________________________________________________________________ Name: svn:executable + * Name: svn:keywords + id author date revision Name: svn:eol-style + native Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AlphaNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -21,6 +21,7 @@ import java.util.Set; import org.drools.FactException; +import org.drools.RuleBaseConfiguration; import org.drools.common.PropagationContextImpl; import org.drools.spi.FieldConstraint; import org.drools.spi.PropagationContext; @@ -61,7 +62,23 @@ AlphaNode(int id, FieldConstraint constraint, ObjectSource objectSource) { - super( id ); + this( id, null, constraint, objectSource ); + } + + /** + * Construct an <code>AlphaNode</code> with a unique id using the provided + * <code>ObjectSinkList</code> and <code>FieldConstraint</code>. + * + * @param id Node unique id + * @param sinklist An object sink list. If null, a default will be used. + * @param constraint Node's constraints + * @param objectSource Node's object source + */ + AlphaNode(int id, + ObjectSinkList sinklist, + FieldConstraint constraint, + ObjectSource objectSource) { + super( id, sinklist ); this.constraint = constraint; this.objectSource = objectSource; setHasMemory( true ); @@ -175,7 +192,7 @@ /** * Creates a HashSet for the AlphaNode's memory. */ - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new HashSet(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaMemory.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.Map; +import org.drools.RuleBaseConfiguration; import org.drools.WorkingMemory; import org.drools.common.BetaNodeBinder; import org.drools.reteoo.beta.BetaLeftMemory; @@ -66,9 +67,9 @@ * Construct a BetaMemory with a LinkedList for the <code>Tuples</code> and a <code>LinkedHashMap</code> for the * <code>FactHandle</code>s */ - BetaMemory(BetaNodeBinder binder) { - this.leftMemory = BetaMemoryFactory.newLeftMemory( binder ); - this.rightMemory = BetaMemoryFactory.newRightMemory( binder ); + BetaMemory(RuleBaseConfiguration config, BetaNodeBinder binder) { + this.leftMemory = BetaMemoryFactory.newLeftMemory( config, binder ); + this.rightMemory = BetaMemoryFactory.newRightMemory( config, binder ); this.rightObjectMap = new HashMap(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/BetaNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -16,6 +16,7 @@ * limitations under the License. */ +import org.drools.RuleBaseConfiguration; import org.drools.common.BetaNodeBinder; import org.drools.common.PropagationContextImpl; import org.drools.spi.PropagationContext; @@ -174,8 +175,8 @@ /** * Creates a BetaMemory for the BetaNode's memory. */ - public Object createMemory() { - return new BetaMemory( this.getJoinNodeBinder() ); + public Object createMemory( RuleBaseConfiguration config ) { + return new BetaMemory( config, this.getJoinNodeBinder() ); } } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -20,6 +20,7 @@ import java.util.Iterator; import java.util.List; +import org.drools.RuleBaseConfiguration; import org.drools.common.PropagationContextImpl; import org.drools.rule.EvalCondition; import org.drools.spi.PropagationContext; @@ -248,7 +249,7 @@ } } - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new LinkedList(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/JoinNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -391,6 +391,6 @@ } } return propagatedTuples; - } + } } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; +import org.drools.RuleBaseConfiguration; import org.drools.common.BetaNodeBinder; import org.drools.common.PropagationContextImpl; import org.drools.rule.EvalCondition; @@ -280,7 +281,7 @@ * LeftInputAdapter uses a HashMap for memory. The key is the received <code>FactHandleImpl</code> and the * created <code>ReteTuple</code> is the value. */ - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new HashMap(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NodeMemory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NodeMemory.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/NodeMemory.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -1,5 +1,7 @@ package org.drools.reteoo; +import org.drools.RuleBaseConfiguration; + /* * Copyright 2005 JBoss Inc * @@ -19,6 +21,6 @@ public interface NodeMemory { public int getId(); - public Object createMemory(); + public Object createMemory( RuleBaseConfiguration config ); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSinkListFactory.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -16,6 +16,8 @@ package org.drools.reteoo; +import org.drools.RuleBaseConfiguration; + /** * ObjectSinkListFactory * A factory for ObjectSinkLists @@ -25,19 +27,25 @@ * Created: 06/march/2006 */ public class ObjectSinkListFactory { - public static final String TYPE_NODE_ALPHA_HASHING = "org.drools.alpha-hash.type-node"; - public static final String ALPHA_NODE_ALPHA_HASHING = "org.drools.alpha-hash.alpha-node"; - - private static final String DISABLED = "false"; - private static final String ENABLED = "true"; - - public static final ObjectSinkList newObjectSinkList(Object owner) { - if ( (!DISABLED.equalsIgnoreCase( System.getProperty( TYPE_NODE_ALPHA_HASHING ) )) && (owner instanceof ObjectTypeNode) ) { + private final RuleBaseConfiguration config; + + public ObjectSinkListFactory(RuleBaseConfiguration config) { + this.config = config; + } + + public final ObjectSinkList newObjectSinkList(Class owner) { + if ( config.getBooleanProperty( RuleBaseConfiguration.HASH_OBJECT_TYPE_NODES) && + (ObjectTypeNode.class.isAssignableFrom( owner )) ) { return new HashedObjectSinkList(); - } else if ( ENABLED.equalsIgnoreCase( System.getProperty( ALPHA_NODE_ALPHA_HASHING ) ) && (owner instanceof AlphaNode) ) { + } else if ( config.getBooleanProperty( RuleBaseConfiguration.HASH_ALPHA_NODES ) && + (AlphaNode.class.isAssignableFrom( owner )) ) { return new HashedObjectSinkList(); } return new DefaultObjectSinkList( 1 ); } + + public static final ObjectSinkList newDefaultObjectSinkList() { + return new DefaultObjectSinkList( 1 ); + } } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -43,7 +43,7 @@ // ------------------------------------------------------------ /** The destination for <code>FactHandleImpl</code>. */ - protected ObjectSinkList objectSinks = ObjectSinkListFactory.newObjectSinkList( this ); + protected ObjectSinkList objectSinks; // ------------------------------------------------------------ // Constructors @@ -55,7 +55,21 @@ * @param id */ ObjectSource(int id) { + this( id, + null ); + } + + /** + * Single parameter constructor that specifies the unique id of the node. + * + * @param id + */ + ObjectSource(int id, + ObjectSinkList objectSinks) { super( id ); + this.objectSinks = (objectSinks != null) ? + objectSinks : + ObjectSinkListFactory.newDefaultObjectSinkList(); } // ------------------------------------------------------------ @@ -151,7 +165,7 @@ public ObjectSinkList getObjectSinks() { return this.objectSinks; } - + /** * Returns the object sinks as an unmodifiable list * @return Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Iterator; +import org.drools.RuleBaseConfiguration; import org.drools.common.PropagationContextImpl; import org.drools.spi.ObjectType; import org.drools.spi.PropagationContext; @@ -76,7 +77,23 @@ public ObjectTypeNode(int id, ObjectType objectType, Rete rete) { - super( id ); + this( id, null, objectType, rete ); + } + + /** + * Construct given a semantic <code>ObjectType</code> and the provided + * unique id. All <code>ObjectTypdeNode</code> have node memory. + * + * @param id The unique id for the node + * @param sinklist An object sink list for the node. If null, a default will be created. + * @param objectType The semantic object-type differentiator + * @param rete The rete network reference + */ + public ObjectTypeNode(int id, + ObjectSinkList sinklist, + ObjectType objectType, + Rete rete) { + super( id, sinklist ); this.rete = rete; this.objectType = objectType; setHasMemory( true ); @@ -237,7 +254,7 @@ * However PrimitiveLongMap is not ideal for spase data. So it should be monitored incase its more optimal * to switch back to a standard HashMap. */ - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new PrimitiveLongMap( 32, 8 ); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -18,6 +18,7 @@ import java.util.LinkedList; +import org.drools.RuleBaseConfiguration; import org.drools.common.PropagationContextImpl; import org.drools.rule.Rule; import org.drools.spi.PropagationContext; @@ -151,7 +152,7 @@ // There are no child nodes to update, do nothing. } - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { //return new QueryTerminalNodeMemory(); return new LinkedList(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/Rete.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/Rete.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/Rete.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -25,6 +25,7 @@ import java.util.Map; import org.drools.FactException; +import org.drools.RuleBaseConfiguration; import org.drools.spi.ObjectType; import org.drools.spi.ObjectTypeResolver; import org.drools.spi.PropagationContext; @@ -273,7 +274,7 @@ //@todo: we really should attempt to clear the memory cache for this ObjectTypeNode } - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new HashMap(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -92,6 +92,10 @@ private Map objectType; private int currentOffsetAdjustment; + + /** A factory for object sink lists */ + private transient ObjectSinkListFactory sinklistFactory; + // ------------------------------------------------------------ // Constructors @@ -111,6 +115,9 @@ //Set to 1 as Rete node is set to 0 this.id = 1; + + // creating factory + this.sinklistFactory = new ObjectSinkListFactory(this.ruleBase.getConfiguration()); } /** @@ -281,6 +288,7 @@ this.currentOffsetAdjustment = 1; ObjectSource objectSource = attachNode( new ObjectTypeNode( this.id++, + this.sinklistFactory.newObjectSinkList( ObjectTypeNode.class ), new ClassObjectType( InitialFact.class ), this.rete ) ); @@ -321,6 +329,7 @@ private void attachQuery(String queryName) { ClassObjectType queryObjectType = new ClassObjectType( DroolsQuery.class ); ObjectTypeNode queryObjectTypeNode = new ObjectTypeNode( this.id++, + this.sinklistFactory.newObjectSinkList( ObjectTypeNode.class ), queryObjectType, rete ); queryObjectTypeNode.attach(); @@ -338,6 +347,7 @@ evaluator ); AlphaNode alphaNode = new AlphaNode( this.id++, + this.sinklistFactory.newObjectSinkList( AlphaNode.class ), constraint, queryObjectTypeNode ); alphaNode.attach(); @@ -384,6 +394,7 @@ Class thisClass = ((ClassObjectType) column.getObjectType()).getClassType(); this.objectSource = attachNode( new ObjectTypeNode( this.id++, + this.sinklistFactory.newObjectSinkList( ObjectTypeNode.class ), column.getObjectType(), this.rete ) ); @@ -419,6 +430,7 @@ FieldConstraint fieldConstraint = (FieldConstraint) object; if ( fieldConstraint instanceof LiteralConstraint ) { this.objectSource = attachNode( new AlphaNode( this.id++, + this.sinklistFactory.newObjectSinkList( AlphaNode.class ), fieldConstraint, objectSource ) ); } else { Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleBaseImpl.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleBaseImpl.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleBaseImpl.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -36,10 +36,12 @@ import org.drools.FactHandle; import org.drools.PackageIntegrationException; import org.drools.RuleBase; +import org.drools.RuleBaseConfiguration; import org.drools.RuleIntegrationException; import org.drools.WorkingMemory; import org.drools.common.ObjectInputStreamWithLoader; import org.drools.common.PropagationContextImpl; +import org.drools.reteoo.beta.BetaMemoryFactory; import org.drools.rule.CompositePackageClassLoader; import org.drools.rule.InvalidPatternException; import org.drools.rule.Package; @@ -65,6 +67,7 @@ // ------------------------------------------------------------ // Instance members // ------------------------------------------------------------ + private RuleBaseConfiguration config; private Map pkgs; @@ -89,7 +92,7 @@ /** Special value when adding to the underlying map. */ private static final Object PRESENT = new Object(); - + // ------------------------------------------------------------ // Constructors // ------------------------------------------------------------ @@ -101,16 +104,31 @@ * The rete network. */ public RuleBaseImpl() { - this( new DefaultFactHandleFactory() ); + this( null, new DefaultFactHandleFactory() ); } /** + * @param factHandleFactory + */ + public RuleBaseImpl(FactHandleFactory factHandleFactory) { + this( null, factHandleFactory ); + } + + /** + * @param config + */ + public RuleBaseImpl(RuleBaseConfiguration config) { + this( config, new DefaultFactHandleFactory() ); + } + + /** * Construct. * * @param rete * The rete network. */ - public RuleBaseImpl(FactHandleFactory factHandleFactory) { + public RuleBaseImpl(RuleBaseConfiguration config, FactHandleFactory factHandleFactory) { + this.config = ( config != null ) ? config : new RuleBaseConfiguration(); ObjectTypeResolver resolver = new ClassObjectTypeResolver(); this.rete = new Rete( resolver ); this.reteooBuilder = new ReteooBuilder( this, @@ -120,7 +138,7 @@ this.packageClassLoader = new CompositePackageClassLoader( Thread.currentThread().getContextClassLoader() ); this.pkgs = new HashMap(); this.globals = new HashMap(); - this.workingMemories = new WeakHashMap(); + this.workingMemories = new WeakHashMap(); } /** @@ -139,6 +157,7 @@ out.writeObject( this.reteooBuilder ); out.writeObject( this.factHandleFactory ); out.writeObject( this.globals ); + out.writeObject( this.config ); stream.writeObject( bos.toByteArray() ); } @@ -174,6 +193,8 @@ this.factHandleFactory = (FactHandleFactory) streamWithLoader.readObject(); this.globals = (Map) streamWithLoader.readObject(); + + this.config = (RuleBaseConfiguration) streamWithLoader.readObject(); this.workingMemories = new WeakHashMap(); } @@ -474,6 +495,10 @@ public Set getWorkingMemories() { return this.workingMemories.keySet(); } + + public RuleBaseConfiguration getConfiguration() { + return this.config; + } // /** // * This is to allow the RuleBase to be serializable. Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TerminalNode.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TerminalNode.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/TerminalNode.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -16,10 +16,9 @@ * limitations under the License. */ -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import org.drools.RuleBaseConfiguration; import org.drools.common.Agenda; import org.drools.common.AgendaGroupImpl; import org.drools.common.AgendaItem; @@ -27,12 +26,10 @@ import org.drools.common.ScheduledAgendaItem; import org.drools.rule.Rule; import org.drools.spi.Activation; +import org.drools.spi.ActivationGroup; import org.drools.spi.AgendaGroup; import org.drools.spi.Duration; import org.drools.spi.PropagationContext; -import org.drools.spi.ActivationGroup; -import org.drools.util.LinkedListObjectWrapper; -import org.drools.util.Queueable; /** * Leaf Rete-OO node responsible for enacting <code>Action</code> s on a @@ -295,7 +292,7 @@ // There are no child nodes to update, do nothing. } - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new TerminalNodeMemory(); } Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/WorkingMemoryImpl.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/WorkingMemoryImpl.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/WorkingMemoryImpl.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -780,7 +780,7 @@ Object memory = this.nodeMemories.get( node.getId() ); if ( memory == null ) { - memory = node.createMemory(); + memory = node.createMemory( this.ruleBase.getConfiguration() ); this.nodeMemories.put( node.getId(), memory ); Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/beta/BetaMemoryFactory.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -18,6 +18,7 @@ import javax.naming.OperationNotSupportedException; +import org.drools.RuleBaseConfiguration; import org.drools.common.BetaNodeBinder; import org.drools.rule.BoundVariableConstraint; import org.drools.spi.Evaluator; @@ -32,12 +33,7 @@ * Created: 12/02/2006 */ public class BetaMemoryFactory { - private static final String INDEX_DISABLED = "false"; - private static final String INDEX_ENABLED = "true"; - public static final String INDEX_LEFT_BETA_MEMORY = "org.drools.reteoo.beta.index-left"; - public static final String INDEX_RIGHT_BETA_MEMORY = "org.drools.reteoo.beta.index-right"; - protected BetaMemoryFactory() { } @@ -50,11 +46,11 @@ * * @return the newly created BetaLeftMemory */ - public static BetaLeftMemory newLeftMemory(BetaNodeBinder binder) { + public static BetaLeftMemory newLeftMemory(RuleBaseConfiguration config, BetaNodeBinder binder) { BetaLeftMemory memory = null; BetaLeftMemory innerMostMemory = null; FieldConstraint[] constraints = (binder != null) ? binder.getConstraints() : null; - if ( (constraints != null) && (INDEX_ENABLED.equalsIgnoreCase( System.getProperty( INDEX_LEFT_BETA_MEMORY ) )) ) { + if ( (constraints != null) && (config.getBooleanProperty( RuleBaseConfiguration.INDEX_LEFT_BETA_MEMORY ))) { for ( int i = 0; i < constraints.length; i++ ) { if ( constraints[i] instanceof BoundVariableConstraint ) { BoundVariableConstraint bvc = (BoundVariableConstraint) constraints[i]; @@ -113,11 +109,11 @@ * * @return the newly created BetaRightMemory */ - public static BetaRightMemory newRightMemory(BetaNodeBinder binder) { + public static BetaRightMemory newRightMemory(RuleBaseConfiguration config, BetaNodeBinder binder) { BetaRightMemory memory = null; BetaRightMemory innerMostMemory = null; FieldConstraint[] constraints = (binder != null) ? binder.getConstraints() : null; - if ( (constraints != null) && (!INDEX_DISABLED.equalsIgnoreCase( System.getProperty( INDEX_RIGHT_BETA_MEMORY ) )) ) { + if ( (constraints != null) && ( config.getBooleanProperty( RuleBaseConfiguration.INDEX_RIGHT_BETA_MEMORY ))) { for ( int i = 0; i < constraints.length; i++ ) { if ( constraints[i] instanceof BoundVariableConstraint ) { BoundVariableConstraint bvc = (BoundVariableConstraint) constraints[i]; Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -23,6 +23,7 @@ import java.util.List; import org.drools.FactException; +import org.drools.RuleBaseConfiguration; import org.drools.spi.PropagationContext; public class MockTupleSink extends TupleSource @@ -85,7 +86,7 @@ return this.id; } - public Object createMemory() { + public Object createMemory( RuleBaseConfiguration config ) { return new HashMap(); } Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/beta/BetaMemoryFactoryTest.java =================================================================== --- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/beta/BetaMemoryFactoryTest.java 2006-05-18 00:32:47 UTC (rev 4305) +++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/beta/BetaMemoryFactoryTest.java 2006-05-18 00:34:24 UTC (rev 4306) @@ -19,6 +19,7 @@ import junit.framework.Assert; import junit.framework.TestCase; +import org.drools.RuleBaseConfiguration; import org.drools.common.BetaNodeBinder; import org.drools.spi.FieldConstraint; import org.drools.spi.MockConstraint; @@ -34,9 +35,11 @@ */ public class BetaMemoryFactoryTest extends TestCase { BetaNodeBinder binder = null; + RuleBaseConfiguration config; protected void setUp() throws Exception { super.setUp(); + config = new RuleBaseConfiguration(); FieldConstraint[] constraints = new FieldConstraint[]{new MockConstraint()}; binder = new BetaNodeBinder( constraints ); } @@ -50,14 +53,14 @@ */ public void testNewLeftMemory() { try { - BetaLeftMemory memory = BetaMemoryFactory.newLeftMemory( null ); + BetaLeftMemory memory = BetaMemoryFactory.newLeftMemory( config, null ); Assert.assertNotNull( "BetaMemoryFactory should not return null", memory ); Assert.assertTrue( "Without constraints, BetaMemoryFactory should " + "return an instance of DefaultLeftMemory", memory instanceof DefaultLeftMemory ); - memory = BetaMemoryFactory.newLeftMemory( binder ); + memory = BetaMemoryFactory.newLeftMemory( config, binder ); Assert.assertNotNull( "BetaMemoryFactory should not return null", memory ); @@ -71,14 +74,14 @@ */ public void testNewRightMemory() { try { - BetaRightMemory memory = BetaMemoryFactory.newRightMemory( null ); + BetaRightMemory memory = BetaMemoryFactory.newRightMemory( config, null ); Assert.assertNotNull( "BetaMemoryFactory should not return null", memory ); Assert.assertTrue( "Without constraints, BetaMemoryFactory should " + "return an instance of DefaultRightMemory", memory instanceof DefaultRightMemory ); - memory = BetaMemoryFactory.newRightMemory( binder ); + memory = BetaMemoryFactory.newRightMemory( config, binder ); Assert.assertNotNull( "BetaMemoryFactory should not return null", memory ); |
From: <jbo...@li...> - 2006-05-18 00:32:53
|
Author: mic...@jb... Date: 2006-05-17 20:32:47 -0400 (Wed, 17 May 2006) New Revision: 4305 Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Eclipse.xml Log: Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Eclipse.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Eclipse.xml 2006-05-18 00:31:53 UTC (rev 4304) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Install/Section-Eclipse.xml 2006-05-18 00:32:47 UTC (rev 4305) @@ -5,10 +5,11 @@ <section> <title>Generating Eclipse Projects</title> - <para> - The drools project has eclipse projects checked in for convenience. However, these are originally generated by maven 2. - If you have maven 2 installed, you can also regenerate the eclipse projects automatically, or even generate it for IntelliJ etc, see the instructions below for this (most people can ignore this section) - </para> + <para>The drools project has eclipse projects checked in for convenience. + However, these are originally generated by maven 2. If you have maven 2 + installed, you can also regenerate the eclipse projects automatically, or + even generate it for IntelliJ etc, see the instructions below for this + (most people can ignore this section)</para> <para><indexterm> <primary>maven</primary> @@ -239,6 +240,10 @@ /jbossrules/update instead of /trunk. They are plain vanilla eclipse feature and site projects.</para> + <para>PLEASE REMEMBER that the plug in in the downloads directory, as a + zip, should also be updated at the same time as the update site (as they + are alternative ways ot getting the same plug in).</para> + <para>Eclipse refreshing plugins in features and sites seems to not work, so what is best is to manually edit the site.xml project and the feature.xml. To do this, open the site.xml file in the drools-ide-update @@ -300,7 +305,8 @@ site.xml.</para> <para>Finally, drop the plugin jar into the /plugins jar directory of the - update site. Now you can upload the site as is, and it will show up as a - new version for Eclipse clients.</para> + update site (get the actual plug in from the exported plugin in the + previous step). Now you can upload the site as is, and it will show up as + a new version for Eclipse clients.</para> </section> </section> \ No newline at end of file |
From: <jbo...@li...> - 2006-05-18 00:32:00
|
Author: mar...@jb... Date: 2006-05-17 20:31:53 -0400 (Wed, 17 May 2006) New Revision: 4304 Modified: labs/jbossrules/trunk/build.xml Log: -added about junit being in the classpath Modified: labs/jbossrules/trunk/build.xml =================================================================== --- labs/jbossrules/trunk/build.xml 2006-05-18 00:09:54 UTC (rev 4303) +++ labs/jbossrules/trunk/build.xml 2006-05-18 00:31:53 UTC (rev 4304) @@ -29,6 +29,10 @@ <echo level="info" message=" " /> <echo level="info" message="clean-all - cleans all directories" /> <echo level="info" message=" " /> + <echo level="info" message="compile-all - compiles all modules" /> + <echo level="info" message=" " /> + <echo level="info" message="test-all - tests all modules" /> + <echo level="info" message=" " /> <echo level="info" message="build-all - builds all modules" /> <echo level="info" message=" " /> <echo level="info" message="javadocs - generates the javadoc at target/docs" /> @@ -61,6 +65,9 @@ <echo level="info" message="Targets may be combined:" /> <echo level="info" message="ant -Dtest.skip=true clean-all build-all" /> <echo level="info" message=" " /> + <echo level="info" message="Please make sure that junit is in your classpath or" /> + <echo level="info" message="in your ANT_HOME/lib directory for unit tests to work " /> + <echo level="info" message=" " /> <echo level="info" message="For more help use the build system to generate the manual" /> <echo level="info" message="or you can find the manual online at:" /> <echo level="info" message="http://labs.jboss.com/portal/jbossrules/docs/index.html" /> |