You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(544) |
May
(1715) |
Jun
(1059) |
Jul
(886) |
Aug
(1214) |
Sep
(1375) |
Oct
(1664) |
Nov
(1153) |
Dec
(1084) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1630) |
Feb
(1634) |
Mar
(1979) |
Apr
(1119) |
May
(1850) |
Jun
(1231) |
Jul
(1168) |
Aug
(1840) |
Sep
(1038) |
Oct
(1127) |
Nov
(1458) |
Dec
(854) |
2004 |
Jan
(1145) |
Feb
(1064) |
Mar
(2242) |
Apr
(1728) |
May
(1346) |
Jun
(1280) |
Jul
(1681) |
Aug
(2388) |
Sep
(2233) |
Oct
(3246) |
Nov
(3248) |
Dec
(1775) |
2005 |
Jan
(3407) |
Feb
(3049) |
Mar
(2402) |
Apr
(3687) |
May
(3289) |
Jun
(5731) |
Jul
(3905) |
Aug
(5843) |
Sep
(5149) |
Oct
(6866) |
Nov
(4051) |
Dec
(4646) |
2006 |
Jan
(7356) |
Feb
(4713) |
Mar
(9447) |
Apr
(6553) |
May
(6206) |
Jun
(4301) |
Jul
(1160) |
Aug
(23) |
Sep
(11) |
Oct
(19) |
Nov
(26) |
Dec
(15) |
2007 |
Jan
(28) |
Feb
(24) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gurkan E. <gur...@ya...> - 2006-07-08 01:59:08
|
User: gurkanerdogdu Date: 06/07/07 21:59:06 Modified: cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache ICacheConstants.java JBossCachePlugin.java Log: Cache Statistic View added Revision Changes Path 1.6 +11 -0 jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/ICacheConstants.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ICacheConstants.java =================================================================== RCS file: /cvsroot/jboss/jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/ICacheConstants.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- ICacheConstants.java 6 Jul 2006 17:17:02 -0000 1.5 +++ ICacheConstants.java 8 Jul 2006 01:59:06 -0000 1.6 @@ -125,6 +125,8 @@ String CACHE_NODE_CONTENT_VIEW_ID = "org.jboss.ide.eclipse.jbosscache.view.NodeContentView"; + String CACHE_STATISTIC_VIEW_ID = "org.jboss.ide.eclipse.jbosscache.view.StatisticContentView"; + String CACHE_GRAPH_VIEW_ID = "org.jboss.ide.eclipse.jbosscache.views.CacheGraphView"; ////////////////End of View Id Constants//////////////////////// @@ -253,6 +255,12 @@ String IMAGE_KEY_DB16_GIF = "jdbc_16.gif"; + String IMAGE_KEY_SEARCH_GIF = "search.gif"; + + String IMAGE_KEY_STAT_ATTRIBUTE = "property_obj.gif"; + + String IMAGE_KEY_STAT_PARENT_ATTRIBUTE = "prop_ps.gif"; + @@ -350,4 +358,7 @@ String CLASS = "class"; +String[] STAT_INTERCEPTOR_NAMES = {"ActivationInterceptor","CacheLoaderInterceptor","CacheMgmtInterceptor","CacheStoreInterceptor","InvalidationInterceptor","PassivationInterceptor","TxInterceptor"}; + + }//end of interface \ No newline at end of file 1.3 +14 -1 jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/JBossCachePlugin.java (In the diff below, changes in quantity of whitespace are not shown.) Index: JBossCachePlugin.java =================================================================== RCS file: /cvsroot/jboss/jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/JBossCachePlugin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- JBossCachePlugin.java 23 Mar 2006 11:12:31 -0000 1.2 +++ JBossCachePlugin.java 8 Jul 2006 01:59:06 -0000 1.3 @@ -295,6 +295,19 @@ + ICacheConstants.IMAGE_KEY_DB16_GIF)); getImageRegistry().put(ICacheConstants.IMAGE_KEY_DB16_GIF, imageDesc); + imageDesc = ImageDescriptor.createFromURL(new URL(url, ICacheConstants.PLUGIN_IMAGE_PATH + + ICacheConstants.IMAGE_KEY_SEARCH_GIF)); + getImageRegistry().put(ICacheConstants.IMAGE_KEY_SEARCH_GIF, imageDesc); + + imageDesc = ImageDescriptor.createFromURL(new URL(url, ICacheConstants.PLUGIN_IMAGE_PATH + + ICacheConstants.IMAGE_KEY_STAT_ATTRIBUTE)); + getImageRegistry().put(ICacheConstants.IMAGE_KEY_STAT_ATTRIBUTE, imageDesc); + + imageDesc = ImageDescriptor.createFromURL(new URL(url, ICacheConstants.PLUGIN_IMAGE_PATH + + ICacheConstants.IMAGE_KEY_STAT_PARENT_ATTRIBUTE)); + getImageRegistry().put(ICacheConstants.IMAGE_KEY_STAT_PARENT_ATTRIBUTE, imageDesc); + + } catch (MalformedURLException e) |
From: Gurkan E. <gur...@ya...> - 2006-07-08 01:59:07
|
User: gurkanerdogdu Date: 06/07/07 21:59:06 Added: cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic CacheStatContentProvider.java CacheStatView.java CacheStatLabelProvider.java CacheStatModel.java Log: Cache Statistic View added Revision Changes Path 1.1 date: 2006/07/08 01:59:06; author: gurkanerdogdu; state: Exp;jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic/CacheStatContentProvider.java Index: CacheStatContentProvider.java =================================================================== package org.jboss.ide.eclipse.jbosscache.views.statistic; import java.util.Collections; import java.util.List; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; import org.jboss.ide.eclipse.jbosscache.views.statistic.CacheStatModel.CacheStatAttributes; public class CacheStatContentProvider implements ITreeContentProvider{ public Object[] getChildren(Object parentElement) { if(parentElement instanceof List) return ((List)parentElement).toArray(); else if(parentElement instanceof CacheStatModel){ CacheStatModel model = (CacheStatModel)parentElement; return model.getAttrChilds().toArray(); } else if(parentElement instanceof CacheStatAttributes){ CacheStatAttributes attr = (CacheStatAttributes)parentElement; return new Object[]{attr}; } else return Collections.EMPTY_LIST.toArray(); } public Object getParent(Object element) { if(element instanceof CacheStatModel) return null; else if(element instanceof CacheStatAttributes){ CacheStatAttributes attr = (CacheStatAttributes)element; return attr.getParent(); } else return null; } public boolean hasChildren(Object element){ if(element instanceof CacheStatAttributes) return false; else if(element instanceof CacheStatModel){ CacheStatModel model = (CacheStatModel)element; return model.getAttrChilds().size() > 0; } else if(element instanceof List){ return ((List)element).size() > 0; } return false; } public Object[] getElements(Object inputElement) { return getChildren(inputElement); } public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } 1.1 date: 2006/07/08 01:59:06; author: gurkanerdogdu; state: Exp;jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic/CacheStatView.java Index: CacheStatView.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.ide.eclipse.jbosscache.views.statistic; import java.util.Map; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.part.ViewPart; import org.jboss.ide.eclipse.jbosscache.ICacheConstants; import org.jboss.ide.eclipse.jbosscache.JBossCachePlugin; import org.jboss.ide.eclipse.jbosscache.actions.ShowObjectFieldsAction; import org.jboss.ide.eclipse.jbosscache.internal.CacheMessages; import org.jboss.ide.eclipse.jbosscache.model.cache.AbstractCacheRootInstance; import org.jboss.ide.eclipse.jbosscache.model.cache.ICacheRootInstance; import org.jboss.ide.eclipse.jbosscache.model.cache.ICacheRootInstanceConnectionListener; import org.jboss.ide.eclipse.jbosscache.model.internal.RemoteCacheManager; import org.jboss.ide.eclipse.jbosscache.utils.CacheUtil; /** * This view will show the node content. * * @author Gurkaner */ public class CacheStatView extends ViewPart implements ICacheRootInstanceConnectionListener { /** Show contents of the cache node in the table */ private TreeViewer treeViewer; /** Table clear action */ private ClearTableAction clearTableAction; private String [] columnTitles = {"Attribute","Value"}; class ClearTableAction extends Action { public ClearTableAction() { super( CacheUtil .getResourceBundleValue(ICacheConstants.NODECONTENTVIEW_CLEAR_TABLE_ACTION)); setImageDescriptor(JBossCachePlugin.getDefault().getImageRegistry() .getDescriptor(ICacheConstants.IMAGE_KEY_DELETE_EDIT)); setToolTipText(CacheUtil .getResourceBundleValue(ICacheConstants.NODECONTENTVIEW_CLEAR_TABLE_ACTION)); setEnabled(false); } public void run() { treeViewer.getTree().clearAll(true); treeViewer.setInput(new Object()); clearTableAction.setEnabled(false); } } /** * The constructor. */ public CacheStatView() { AbstractCacheRootInstance.addConnectListener(this); } /** * This is a callback that will allow us to create the viewer and initialize * it. */ public void createPartControl(Composite parent) { treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION); treeViewer.setContentProvider(new CacheStatContentProvider()); treeViewer.setLabelProvider(new CacheStatLabelProvider()); treeViewer.getTree().setLinesVisible(true); treeViewer.getTree().setHeaderVisible(true); for(int i=0;i<columnTitles.length;i++){ TreeColumn column = new TreeColumn(treeViewer.getTree(),SWT.CENTER); column.setWidth(300); column.setText(columnTitles[i]); column.setAlignment(SWT.LEFT); column.setResizable(true); } // Actions makeActions(); hookContextMenu(); contributeToActionBars(); getSite().setSelectionProvider(treeViewer); } /** * Selected object * * @return */ public Object getSelection() { if (treeViewer.getSelection().isEmpty()) return null; if (treeViewer.getSelection() instanceof IStructuredSelection) { IStructuredSelection strSel = (IStructuredSelection) treeViewer .getSelection(); return strSel.getFirstElement(); } else { return treeViewer.getSelection(); } } private void handleFocusGained() { if (treeViewer.getTree().getItemCount() > 0) clearTableAction.setEnabled(true); else clearTableAction.setEnabled(false); } /** * Contect menu registration */ private void hookContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { CacheStatView.this.fillContextMenu(manager); } }); Menu menu = menuMgr.createContextMenu(treeViewer.getControl()); treeViewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, treeViewer); } /** * Tool bar contribution */ private void contributeToActionBars() { IActionBars bars = getViewSite().getActionBars(); fillLocalPullDown(bars.getMenuManager()); fillLocalToolBar(bars.getToolBarManager()); } /** * Local pull down actions * * @param manager */ private void fillLocalPullDown(IMenuManager manager) { manager.add(clearTableAction); manager.add(new Separator()); } /** * Context menu actions * * @param manager */ private void fillContextMenu(IMenuManager manager) { // Other plug-ins can contribute there actions here manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } /** * Tool bar actions * * @param manager */ private void fillLocalToolBar(IToolBarManager manager) { manager.add(clearTableAction); } /** * Make the actions to use */ private void makeActions() { clearTableAction = new ClearTableAction(); } /** * Passing the focus request to the viewer's control. */ public void setFocus() { treeViewer.getControl().setFocus(); } /** * When selection changes in the view */ public void showStatContent(Object selection) { if (!(selection instanceof ICacheRootInstance)) return; ICacheRootInstance rootInstance = (ICacheRootInstance)selection; RemoteCacheManager remManager = rootInstance.getRemoteCacheManager(); if(!remManager.isUseMbeanAttributes()){ ErrorDialog.openError(getSite().getShell(), "Statistic Error", "Set UseInterceptorMBeans Cache Parameter to Get Statistics.", null); } Map map = remManager.getStatisticsAttribute(); treeViewer.setInput(CacheStatModel.getInstance(map)); handleFocusGained(); }// end of method public void dispose() { super.dispose(); AbstractCacheRootInstance.removeConnectListener(this); } public void cacheRootInstanceConnected(ICacheRootInstance rootInstance) { // TODO Auto-generated method stub } public void cacheRootInstanceDisConnected(ICacheRootInstance rootInstance) { clearTableAction.run(); } }// end of class 1.1 date: 2006/07/08 01:59:06; author: gurkanerdogdu; state: Exp;jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic/CacheStatLabelProvider.java Index: CacheStatLabelProvider.java =================================================================== package org.jboss.ide.eclipse.jbosscache.views.statistic; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.swt.graphics.Image; import org.jboss.ide.eclipse.jbosscache.ICacheConstants; import org.jboss.ide.eclipse.jbosscache.JBossCachePlugin; import org.jboss.ide.eclipse.jbosscache.views.statistic.CacheStatModel.CacheStatAttributes; public class CacheStatLabelProvider implements ITableLabelProvider{ public Image getColumnImage(Object element, int columnIndex) { switch (columnIndex) { case 0: if(element instanceof CacheStatModel){ return JBossCachePlugin.getDefault().getImageRegistry().get(ICacheConstants.IMAGE_KEY_STAT_PARENT_ATTRIBUTE); } if(element instanceof CacheStatAttributes) return JBossCachePlugin.getDefault().getImageRegistry().get(ICacheConstants.IMAGE_KEY_STAT_ATTRIBUTE); } return null; } public String getColumnText(Object element, int columnIndex) { switch (columnIndex) { case 0: if(element instanceof CacheStatModel){ CacheStatModel model = (CacheStatModel)element; return model.getNameOfInterceptor(); } if(element instanceof CacheStatAttributes){ CacheStatAttributes model = (CacheStatAttributes)element; return model.getNameOfAttribute(); } case 1: if(element instanceof CacheStatAttributes){ CacheStatAttributes model = (CacheStatAttributes)element; return model.getValueOfAttribute(); } } return ""; } public void addListener(ILabelProviderListener listener) { } public void dispose() { } public boolean isLabelProperty(Object element, String property) { return false; } public void removeListener(ILabelProviderListener listener) { } } 1.1 date: 2006/07/08 01:59:06; author: gurkanerdogdu; state: Exp;jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic/CacheStatModel.java Index: CacheStatModel.java =================================================================== package org.jboss.ide.eclipse.jbosscache.views.statistic; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; class CacheStatModel { private String nameOfInterceptor; private List attrChilds = Collections.EMPTY_LIST; private static List listModel = Collections.EMPTY_LIST; public static List getInstance(Map map){ Set key = map.keySet(); Iterator it = key.iterator(); CacheStatModel model = null; listModel = new ArrayList(); while(it.hasNext()){ String interceptorName = it.next().toString(); Map values = (Map)map.get(interceptorName); List childs = new ArrayList(); Set keyChild = values.keySet(); Iterator itChild = keyChild.iterator(); CacheStatAttributes cacheStateAttrModel = null; while(itChild.hasNext()){ String attName = itChild.next().toString(); String value = values.get(attName).toString(); cacheStateAttrModel = new CacheStatAttributes(attName,value); childs.add(cacheStateAttrModel); } model = new CacheStatModel(interceptorName,childs); cacheStateAttrModel.setParent(model); listModel.add(model); } return listModel; } static class CacheStatAttributes{ private String nameOfAttribute; private String valueOfAttribute; private CacheStatModel parent; public CacheStatAttributes(String name,String value){ this.nameOfAttribute = name; this.valueOfAttribute = value; } public String getNameOfAttribute() { return nameOfAttribute; } public CacheStatModel getParent() { return parent; } public String getValueOfAttribute() { return valueOfAttribute; } public void setParent(CacheStatModel parent) { this.parent = parent; } } CacheStatModel(String interceptorName,List childs) { this.nameOfInterceptor = interceptorName; this.attrChilds = childs; } public List getAttrChilds() { return attrChilds; } public String getNameOfInterceptor() { return nameOfInterceptor; } } |
From: Gurkan E. <gur...@ya...> - 2006-07-08 01:59:07
|
User: gurkanerdogdu Date: 06/07/07 21:59:06 Modified: cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/perspective CachePerspective.java Log: Cache Statistic View added Revision Changes Path 1.2 +1 -0 jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/perspective/CachePerspective.java (In the diff below, changes in quantity of whitespace are not shown.) Index: CachePerspective.java =================================================================== RCS file: /cvsroot/jboss/jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/perspective/CachePerspective.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- CachePerspective.java 13 Dec 2005 16:04:34 -0000 1.1 +++ CachePerspective.java 8 Jul 2006 01:59:06 -0000 1.2 @@ -36,6 +36,7 @@ //BOTTOM folderLayoutNext = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, layout.getEditorArea()); folderLayoutNext.addView(ICacheConstants.CACHE_NODE_CONTENT_VIEW_ID); + folderLayoutNext.addView(ICacheConstants.CACHE_STATISTIC_VIEW_ID); folderLayoutNext.addView(IConsoleConstants.ID_CONSOLE_VIEW); //RIGHT |
From: Gurkan E. <gur...@ya...> - 2006-07-08 01:59:07
|
User: gurkanerdogdu Date: 06/07/07 21:59:06 Modified: cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/config TreeCacheView.java Log: Cache Statistic View added Revision Changes Path 1.3 +17 -3 jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/config/TreeCacheView.java (In the diff below, changes in quantity of whitespace are not shown.) Index: TreeCacheView.java =================================================================== RCS file: /cvsroot/jboss/jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/config/TreeCacheView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- TreeCacheView.java 23 Mar 2006 11:12:30 -0000 1.2 +++ TreeCacheView.java 8 Jul 2006 01:59:06 -0000 1.3 @@ -51,6 +51,7 @@ import org.jboss.ide.eclipse.jbosscache.actions.RenameAction; import org.jboss.ide.eclipse.jbosscache.actions.ShowContentAction; import org.jboss.ide.eclipse.jbosscache.actions.ShowObjectGraphAction; +import org.jboss.ide.eclipse.jbosscache.actions.ShowStatisticsAction; import org.jboss.ide.eclipse.jbosscache.model.cache.AbstractCacheInstance; import org.jboss.ide.eclipse.jbosscache.model.cache.AbstractCacheRootInstance; import org.jboss.ide.eclipse.jbosscache.model.cache.ICacheInstance; @@ -144,6 +145,8 @@ private IMemento memento; + private Action cacheStatAction; + /** * The constructor. */ @@ -363,11 +366,17 @@ if(rootInstance.isRemoteCache()) { manager.add(refreshAction); + manager.add(cacheStatAction); + - if(rootInstance.isConnected()) + if(rootInstance.isConnected()){ refreshAction.setEnabled(true); - else + cacheStatAction.setEnabled(true); + } + else{ refreshAction.setEnabled(false); + cacheStatAction.setEnabled(false); + } connectAction.setText("Connect to Remote"); connectAction.setToolTipText("Connect to Remote"); @@ -560,6 +569,11 @@ refreshAction = new RemoteRefreshAction(this,"refAction"); + cacheStatAction = new ShowStatisticsAction(this, "showStatAction"); + cacheStatAction.setText("Show Statistics"); + cacheStatAction.setToolTipText("Show Statistics"); + cacheStatAction.setImageDescriptor(JBossCachePlugin.getDefault().getImageRegistry().getDescriptor( + ICacheConstants.IMAGE_KEY_SEARCH_GIF)); } |
From: Gurkan E. <gur...@ya...> - 2006-07-08 01:58:44
|
User: gurkanerdogdu Date: 06/07/07 21:58:42 Log: Directory /cvsroot/jboss/jbosside/cache/plugins/org.jboss.ide.eclipse.jbosscache/src/org/jboss/ide/eclipse/jbosscache/views/statistic added to the repository |
From: Aron S. <bi...@gm...> - 2006-07-08 01:48:13
|
User: asogor Date: 06/07/07 21:48:10 Added: src/calendar/calendarejb/src/java/org/jboss/mail/calendar/util/availability AvailabilityCalculator.java Log: This is the base for getting suggestion for meeting times Revision Changes Path 1.1 date: 2006/07/08 01:48:10; author: asogor; state: Exp;jboss-mail/src/calendar/calendarejb/src/java/org/jboss/mail/calendar/util/availability/AvailabilityCalculator.java Index: AvailabilityCalculator.java =================================================================== package org.jboss.mail.calendar.util.availability; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jboss.mail.calendar.data.CalendarEvent; import org.jboss.mail.calendar.data.Invite; /** * AvailabilityCalculator is a utility to figure out possible timeslots for a meeting * * @author Aron Sogor * */ public class AvailabilityCalculator { private Log log = LogFactory.getLog(AvailabilityCalculator.class); /** * The logic of this calculator is simple: * * Create segments using the increment between start date and end date. * Check which segments are free, meaning there are no meeting during that segment. * Find numberOfunits continous free segments. * Return all event proposals. * * @param invites all the attendees events * @param startTime the begining of the search range * @param endTime the end of the search range * @param incrementSize the size of an increment in minutes * @param numberOfunits the number of increments the meeting should last */ public static CalendarEvent[] calculate(Invite[] invites,Date startTime,Date endTime,int incrementSize,int numberOfunits) { return (new AvailabilityCalculator()).calculateEvents(invites,startTime,endTime,incrementSize,numberOfunits); } private CalendarEvent[] calculateEvents(Invite[] invites,Date startTime,Date endTime,int incrementSize,int numberOfunits) { ArrayList<CalendarEvent> result = new ArrayList<CalendarEvent>(); if(startTime.after(endTime)) { log.warn("Availibilty calculator was passed stared and end date reversed"); return new CalendarEvent[0]; } double segmentTotal = Math.ceil((startTime.getTime() - endTime.getTime())/(60000 * incrementSize)); //generate the segments Segment firstSegment = setupSegments(startTime,endTime,segmentTotal); //mark each segment free(true) or busy(false) //check each segment as valid return (CalendarEvent[])result.toArray(new CalendarEvent[0]); } private Segment setupSegments(Date startTime,Date endTime,double segmentTotal) { Segment firstSegment = null; Segment currentSegment = null; for (int segmentCnt = 0; segmentCnt < segmentTotal; segmentCnt++) { if(currentSegment == null) { currentSegment.setNextSegment(new Segment(startTime,endTime,true)); firstSegment = currentSegment; } else currentSegment.setNextSegment(new Segment(startTime,endTime,true)); currentSegment = currentSegment.getNextSegment(); } return firstSegment; } private class Segment{ private Date startTime = null; private Date endTime = null; private boolean isBusy = false; private Segment nextSegment = null; public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public boolean isBusy() { return isBusy; } public void setBusy(boolean isBusy) { this.isBusy = isBusy; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Segment getNextSegment() { return nextSegment; } public void setNextSegment(Segment nextSegment) { this.nextSegment = nextSegment; } public Segment(Date startTime, Date endTime, boolean isBusy) { super(); // TODO Auto-generated constructor stub this.startTime = startTime; this.endTime = endTime; this.isBusy = isBusy; } } } |
From: Aron S. <bi...@gm...> - 2006-07-08 01:48:12
|
User: asogor Date: 06/07/07 21:48:09 Log: Directory /cvsroot/jboss/jboss-mail/src/calendar/calendarejb/src/java/org/jboss/mail/calendar/util/availability added to the repository |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:29:39
|
User: mculpepper Date: 06/07/07 21:29:18 Added: eclipse/gef/3.2 GEF-SDK-3.2.zip Log: new callisto drivers Revision Changes Path 1.1 date: 2006/07/08 01:29:18; author: mculpepper; state: Exp;repository.jboss.com/eclipse/gef/3.2/GEF-SDK-3.2.zip <<Binary file>> |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:29:39
|
User: mculpepper Date: 06/07/07 21:29:19 Added: eclipse/webtools/1.5 wtp-sdk-R-1.5.0-200606281455.zip Log: new callisto drivers Revision Changes Path 1.1 date: 2006/07/08 01:29:18; author: mculpepper; state: Exp;repository.jboss.com/eclipse/webtools/1.5/wtp-sdk-R-1.5.0-200606281455.zip <<Binary file>> |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:29:39
|
User: mculpepper Date: 06/07/07 21:29:17 Added: eclipse/jem/1.2 JEM-SDK-1.2.zip Log: new callisto drivers Revision Changes Path 1.1 date: 2006/07/08 01:29:17; author: mculpepper; state: Exp;repository.jboss.com/eclipse/jem/1.2/JEM-SDK-1.2.zip <<Binary file>> |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:29:39
|
User: mculpepper Date: 06/07/07 21:29:27 Added: eclipse/emf-sdo-xsd/2.2.0 emf-sdo-xsd-SDK-2.2.0.zip Log: new callisto drivers Revision Changes Path 1.1 date: 2006/07/08 01:29:26; author: mculpepper; state: Exp;repository.jboss.com/eclipse/emf-sdo-xsd/2.2.0/emf-sdo-xsd-SDK-2.2.0.zip <<Binary file>> |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:29:39
|
User: mculpepper Date: 06/07/07 21:29:17 Added: eclipse/test-framework/3.2 eclipse-test-framework-3.2.zip Log: new callisto drivers Revision Changes Path 1.1 date: 2006/07/08 01:29:17; author: mculpepper; state: Exp;repository.jboss.com/eclipse/test-framework/3.2/eclipse-test-framework-3.2.zip <<Binary file>> |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:19:10
|
User: mculpepper Date: 06/07/07 21:19:06 Log: Directory /cvsroot/jboss/repository.jboss.com/eclipse/jem/1.2 added to the repository |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:19:10
|
User: mculpepper Date: 06/07/07 21:19:05 Log: Directory /cvsroot/jboss/repository.jboss.com/eclipse/emf-sdo-xsd/2.2.0 added to the repository |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:19:10
|
User: mculpepper Date: 06/07/07 21:19:06 Log: Directory /cvsroot/jboss/repository.jboss.com/eclipse/webtools/1.5 added to the repository |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:19:10
|
User: mculpepper Date: 06/07/07 21:19:06 Log: Directory /cvsroot/jboss/repository.jboss.com/eclipse/test-framework/3.2 added to the repository |
From: Marshall C. <mcu...@jb...> - 2006-07-08 01:19:10
|
User: mculpepper Date: 06/07/07 21:19:06 Log: Directory /cvsroot/jboss/repository.jboss.com/eclipse/gef/3.2 added to the repository |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:10
|
User: julien Date: 06/07/07 20:33:07 Added: server/src/main/org/jboss/portal/test/server/charset CharsetTestSuite.java GetTest.java PostMultipartFormDataNoCharsetTest.java PostMultipartFormDataUTF8Test.java PostTest.java PostXWWWFormURLEncodedNoCharsetTest.java PostXWWWFormURLEncodedUTF8Test.java Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/CharsetTestSuite.java Index: CharsetTestSuite.java =================================================================== /* * 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.portal.test.server.charset; import junit.framework.Test; import org.jboss.portal.test.framework.container.client.TestSuite; import org.jboss.portal.test.framework.container.client.TestCase; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class CharsetTestSuite { public static Test suite() { TestSuite suite = new TestSuite("test-charset.sar"); suite.addTest(new TestCase("GetTest")); suite.addTest(new TestCase("PostTest")); suite.addTest(new TestCase("PostXWWWFormURLEncodedNoCharsetTest")); suite.addTest(new TestCase("PostXWWWFormURLEncodedUTF8Test")); suite.addTest(new TestCase("PostMultipartFormDataNoCharsetTest")); suite.addTest(new TestCase("PostMultipartFormDataUTF8Test")); return suite; } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/GetTest.java Index: GetTest.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.server.parameters.Utils; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.InvokeGetResult; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.ServerRequestContext; import org.jboss.portal.server.request.RequestParameter; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class GetTest extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); return new InvokeGetResult(s); } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertNull(context.getMediaType()); assertNull(req.getCharacterEncoding()); } }); return assertResult; } } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataNoCharsetTest.java Index: PostMultipartFormDataNoCharsetTest.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.InvokePostResult; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.PortalConstants; import org.jboss.portal.server.ServerRequestContext; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class PostMultipartFormDataNoCharsetTest extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); InvokePostResult post = new InvokePostResult(); post.setURL(s); post.setContentType(PortalConstants.MULTIPART_FORM_DATA); post.setBody(new InvokePostResult.FormBody()); return post; } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertEquals(PortalConstants.MULTIPART_FORM_DATA, context.getMediaType()); assertNull(req.getCharacterEncoding()); } }); return assertResult; } } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/PostMultipartFormDataUTF8Test.java Index: PostMultipartFormDataUTF8Test.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.InvokePostResult; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.PortalConstants; import org.jboss.portal.server.ServerRequestContext; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class PostMultipartFormDataUTF8Test extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); InvokePostResult post = new InvokePostResult(); post.setURL(s); post.setContentType(PortalConstants.MULTIPART_FORM_DATA); post.setBody(new InvokePostResult.FormBody()); return post; } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertEquals(PortalConstants.MULTIPART_FORM_DATA, context.getMediaType()); // assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding()); } }); return assertResult; } } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/PostTest.java Index: PostTest.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.InvokePostResult; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.PortalConstants; import org.jboss.portal.server.ServerRequestContext; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class PostTest extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); InvokePostResult post = new InvokePostResult(); post.setURL(s); post.setBody(new InvokePostResult.FormBody()); return post; } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertNull(context.getMediaType()); assertNull(req.getCharacterEncoding()); } }); return assertResult; } } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedNoCharsetTest.java Index: PostXWWWFormURLEncodedNoCharsetTest.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.result.InvokePostResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.PortalConstants; import org.jboss.portal.server.ServerRequestContext; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class PostXWWWFormURLEncodedNoCharsetTest extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); InvokePostResult post = new InvokePostResult(); post.setURL(s); post.setContentType(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED); post.setBody(new InvokePostResult.FormBody()); return post; } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertEquals(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED, context.getMediaType()); assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding()); } }); return assertResult; } } } 1.1 date: 2006/07/08 00:33:06; author: julien; state: Exp;jboss-portal/server/src/main/org/jboss/portal/test/server/charset/PostXWWWFormURLEncodedUTF8Test.java Index: PostXWWWFormURLEncodedUTF8Test.java =================================================================== /* * 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.portal.test.server.charset; import org.jboss.portal.test.server.AbstractTest; import org.jboss.portal.test.framework.container.result.Result; import org.jboss.portal.test.framework.container.result.InvokePostResult; import org.jboss.portal.test.framework.container.result.AssertResult; import org.jboss.portal.test.framework.container.TestCaseContext; import org.jboss.portal.server.ServerInvocation; import org.jboss.portal.server.AbstractServerURL; import org.jboss.portal.server.PortalConstants; import org.jboss.portal.server.ServerRequestContext; import javax.servlet.http.HttpServletRequest; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> * @version $Revision: 1.1 $ */ public class PostXWWWFormURLEncodedUTF8Test extends AbstractTest { public Result execute(final ServerInvocation invocation) { if (TestCaseContext.isCurrentRequestCount(0)) { AbstractServerURL url = new AbstractServerURL(); url.setPortalRequestPath("/index.html"); String s = invocation.getResponse().encodeURL(url); InvokePostResult post = new InvokePostResult(); post.setURL(s); post.setContentType(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED + "; charset=" + PortalConstants.UTF_8.name()); post.setBody(new InvokePostResult.FormBody()); return post; } else { AssertResult assertResult = new AssertResult(); assertResult.execute(new AssertResult.Test() { public void run() throws Exception { ServerRequestContext context = invocation.getRequest().getContext(); HttpServletRequest req = context.getClientRequest(); assertEquals(PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED, context.getMediaType()); assertEquals(PortalConstants.UTF_8.name(), req.getCharacterEncoding()); } }); return assertResult; } } } |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:09
|
User: julien Date: 06/07/07 20:33:07 Modified: test/src/main/org/jboss/portal/test/framework/container/result AssertResult.java Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.2 +8 -1 jboss-portal/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java (In the diff below, changes in quantity of whitespace are not shown.) Index: AssertResult.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/test/src/main/org/jboss/portal/test/framework/container/result/AssertResult.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- AssertResult.java 22 Apr 2006 17:43:13 -0000 1.1 +++ AssertResult.java 8 Jul 2006 00:33:07 -0000 1.2 @@ -32,7 +32,7 @@ * A set of assertions as result. * * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class AssertResult extends Result { @@ -59,6 +59,13 @@ count++; } + public static AssertResult run(Test test) throws IllegalArgumentException, IllegalStateException + { + AssertResult assertResult = new AssertResult(); + assertResult.execute(test); + return assertResult; + } + /** * Run the test, record the error or failure if any and increment the count. * |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:09
|
User: julien Date: 06/07/07 20:33:06 Modified: server/src/main/org/jboss/portal/server PortalConstants.java ServerRequestContext.java Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.20 +7 -2 jboss-portal/server/src/main/org/jboss/portal/server/PortalConstants.java (In the diff below, changes in quantity of whitespace are not shown.) Index: PortalConstants.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/server/src/main/org/jboss/portal/server/PortalConstants.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -b -r1.19 -r1.20 --- PortalConstants.java 5 Jul 2006 16:58:34 -0000 1.19 +++ PortalConstants.java 8 Jul 2006 00:33:06 -0000 1.20 @@ -23,11 +23,13 @@ import org.jboss.portal.common.util.Version; +import java.nio.charset.Charset; + /** * Defines various constants for the portal. * * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ */ public class PortalConstants { @@ -43,6 +45,9 @@ /** . */ public static final String MULTIPART_FORM_DATA = "multipart/form-data"; + /** . */ + public static final Charset UTF_8 = Charset.forName("UTF-8"); + // Portal properties public static String PORTAL_PROP_NAME_KEY = "org.jboss.portal.property.name"; 1.7 +12 -1 jboss-portal/server/src/main/org/jboss/portal/server/ServerRequestContext.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ServerRequestContext.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/server/src/main/org/jboss/portal/server/ServerRequestContext.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- ServerRequestContext.java 4 Jul 2006 10:07:51 -0000 1.6 +++ ServerRequestContext.java 8 Jul 2006 00:33:06 -0000 1.7 @@ -25,10 +25,11 @@ import javax.servlet.http.HttpServletRequest; import java.util.Map; +import java.nio.charset.Charset; /** * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ public interface ServerRequestContext { @@ -39,6 +40,16 @@ Map getParameterMap(); /** + * Return the normalized media type of the request or null if none has been provided by the client. + */ + String getMediaType(); + + /** + * Return the charset of the request or null if none has been provided by the client. + */ + // Charset getCharset(); + + /** * Return the url context of this request. */ URLContext getURLContext(); |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:09
|
User: julien Date: 06/07/07 20:33:07 Modified: theme/src/main/org/jboss/portal/test/theme TestHelper.java Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.16 +6 -1 jboss-portal/theme/src/main/org/jboss/portal/test/theme/TestHelper.java (In the diff below, changes in quantity of whitespace are not shown.) Index: TestHelper.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/theme/src/main/org/jboss/portal/test/theme/TestHelper.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -b -r1.15 -r1.16 --- TestHelper.java 4 Jul 2006 10:07:53 -0000 1.15 +++ TestHelper.java 8 Jul 2006 00:33:07 -0000 1.16 @@ -80,7 +80,7 @@ /** * @author <a href="mailto:mho...@no...">Martin Holzner</a> - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class TestHelper { @@ -220,6 +220,11 @@ return clientRequest; } + public String getMediaType() + { + throw new UnsupportedOperationException(); + } + public Map getParameterMap() { throw new UnsupportedOperationException(); |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:09
|
User: julien Date: 06/07/07 20:33:07 Added: server/src/resources/test/test-charset-sar/META-INF jboss-service.xml Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.1 date: 2006/07/08 00:33:07; author: julien; state: Exp;jboss-portal/server/src/resources/test/test-charset-sar/META-INF/jboss-service.xml Index: jboss-service.xml =================================================================== <server> <!-- Server configuration service --> <mbean code="org.jboss.portal.server.config.ServerConfigService" name="portal:service=ServerConfig" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <attribute name="ConfigLocation">conf/config.xml</attribute> </mbean> <!-- Server --> <mbean code="org.jboss.portal.server.impl.ServerImpl" name="portal:service=Server" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Config" proxy-type="attribute">portal:service=ServerConfig</depends> </mbean> <!-- Server stack --> <mbean code="org.jboss.portal.server.impl.invocation.JBossInterceptorStack" name="portal:service=InterceptorStack,type=Server" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends-list optional-attribute-name="InterceptorNames"> </depends-list> </mbean> <!-- --> <mbean code="org.jboss.portal.test.server.RequestControllerTestImpl" name="portal:controller=Request" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> </mbean> <!-- --> <mbean code="org.jboss.portal.test.server.charset.GetTest" name="portal:test=Get" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> <mbean code="org.jboss.portal.test.server.charset.PostTest" name="portal:test=Post" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> <mbean code="org.jboss.portal.test.server.charset.PostXWWWFormURLEncodedNoCharsetTest" name="portal:test=PostXWWWFormURLEncodedNoCharsetType" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> <mbean code="org.jboss.portal.test.server.charset.PostXWWWFormURLEncodedUTF8Test" name="portal:test=PostXWWWFormURLEncodedUTF8Type" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> <mbean code="org.jboss.portal.test.server.charset.PostMultipartFormDataNoCharsetTest" name="portal:test=PostMultipartFormDataNoCharsetType" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> <mbean code="org.jboss.portal.test.server.charset.PostMultipartFormDataUTF8Test" name="portal:test=PostMultipartFormDataUTF8Type" xmbean-dd="" xmbean-code="org.jboss.portal.common.system.JBossServiceModelMBean"> <xmbean/> <depends optional-attribute-name="Controller" proxy-type="attribute">portal:controller=Request</depends> </mbean> </server> |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:09
|
User: julien Date: 06/07/07 20:33:07 Added: server/src/resources/test/test-charset-sar/conf config.xml Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.1 date: 2006/07/08 00:33:07; author: julien; state: Exp;jboss-portal/server/src/resources/test/test-charset-sar/conf/config.xml Index: config.xml =================================================================== <properties> </properties> |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:08
|
User: julien Date: 06/07/07 20:33:06 Modified: server build.xml Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.37 +13 -1 jboss-portal/server/build.xml (In the diff below, changes in quantity of whitespace are not shown.) Index: build.xml =================================================================== RCS file: /cvsroot/jboss/jboss-portal/server/build.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -u -b -r1.36 -r1.37 --- build.xml 30 Jun 2006 23:51:01 -0000 1.36 +++ build.xml 8 Jul 2006 00:33:06 -0000 1.37 @@ -8,7 +8,7 @@ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent"> ]> -<!-- $Id: build.xml,v 1.36 2006/06/30 23:51:01 julien Exp $ --> +<!-- $Id: build.xml,v 1.37 2006/07/08 00:33:06 julien Exp $ --> <!--+======================================================================+--> <!--| JBoss Portal (The OpenSource Portal) Build File |--> @@ -212,6 +212,17 @@ <fileset dir="${build.resources}/test/test-session-sar"/> <fileset dir="${build.lib}" includes="test-session.war"/> </jar> + + <!-- --> + <jar jarfile="${build.lib}/test-charset.sar"> + + <fileset dir="${jboss.portal-common.root}/lib" includes="portal-common-lib.jar"/> + <fileset dir="${build.lib}" includes="test-agent.war"/> + <fileset dir="${build.lib}" includes="portal-server-lib.jar"/> + <fileset dir="${build.lib}" includes="portal-server-test-lib.jar"/> + + <fileset dir="${build.resources}/test/test-charset-sar"/> + </jar> </target> <!-- ================================================================== --> @@ -310,6 +321,7 @@ <test name="org.jboss.portal.test.server.parameters.ParametersTestSuite"/> <test name="org.jboss.portal.test.server.servlet.ServletTestSuite"/> <test name="org.jboss.portal.test.server.session.SessionTestSuite"/> + <test name="org.jboss.portal.test.server.charset.CharsetTestSuite"/> <!-- Standalone tests --> <test name="org.jboss.portal.test.portal.util.PropertiesTestCase"/> |
From: Julien V. <ju...@jb...> - 2006-07-08 00:33:08
|
User: julien Date: 06/07/07 20:33:06 Modified: server/src/main/org/jboss/portal/server/servlet PortalServlet.java Log: - improve request decoding of the media type from the content type - added test case to ensure this is done correctly by the portal servlet Revision Changes Path 1.24 +39 -8 jboss-portal/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java (In the diff below, changes in quantity of whitespace are not shown.) Index: PortalServlet.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- PortalServlet.java 5 Jul 2006 16:47:20 -0000 1.23 +++ PortalServlet.java 8 Jul 2006 00:33:06 -0000 1.24 @@ -63,7 +63,7 @@ * mapped. * * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.23 $ + * @version $Revision: 1.24 $ */ public class PortalServlet extends HttpServlet { @@ -172,24 +172,48 @@ process(req, resp, true); } - private Charset utf8 = Charset.forName("UTF-8"); + private String retrieveMediaType(String contentType) + { + String mediaType = contentType; + + // + if (mediaType != null) + { + // Remove any parameters + int index = mediaType.indexOf(';'); + if (index != -1) + { + mediaType = contentType.substring(0, index); + } + + // Trim + mediaType = mediaType.trim(); + + // Media type matching is case insensitive, so we convert to lower case + mediaType = mediaType.toLowerCase(); + } + return mediaType; + } protected void process(final HttpServletRequest req, final HttpServletResponse resp, boolean isGet) throws ServletException, IOException { + // Compute the media type in the content type + String mediaType = retrieveMediaType(req.getContentType()); + // Only affect the charset encoding if the servlet container will decode the request - String contentType = req.getContentType(); - if (isGet == false && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(contentType)) + if (isGet == false && PortalConstants.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType)) { + // Now we must ensure that we have either an equals or a trailing space after the media-type String characterEncoding = req.getCharacterEncoding(); if (characterEncoding == null) { // Set out charset for the portal request - req.setCharacterEncoding(utf8.name()); + req.setCharacterEncoding(PortalConstants.UTF_8.name()); } else { Charset charset = Charset.forName(characterEncoding); - if (!utf8.equals(charset)) + if (!PortalConstants.UTF_8.equals(charset)) { throw new ServletException("Unaccepted charset " + characterEncoding); } @@ -249,7 +273,7 @@ RequestController controller = getController(); // - ServerRequestContext requestContext = new ServerRequestContextImpl(req, portalRequestPath, portalContextPath, parameterMap, urlContext); + ServerRequestContext requestContext = new ServerRequestContextImpl(req, portalRequestPath, portalContextPath, parameterMap, urlContext, mediaType); ServerRequest request = new ServerRequest(requestContext); request.setServer(server); @@ -339,6 +363,7 @@ private HttpServletRequest req; private String portalRequestPath; private String portalContextPath; + private String mediaType; /** The <String,Parameter>Map. */ private Map parameterMap; @@ -346,15 +371,21 @@ /** The url context. */ private URLContext urlContext; - public ServerRequestContextImpl(HttpServletRequest req, String requestPath, String contextPath, Map parameterMap, URLContext urlContext) + public ServerRequestContextImpl(HttpServletRequest req, String requestPath, String contextPath, Map parameterMap, URLContext urlContext, String mediaType) { this.req = req; this.portalRequestPath = requestPath; this.portalContextPath = contextPath; + this.mediaType = mediaType; this.parameterMap = parameterMap; this.urlContext = urlContext; } + public String getMediaType() + { + return mediaType; + } + public URLContext getURLContext() { return urlContext; |