Author: julien_viet
Date: 2010-02-25 03:45:38 -0500 (Thu, 25 Feb 2010)
New Revision: 1859
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/serialization/serial/ObjectWriter.java
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
portal/trunk/component/web/src/main/java/org/exoplatform/upload/UploadService.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Param.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputIconSelector.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputWithActions.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageTemplateOptions.java
Log:
- GTNPORTAL-502 : Remove println messages from java files
- make a bit more type safe
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/serialization/serial/ObjectWriter.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/serialization/serial/ObjectWriter.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/serialization/serial/ObjectWriter.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -22,6 +22,8 @@
import org.exoplatform.commons.serialization.SerializationContext;
import org.exoplatform.commons.serialization.api.TypeConverter;
import org.exoplatform.commons.serialization.model.*;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import java.io.*;
import java.util.IdentityHashMap;
@@ -34,6 +36,9 @@
{
/** . */
+ private static final Logger log = LoggerFactory.getLogger(ObjectWriter.class);
+
+ /** . */
private final SerializationContext context;
/** . */
@@ -188,7 +193,7 @@
case FULL:
break;
case PARTIAL:
- System.out.println("Partial serialization of object " + obj);
+ log.debug("Partial serialization of object " + obj);
break;
case NONE:
throw new NotSerializableException("Type " + typeModel + "
is not serializable");
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
---
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -105,7 +105,7 @@
windowId = ((PortletRequestContext)context).getRequest().getWindowID();
Param param = initParams.getParam("ContainerConfigs");
- containerOptions = param.getMapGroovyObject(context);
+ containerOptions =
(List<SelectItemOption<String>>)param.getMapGroovyObject(context);
if (containerOptions == null)
{
return;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -27,6 +27,8 @@
import org.exoplatform.portal.application.PortletPreferences;
import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.pom.data.Mapper;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.mop.api.Model;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.workspace.ObjectType;
@@ -57,6 +59,9 @@
{
/** . */
+ private static final Logger log = LoggerFactory.getLogger(POMSession.class);
+
+ /** . */
private static final Map<ObjectType<?>, Class> mapping = new
HashMap<ObjectType<?>, Class>();
static
@@ -396,7 +401,7 @@
}
else
{
- System.out.println("Will not save session that is marked for
rollback");
+ log.debug("Will not save session that is marked for rollback");
}
}
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/PageNavigationTask.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -26,6 +26,8 @@
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.data.NavigationData;
import org.exoplatform.portal.pom.data.NavigationKey;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
@@ -39,6 +41,9 @@
{
/** . */
+ private static final Logger log = LoggerFactory.getLogger(PageNavigationTask.class);
+
+ /** . */
protected final ObjectType<? extends Site> siteType;
/** . */
@@ -88,7 +93,7 @@
}
else
{
- System.out.println("Cannot load page navigation as the corresponding
portal " + key.getId()
+ log.debug("Cannot load page navigation as the corresponding portal
" + key.getId()
+ " with type " + siteType + " does not exist");
}
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/upload/UploadService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -21,6 +21,8 @@
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PortalContainerInfo;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
@@ -40,6 +42,9 @@
public class UploadService
{
+ /** . */
+ private static final Logger log = LoggerFactory.getLogger(UploadService.class);
+
private Map<String, UploadResource> uploadResources = new
LinkedHashMap<String, UploadResource>();
private String uploadLocation_;
@@ -78,7 +83,7 @@
upResource.setStatus(UploadResource.FAILED_STATUS);
//upResource.setLimitMB(limitMB);
uploadResources.put(uploadId, upResource);
- System.out.println("Upload cancelled because file bigger than size limit :
" + estimatedSizeMB + " MB > "
+ log.debug("Upload cancelled because file bigger than size limit : " +
estimatedSizeMB + " MB > "
+ limitMB + " MB");
// WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
// UIApplication uiApp = ctx.getUIApplication();
@@ -129,7 +134,7 @@
{ // a limit set to 0 means unlimited
upResource.setStatus(UploadResource.FAILED_STATUS);
uploadResources.put(uploadId, upResource);
- System.out.println("Upload cancelled because file bigger than size limit :
" + estimatedSizeMB + " MB > "
+ log.debug("Upload cancelled because file bigger than size limit : " +
estimatedSizeMB + " MB > "
+ limitMB + " MB");
return;
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -72,7 +72,7 @@
{
Param param = initParams.getParam("SampleGadget");
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- String sample = param.getMapGroovyObject(context);
+ String sample = (String)param.getMapGroovyObject(context);
addUIFormInput(new UIFormTextAreaInput(FIELD_SOURCE, null,
sample).addValidator(MandatoryValidator.class)
.addValidator(GadgetSpecValidator.class));
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Param.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Param.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Param.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -25,12 +25,17 @@
import org.exoplatform.resolver.ResourceResolver;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.xml.object.XMLObject;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import java.io.InputStream;
public class Param
{
+ /** . */
+ private static final Logger log = LoggerFactory.getLogger(Param.class);
+
private String name;
private String value;
@@ -69,12 +74,12 @@
}
@SuppressWarnings("unchecked")
- public <T> T getMapGroovyObject(WebuiRequestContext context) throws Exception
+ public Object getMapGroovyObject(WebuiRequestContext context) throws Exception
{
try
{
if (object != null)
- return (T)object;
+ return object;
ResourceResolver resolver = context.getResourceResolver(value);
InputStream is = resolver.getInputStream(value);
//TODO if is == null throw an exception saying the it's impossible to find
the file
@@ -82,17 +87,16 @@
GroovyShell shell = new
GroovyShell(Thread.currentThread().getContextClassLoader(), binding);
object = shell.evaluate(is);
is.close();
- return (T)object;
+ return object;
}
- catch (Exception ex)
+ catch (Exception e)
{
- System.out.println("A problem in the groovy script : " + value);
- ex.printStackTrace();
- throw ex;
+ log.error("A problem in the groovy script : " + value, e);
+ throw e;
}
}
- public <T> T getFreshObject(WebuiRequestContext context) throws Exception
+ public Object getFreshObject(WebuiRequestContext context) throws Exception
{
try
{
@@ -102,13 +106,12 @@
GroovyShell shell = new
GroovyShell(Thread.currentThread().getContextClassLoader(), binding);
object = shell.evaluate(is);
is.close();
- return (T)object;
+ return object;
}
- catch (Exception ex)
+ catch (Exception e)
{
- System.out.println("A problem in the groovy script : " + value);
- ex.printStackTrace();
- throw ex;
+ log.error("A problem in the groovy script : " + value, e);
+ throw e;
}
}
}
\ No newline at end of file
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputIconSelector.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputIconSelector.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputIconSelector.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -111,7 +111,7 @@
{
if (param.getName().equals(paramName))
{
- CategoryIcon categoryIconSet = param.getMapGroovyObject(context);
+ CategoryIcon categoryIconSet =
(CategoryIcon)param.getMapGroovyObject(context);
if (selectedIconCategory == null)
selectedIconCategory = categoryIconSet;
for (IconSet iconset : categoryIconSet.getCategory())
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputWithActions.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputWithActions.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputWithActions.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -109,18 +109,18 @@
catch (MissingResourceException ex)
{
actionLabel = action.getActionName();
- System.out.println("\n Key: '" + uiForm.getId() +
".label.action." + action.getActionName()
+ log.debug("Key: '" + uiForm.getId() +
".label.action." + action.getActionName()
+ "' not found");
}
String actionLink;
if (action.getActionParameter() != null)
{
actionLink =
- ((UIComponent)getParent()).event(action.getActionListener(),
action.getActionParameter());
+ getParent().event(action.getActionListener(),
action.getActionParameter());
}
else
{
- actionLink =
((UIComponent)getParent()).event(action.getActionListener());
+ actionLink = getParent().event(action.getActionListener());
}
if (action.getActionType() == ActionData.TYPE_ICON)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -24,6 +24,8 @@
import org.exoplatform.webui.core.model.SelectItem;
import org.exoplatform.webui.core.model.SelectOption;
import org.exoplatform.webui.core.model.SelectOptionGroup;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import java.io.Writer;
import java.util.ArrayList;
@@ -38,6 +40,9 @@
public class UIFormSelectBoxWithGroups extends UIFormStringInput
{
+ /** . */
+ private static final Logger log =
LoggerFactory.getLogger(UIFormSelectBoxWithGroups.class);
+
/**
* It make SelectBox's ability to select multiple values
*/
@@ -339,7 +344,7 @@
}
catch (MissingResourceException ex)
{
- System.out.println("Could not find: " + getFrom().getId() +
".optionGroup.label." + label);
+ log.debug("Could not find: " + getFrom().getId() +
".optionGroup.label." + label);
}
w.write("<optgroup label=\"");
w.write(label);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -31,6 +31,8 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.core.UIApplication;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -46,6 +48,12 @@
public class ReplicatingStateManager extends StateManager
{
+ /** . */
+ private static final String APPLICATION_ATTRIBUTE_PREFIX = "rsm.";
+
+ /** . */
+ private static final Logger log =
LoggerFactory.getLogger(ReplicatingStateManager.class);
+
@Override
public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws
Exception
{
@@ -59,7 +67,7 @@
String key = getKey(context);
//
- ApplicationState appState =
(ApplicationState)session.getAttribute("bilto_" + key);
+ ApplicationState appState =
(ApplicationState)session.getAttribute(APPLICATION_ATTRIBUTE_PREFIX + key);
//
UIApplication uiapp = null;
@@ -74,11 +82,11 @@
//
if (appState != null)
{
- System.out.println("Found application " + key + " :" +
appState.getApplication());
+ log.debug("Found application " + key + " :" +
appState.getApplication());
}
else
{
- System.out.println("Application " + key + " not found");
+ log.debug("Application " + key + " not found");
}
// Looks like some necessary hacking
@@ -123,8 +131,8 @@
String key = getKey(context);
//
- System.out.println("Storing application " + key);
- session.setAttribute("bilto_" + key, new ApplicationState(uiapp,
context.getRemoteUser()));
+ log.debug("Storing application " + key);
+ session.setAttribute(APPLICATION_ATTRIBUTE_PREFIX + key, new
ApplicationState(uiapp, context.getRemoteUser()));
}
@Override
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerList.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -59,7 +59,7 @@
return;
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
Param param = initParams.getParam("ContainerConfigOption");
- categories_ = param.getMapGroovyObject(context);
+ categories_ = (List<SelectItemCategory>)param.getMapGroovyObject(context);
if (categories_ == null)
return;
setSelectedCategory(categories_.get(0));
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -131,7 +131,7 @@
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
Param param = initParams.getParam("PageTemplate");
- List<SelectItemCategory> itemCategories = param.getMapGroovyObject(context);
+ List<SelectItemCategory> itemCategories =
(List<SelectItemCategory>)param.getMapGroovyObject(context);
UIFormInputItemSelector uiTemplate = new
UIFormInputItemSelector("Template", "template");
uiTemplate.setItemCategories(itemCategories);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageTemplateOptions.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageTemplateOptions.java 2010-02-25
07:39:51 UTC (rev 1858)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageTemplateOptions.java 2010-02-25
08:45:38 UTC (rev 1859)
@@ -54,7 +54,7 @@
return;
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
Param param = initParams.getParam("PageLayout");
- categories_ = param.getFreshObject(context);
+ categories_ = (List<SelectItemCategory>)param.getFreshObject(context);
selectedItemOption_ = getDefaultItemOption();
List<SelectItemOption<String>> itemOptions = new
ArrayList<SelectItemOption<String>>();