JBoss Portal SVN: r12041 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: controller/handler and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-07 06:22:17 -0400 (Tue, 07 Oct 2008)
New Revision: 12041
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java
Log:
JBPORTAL-2178: NPE when requesting dashboard as unauthenticated user
Don't NPE but returns a 500 error
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-10-07 09:06:48 UTC (rev 12040)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-10-07 10:22:17 UTC (rev 12041)
@@ -175,7 +175,7 @@
log.error("An error occured", cause);
}
- return HTTPResponse.sendError();
+ return HTTPResponse.sendError(errorResponse.getMessage());
}
else if (controllerResponse instanceof UnavailableResourceResponse)
{
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-10-07 09:06:48 UTC (rev 12040)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-10-07 10:22:17 UTC (rev 12041)
@@ -124,27 +124,49 @@
public static HTTPResponse sendForbidden()
{
- return sendStatus(HttpServletResponse.SC_FORBIDDEN);
+ return sendStatus(HttpServletResponse.SC_FORBIDDEN, null);
}
public static HTTPResponse sendNotFound()
{
- return sendStatus(HttpServletResponse.SC_NOT_FOUND);
+ return sendStatus(HttpServletResponse.SC_NOT_FOUND, null);
}
public static HTTPResponse sendError()
{
- return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
}
- private static HTTPResponse sendStatus(final int statusCode)
+ public static HTTPResponse sendForbidden(String message)
{
+ return sendStatus(HttpServletResponse.SC_FORBIDDEN, message);
+ }
+
+ public static HTTPResponse sendNotFound(String message)
+ {
+ return sendStatus(HttpServletResponse.SC_NOT_FOUND, message);
+ }
+
+ public static HTTPResponse sendError(String message)
+ {
+ return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+ }
+
+ private static HTTPResponse sendStatus(final int statusCode, final String message)
+ {
return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException
{
HttpServletResponse resp = ctx.getClientResponse();
- resp.sendError(statusCode);
+ if (message == null)
+ {
+ resp.sendError(statusCode);
+ }
+ else
+ {
+ resp.sendError(statusCode, message);
+ }
}
};
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java 2008-10-07 09:06:48 UTC (rev 12040)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java 2008-10-07 10:22:17 UTC (rev 12041)
@@ -26,6 +26,8 @@
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.command.response.ErrorResponse;
+import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectId;
@@ -58,9 +60,22 @@
if (isDashboard())
{
User user = context.getUser();
+
+ if (user == null)
+ {
+ return new ErrorResponse("No authenticated user", false);
+ }
+
Portal portal = context.getController().getCustomizationManager().getDashboard(user);
- Page page = portal.getDefaultPage();
- return new UpdatePageResponse(page.getId());
+ if (portal != null)
+ {
+ Page page = portal.getDefaultPage();
+ return new UpdatePageResponse(page.getId());
+ }
+ else
+ {
+ return new UnavailableResourceResponse("Dashboard for user:" + user.getUserName() + " can't be found" , false);
+ }
}
else
{
17 years, 7 months
JBoss Portal SVN: r12040 - branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-07 05:06:48 -0400 (Tue, 07 Oct 2008)
New Revision: 12040
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
Log:
JBPORTAL-2192: Invalid regions after changing layout in Configure Dashboard
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2008-10-07 09:03:22 UTC (rev 12039)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2008-10-07 09:06:48 UTC (rev 12040)
@@ -188,9 +188,10 @@
userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, "".equals(selectedPageTheme) ? null : selectedPageTheme);
}
- public void updateLayout()
+ public String updateLayout()
{
userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "".equals(selectedPageLayout) ? null : selectedPageLayout);
+ return "dashboard";
}
public void destroyPage()
17 years, 7 months
JBoss Portal SVN: r12039 - branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-07 05:03:22 -0400 (Tue, 07 Oct 2008)
New Revision: 12039
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
Log:
JBPORTAL-2192: Invalid regions after changing layout in Configure Dashboard
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2008-10-06 14:20:04 UTC (rev 12038)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/dashboard/DashboardBean.java 2008-10-07 09:03:22 UTC (rev 12039)
@@ -188,9 +188,10 @@
userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_THEME, "".equals(selectedPageTheme) ? null : selectedPageTheme);
}
- public void updateLayout()
+ public String updateLayout()
{
userPortal.setDeclaredProperty(ThemeConstants.PORTAL_PROP_LAYOUT, "".equals(selectedPageLayout) ? null : selectedPageLayout);
+ return "dashboard";
}
public void destroyPage()
17 years, 7 months
JBoss Portal SVN: r12038 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/impl/coordination and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-06 10:20:04 -0400 (Mon, 06 Oct 2008)
New Revision: 12038
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
Log:
- JBPORTAL-2147: first step.
+ Removed ParameterBindingInfo parent
+ Renamed WindowBindingInfo to ParameterBindingInfo
+ Renamed methods and variables accordingly
+ Improved getEventWindows implementation a little (needs test case, btw)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -22,6 +22,8 @@
package org.jboss.portal.core.controller.coordination;
+import org.jboss.portal.core.model.portal.Page;
+
import javax.xml.namespace.QName;
import java.util.Set;
@@ -30,7 +32,11 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version : 0.1 $
*/
-public interface AliasBindingInfo extends ParameterBindingInfo
+public interface AliasBindingInfo
{
Set<QName> getNames();
+
+ String getName();
+
+ Page getPage();
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/CoordinationConfigurator.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -154,7 +154,7 @@
* @param mappings
* @throws IllegalCoordinationException
*/
- void setWindowBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException;
+ void setParameterBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException;
/**
* Removes given parameter binding
@@ -162,22 +162,22 @@
* @param parameterBinding
* @throws IllegalCoordinationException
*/
- void removeWindowBinding(WindowBindingInfo parameterBinding) throws IllegalCoordinationException;
+ void removeParameterBinding(ParameterBindingInfo parameterBinding) throws IllegalCoordinationException;
/**
* @param page
* @param name
*/
- void removeWindowBinding(Page page, String name);
+ void removeParameterBinding(Page page, String name);
/**
* Renames the specified window binding to the new name
*
- * @param windowBinding the window binding to be renamed
- * @param newName the binding new name
+ * @param parameterBinding the window binding to be renamed
+ * @param newName the binding new name
* @throws IllegalCoordinationException
*/
- void renameWindowBinding(WindowBindingInfo windowBinding, String newName) throws IllegalCoordinationException;
+ void renameParameterBinding(ParameterBindingInfo parameterBinding, String newName) throws IllegalCoordinationException;
/**
* @param page
@@ -185,19 +185,19 @@
* @param newName
* @throws IllegalCoordinationException
*/
- void renameWindowBinding(Page page, String bindingName, String newName) throws IllegalCoordinationException;
+ void renameParameterBinding(Page page, String bindingName, String newName) throws IllegalCoordinationException;
/**
* @param page
* @return window bindings define in the scope of a given page
*/
- Collection<? extends WindowBindingInfo> getWindowBindings(Page page);
+ Collection<? extends ParameterBindingInfo> getParameterBindings(Page page);
/**
* @param window
* @return window bindings where given window is involved
*/
- Collection<? extends WindowBindingInfo> getWindowBindings(Window window);
+ Collection<? extends ParameterBindingInfo> getParameterBindings(Window window);
/**
* @param page
@@ -205,7 +205,7 @@
* @return
* @throws IllegalCoordinationException
*/
- WindowBindingInfo getWindowBinding(Page page, String name) throws IllegalCoordinationException;
+ ParameterBindingInfo getParameterBinding(Page page, String name) throws IllegalCoordinationException;
/**
* Set parameter binding implicit mode for a given page container. This will be inherited recursively by all children
@@ -294,5 +294,5 @@
* @param parameterQName
* @return window bindings for a given parameter qname
*/
- Collection<? extends WindowBindingInfo> getWindowBindings(Page page, QName parameterQName);
+ Collection<? extends ParameterBindingInfo> getParameterBindings(Page page, QName parameterQName);
}
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -1,37 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, 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.core.controller.coordination;
-
-import org.jboss.portal.core.model.portal.Page;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version : 0.1 $
- */
-public interface ParameterBindingInfo
-{
- String getName();
-
- Page getPage();
-}
Copied: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java (from rev 12035, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.core.controller.coordination;
+
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version : 0.1 $
+ */
+public interface ParameterBindingInfo
+{
+ Map<Window, Set<QName>> getMappings();
+
+ String getName();
+
+ Page getPage();
+}
Property changes on: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/ParameterBindingInfo.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/WindowBindingInfo.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -1,39 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, 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.core.controller.coordination;
-
-import org.jboss.portal.core.model.portal.Window;
-
-import javax.xml.namespace.QName;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version : 0.1 $
- */
-public interface WindowBindingInfo extends ParameterBindingInfo
-{
- Map<Window, Set<QName>> getMappings();
-}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -29,7 +29,7 @@
import org.jboss.portal.core.controller.coordination.EventConverter;
import org.jboss.portal.core.controller.coordination.EventWiringInfo;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
-import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
+import org.jboss.portal.core.controller.coordination.ParameterBindingInfo;
import org.jboss.portal.core.controller.coordination.Utils;
import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.core.model.portal.Page;
@@ -107,19 +107,12 @@
// Only explicit wirings
Map<Window, PortletWindowEvent> windows;
- if (!implicitMode)
- {
- windows = getEventWindowsExplicit(page, event, context);
- }
+ windows = getEventWindowsExplicit(page, event, context);
+
// If no explicit wirings for this event fallback to implicit
- else
+ if (implicitMode && windows.size() == 0)
{
- windows = getEventWindowsExplicit(page, event, context);
-
- if (windows.size() == 0)
- {
- windows = getEventWindowsImplicit(page, event, context);
- }
+ windows = getEventWindowsImplicit(page, event, context);
}
return windows;
@@ -129,7 +122,7 @@
{
Set<String> names = new HashSet<String>();
- for (WindowBindingInfo info : getWindowBindings(window))
+ for (ParameterBindingInfo info : getParameterBindings(window))
{
for (Map.Entry<Window, Set<QName>> entry : info.getMappings().entrySet())
{
@@ -514,7 +507,7 @@
// Binding stuff *****************************************************************************************
- public void setWindowBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException
+ public void setParameterBinding(String name, Map<Window, Set<QName>> mappings) throws IllegalCoordinationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(mappings, "windows");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "window binding");
@@ -547,14 +540,14 @@
}
}
- public void removeWindowBinding(WindowBindingInfo info) throws IllegalCoordinationException
+ public void removeParameterBinding(ParameterBindingInfo info) throws IllegalCoordinationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(info, "WindowBindingInfo");
- removeWindowBinding(info.getPage(), info.getName());
+ removeParameterBinding(info.getPage(), info.getName());
}
- public void removeWindowBinding(Page page, String name)
+ public void removeParameterBinding(Page page, String name)
{
ParameterValidation.throwIllegalArgExceptionIfNull(name, "window binding name");
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
@@ -566,20 +559,20 @@
}
}
- public void renameWindowBinding(WindowBindingInfo windowBinding, String newName) throws IllegalCoordinationException
+ public void renameParameterBinding(ParameterBindingInfo parameterBinding, String newName) throws IllegalCoordinationException
{
- removeWindowBinding(windowBinding);
- setWindowBinding(newName, windowBinding.getMappings());
+ removeParameterBinding(parameterBinding);
+ setParameterBinding(newName, parameterBinding.getMappings());
}
- public void renameWindowBinding(Page page, String bindingName, String newName) throws IllegalCoordinationException
+ public void renameParameterBinding(Page page, String bindingName, String newName) throws IllegalCoordinationException
{
- WindowBindingInfo info = getWindowBinding(page, bindingName);
- removeWindowBinding(page, bindingName);
- setWindowBinding(newName, info.getMappings());
+ ParameterBindingInfo info = getParameterBinding(page, bindingName);
+ removeParameterBinding(page, bindingName);
+ setParameterBinding(newName, info.getMappings());
}
- public WindowBindingInfo getWindowBinding(Page page, String name) throws IllegalCoordinationException
+ public ParameterBindingInfo getParameterBinding(Page page, String name) throws IllegalCoordinationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
ParameterValidation.throwIllegalArgExceptionIfNull(name, "window binding name");
@@ -605,7 +598,7 @@
}
else
{
- return new WindowInfoPOJO(name, page, mappings);
+ return new ParameterInfoPOJO(name, page, mappings);
}
}
@@ -755,14 +748,14 @@
return names;
}
- public Collection<? extends WindowBindingInfo> getWindowBindings(Page page, QName parameterName)
+ public Collection<? extends ParameterBindingInfo> getParameterBindings(Page page, QName parameterName)
{
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
ParameterValidation.throwIllegalArgExceptionIfNull(parameterName, "parameter QName");
- Collection<? extends WindowBindingInfo> pageParams = getWindowBindings(page);
- Collection<WindowBindingInfo> infos = new HashSet<WindowBindingInfo>();
- for (WindowBindingInfo pageParam : pageParams)
+ Collection<? extends ParameterBindingInfo> pageParams = getParameterBindings(page);
+ Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+ for (ParameterBindingInfo pageParam : pageParams)
{
if (pageParam.getMappings().containsValue(parameterName))
{
@@ -772,11 +765,11 @@
return infos;
}
- public Collection<WindowBindingInfo> getWindowBindings(Window window)
+ public Collection<ParameterBindingInfo> getParameterBindings(Window window)
{
- Collection<? extends WindowBindingInfo> pageParams = getWindowBindings(window.getPage());
- Collection<WindowBindingInfo> infos = new HashSet<WindowBindingInfo>();
- for (WindowBindingInfo pageParam : pageParams)
+ Collection<? extends ParameterBindingInfo> pageParams = getParameterBindings(window.getPage());
+ Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+ for (ParameterBindingInfo pageParam : pageParams)
{
if (pageParam.getMappings().keySet().contains(window))
{
@@ -786,14 +779,14 @@
return infos;
}
- public Collection<? extends WindowBindingInfo> getWindowBindings(Page page)
+ public Collection<? extends ParameterBindingInfo> getParameterBindings(Page page)
{
ParameterValidation.throwIllegalArgExceptionIfNull(page, "Page");
// Examine window properties and create page parameters
Collection<PortalObject> children = page.getChildren(PortalObject.WINDOW_MASK);
- Map<String, WindowInfoPOJO> params = new HashMap<String, WindowInfoPOJO>();
+ Map<String, ParameterInfoPOJO> params = new HashMap<String, ParameterInfoPOJO>();
for (PortalObject child : children)
{
Set<String> propNames = child.getProperties().keySet();
@@ -803,10 +796,10 @@
if (propName.startsWith(PREFIX_PARAMETER_BINDING))
{
String pn = propName.substring(PREFIX_PARAMETER_BINDING_LENGTH);
- WindowInfoPOJO info;
+ ParameterInfoPOJO info;
if (!params.keySet().contains(pn))
{
- info = new WindowInfoPOJO(pn, page);
+ info = new ParameterInfoPOJO(pn, page);
params.put(pn, info);
}
else
@@ -971,20 +964,20 @@
}
}
- private class WindowInfoPOJO implements WindowBindingInfo
+ private class ParameterInfoPOJO implements ParameterBindingInfo
{
private final String name;
private Map<Window, Set<QName>> mappings;
private final Page page;
- private WindowInfoPOJO(String name, Page page, Map<Window, Set<QName>> mappings)
+ private ParameterInfoPOJO(String name, Page page, Map<Window, Set<QName>> mappings)
{
this.name = name;
this.mappings = mappings;
this.page = page;
}
- private WindowInfoPOJO(String name, Page page)
+ private ParameterInfoPOJO(String name, Page page)
{
this(name, page, new HashMap<Window, Set<QName>>());
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationMetaData.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -22,21 +22,21 @@
package org.jboss.portal.core.model.portal.metadata.coordination;
+import org.jboss.portal.common.xml.XMLTools;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
-import org.jboss.portal.core.model.portal.metadata.BuildContext;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PageContainer;
import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PageContainer;
-import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Window;
-import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.core.model.portal.metadata.BuildContext;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
import java.util.Map;
-import java.util.HashMap;
import java.util.Set;
/**
@@ -50,7 +50,7 @@
private String implicitModeParameter;
- List<CoordinationWindowBindingMetaData> windowBindings = new LinkedList<CoordinationWindowBindingMetaData>();
+ List<CoordinationParameterBindingMetaData> parameterBindings = new LinkedList<CoordinationParameterBindingMetaData>();
List<CoordinationAliasBindingMetaData> aliasBindings = new LinkedList<CoordinationAliasBindingMetaData>();
@@ -100,7 +100,7 @@
while (paramBindingsIter.hasNext())
{
Element bindingElement = (Element)paramBindingsIter.next();
- coordinationMetaData.addWindowBinding(CoordinationWindowBindingMetaData.buildMetaData(bindingElement));
+ coordinationMetaData.addParameterBinding(CoordinationParameterBindingMetaData.buildMetaData(bindingElement));
}
// Alias bindings
@@ -149,11 +149,11 @@
{
Page page = (Page)object;
- for (CoordinationWindowBindingMetaData windowBinding : windowBindings)
+ for (CoordinationParameterBindingMetaData parameterBinding : parameterBindings)
{
Map<Window, Set<QName>> bindings = new HashMap<Window, Set<QName>>();
- for (CoordinationWindowMultiQNameMetaData windowMD : windowBinding.getWindows())
+ for (CoordinationWindowMultiQNameMetaData windowMD : parameterBinding.getWindows())
{
String windowName = windowMD.getWindowName();
Window window = page.getWindow(windowName);
@@ -167,7 +167,7 @@
bindings.put(window, windowMD.getNames());
}
- buildContext.getCoordinationConfigurator().setWindowBinding(windowBinding.getName(), bindings);
+ buildContext.getCoordinationConfigurator().setParameterBinding(parameterBinding.getName(), bindings);
}
for (CoordinationAliasBindingMetaData windowBinding : aliasBindings)
@@ -244,19 +244,19 @@
this.wirings.add(wiring);
}
- public List<CoordinationWindowBindingMetaData> getWindowBindings()
+ public List<CoordinationParameterBindingMetaData> getParameterBindings()
{
- return windowBindings;
+ return parameterBindings;
}
- public void setWindowBindings(List<CoordinationWindowBindingMetaData> windowBindings)
+ public void setParameterBindings(List<CoordinationParameterBindingMetaData> parameterBindings)
{
- this.windowBindings = windowBindings;
+ this.parameterBindings = parameterBindings;
}
- public void addWindowBinding(CoordinationWindowBindingMetaData binding)
+ public void addParameterBinding(CoordinationParameterBindingMetaData binding)
{
- this.windowBindings.add(binding);
+ this.parameterBindings.add(binding);
}
public List<CoordinationAliasBindingMetaData> getAliasBindings()
Copied: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java (from rev 12035, branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationParameterBindingMetaData.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -0,0 +1,83 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.core.model.portal.metadata.coordination;
+
+import org.jboss.portal.common.xml.XMLTools;
+import org.w3c.dom.Element;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CoordinationParameterBindingMetaData
+{
+ private String name;
+
+ List<CoordinationWindowMultiQNameMetaData> windows = new LinkedList<CoordinationWindowMultiQNameMetaData>();
+
+ public CoordinationParameterBindingMetaData(String name)
+ {
+ this.name = name;
+ }
+
+ public List<CoordinationWindowMultiQNameMetaData> getWindows()
+ {
+ return windows;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ private void addWindow(CoordinationWindowMultiQNameMetaData window)
+ {
+ windows.add(window);
+ }
+
+ public static CoordinationParameterBindingMetaData buildMetaData(Element bindingElement)
+ {
+ Element nameElt = XMLTools.getUniqueChild(bindingElement, "id", true);
+ CoordinationParameterBindingMetaData paramMetaData = new CoordinationParameterBindingMetaData(XMLTools.asString(nameElt));
+
+ Iterator windowIter = XMLTools.getChildrenIterator(bindingElement, "window-coordination");
+
+ while (windowIter.hasNext())
+ {
+ Element element = (Element)windowIter.next();
+
+ paramMetaData.addWindow(CoordinationWindowMultiQNameMetaData.buildMetaData(element));
+ }
+
+ return paramMetaData;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -32,7 +32,7 @@
import org.jboss.portal.core.controller.coordination.AliasBindingInfo;
import org.jboss.portal.core.controller.coordination.EventWiringInfo;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
-import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
+import org.jboss.portal.core.controller.coordination.ParameterBindingInfo;
import org.jboss.portal.core.impl.coordination.CoordinationService;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.portal.Context;
@@ -45,11 +45,11 @@
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.Collections;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -261,7 +261,7 @@
TransactionAssert.commitTransaction();
}
- public void testWindowBinding() throws Exception
+ public void testParameterBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -277,9 +277,9 @@
ws.put(w2, Collections.singleton(new QName("juju", "foo1")));
ws.put(w4, Collections.singleton(new QName("juju", "foo3")));
- cos.setWindowBinding("binding1", ws);
+ cos.setParameterBinding("binding1", ws);
- Collection<? extends WindowBindingInfo> bindings = cos.getWindowBindings(page1);
+ Collection<? extends ParameterBindingInfo> bindings = cos.getParameterBindings(page1);
assertEquals(1, bindings.size());
@@ -291,9 +291,9 @@
assertTrue(mappings.containsKey(w2));
assertTrue(mappings.containsKey(w4));
- cos.removeWindowBinding(bindings.iterator().next());
+ cos.removeParameterBinding(bindings.iterator().next());
- bindings = cos.getWindowBindings(w1);
+ bindings = cos.getParameterBindings(w1);
assertEquals(0, bindings.size());
@@ -301,7 +301,7 @@
TransactionAssert.commitTransaction();
}
- public void testGetWindowBinding() throws Exception
+ public void testGetParameterBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -317,14 +317,14 @@
QName qName12 = new QName("ns1", "2");
ws.put(w1, Collections.singleton(qName11));
ws.put(w2, Collections.singleton(qName12));
- cos.setWindowBinding("binding1", ws);
+ cos.setParameterBinding("binding1", ws);
QName qName21 = new QName("ns2", "foo3");
ws.clear();
ws.put(w4, Collections.singleton(qName21));
- cos.setWindowBinding("binding2", ws);
+ cos.setParameterBinding("binding2", ws);
- WindowBindingInfo info = cos.getWindowBinding(page1, "binding1");
+ ParameterBindingInfo info = cos.getParameterBinding(page1, "binding1");
assertNotNull(info);
assertEquals("binding1", info.getName());
assertEquals(page1, info.getPage());
@@ -336,7 +336,7 @@
assertEquals(Collections.singleton(qName11), windows.get(w1));
assertEquals(Collections.singleton(qName12), windows.get(w2));
- info = cos.getWindowBinding(page1, "binding2");
+ info = cos.getParameterBinding(page1, "binding2");
assertNotNull(info);
assertEquals("binding2", info.getName());
assertEquals(page1, info.getPage());
@@ -349,7 +349,7 @@
TransactionAssert.commitTransaction();
}
- public void testRemoveWindowBinding() throws Exception
+ public void testRemoveParameterBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -364,23 +364,23 @@
QName qName12 = new QName("ns1", "2");
ws.put(w1, Collections.singleton(qName11));
ws.put(w2, Collections.singleton(qName12));
- cos.setWindowBinding("binding1", ws);
+ cos.setParameterBinding("binding1", ws);
QName qName21 = new QName("ns2", "foo3");
ws.clear();
ws.put(w4, Collections.singleton(qName21));
- cos.setWindowBinding("binding2", ws);
+ cos.setParameterBinding("binding2", ws);
- Collection<? extends WindowBindingInfo> infos = cos.getWindowBindings(page1);
+ Collection<? extends ParameterBindingInfo> infos = cos.getParameterBindings(page1);
assertNotNull(infos);
assertEquals(2, infos.size());
- cos.removeWindowBinding(page1, "binding2");
- infos = cos.getWindowBindings(page1);
+ cos.removeParameterBinding(page1, "binding2");
+ infos = cos.getParameterBindings(page1);
assertNotNull(infos);
assertEquals(1, infos.size());
- assertNotNull(cos.getWindowBinding(page1, "binding1"));
- assertNull(cos.getWindowBinding(page1, "binding2"));
+ assertNotNull(cos.getParameterBinding(page1, "binding1"));
+ assertNull(cos.getParameterBinding(page1, "binding2"));
TransactionAssert.commitTransaction();
}
@@ -724,7 +724,7 @@
TransactionAssert.commitTransaction();
}
- public void testRenameWindowBinding() throws Exception
+ public void testRenameParameterBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -737,24 +737,24 @@
ws.put(w1, Collections.singleton(new QName("juju", "foo")));
ws.put(w2, Collections.singleton(new QName("juju", "foo1")));
- cos.setWindowBinding("binding1", ws);
+ cos.setParameterBinding("binding1", ws);
- Collection<? extends WindowBindingInfo> bindings = cos.getWindowBindings(page1);
+ Collection<? extends ParameterBindingInfo> bindings = cos.getParameterBindings(page1);
assertEquals(1, bindings.size());
- WindowBindingInfo info = bindings.iterator().next();
+ ParameterBindingInfo info = bindings.iterator().next();
assertEquals("binding1", info.getName());
- cos.renameWindowBinding(info, "new");
+ cos.renameParameterBinding(info, "new");
- bindings = cos.getWindowBindings(w1);
+ bindings = cos.getParameterBindings(w1);
assertEquals(1, bindings.size());
info = bindings.iterator().next();
assertEquals("new", info.getName());
- cos.renameWindowBinding(page1, "new", "newer");
+ cos.renameParameterBinding(page1, "new", "newer");
- info = cos.getWindowBinding(page1, "newer");
+ info = cos.getParameterBinding(page1, "newer");
assertNotNull(info);
TransactionAssert.commitTransaction();
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java 2008-10-06 12:08:57 UTC (rev 12037)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java 2008-10-06 14:20:04 UTC (rev 12038)
@@ -23,8 +23,8 @@
package org.jboss.portal.core.admin.ui.coordination;
import org.jboss.portal.core.controller.coordination.IllegalCoordinationException;
+import org.jboss.portal.core.controller.coordination.ParameterBindingInfo;
import org.jboss.portal.core.controller.coordination.Utils;
-import org.jboss.portal.core.controller.coordination.WindowBindingInfo;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.Window;
@@ -137,11 +137,11 @@
public void loadInfoFrom(Page page)
{
- Collection<? extends WindowBindingInfo> windowBindingInfos = managerBean.getCoordinationService().getWindowBindings(page);
+ Collection<? extends ParameterBindingInfo> windowBindingInfos = managerBean.getCoordinationService().getParameterBindings(page);
if (windowBindingInfos != null && !windowBindingInfos.isEmpty())
{
displayParameterBindings = new HashMap<String, DisplayParameterBinding>(windowBindingInfos.size());
- for (WindowBindingInfo wbInfo : windowBindingInfos)
+ for (ParameterBindingInfo wbInfo : windowBindingInfos)
{
displayParameterBindings.put(wbInfo.getName(), new DisplayParameterBinding(wbInfo));
}
@@ -166,7 +166,7 @@
Utils.addToMultiMap(windowBinding, window, QName.valueOf(names[ParameterWindowPair.PARAM_NAME]));
}
- managerBean.getCoordinationService().setWindowBinding(windowBindingName, windowBinding);
+ managerBean.getCoordinationService().setParameterBinding(windowBindingName, windowBinding);
}
return resetSelection();
@@ -182,13 +182,13 @@
public String delete(String name) throws IllegalCoordinationException
{
- managerBean.getCoordinationService().removeWindowBinding(managerBean.getSelectedPage(), name);
+ managerBean.getCoordinationService().removeParameterBinding(managerBean.getSelectedPage(), name);
return resetSelection();
}
public String rename(String name, String newName) throws IllegalCoordinationException
{
- managerBean.getCoordinationService().renameWindowBinding(managerBean.getSelectedPage(), name, newName);
+ managerBean.getCoordinationService().renameParameterBinding(managerBean.getSelectedPage(), name, newName);
return resetSelection();
}
@@ -208,9 +208,9 @@
public static class DisplayParameterBinding implements Comparable
{
private List<ParameterWindowPair> parameterWindowPairs;
- private WindowBindingInfo bindingInfo;
+ private ParameterBindingInfo bindingInfo;
- public DisplayParameterBinding(WindowBindingInfo bindingInfo)
+ public DisplayParameterBinding(ParameterBindingInfo bindingInfo)
{
this.bindingInfo = bindingInfo;
Set<Map.Entry<Window, Set<QName>>> entries = bindingInfo.getMappings().entrySet();
@@ -230,7 +230,7 @@
return bindingInfo.getName();
}
- public WindowBindingInfo getBindingInfo()
+ public ParameterBindingInfo getBindingInfo()
{
return bindingInfo;
}
17 years, 7 months
JBoss Portal SVN: r12037 - in branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF: jsp/users and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-06 08:08:57 -0400 (Mon, 06 Oct 2008)
New Revision: 12037
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_de.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_it.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_ru.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/noUser.jsp
Log:
minor
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-06 12:08:57 UTC (rev 12037)
@@ -23,7 +23,7 @@
javax.portlet.title=Current users
javax.portlet.keywords=sample,test
-NO_USERS_ONLINE=No online user
+NO_USER_ONLINE=No online user
ONE_USER_ONLINE=You are the only user online
USERS_ONLINE_0=There are <b>
USERS_ONLINE_1=</b> users online
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_de.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_de.properties 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_de.properties 2008-10-06 12:08:57 UTC (rev 12037)
@@ -23,17 +23,13 @@
javax.portlet.title=Momentan angemeldete Benutzer
javax.portlet.keywords=beispiel,test
-NO_USERS_ONLINE=Keine Benutzer online
-ONE_USER_ONLINE_0=Es ist <b>
-ONE_USER_ONLINE_1=</b> Benutzer online
-ONE_USER_LOGGED_1=</b> Benutzer angemeldet
-ONE_USER_IS_0=<b>
-ONE_USER_IS_1=</b>
+NO_USER_ONLINE=Keine Benutzer online
+ONE_USER_ONLINE=Sie sind der einizge Benutzer online
USERS_ONLINE_0=Es sind <b>
USERS_ONLINE_1=</b> Benutzer online
-USERS_LOGGED_1=</b> Benutzer angemeldet
USERS_ARE_0=<b>
USERS_ARE_1=</b>
USERS_WHICH_0=von denen <b>
USERS_WHICH_1=</b> angemeldet sind:
USERS_WHICH_2=</b> angemeldet ist:
+
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-06 12:08:57 UTC (rev 12037)
@@ -22,18 +22,12 @@
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
-NO_USERS_ONLINE = Pas d'utilisateur en ligne.
+NO_USER_ONLINE = Pas d'utilisateur en ligne.
ONE_USER_ONLINE=Vous \u00EAtes le seul utilisateur
USERS_ONLINE_0=Il y a <b>
-USERS_ONLINE_1=</b> utilisateurs online
-
+USERS_ONLINE_1=</b> utilisateurs en ligne
USERS_ARE_0 = <b>
-
USERS_ARE_1 = </b>
-
-USERS_ONLINE_0 = Il y a <b>
-
-USERS_ONLINE_1 = </b> utilisateurs en ligne:
USERS_WHICH_0=Parmi eux: <b>
USERS_WHICH_1=</b> sont connect\u00E9s:
USERS_WHICH_2=</b> est connect\u00E9:
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_it.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_it.properties 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_it.properties 2008-10-06 12:08:57 UTC (rev 12037)
@@ -21,15 +21,10 @@
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
-NO_USERS_ONLINE=Nessun utente \u00e8 online
-ONE_USER_ONLINE_0=Al momento c'\u00e8 <b>
-ONE_USER_ONLINE_1=</b> utente online
-ONE_USER_LOGGED_1=</b> utente loggato
-ONE_USER_IS_0=<b>
-ONE_USER_IS_1=</b>
+NO_USER_ONLINE=Nessun utente \u00e8 online
+#ONE_USER_ONLINE=You are the only user online
USERS_ONLINE_0=Al momento ci sono <b>
USERS_ONLINE_1=</b> utenti online
-USERS_LOGGED_1=</b> utenti loggati
USERS_ARE_0=<b>
USERS_ARE_1=</b>
USERS_WHICH_0=Di cui <b>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_ru.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_ru.properties 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_ru.properties 2008-10-06 12:08:57 UTC (rev 12037)
@@ -21,12 +21,13 @@
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
-NO_USERS_ONLINE=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435\u0442
-ONE_USER_ONLINE_0=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d <b>
-ONE_USER_ONLINE_1=</b> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:
-ONE_USER_IS_0=<b>
-ONE_USER_IS_1=</b>
+NO_USER_ONLINE=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435\u0442
+#ONE_USER_ONLINE=You are the only user online
USERS_ONLINE_0=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043e <b>
USERS_ONLINE_1=</b> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f(\u0439):
USERS_ARE_0=<b>
USERS_ARE_1=</b>
+#USERS_WHICH_0=Among them: <b>
+#USERS_WHICH_1=</b> are logged-in:
+#USERS_WHICH_2=</b> is logged-in:
+
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/noUser.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/noUser.jsp 2008-10-06 11:59:02 UTC (rev 12036)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/noUser.jsp 2008-10-06 12:08:57 UTC (rev 12037)
@@ -32,7 +32,7 @@
<tr>
<td colspan="1">
<span class="portlet-text">
- ${n:i18n("NO_USERS_ONLINE")}
+ ${n:i18n("NO_USER_ONLINE")}
</span>
</td>
</tr>
17 years, 7 months
JBoss Portal SVN: r12036 - in branches/JBoss_Portal_Branch_2_7: core-samples/src/main/org/jboss/portal/core/samples/users and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-06 07:59:02 -0400 (Mon, 06 Oct 2008)
New Revision: 12036
Removed:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
Log:
JBPORTAL-2171: CurrentUsersPortletWindow spelling errors
(Simplified the portlet)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/identity/UsersActivityStatsServiceImpl.java 2008-10-06 11:59:02 UTC (rev 12036)
@@ -135,7 +135,7 @@
for (Iterator iterator = activityResults.iterator(); iterator.hasNext();)
{
UserActivity ua = (UserActivity) iterator.next();
- if (currentTime - ua.getTimestamp() < period && ua.getId().equals(UserActivity.GUEST))
+ if (currentTime - ua.getTimestamp() < period)
{
results++;
}
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/CurrentUsersPortlet.java 2008-10-06 11:59:02 UTC (rev 12036)
@@ -51,6 +51,8 @@
/** Help page */
private static final String JSP_HELP = "/WEB-INF/jsp/users/help.jsp";
+
+ private final long period = 1800000; // Default to 30min
protected void doHelp(JBossRenderRequest request,
JBossRenderResponse response) throws PortletException,
@@ -65,40 +67,25 @@
JBossRenderResponse rResponse) throws PortletException,
IOException, UnavailableException {
- String guestNumber = rRequest.getPreferences().getValue("guestNumber","");
-
UsersActivityStatsService uass = (UsersActivityStatsService) this
.getPortletContext().getAttribute("UsersActivityStats");
rResponse.setContentType("text/html");
PrintWriter writer = rResponse.getWriter();
- long currentTime = System.currentTimeMillis();
+ // Non guest users
+ Set users = uass.getActiveUsersNames(period);
- // TODO: this is wrong - should pass period instead of current time -
- // actually it works by a coincedence...
- Set users = uass.getActiveUsersNames(currentTime);
+ // Number of active sessions, users and anonymous
+ int sessionCount = uass.getActiveSessionCount(period);
- int sessionCount = uass.getActiveSessionCount(currentTime);
-
- int allLoggedSessions = uass.getUsersActivities(currentTime).size();
-
- if (sessionCount == 1 || (guestNumber.equals("false") && users.size() == 1)) {
+ if (sessionCount > 0) {
DelegateContext ctx = new DelegateContext();
ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(sessionCount));
- ctx.put("USERS_LOGGED_COUNT", Integer.toString(users.size()));
+ ctx.put("USERS_COUNT", sessionCount);
+ ctx.put("USERS_LOGGED_COUNT", users.size());
rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
PortletRequestDispatcher rd = getPortletContext()
- .getRequestDispatcher("/WEB-INF/jsp/users/oneUser.jsp");
- rd.include(rRequest, rResponse);
- } else if (sessionCount > 1) {
- DelegateContext ctx = new DelegateContext();
- ctx.put("USERS", users.toString());
- ctx.put("USERS_COUNT", Integer.toString(sessionCount));
- ctx.put("USERS_LOGGED_COUNT", Integer.toString(users.size()));
- rRequest.setAttribute(PortalJsp.CTX_REQUEST, ctx);
- PortletRequestDispatcher rd = getPortletContext()
.getRequestDispatcher("/WEB-INF/jsp/users/users.jsp");
rd.include(rRequest, rResponse);
} else {
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource.properties 2008-10-06 11:59:02 UTC (rev 12036)
@@ -24,16 +24,11 @@
javax.portlet.keywords=sample,test
NO_USERS_ONLINE=No online user
-ONE_USER_ONLINE_0=There is <b>
-ONE_USER_ONLINE_1=</b> online user
-ONE_USER_LOGGED_1=</b> logged user
-ONE_USER_IS_0=<b>
-ONE_USER_IS_1=</b>
+ONE_USER_ONLINE=You are the only user online
USERS_ONLINE_0=There are <b>
-USERS_ONLINE_1=</b> online users
-USERS_LOGGED_1=</b> logged users
+USERS_ONLINE_1=</b> users online
USERS_ARE_0=<b>
USERS_ARE_1=</b>
-USERS_WHICH_0=Whose <b>
+USERS_WHICH_0=Among them: <b>
USERS_WHICH_1=</b> are logged-in:
USERS_WHICH_2=</b> is logged-in:
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/classes/Resource_fr.properties 2008-10-06 11:59:02 UTC (rev 12036)
@@ -22,16 +22,11 @@
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
-NO_USERS_ONLINE = Pas d'utilisateurs en ligne.
+NO_USERS_ONLINE = Pas d'utilisateur en ligne.
+ONE_USER_ONLINE=Vous \u00EAtes le seul utilisateur
+USERS_ONLINE_0=Il y a <b>
+USERS_ONLINE_1=</b> utilisateurs online
-ONE_USER_IS_0 = <b>
-
-ONE_USER_IS_1 = </b>
-
-ONE_USER_ONLINE_0 = Il y a <b>
-
-ONE_USER_ONLINE_1 = </b> utilisateur en ligne:
-
USERS_ARE_0 = <b>
USERS_ARE_1 = </b>
@@ -39,3 +34,6 @@
USERS_ONLINE_0 = Il y a <b>
USERS_ONLINE_1 = </b> utilisateurs en ligne:
+USERS_WHICH_0=Parmi eux: <b>
+USERS_WHICH_1=</b> sont connect\u00E9s:
+USERS_WHICH_2=</b> est connect\u00E9:
\ No newline at end of file
Deleted: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/oneUser.jsp 2008-10-06 11:59:02 UTC (rev 12036)
@@ -1,67 +0,0 @@
-<%@ page import="org.jboss.portal.core.CoreConstants" %>
-<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-~ JBoss, a division of Red Hat ~
-~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
-<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
-<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<%@ page isELIgnored="false" %>
-<portlet:defineObjects/>
-
-<div class="box">
- <table border="0" class="portlet-font" cellspacing="0" cellpadding="2">
- <tr>
- <td colspan="1">
- <span class="portlet-text">
- <% if (renderRequest.getPreferences().getValue("guestNumber", "").equals("true")) { %>
- ${n:i18n("ONE_USER_ONLINE_0")}
- ${n:out("USERS_COUNT")}
- ${n:i18n("ONE_USER_ONLINE_1")}
- <br/><br/>
- <% }
- java.util.LinkedList linkedStack = (java.util.LinkedList)contextStack.get();
- org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
- ((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
- if (!currentContext.get("USERS_LOGGED_COUNT").equals("0") && renderRequest.getPreferences().getValue("loggedNumber", "").equals("true")) { %>
-
- <% if (renderRequest.getPreferences().getValue("guestNumber", "").equals("true")) { %>
- ${n:i18n("USERS_WHICH_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("USERS_WHICH_2")}
- <% } else { %>
- ${n:i18n("ONE_USER_ONLINE_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("ONE_USER_LOGGED_1")}
- <% } %>
- <br/><br/>
- <% }
- if (!currentContext.get("USERS").equals("[]") && renderRequest.getPreferences().getValue("loggedUsers", "").equals("true")) { %>
-
- ${n:i18n("ONE_USER_IS_0")}
- ${n:out("USERS")}
- ${n:i18n("ONE_USER_IS_1")}
- <% } %>
- </span>
- </td>
- </tr>
- </table>
-</div>
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp 2008-10-04 19:39:20 UTC (rev 12035)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-war/WEB-INF/jsp/users/users.jsp 2008-10-06 11:59:02 UTC (rev 12036)
@@ -32,18 +32,32 @@
<tr>
<td colspan="1">
<span class="portlet-text">
- <% if (renderRequest.getPreferences().getValue("guestNumber", "").equals("true")) { %>
+ <%
+ java.util.LinkedList linkedStack = (java.util.LinkedList)contextStack.get();
+ org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
+ ((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
+
+ if (renderRequest.getPreferences().getValue("guestNumber", "").equals("true")) {
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) > 1)
+ {
+ %>
${n:i18n("USERS_ONLINE_0")}
${n:out("USERS_COUNT")}
${n:i18n("USERS_ONLINE_1")}
+ <%
+ }
+ else
+ {
+ %>
+ ${n:i18n("ONE_USER_ONLINE")}
+ <%
+ }
+ %>
<br/><br/>
- <% }
- java.util.LinkedList linkedStack = (java.util.LinkedList)contextStack.get();
- org.jboss.portal.core.servlet.jsp.taglib.context.Context currentContext =
- ((org.jboss.portal.core.servlet.jsp.taglib.context.NamedContext)linkedStack.getLast()).getContext();
- if (!currentContext.get("USERS_LOGGED_COUNT").equals("0") && renderRequest.getPreferences().getValue("loggedNumber", "").equals("true")) { %>
+ <%
+ }
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) > 1 && !currentContext.get("USERS_LOGGED_COUNT").equals("0") && renderRequest.getPreferences().getValue("loggedNumber", "").equals("true")) { %>
- <% if (renderRequest.getPreferences().getValue("guestNumber", "").equals("true")) { %>
${n:i18n("USERS_WHICH_0")}
${n:out("USERS_LOGGED_COUNT")}
<% if (!currentContext.get("USERS_LOGGED_COUNT").equals("1")) { %>
@@ -51,14 +65,9 @@
<% } else { %>
${n:i18n("USERS_WHICH_2")}
<% } %>
- <% } else { %>
- ${n:i18n("USERS_ONLINE_0")}
- ${n:out("USERS_LOGGED_COUNT")}
- ${n:i18n("USERS_LOGGED_1")}
- <% } %>
<br/><br/>
<% }
- if (!currentContext.get("USERS").equals("[]") && renderRequest.getPreferences().getValue("loggedUsers", "").equals("true")) { %>
+ if (Integer.parseInt(currentContext.get("USERS_COUNT")) > 1 && !currentContext.get("USERS").equals("[]") && renderRequest.getPreferences().getValue("loggedUsers", "").equals("true")) { %>
${n:i18n("USERS_ARE_0")}
${n:out("USERS")}
17 years, 7 months
JBoss Portal SVN: r12035 - in branches/JBoss_Portal_Branch_2_7/core-samples/src: resources/portal-basic-samples-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-10-04 15:39:20 -0400 (Sat, 04 Oct 2008)
New Revision: 12035
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
serveResource demo cleanup
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java 2008-10-03 22:27:18 UTC (rev 12034)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java 2008-10-04 19:39:20 UTC (rev 12035)
@@ -53,7 +53,7 @@
{
String repeatText = req.getParameter("repeat");
- // set zip as render parameter
+ // set the text from form input
if (repeatText != null){
resp.setRenderParameter("repeat", repeatText);
}
@@ -65,24 +65,11 @@
{
ResourceURL resourceURL = resp.createResourceURL();
PortletURL actionURL = resp.createActionURL();
- //
-// Element elt = resp.createElement("script");
-// elt.setAttribute("type", "text/javascript");
-// elt.setAttribute("src", resourceURL.toString());
-// elt.appendChild(elt.getOwnerDocument().createTextNode(""));
-// resp.addProperty("script", elt);
- //
-
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
writer.print("" +
"<script type=\"text/javascript\">" +
- "" +
- // "function init(){\n" +
- //" Event.observe('repeat', 'keyup', repeat(), false);\n" +
- // "}" +
- "" +
"function browse(id) {" +
"var url = id;\n" +
"var pars = 'foo=bar';\n" +
@@ -105,9 +92,7 @@
"</div>" +
"");
writer.print("<div id=\"repeat-container\"><div id=\"repeat-div\" class='half-width float-left' style='height:50px'></div></div>");
-// "<input type=\"text\" id=\"hidden-input\" value=\"" + resourceURL.toString() + "\" />" +
-// "<a href='javascript:" + resp.getNamespace() + "_handle()'>Click me to trigger script</a>" +
- writer.print("<br class='clear'/><br class='clear'/><hr/>" +
+ writer.print("<br class='clear'/><br class='clear'/><hr/>" +
"<h4>Partial Refresh Product Catalog</h4>" +
"<div class='full-width'>" +
"");
@@ -129,10 +114,6 @@
writer.print("<br class='clear'/></div>");
writer.print("<br class='clear'/></div>");
writer.print("<br class='clear'/></div>");
-
-
-
- // writer.print("</div>");
}
public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException, IOException
@@ -141,7 +122,7 @@
String prodId = req.getParameter("prodId");
String namespace =resp.getNamespace();
- //resp.setContentType("application/json");
+
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
if (repeatText != null){
@@ -173,9 +154,6 @@
}
-
-
-
writer.close();
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-10-03 22:27:18 UTC (rev 12034)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-10-04 19:39:20 UTC (rev 12035)
@@ -320,7 +320,7 @@
</window>
</page>
<page>
- <page-name>286 serveResource Demo</page-name>
+ <page-name>serveResource Demo</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
@@ -668,7 +668,7 @@
</window>
</page>
<page>
- <page-name>286 serveResource Demo</page-name>
+ <page-name>serveResource Demo</page-name>
<window>
<window-name>CatalogPortletWindow</window-name>
<instance-ref>CatalogPortletInstance</instance-ref>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-10-03 22:27:18 UTC (rev 12034)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-10-04 19:39:20 UTC (rev 12035)
@@ -268,16 +268,16 @@
</portlet-info>
</portlet>
<portlet>
- <description>286 serveResource Demo Portlet</description>
+ <description>serveResource Demo Portlet</description>
<portlet-name>RepeatRefreshPortlet</portlet-name>
- <display-name>286 serveResource Demo Portlet</display-name>
+ <display-name>serveResource Demo Portlet</display-name>
<portlet-class>org.jboss.portal.core.samples.basic.RepeatRefreshPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
- <title>286 serveResource Demo Portlet</title>
+ <title>serveResource Demo Portlet</title>
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
17 years, 7 months
JBoss Portal SVN: r12034 - in modules/authorization/trunk: security-console/ear and 2 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-03 18:27:18 -0400 (Fri, 03 Oct 2008)
New Revision: 12034
Modified:
modules/authorization/trunk/PEP/
modules/authorization/trunk/security-console/ear/
modules/authorization/trunk/security-console/ejb/
modules/authorization/trunk/security-console/war/
Log:
cleanup
Property changes on: modules/authorization/trunk/PEP
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: modules/authorization/trunk/security-console/ear
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: modules/authorization/trunk/security-console/ejb
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: modules/authorization/trunk/security-console/war
___________________________________________________________________
Name: svn:ignore
+ target
17 years, 7 months
JBoss Portal SVN: r12033 - in modules: authorization and 33 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-03 18:21:02 -0400 (Fri, 03 Oct 2008)
New Revision: 12033
Added:
modules/authorization/
modules/authorization/trunk/
modules/authorization/trunk/.classpath
modules/authorization/trunk/.project
modules/authorization/trunk/PEP/
modules/authorization/trunk/PEP/pom.xml
modules/authorization/trunk/PEP/src/
modules/authorization/trunk/PEP/src/main/
modules/authorization/trunk/PEP/src/main/java/
modules/authorization/trunk/PEP/src/main/resources/
modules/authorization/trunk/PEP/src/test/
modules/authorization/trunk/PEP/src/test/java/
modules/authorization/trunk/PEP/src/test/java/org/
modules/authorization/trunk/PEP/src/test/java/org/jboss/
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/NoPermitMeansDeniedAlg.java
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/RuleCombiningAlgImplies.java
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPDP.java
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPolicyBuilder.java
modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestRequestContext.java
modules/authorization/trunk/PEP/src/test/resources/
modules/authorization/trunk/PEP/src/test/resources/log4j.properties
modules/authorization/trunk/build/
modules/authorization/trunk/build/misc/
modules/authorization/trunk/build/misc/codeguide.html
modules/authorization/trunk/classes/
modules/authorization/trunk/pom.xml
modules/authorization/trunk/security-console/
modules/authorization/trunk/security-console/ear/
modules/authorization/trunk/security-console/ear/pom.xml
modules/authorization/trunk/security-console/ejb/
modules/authorization/trunk/security-console/ejb/pom.xml
modules/authorization/trunk/security-console/ejb/src/
modules/authorization/trunk/security-console/ejb/src/main/
modules/authorization/trunk/security-console/ejb/src/main/java/
modules/authorization/trunk/security-console/ejb/src/main/java/org/
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/Register.java
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/RegisterAction.java
modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/User.java
modules/authorization/trunk/security-console/ejb/src/main/resources/
modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/
modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/ejb-jar.xml
modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/persistence.xml
modules/authorization/trunk/security-console/ejb/src/main/resources/seam.properties
modules/authorization/trunk/security-console/pom.xml
modules/authorization/trunk/security-console/war/
modules/authorization/trunk/security-console/war/pom.xml
modules/authorization/trunk/security-console/war/src/
modules/authorization/trunk/security-console/war/src/main/
modules/authorization/trunk/security-console/war/src/main/webapp/
modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/
modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/components.xml
modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/faces-config.xml
modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/web.xml
modules/authorization/trunk/security-console/war/src/main/webapp/index.html
modules/authorization/trunk/security-console/war/src/main/webapp/register.xhtml
modules/authorization/trunk/security-console/war/src/main/webapp/registered.xhtml
Log:
backing up some code
Added: modules/authorization/trunk/.classpath
===================================================================
--- modules/authorization/trunk/.classpath (rev 0)
+++ modules/authorization/trunk/.classpath 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="security-console/ejb/src/main/java"/>
+ <classpathentry kind="src" path="PEP/src/main/java"/>
+ <classpathentry kind="src" path="PEP/src/main/resources"/>
+ <classpathentry kind="src" path="PEP/src/test/java"/>
+ <classpathentry kind="src" path="PEP/src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="classes"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm/1.5.3/asm-1.5.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/cglib/cglib/2.1_3/cglib-2.1_3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.6/commons-beanutils-1.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1-jboss/dom4j-1.6.1-jboss.jar"/>
+ <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.4.sp1/hibernate-3.2.4.sp1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-validator/3.0.0.GA/hibernate-validator-3.0.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.3.GA/javassist-3.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/el/jboss-el/2.0.1.GA/jboss-el-2.0.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/seam/jboss-seam/2.0.2.SP1/jboss-seam-2.0.2.SP1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/seam/jboss-seam-ui/2.0.2.SP1/jboss-seam-ui-2.0.2.SP1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/faces/jsf-api/1.2_04-p02/jsf-api-1.2_04-p02.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-impl/2.1.4/jaxb-impl-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-xjc/2.1.4/jaxb-xjc-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-sunxacml/2.0.3-SNAPSHOT/jboss-sunxacml-2.0.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/security/jboss-sunxacml/2.0.3-SNAPSHOT/jboss-sunxacml-2.0.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jboss-xacml/2.0.3-SNAPSHOT/jboss-xacml-2.0.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/security/jboss-xacml/2.0.3-SNAPSHOT/jboss-xacml-2.0.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
+</classpath>
Added: modules/authorization/trunk/.project
===================================================================
--- modules/authorization/trunk/.project (rev 0)
+++ modules/authorization/trunk/.project 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>module-authorization</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: modules/authorization/trunk/PEP/pom.xml
===================================================================
--- modules/authorization/trunk/PEP/pom.xml (rev 0)
+++ modules/authorization/trunk/PEP/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,65 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-parent</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-authz-pep</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Authorization PEP</name>
+ <url>http://www.jboss.org</url>
+ <description>A Generic PEP (Policy Enforcement Point) component</description>
+
+ <dependencies>
+ <!-- jboss xacml -->
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-xacml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-sunxacml</artifactId>
+ </dependency>
+
+ <!-- sun jaxb -->
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </dependency>
+
+ <!-- junit -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <includes>
+ <include>**/TestPDP.java</include>
+ <!--
+ <include>**/TestPolicyBuilder.java</include>
+ -->
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/NoPermitMeansDeniedAlg.java
===================================================================
--- modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/NoPermitMeansDeniedAlg.java (rev 0)
+++ modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/NoPermitMeansDeniedAlg.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.security.authz.test.pep;
+
+import java.util.List;
+import java.util.Iterator;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.security.xacml.sunxacml.combine.RuleCombiningAlgorithm;
+import org.jboss.security.xacml.sunxacml.EvaluationCtx;
+import org.jboss.security.xacml.sunxacml.ctx.Result;
+import org.jboss.security.xacml.sunxacml.Rule;
+import org.jboss.security.xacml.sunxacml.combine.RuleCombinerElement;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class NoPermitMeansDeniedAlg extends RuleCombiningAlgorithm
+{
+ /**
+ *
+ * @throws URISyntaxException
+ */
+ public NoPermitMeansDeniedAlg() throws URISyntaxException
+ {
+ super(new URI("rule-combining-alg:nopermit-means-denied"));
+ }
+
+ /**
+ *
+ * @param context
+ * @param rules
+ * @return
+ */
+ public Result combine(EvaluationCtx context, List parameters, List ruleElements)
+ {
+ Result result = new Result(Result.DECISION_PERMIT);
+
+ Iterator rules = ruleElements.iterator();
+ boolean permitFound = false;
+ while(rules.hasNext())
+ {
+ RuleCombinerElement ruleCombinerElement = (RuleCombinerElement)rules.next();
+ Rule rule = ruleCombinerElement.getRule();
+ Result currentResult = rule.evaluate(context);
+
+ if(currentResult.getDecision() == Result.DECISION_PERMIT)
+ {
+ permitFound = true;
+ break;
+ }
+ }
+
+ if(!permitFound)
+ {
+ result = new Result(Result.DECISION_DENY);
+ }
+
+ return result;
+ }
+}
Added: modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/RuleCombiningAlgImplies.java
===================================================================
--- modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/RuleCombiningAlgImplies.java (rev 0)
+++ modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/RuleCombiningAlgImplies.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.security.authz.test.pep;
+
+import java.util.List;
+import java.util.Iterator;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.security.xacml.sunxacml.combine.RuleCombiningAlgorithm;
+import org.jboss.security.xacml.sunxacml.EvaluationCtx;
+import org.jboss.security.xacml.sunxacml.ctx.Result;
+import org.jboss.security.xacml.sunxacml.Rule;
+import org.jboss.security.xacml.sunxacml.combine.RuleCombinerElement;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class RuleCombiningAlgImplies extends RuleCombiningAlgorithm
+{
+ /**
+ *
+ * @throws URISyntaxException
+ */
+ public RuleCombiningAlgImplies() throws URISyntaxException
+ {
+ super(new URI("rule-combining-alg:cms-implies"));
+ }
+
+ /**
+ *
+ * @param context
+ * @param rules
+ * @return
+ */
+ public Result combine(EvaluationCtx context, List parameters, List ruleElements)
+ {
+ Iterator rules = ruleElements.iterator();
+ while(rules.hasNext())
+ {
+ RuleCombinerElement ruleCombinerElement = (RuleCombinerElement)rules.next();
+ Rule rule = ruleCombinerElement.getRule();
+ }
+
+ // if nothing returned Permit, then the alg returns Deny
+ return new Result(Result.DECISION_DENY);
+ }
+}
Added: modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPDP.java
===================================================================
--- modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPDP.java (rev 0)
+++ modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPDP.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,813 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.security.authz.test.pep;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.net.URI;
+import java.io.File;
+import java.io.FileOutputStream;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.security.xacml.core.model.context.ActionType;
+import org.jboss.security.xacml.core.model.context.AttributeType;
+import org.jboss.security.xacml.core.model.context.AttributeValueType;
+import org.jboss.security.xacml.core.model.context.ObjectFactory;
+import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.core.model.context.ResourceType;
+import org.jboss.security.xacml.core.model.context.SubjectType;
+
+import org.jboss.security.xacml.core.model.policy.ActionMatchType;
+import org.jboss.security.xacml.core.model.policy.ActionsType;
+import org.jboss.security.xacml.core.model.policy.ApplyType;
+import org.jboss.security.xacml.core.model.policy.ConditionType;
+import org.jboss.security.xacml.core.model.policy.EffectType;
+import org.jboss.security.xacml.core.model.policy.ExpressionType;
+import org.jboss.security.xacml.core.model.policy.FunctionType;
+import org.jboss.security.xacml.core.model.policy.PolicyType;
+import org.jboss.security.xacml.core.model.policy.ResourceMatchType;
+import org.jboss.security.xacml.core.model.policy.ResourcesType;
+import org.jboss.security.xacml.core.model.policy.RuleType;
+import org.jboss.security.xacml.core.model.policy.SubjectAttributeDesignatorType;
+import org.jboss.security.xacml.core.model.policy.TargetType;
+
+
+import org.jboss.security.xacml.factories.RequestResponseContextFactory;
+import org.jboss.security.xacml.factories.PolicyAttributeFactory;
+import org.jboss.security.xacml.interfaces.RequestContext;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+import org.jboss.security.xacml.sunxacml.PDP;
+import org.jboss.security.xacml.sunxacml.PDPConfig;
+import org.jboss.security.xacml.sunxacml.finder.AttributeFinder;
+import org.jboss.security.xacml.sunxacml.finder.impl.CurrentEnvModule;
+import org.jboss.security.xacml.sunxacml.finder.impl.SelectorModule;
+import org.jboss.security.xacml.sunxacml.finder.PolicyFinder;
+import org.jboss.security.xacml.sunxacml.support.finder.FilePolicyModule;
+import org.jboss.security.xacml.sunxacml.ctx.RequestCtx;
+import org.jboss.security.xacml.sunxacml.ctx.ResponseCtx;
+import org.jboss.security.xacml.sunxacml.combine.CombiningAlgFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestPDP extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestPDP.class);
+
+ /**
+ *
+ */
+ public void setUp() throws Exception
+ {
+ //Setup custom combining algorithms
+ boolean register = true;
+ String naIsDeniedURI = new NoPermitMeansDeniedAlg().getIdentifier().toString();
+ CombiningAlgFactory factory = CombiningAlgFactory.getInstance();
+ Set supportedAlgorithms = factory.getSupportedAlgorithms();
+ String[] algorithms = (String[])supportedAlgorithms.toArray(new String[supportedAlgorithms.size()]);
+ for(String supportedAlgorithm: algorithms)
+ {
+ if(supportedAlgorithm.equals(naIsDeniedURI))
+ {
+ register = false;
+ }
+ }
+ if(register)
+ {
+ factory.addAlgorithm(new NoPermitMeansDeniedAlg());
+ }
+
+ this.generateSimplePolicy();
+ this.generateMultiTierPolicy();
+ }
+
+ /**
+ *
+ */
+ public void tearDown() throws Exception
+ {
+ this.deleteSimplePolicy();
+ this.deleteMultiTierPolicy();
+ }
+
+
+ public void testSimplePermit() throws Exception
+ {
+ //PDP Setup
+ String[] policyFiles = new String[]{"simple-policy.xml"};
+ PDP pdp = new PDP(new PDPConfig(this.getAttributeFinder(), this.getPolicyFinder(policyFiles), null));
+ assertNotNull(pdp);
+
+ //Request Setup
+ RequestContext requestContext = this.createPermitRequestContext();
+ assertNotNull(requestContext);
+
+ log.info("-----------------------------------");
+ requestContext.marshall(System.out);
+
+ //Process the request
+ ResponseCtx response = pdp.evaluate((RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX));
+ assertNotNull(response);
+
+ log.info("-----------------------------------");
+ response.encode(System.out);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, response);
+ assertNotNull(responseContext);
+ assertEquals(responseContext.getDecision(), XACMLConstants.DECISION_PERMIT);
+
+ log.info("-----------------------------------");
+ log.info("Decision="+responseContext.getDecision());
+ }
+
+
+ public void testSimpleDeny() throws Exception
+ {
+ //PDP Setup
+ String[] policyFiles = new String[]{"simple-policy.xml"};
+ PDP pdp = new PDP(new PDPConfig(this.getAttributeFinder(), this.getPolicyFinder(policyFiles), null));
+ assertNotNull(pdp);
+
+ //Request Setup
+ RequestContext requestContext = this.createDenyRequestContext();
+ assertNotNull(requestContext);
+
+ log.info("-----------------------------------");
+ requestContext.marshall(System.out);
+
+ //Process the request
+ ResponseCtx response = pdp.evaluate((RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX));
+ assertNotNull(response);
+
+ log.info("-----------------------------------");
+ response.encode(System.out);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, response);
+ assertNotNull(responseContext);
+ assertEquals(responseContext.getDecision(), XACMLConstants.DECISION_DENY);
+
+ log.info("-----------------------------------");
+ log.info("Decision="+responseContext.getDecision());
+ }
+
+
+ public void testMultiTierPermit() throws Exception
+ {
+ //PDP Setup
+ String[] policyFiles = new String[]{"multitier-policy.xml"};
+ PDP pdp = new PDP(new PDPConfig(this.getAttributeFinder(), this.getPolicyFinder(policyFiles), null));
+ assertNotNull(pdp);
+
+ //Request Setup
+ RequestContext requestContext = this.createPermitMultiTierRequestContext();
+ assertNotNull(requestContext);
+
+ log.info("-----------------------------------");
+ requestContext.marshall(System.out);
+
+ //Process the request
+ RequestCtx requestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
+ ResponseCtx response = pdp.evaluate(requestCtx);
+ assertNotNull(response);
+
+ log.info("-----------------------------------");
+ response.encode(System.out);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, response);
+ assertNotNull(responseContext);
+ assertEquals(responseContext.getDecision(), XACMLConstants.DECISION_PERMIT);
+
+ log.info("-----------------------------------");
+ log.info("Decision="+responseContext.getDecision());
+ }
+
+ /*public void testRecursivePermit() throws Exception
+ {
+ //PDP Setup
+ String[] policyFiles = new String[]{"/home/soshah/projects/jboss-portal/sandbox/trunk/prototype/resources/policy/recursive-policy.xml"};
+ PDP pdp = new PDP(new PDPConfig(this.getAttributeFinder(), this.getPolicyFinder(policyFiles), null));
+ assertNotNull(pdp);
+
+ //Request Setup
+ RequestContext requestContext = this.createPermitRecursiveRequestContext("/protected/private/index2.html");
+ assertNotNull(requestContext);
+
+ log.info("-----------------------------------");
+ requestContext.marshall(System.out);
+
+ //Process the request
+ RequestCtx requestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
+ ResponseCtx response = pdp.evaluate(requestCtx);
+ assertNotNull(response);
+
+ log.info("-----------------------------------");
+ response.encode(System.out);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, response);
+ assertNotNull(responseContext);
+ assertEquals(responseContext.getDecision(), XACMLConstants.DECISION_PERMIT);
+
+ log.info("-----------------------------------");
+ log.info("Decision="+responseContext.getDecision());
+ }*/
+
+ /*public void testImplies() throws Exception
+ {
+ //PDP Setup
+ String[] policyFiles = new String[]{"/home/soshah/projects/jboss-portal/sandbox/trunk/prototype/src/resources/policy/implies-policy.xml"};
+
+ //Register the custom Rule Combining Algorithm
+ CombiningAlgFactory factory = CombiningAlgFactory.getInstance();
+ factory.addAlgorithm(new RuleCombiningAlgImplies());
+
+ PDP pdp = new PDP(new PDPConfig(this.getAttributeFinder(), this.getPolicyFinder(policyFiles), null));
+ assertNotNull(pdp);
+
+ //Request Setup
+ RequestContext requestContext = this.createImpliesRequestContext();
+ assertNotNull(requestContext);
+
+ log.info("-----------------------------------");
+ requestContext.marshall(System.out);
+
+ //Process the request
+ RequestCtx requestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
+ ResponseCtx response = pdp.evaluate(requestCtx);
+ assertNotNull(response);
+
+ log.info("-----------------------------------");
+ response.encode(System.out);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, response);
+ assertNotNull(responseContext);
+ assertEquals(responseContext.getDecision(), XACMLConstants.DECISION_PERMIT);
+
+ log.info("-----------------------------------");
+ log.info("Decision="+responseContext.getDecision());
+ }*/
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ private AttributeFinder getAttributeFinder()
+ {
+ //Prefill the attribute finder with the Sun's impl of
+ //environment attribute module and the selector attribute module
+ AttributeFinder attributeFinder = new AttributeFinder();
+ List attributeModules = new ArrayList();
+ attributeModules.add(new CurrentEnvModule());
+ attributeModules.add(new SelectorModule());
+ attributeFinder.setModules(attributeModules);
+ return attributeFinder;
+ }
+
+ private PolicyFinder getPolicyFinder(String[] policyFiles) throws Exception
+ {
+ //Create a PolicyFinderModule and initialize it...in this case,
+ // we're using the sample FilePolicyModule that is pre-configured
+ // with a set of policies from the filesystem
+ FilePolicyModule filePolicyModule = new FilePolicyModule();
+ for (int i = 0; i < policyFiles.length; i++)
+ filePolicyModule.addPolicy(policyFiles[i]);
+
+ // next, setup the PolicyFinder that this PDP will use
+ PolicyFinder policyFinder = new PolicyFinder();
+ Set policyModules = new HashSet();
+ policyModules.add(filePolicyModule);
+ policyFinder.setModules(policyModules);
+
+ return policyFinder;
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ private RequestContext createPermitRequestContext() throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("developer");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("http://www.redhat.com/protected/index.html");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("write");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ return requestContext;
+ }
+
+ private RequestContext createDenyRequestContext() throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("anonymous");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("http://www.redhat.com/protected/index.html");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("write");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ return requestContext;
+ }
+
+ private RequestContext createPermitMultiTierRequestContext() throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("developer");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("org.jboss.cms.CMSService");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ AttributeType param0Attribute = objectFactory.createAttributeType();
+ param0Attribute.setAttributeId(XACMLConstants.CUSTOM_ATTR+":param0");
+ param0Attribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType param0Id = objectFactory.createAttributeValueType();
+ param0Id.getContent().add("http://www.redhat.com/protected/index.html");
+ param0Attribute.getAttributeValue().add(param0Id);
+ resource.getAttribute().add(param0Attribute);
+
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("write");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ return requestContext;
+ }
+
+ private RequestContext createPermitRecursiveRequestContext(String path) throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("developer");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("org.jboss.cms.CMSService");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ StringBuffer buffer = new StringBuffer("/");
+ StringTokenizer st = new StringTokenizer(path, "/");
+ while(st.hasMoreTokens())
+ {
+ buffer.append(st.nextToken());
+ AttributeType param1Attribute = objectFactory.createAttributeType();
+ param1Attribute.setAttributeId(XACMLConstants.CUSTOM_ATTR+":param0");
+ param1Attribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType param1Id = objectFactory.createAttributeValueType();
+ param1Id.getContent().add(buffer.toString());
+ param1Attribute.getAttributeValue().add(param1Id);
+ resource.getAttribute().add(param1Attribute);
+
+ if(st.hasMoreTokens())
+ {
+ buffer.append("/");
+ }
+ }
+
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("update");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ return requestContext;
+ }
+
+ private RequestContext createImpliesRequestContext() throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("developer");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("org.jboss.cms.CMSService");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ AttributeType param0Attribute = objectFactory.createAttributeType();
+ param0Attribute.setAttributeId(XACMLConstants.CUSTOM_ATTR+":param0");
+ param0Attribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType param0Id = objectFactory.createAttributeValueType();
+ param0Id.getContent().add("/protected/write.html");
+ param0Attribute.getAttributeValue().add(param0Id);
+ resource.getAttribute().add(param0Attribute);
+
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("read");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ return requestContext;
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------
+ private void generateSimplePolicy() throws Exception
+ {
+ org.jboss.security.xacml.core.model.policy.ObjectFactory objectFactory = new org.jboss.security.xacml.core.model.policy.ObjectFactory();
+
+ PolicyType policyType = new PolicyType();
+ policyType.setPolicyId("SimplePolicy");
+ policyType.setVersion("2.0");
+ policyType.setRuleCombiningAlgId(new NoPermitMeansDeniedAlg().getIdentifier().toString());
+
+ //Create a target
+ TargetType targetType = new TargetType();
+
+ ResourcesType resourcesType = new ResourcesType();
+ org.jboss.security.xacml.core.model.policy.ResourceType resourceType = new org.jboss.security.xacml.core.model.policy.ResourceType();
+ ResourceMatchType rmt = new ResourceMatchType();
+ rmt.setMatchId(XACMLConstants.FUNCTION_ANYURI_EQUAL);
+ rmt.setResourceAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_RESOURCE_ID, XMLSchemaConstants.DATATYPE_ANYURI, null, false));
+ rmt.setAttributeValue(PolicyAttributeFactory
+ .createAnyURIAttributeType(new URI("http://www.redhat.com/protected/index.html")));
+ resourceType.getResourceMatch().add(rmt);
+ resourcesType.getResource().add(resourceType);
+
+ targetType.setResources(resourcesType);
+
+ policyType.setTarget(targetType);
+
+ //Create a Rule
+ RuleType permitRule = new RuleType();
+ permitRule.setRuleId("WriteRule");
+ permitRule.setEffect(EffectType.PERMIT);
+
+ ActionsType permitRuleActionsType = new ActionsType();
+ org.jboss.security.xacml.core.model.policy.ActionType permitRuleActionType = new org.jboss.security.xacml.core.model.policy.ActionType();
+
+ ActionMatchType amct = new ActionMatchType();
+ amct.setMatchId("urn:oasis:names:tc:xacml:1.0:function:string-equal");
+ amct.setAttributeValue(PolicyAttributeFactory.createStringAttributeType("write"));
+ amct.setActionAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ACTION_ID, XMLSchemaConstants.DATATYPE_STRING, null, false));
+ permitRuleActionType.getActionMatch().add(amct);
+ TargetType permitRuleTargetType = new TargetType();
+ permitRuleActionsType.getAction().add(permitRuleActionType);
+ permitRuleTargetType.setActions(permitRuleActionsType);
+ permitRule.setTarget(permitRuleTargetType);
+
+ ConditionType permitRuleConditionType = new ConditionType();
+ FunctionType functionType = new FunctionType();
+ functionType.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
+ JAXBElement<ExpressionType> jaxbElementFunctionType = objectFactory.createExpression(functionType);
+ permitRuleConditionType.setExpression(jaxbElementFunctionType);
+
+ ApplyType permitRuleApplyType = new ApplyType();
+ permitRuleApplyType.setFunctionId(XACMLConstants.FUNCTION_STRING_IS_IN);
+
+ SubjectAttributeDesignatorType sadt = PolicyAttributeFactory.createSubjectAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ROLE, XMLSchemaConstants.DATATYPE_STRING, null, false, null);
+ JAXBElement<SubjectAttributeDesignatorType> sadtElement = objectFactory.createSubjectAttributeDesignator(sadt);
+ org.jboss.security.xacml.core.model.policy.AttributeValueType avt = PolicyAttributeFactory.createStringAttributeType("developer");
+ JAXBElement<org.jboss.security.xacml.core.model.policy.AttributeValueType> jaxbAVT = objectFactory.createAttributeValue(avt);
+ permitRuleApplyType.getExpression().add(jaxbAVT);
+ permitRuleApplyType.getExpression().add(sadtElement);
+
+ permitRuleConditionType.setExpression(objectFactory.createApply(permitRuleApplyType));
+
+ permitRule.setCondition(permitRuleConditionType);
+
+ policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(permitRule);
+
+ //marshal it into xml format
+ FileOutputStream fos = null;
+ try
+ {
+ fos = new FileOutputStream(new File("simple-policy.xml"));
+ policyType.marshall(fos);
+ log.info("-------------------------------------------------------------------");
+ policyType.marshall(System.out);
+ log.info("-------------------------------------------------------------------");
+ }
+ finally
+ {
+ if(fos != null)
+ {
+ fos.close();
+ }
+ }
+ }
+
+ private void deleteSimplePolicy() throws Exception
+ {
+ File file = new File("simple-policy.xml");
+ file.delete();
+ }
+
+ private void generateMultiTierPolicy() throws Exception
+ {
+ org.jboss.security.xacml.core.model.policy.ObjectFactory objectFactory = new org.jboss.security.xacml.core.model.policy.ObjectFactory();
+
+ PolicyType policyType = new PolicyType();
+ policyType.setPolicyId("MultiTierPolicy");
+ policyType.setVersion("2.0");
+ policyType.setRuleCombiningAlgId(new NoPermitMeansDeniedAlg().getIdentifier().toString());
+
+ //Create a target
+ TargetType targetType = new TargetType();
+
+ //Add a Web Tier resource
+ ResourcesType resourcesType = new ResourcesType();
+ org.jboss.security.xacml.core.model.policy.ResourceType resourceType = new org.jboss.security.xacml.core.model.policy.ResourceType();
+ ResourceMatchType rmt = new ResourceMatchType();
+ rmt.setMatchId(XACMLConstants.FUNCTION_ANYURI_EQUAL);
+ rmt.setResourceAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_RESOURCE_ID, XMLSchemaConstants.DATATYPE_ANYURI, null, false));
+ rmt.setAttributeValue(PolicyAttributeFactory
+ .createAnyURIAttributeType(new URI("http://www.redhat.com/protected/index.html")));
+ resourceType.getResourceMatch().add(rmt);
+ resourcesType.getResource().add(resourceType);
+
+ //Add a POJO tier resource
+ resourceType = new org.jboss.security.xacml.core.model.policy.ResourceType();
+ rmt = new ResourceMatchType();
+ rmt.setMatchId(XACMLConstants.FUNCTION_ANYURI_EQUAL);
+ rmt.setResourceAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_RESOURCE_ID, XMLSchemaConstants.DATATYPE_ANYURI, null, false));
+ rmt.setAttributeValue(PolicyAttributeFactory
+ .createAnyURIAttributeType(new URI("org.jboss.cms.CMSService")));
+ resourceType.getResourceMatch().add(rmt);
+
+ rmt = new ResourceMatchType();
+ rmt.setMatchId(XACMLConstants.FUNCTION_ANYURI_EQUAL);
+ rmt.setResourceAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.CUSTOM_ATTR+":param0", XMLSchemaConstants.DATATYPE_ANYURI, null, false));
+ rmt.setAttributeValue(PolicyAttributeFactory
+ .createAnyURIAttributeType(new URI("http://www.redhat.com/protected/index.html")));
+ resourceType.getResourceMatch().add(rmt);
+
+ resourcesType.getResource().add(resourceType);
+
+
+ targetType.setResources(resourcesType);
+
+ policyType.setTarget(targetType);
+
+ //Create a Rule
+ RuleType permitRule = new RuleType();
+ permitRule.setRuleId("WriteRule");
+ permitRule.setEffect(EffectType.PERMIT);
+
+ ActionsType permitRuleActionsType = new ActionsType();
+ org.jboss.security.xacml.core.model.policy.ActionType permitRuleActionType = new org.jboss.security.xacml.core.model.policy.ActionType();
+
+ ActionMatchType amct = new ActionMatchType();
+ amct.setMatchId("urn:oasis:names:tc:xacml:1.0:function:string-equal");
+ amct.setAttributeValue(PolicyAttributeFactory.createStringAttributeType("write"));
+ amct.setActionAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ACTION_ID, XMLSchemaConstants.DATATYPE_STRING, null, false));
+ permitRuleActionType.getActionMatch().add(amct);
+ TargetType permitRuleTargetType = new TargetType();
+ permitRuleActionsType.getAction().add(permitRuleActionType);
+ permitRuleTargetType.setActions(permitRuleActionsType);
+ permitRule.setTarget(permitRuleTargetType);
+
+ ConditionType permitRuleConditionType = new ConditionType();
+ FunctionType functionType = new FunctionType();
+ functionType.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
+ JAXBElement<ExpressionType> jaxbElementFunctionType = objectFactory.createExpression(functionType);
+ permitRuleConditionType.setExpression(jaxbElementFunctionType);
+
+ ApplyType permitRuleApplyType = new ApplyType();
+ permitRuleApplyType.setFunctionId(XACMLConstants.FUNCTION_STRING_IS_IN);
+
+ SubjectAttributeDesignatorType sadt = PolicyAttributeFactory.createSubjectAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ROLE, XMLSchemaConstants.DATATYPE_STRING, null, false, null);
+ JAXBElement<SubjectAttributeDesignatorType> sadtElement = objectFactory.createSubjectAttributeDesignator(sadt);
+ org.jboss.security.xacml.core.model.policy.AttributeValueType avt = PolicyAttributeFactory.createStringAttributeType("developer");
+ JAXBElement<org.jboss.security.xacml.core.model.policy.AttributeValueType> jaxbAVT = objectFactory.createAttributeValue(avt);
+ permitRuleApplyType.getExpression().add(jaxbAVT);
+ permitRuleApplyType.getExpression().add(sadtElement);
+
+ permitRuleConditionType.setExpression(objectFactory.createApply(permitRuleApplyType));
+
+ permitRule.setCondition(permitRuleConditionType);
+
+ policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(permitRule);
+
+ //marshal it into xml format
+ FileOutputStream fos = null;
+ try
+ {
+ fos = new FileOutputStream(new File("multitier-policy.xml"));
+ policyType.marshall(fos);
+ log.info("-------------------------------------------------------------------");
+ policyType.marshall(System.out);
+ log.info("-------------------------------------------------------------------");
+ }
+ finally
+ {
+ if(fos != null)
+ {
+ fos.close();
+ }
+ }
+ }
+
+ private void deleteMultiTierPolicy() throws Exception
+ {
+ File file = new File("multitier-policy.xml");
+ file.delete();
+ }
+}
Added: modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPolicyBuilder.java
===================================================================
--- modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPolicyBuilder.java (rev 0)
+++ modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestPolicyBuilder.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,139 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.security.authz.test.pep;
+
+import java.net.URI;
+
+import javax.xml.bind.JAXBElement;
+
+import org.jboss.security.xacml.core.model.policy.ActionMatchType;
+import org.jboss.security.xacml.core.model.policy.ActionType;
+import org.jboss.security.xacml.core.model.policy.ActionsType;
+import org.jboss.security.xacml.core.model.policy.ApplyType;
+import org.jboss.security.xacml.core.model.policy.AttributeValueType;
+import org.jboss.security.xacml.core.model.policy.ConditionType;
+import org.jboss.security.xacml.core.model.policy.EffectType;
+import org.jboss.security.xacml.core.model.policy.ExpressionType;
+import org.jboss.security.xacml.core.model.policy.FunctionType;
+import org.jboss.security.xacml.core.model.policy.ObjectFactory;
+import org.jboss.security.xacml.core.model.policy.PolicyType;
+import org.jboss.security.xacml.core.model.policy.ResourceMatchType;
+import org.jboss.security.xacml.core.model.policy.ResourceType;
+import org.jboss.security.xacml.core.model.policy.ResourcesType;
+import org.jboss.security.xacml.core.model.policy.RuleType;
+import org.jboss.security.xacml.core.model.policy.SubjectAttributeDesignatorType;
+import org.jboss.security.xacml.core.model.policy.TargetType;
+import org.jboss.security.xacml.factories.PolicyAttributeFactory;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestPolicyBuilder extends TestCase
+{
+ /**
+ *
+ * @throws Exception
+ */
+ public void testSimplePolicyBuilder() throws Exception
+ {
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ PolicyType policyType = new PolicyType();
+ policyType.setPolicyId("ExamplePolicy");
+ policyType.setVersion("2.0");
+ policyType.setRuleCombiningAlgId(XACMLConstants.RULE_COMBINING_PERMIT_OVERRIDES);
+
+ //Create a target
+ TargetType targetType = new TargetType();
+
+ ResourcesType resourcesType = new ResourcesType();
+ ResourceType resourceType = new ResourceType();
+ ResourceMatchType rmt = new ResourceMatchType();
+ rmt.setMatchId(XACMLConstants.FUNCTION_ANYURI_EQUAL);
+ rmt.setResourceAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_RESOURCE_ID, XMLSchemaConstants.DATATYPE_ANYURI, null, false));
+ rmt.setAttributeValue(PolicyAttributeFactory
+ .createAnyURIAttributeType(new URI("http://www.redhat.com/protected/index.html")));
+ resourceType.getResourceMatch().add(rmt);
+ resourcesType.getResource().add(resourceType);
+
+ targetType.setResources(resourcesType);
+
+ policyType.setTarget(targetType);
+
+ //Create a Rule
+ RuleType permitRule = new RuleType();
+ permitRule.setRuleId("WriteRule");
+ permitRule.setEffect(EffectType.PERMIT);
+
+ ActionsType permitRuleActionsType = new ActionsType();
+ ActionType permitRuleActionType = new ActionType();
+
+ ActionMatchType amct = new ActionMatchType();
+ amct.setMatchId("urn:oasis:names:tc:xacml:1.0:function:string-equal");
+ amct.setAttributeValue(PolicyAttributeFactory.createStringAttributeType("write"));
+ amct.setActionAttributeDesignator(PolicyAttributeFactory.createAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ACTION_ID, XMLSchemaConstants.DATATYPE_STRING, null, false));
+ permitRuleActionType.getActionMatch().add(amct);
+ TargetType permitRuleTargetType = new TargetType();
+ permitRuleActionsType.getAction().add(permitRuleActionType);
+ permitRuleTargetType.setActions(permitRuleActionsType);
+ permitRule.setTarget(permitRuleTargetType);
+
+ ConditionType permitRuleConditionType = new ConditionType();
+ FunctionType functionType = new FunctionType();
+ functionType.setFunctionId(XACMLConstants.FUNCTION_STRING_EQUAL);
+ JAXBElement<ExpressionType> jaxbElementFunctionType = objectFactory.createExpression(functionType);
+ permitRuleConditionType.setExpression(jaxbElementFunctionType);
+
+ ApplyType permitRuleApplyType = new ApplyType();
+ permitRuleApplyType.setFunctionId(XACMLConstants.FUNCTION_STRING_IS_IN);
+
+ SubjectAttributeDesignatorType sadt = PolicyAttributeFactory.createSubjectAttributeDesignatorType(
+ XACMLConstants.ATTRIBUTEID_ROLE, XMLSchemaConstants.DATATYPE_STRING, null, false, null);
+ JAXBElement<SubjectAttributeDesignatorType> sadtElement = objectFactory.createSubjectAttributeDesignator(sadt);
+ AttributeValueType avt = PolicyAttributeFactory.createStringAttributeType("developer");
+ JAXBElement<AttributeValueType> jaxbAVT = objectFactory.createAttributeValue(avt);
+ permitRuleApplyType.getExpression().add(jaxbAVT);
+ permitRuleApplyType.getExpression().add(sadtElement);
+
+ permitRuleConditionType.setExpression(objectFactory.createApply(permitRuleApplyType));
+
+ permitRule.setCondition(permitRuleConditionType);
+
+ policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(permitRule);
+ //Create a Deny Rule
+ RuleType denyRule = new RuleType();
+ denyRule.setRuleId("DenyRule");
+ denyRule.setEffect(EffectType.DENY);
+ policyType.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(denyRule);
+
+ //marshal it into xml format
+ policyType.marshall(System.out);
+ }
+}
Added: modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestRequestContext.java
===================================================================
--- modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestRequestContext.java (rev 0)
+++ modules/authorization/trunk/PEP/src/test/java/org/jboss/security/authz/test/pep/TestRequestContext.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,100 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.security.authz.test.pep;
+
+import org.jboss.security.xacml.factories.RequestResponseContextFactory;
+import org.jboss.security.xacml.interfaces.XACMLConstants;
+import org.jboss.security.xacml.interfaces.XMLSchemaConstants;
+import org.jboss.security.xacml.interfaces.RequestContext;
+
+import org.jboss.security.xacml.core.model.context.ObjectFactory;
+import org.jboss.security.xacml.core.model.context.AttributeType;
+import org.jboss.security.xacml.core.model.context.AttributeValueType;
+import org.jboss.security.xacml.core.model.context.SubjectType;
+import org.jboss.security.xacml.core.model.context.RequestType;
+import org.jboss.security.xacml.core.model.context.ResourceType;
+import org.jboss.security.xacml.core.model.context.ActionType;
+
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestRequestContext extends TestCase
+{
+ /**
+ *
+ * @throws Exception
+ */
+ public void testRequestGeneration() throws Exception
+ {
+ //Create ObjectFactory
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ //Create Subjects
+ SubjectType subject = objectFactory.createSubjectType();
+ AttributeType subjectAttribute = objectFactory.createAttributeType();
+ subjectAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ROLE);
+ subjectAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType subjectId = objectFactory.createAttributeValueType();
+ subjectId.getContent().add("developer");
+ subjectAttribute.getAttributeValue().add(subjectId);
+ subject.getAttribute().add(subjectAttribute);
+
+ //Create Resource
+ ResourceType resource = objectFactory.createResourceType();
+ AttributeType resourceAttribute = objectFactory.createAttributeType();
+ resourceAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_RESOURCE_ID);
+ resourceAttribute.setDataType(XMLSchemaConstants.DATATYPE_ANYURI);
+ AttributeValueType resourceId = objectFactory.createAttributeValueType();
+ resourceId.getContent().add("http://www.redhat.com/protected/index.html");
+ resourceAttribute.getAttributeValue().add(resourceId);
+ resource.getAttribute().add(resourceAttribute);
+
+ //Create Action
+ ActionType action = objectFactory.createActionType();
+ AttributeType actionAttribute = objectFactory.createAttributeType();
+ actionAttribute.setAttributeId(XACMLConstants.ATTRIBUTEID_ACTION_ID);
+ actionAttribute.setDataType(XMLSchemaConstants.DATATYPE_STRING);
+ AttributeValueType actionId = objectFactory.createAttributeValueType();
+ actionId.getContent().add("write");
+ actionAttribute.getAttributeValue().add(actionId);
+ action.getAttribute().add(actionAttribute);
+
+ //Create RequestContext
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+
+ //Create a RequestType
+ RequestType requestType = objectFactory.createRequestType();
+ requestType.getSubject().add(subject);
+ requestType.setAction(action);
+ requestType.getResource().add(resource);
+
+ //Spit out RequestContext
+ requestContext.setRequest(requestType);
+
+ requestContext.marshall(System.out);
+ }
+}
Added: modules/authorization/trunk/PEP/src/test/resources/log4j.properties
===================================================================
--- modules/authorization/trunk/PEP/src/test/resources/log4j.properties (rev 0)
+++ modules/authorization/trunk/PEP/src/test/resources/log4j.properties 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,8 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=INFO, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
Added: modules/authorization/trunk/build/misc/codeguide.html
===================================================================
--- modules/authorization/trunk/build/misc/codeguide.html (rev 0)
+++ modules/authorization/trunk/build/misc/codeguide.html 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,133 @@
+<html>
+
+<head>
+<style type="text/css">
+pre { border-style:solid; border-width:thin; padding:5px; background-color:#EEEEFF;}
+span.bad { text-decoration:line-through; }
+span.important { font-weight:bold; color:red; }
+</style>
+</head>
+
+<body>
+
+<h2>Coding Conventions</h2>
+
+<h3>Some more general guidelines</h3>
+<ul>
+<li>Fully qualified imports should be used, rather than importing x.y.*.</li>
+<li>Use newlines for opening braces, so that the top and bottom braces can be visually matched.</li>
+<li>Aid visual separation of logical steps by introducing newlines and appropriate comments above them.</li>
+</ul>
+
+
+<h3>A class that conforms to JBoss coding guidelines</h3>
+
+<pre>
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, 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 x;
+
+// <span class="important">Explicit imports</span>
+import a.b.C1; // <span class="important">good</span>
+import a.b.C2;
+import a.b.C3;
+
+// <span class="important">Do not write</span>
+<span class="bad">import a.b.*;</span> // <span class="important">bad</span>
+
+// <span class="important">DO NOT USE "TAB" TO INDENT CODE USE *3* SPACES FOR PORTABILITY AMONG EDITORS</span>
+
+/**
+ * A description of this class.
+ *
+ * @see SomeRelatedClass.
+ *
+ * @version <tt>$Revision: 7755 $</tt>
+ * @author <a href="mailto:{email}">{full name}</a>
+ */
+public class X
+ extends Y
+ implements Z
+{
+ public void startService() throws Exception
+ {
+ // Use the newline for the opening bracket so we can match top
+ // and bottom bracket visually
+
+ Class cls = Class.forName(dataSourceClass);
+ vendorSource = (XADataSource)cls.newInstance();
+
+ // Jump a line between logically distinct <span class="important">steps</span> and add<
+ // line of comment to it
+ cls = vendorSource.getClass();
+
+ // Comment lines <span class="important">always</span> start with an uppercase
+ // except if it is the second line
+ if(properties != null)
+ {
+
+ try
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ for (Iterator i = props.entrySet().iterator(); i.hasNext();)
+ {
+
+ // Get the name and value for the attributes
+ Map.Entry entry = (Map.Entry) i.next();
+ String attributeName = (String) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+
+ // Print the debug message
+ log.debug("Setting attribute '" + attributeName + "' to '" + attributeValue + "'");
+
+ // get the attribute
+ Method setAttribute =
+ cls.getMethod("set" + attributeName, new Class[] { String.class });
+
+ // And set the value
+ setAttribute.invoke(vendorSource, new Object[] { attributeValue });
+ }
+ }
+
+ <span class="bad">// this is a <span class="important">bad</span> comment line because it starts with a lower case</span>
+ vendorSource.getXAConnection().close();
+
+ // Bind in JNDI
+ bind(new InitialContext(), "java:/"+getPoolName(),
+ new Reference(vendorSource.getClass().getName(),
+ getClass().getName(), null));
+
+ // Block must always be delimited explicitely
+ if (0 == 0)
+ <span class="important">{</span>
+ System.out.println(true);
+ <span class="important">}</span>
+
+ }
+}
+</pre>
+</body>
+</html>
Property changes on: modules/authorization/trunk/build/misc/codeguide.html
___________________________________________________________________
Name: svn:executable
+
Added: modules/authorization/trunk/pom.xml
===================================================================
--- modules/authorization/trunk/pom.xml (rev 0)
+++ modules/authorization/trunk/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,255 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-parent</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Authorization</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Authorization</description>
+
+ <modules>
+ <module>security-console</module>
+ <module>PEP</module>
+ </modules>
+
+ <properties>
+ <version.jboss.seam>2.0.2.SP1</version.jboss.seam>
+ <version.facelets>1.1.14</version.facelets>
+ <version.ajax4jsf>1.1.1</version.ajax4jsf>
+ <version.richfaces>3.0.1</version.richfaces>
+ <version.hibernate>3.0.0.GA</version.hibernate>
+ <version.javax.persistence>1.0</version.javax.persistence>
+ <version.javax.ejb>3.0</version.javax.ejb>
+ <version.javax.faces>1.2_04-p02</version.javax.faces>
+ <version.commons-beanutils>1.6</version.commons-beanutils>
+ <version.commons-digester>1.6</version.commons-digester>
+ <version.junit>3.8.2</version.junit>
+ <version.sun.jaxb>2.1.4</version.sun.jaxb>
+ <version.jboss.xacml>2.0.3-SNAPSHOT</version.jboss.xacml>
+ <version.apache.log4j>1.2.14</version.apache.log4j>
+
+ <!-- local environment properties -->
+ <jboss.home>/home/soshah/appServers/jboss-4.2.2.GA</jboss.home>
+ <server.name>security</server.name>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- seam dependencies -->
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${version.jboss.seam}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ <version>${version.jboss.seam}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>${version.facelets}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>${version.commons-beanutils}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${version.commons-digester}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- richfaces dependencies -->
+ <dependency>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>ajax4jsf</artifactId>
+ <version>${version.ajax4jsf}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces</artifactId>
+ <version>${version.richfaces}</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <!-- dependencies provided by the runtime -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${version.hibernate}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>${version.javax.persistence}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>${version.javax.ejb}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${version.javax.faces}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- sun jaxb -->
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>${version.sun.jaxb}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>${version.sun.jaxb}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>${version.sun.jaxb}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- jboss xacml -->
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-xacml</artifactId>
+ <version>${version.jboss.xacml}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jboss-sunxacml</artifactId>
+ <version>${version.jboss.xacml}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- junit -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${version.apache.log4j}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- project wide dependencies -->
+ <dependencies>
+ <!-- logging -->
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net maven repository</id>
+ <url>http://download.java.net/maven/2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <distributionManagement>
+ <repository>
+ <!--Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
+ <id>repository.jboss.org</id>
+ <url>file://${jboss.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
Added: modules/authorization/trunk/security-console/ear/pom.xml
===================================================================
--- modules/authorization/trunk/security-console/ear/pom.xml (rev 0)
+++ modules/authorization/trunk/security-console/ear/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,197 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-aggregator</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>security-console</artifactId>
+ <packaging>ear</packaging>
+ <name>JBoss Security Console</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Security Console</description>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <version>5</version>
+ <modules>
+ <webModule>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-war</artifactId>
+ <contextRoot>/security-console</contextRoot>
+ </webModule>
+ <jarModule>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>ajax4jsf</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces</artifactId>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ </modules>
+ <jboss>
+ <version>4.2</version>
+ <loader-repository>
+ security-console.jboss.org:loader=security-console
+ </loader-repository>
+ </jboss>
+ </configuration>
+ </plugin>
+
+ <!-- Deploying the Security Console into the local Application Server -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <configuration>
+ <tasks>
+ <echo message="Deploying to the local JBoss Application Server........."/>
+ <copy file="target/security-console-${project.version}.ear"
+ tofile="${jboss.home}/server/${server.name}/deploy/security-console.ear" overwrite="true"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </dependency>
+
+ <!-- richfaces dependencies -->
+ <dependency>
+ <groupId>org.ajax4jsf</groupId>
+ <artifactId>ajax4jsf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- ejb module -->
+ <dependency>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-ejb</artifactId>
+ <type>ejb</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- web module -->
+ <dependency>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-war</artifactId>
+ <type>war</type>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
Added: modules/authorization/trunk/security-console/ejb/pom.xml
===================================================================
--- modules/authorization/trunk/security-console/ejb/pom.xml (rev 0)
+++ modules/authorization/trunk/security-console/ejb/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-aggregator</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>security-console-ejb</artifactId>
+ <packaging>ejb</packaging>
+ <name>JBoss Security Console EJB Module</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Security Console EJB Module</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam-ui</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/Register.java
===================================================================
--- modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/Register.java (rev 0)
+++ modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/Register.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,10 @@
+//$Id: Register.java 2056 2006-09-28 00:36:56Z gavin $
+package org.jboss.seam.example.registration;
+
+import javax.ejb.Local;
+
+@Local
+public interface Register
+{
+ public String register();
+}
\ No newline at end of file
Added: modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/RegisterAction.java
===================================================================
--- modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/RegisterAction.java (rev 0)
+++ modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/RegisterAction.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,48 @@
+//$Id: RegisterAction.java 5298 2007-06-20 00:08:47Z gavin $
+package org.jboss.seam.example.registration;
+
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.log.Log;
+
+@Stateless
+@Name("register")
+public class RegisterAction implements Register
+{
+
+ @In
+ private User user;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ @Logger
+ private static Log log;
+
+ public String register()
+ {
+ List existing = em.createQuery("select u.username from User u where u.username=#{user.username}")
+ .getResultList();
+
+ if ( existing.size()==0 )
+ {
+ em.persist(user);
+ log.info("Registered new user #{user.username}");
+ return "/registered.jspx";
+ }
+ else
+ {
+ FacesMessages.instance().add("User #{user.username} already exists");
+ return null;
+ }
+ }
+
+}
Added: modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/User.java
===================================================================
--- modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/User.java (rev 0)
+++ modules/authorization/trunk/security-console/ejb/src/main/java/org/jboss/seam/example/registration/User.java 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,76 @@
+//$Id: User.java 2360 2006-10-25 20:17:46Z gavin $
+package org.jboss.seam.example.registration;
+
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotNull;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+@Entity
+@Name("user")
+@Scope(SESSION)
+@Table(name="users")
+public class User implements Serializable
+{
+ private static final long serialVersionUID = 1881413500711441951L;
+
+ private String username;
+ private String password;
+ private String name;
+
+ public User(String name, String password, String username)
+ {
+ this.name = name;
+ this.password = password;
+ this.username = username;
+ }
+
+ public User() {}
+
+ @NotNull
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull @Length(min=5, max=15)
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Id @NotNull @Length(min=5, max=15)
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "User(" + username + ")";
+ }
+}
Added: modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/ejb-jar.xml (rev 0)
+++ modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/ejb-jar.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
Added: modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/persistence.xml (rev 0)
+++ modules/authorization/trunk/security-console/ejb/src/main/resources/META-INF/persistence.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="userDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: modules/authorization/trunk/security-console/ejb/src/main/resources/seam.properties
===================================================================
Added: modules/authorization/trunk/security-console/pom.xml
===================================================================
--- modules/authorization/trunk/security-console/pom.xml (rev 0)
+++ modules/authorization/trunk/security-console/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>jboss-authz-parent</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>security-console-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Security Console</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Security Console</description>
+
+
+ <modules>
+ <module>ejb</module>
+ <module>war</module>
+ <module>ear</module>
+ </modules>
+</project>
Added: modules/authorization/trunk/security-console/war/pom.xml
===================================================================
--- modules/authorization/trunk/security-console/war/pom.xml (rev 0)
+++ modules/authorization/trunk/security-console/war/pom.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,15 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.security.authz</groupId>
+ <artifactId>security-console-aggregator</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>security-console-war</artifactId>
+ <packaging>war</packaging>
+ <name>JBoss Security Console War Module</name>
+ <url>http://www.jboss.org</url>
+ <description>JBoss Security Console War Module</description>
+</project>
Added: modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/components.xml
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/components.xml (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/components.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
+
+ <core:init jndi-pattern="security-console/#{ejbName}/local"/>
+
+</components>
Added: modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/faces-config.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <!-- Facelets support -->
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+</faces-config>
Added: modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/WEB-INF/web.xml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <!-- Seam -->
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
+ </servlet>
+
+
+ <servlet-mapping>
+ <servlet-name>Seam Resource Servlet</servlet-name>
+ <url-pattern>/seam/resource/*</url-pattern>
+ </servlet-mapping>
+
+
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <!-- RichFaces configuration -->
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+
+
+ <!-- JSF configuration -->
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: modules/authorization/trunk/security-console/war/src/main/webapp/index.html
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/index.html (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/index.html 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=register.seam">
+</head>
+</html>
\ No newline at end of file
Added: modules/authorization/trunk/security-console/war/src/main/webapp/register.xhtml
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/register.xhtml (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/register.xhtml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+>
+ <head>
+ <title>Register New User</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <rich:panel header="Simple Echo">
+ <h:inputText size="50" value="#{user.username}" >
+ <a4j:support event="onkeyup" reRender="rep"/>
+ </h:inputText>
+ <h:outputText value="#{user.username}" id="rep"/>
+ </rich:panel>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: modules/authorization/trunk/security-console/war/src/main/webapp/registered.xhtml
===================================================================
--- modules/authorization/trunk/security-console/war/src/main/webapp/registered.xhtml (rev 0)
+++ modules/authorization/trunk/security-console/war/src/main/webapp/registered.xhtml 2008-10-03 22:21:02 UTC (rev 12033)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+ <head>
+ <title>Successfully Registered New User</title>
+ </head>
+ <body>
+ <f:view>
+ Welcome, #{user.name}, you are successfully registered as #{user.username}.
+ </f:view>
+ </body>
+
+</html>
17 years, 7 months
JBoss Portal SVN: r12032 - in branches/JBoss_Portal_Branch_2_7: core-admin/src/resources/portal-admin-war/jsf/common and 2 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-10-03 17:52:42 -0400 (Fri, 03 Oct 2008)
New Revision: 12032
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
small ui cleanup, try web.xml config for expired view id, copy over 286 serveResource demo and add to ajax examples
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -57,7 +57,17 @@
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
+
+ <context-param>
+ <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.disableVersionTracking</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
<!-- JSF -->
<context-param>
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/common/showPortletDetails.xhtml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -180,7 +180,7 @@
</f:facet>
<div style="width:150px">
- <h:commandLinkid="edit-link" action="#{instanceDisplayNameAction.editDisplayName}">
+ <h:commandLink id="edit-link" action="#{instanceDisplayNameAction.editDisplayName}">
<h:outputText styleClass="actionRename" value="#{bundle.RENAME}"/>
<f:param name="locale" value="#{value.locale}"/>
<f:param name="editAction" value="rename"/>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java 2008-10-03 21:52:42 UTC (rev 12032)
@@ -0,0 +1,182 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.core.samples.basic;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletMode;
+
+/**
+ * @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
+ * @version $Revision: 630 $
+ */
+public class RepeatRefreshPortlet extends GenericPortlet
+{
+ public final static int TITANIUM = 0;
+ public final static int PLATINUM = 1;
+ public final static int GOLD = 2;
+ public final static int SILVER = 3;
+ public final static int TIN = 4;
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+
+ String repeatText = req.getParameter("repeat");
+ // set zip as render parameter
+ if (repeatText != null){
+ resp.setRenderParameter("repeat", repeatText);
+ }
+ // request view
+ resp.setPortletMode(PortletMode.VIEW);
+
+ }
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ ResourceURL resourceURL = resp.createResourceURL();
+ PortletURL actionURL = resp.createActionURL();
+ //
+// Element elt = resp.createElement("script");
+// elt.setAttribute("type", "text/javascript");
+// elt.setAttribute("src", resourceURL.toString());
+// elt.appendChild(elt.getOwnerDocument().createTextNode(""));
+// resp.addProperty("script", elt);
+
+ //
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ writer.print("" +
+ "<script type=\"text/javascript\">" +
+ "" +
+ // "function init(){\n" +
+ //" Event.observe('repeat', 'keyup', repeat(), false);\n" +
+ // "}" +
+ "" +
+ "function browse(id) {" +
+ "var url = id;\n" +
+ "var pars = 'foo=bar';\n" +
+ "var target = 'output-div';\n" +
+ "var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});" +
+ "}" +
+
+ "</script>");
+
+ writer.print("" +
+ "<div class='full-width' style='padding:5px'>" +
+ "<h4>Partial Refresh Repeater Demo</h4>");
+ writer.print("" +
+ " <div class='half-width float-left'>" +
+ " <form method='post' id=\"testrepeatform\" name=\"testrepeatform\" action=\"" + actionURL + "\" onsubmit=\"new Ajax.Updater('repeat-div', '" + resourceURL + "', {asynchronous:true, parameters:Form.serialize(this)}); return false;\">\n" +
+ " <font class='portlet-font'>Repeat Demo:</font><br/>\n" +
+ " <input class='portlet-form-input-field' type='text' value='' size='12' name=\"repeat\" id=\"repeat\" onkeyup=\"this.form.submit2.click();new Effect.Highlight(document.getElementById('repeat-div'));\"/>\n" +
+ " <input class='portlet-form-input-field hidden' type='submit' name='submit2' value='submit' style=\"display:hidden;\">\n" +
+ " </form>\n" +
+ "</div>" +
+ "");
+ writer.print("<div id=\"repeat-container\"><div id=\"repeat-div\" class='half-width float-left' style='height:50px'></div></div>");
+// "<input type=\"text\" id=\"hidden-input\" value=\"" + resourceURL.toString() + "\" />" +
+// "<a href='javascript:" + resp.getNamespace() + "_handle()'>Click me to trigger script</a>" +
+ writer.print("<br class='clear'/><br class='clear'/><hr/>" +
+ "<h4>Partial Refresh Product Catalog</h4>" +
+ "<div class='full-width'>" +
+ "");
+ writer.print("<div class='float-left third-width'>");
+ resourceURL.setParameter("prodId","1");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 1</a><br/>");
+
+ resourceURL.setParameter("prodId","2");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 2</a><br/>");
+
+ resourceURL.setParameter("prodId","3");
+ writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 3</a><br/>");
+
+ writer.print("<br class='clear'/></div>");
+ writer.print("<div class='float-left two-third-width'>" +
+ "<h4 class='zero'>Product Details</h4>" +
+ "<div id=\"output-div\"></div>" +
+ "");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+
+
+
+ // writer.print("</div>");
+ }
+
+ public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException, IOException
+ {
+ String repeatText = req.getParameter("repeat");
+ String prodId = req.getParameter("prodId");
+
+ String namespace =resp.getNamespace();
+ //resp.setContentType("application/json");
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ if (repeatText != null){
+ writer.print("<div id=\"repeat-text\">"+ req.getPrivateParameterMap().get("repeat")[0] +"</div>");
+ }
+ if (prodId != null){
+ if (prodId.equals("1")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ " B BY BURTON ALPHA<br/>" +
+ "Sale Price: $314.96 " +
+ "</div>");
+ }
+ if (prodId.equals("2")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ "FORUM DESTROYER LTD<br/>" +
+ "$319.99 " +
+ "</div>");
+ }
+ if (prodId.equals("3")){
+ writer.print("<div id=\"product-text\">Product ID: "+ prodId +"" +
+ "<br/>" +
+ "\n" +
+ "SANTA CRUZ ALLSTAR<br/>" +
+ "$256.00 " +
+ "</div>");
+ }
+
+ }
+
+
+
+
+ writer.close();
+ }
+}
+
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -320,6 +320,21 @@
</window>
</page>
<page>
+ <page-name>286 serveResource Demo</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>RepeatRefreshPortletWindow</window-name>
+ <instance-ref>RepeatRefreshPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ <page>
<page-name>Public parameters test</page-name>
<window>
<window-name>PublicParametersPortletWindow1</window-name>
@@ -653,6 +668,21 @@
</window>
</page>
<page>
+ <page-name>286 serveResource Demo</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>RepeatRefreshPortletWindow</window-name>
+ <instance-ref>RepeatRefreshPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ </page>
+ <page>
<page-name>Public parameters test</page-name>
<window>
<window-name>PublicParametersPortletWindow1</window-name>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -82,6 +82,12 @@
</ajax>
</portlet>
<portlet>
+ <portlet-name>RepeatRefreshPortlet</portlet-name>
+ <ajax>
+ <partial-refresh>false</partial-refresh>
+ </ajax>
+ </portlet>
+ <portlet>
<portlet-name>AsyncURLPortlet</portlet-name>
<ajax>
<partial-refresh>true</partial-refresh>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -69,6 +69,12 @@
</deployment>
<deployment>
<instance>
+ <instance-id>RepeatRefreshPortletInstance</instance-id>
+ <portlet-ref>RepeatRefreshPortlet</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
<instance-id>TestPortletInstance</instance-id>
<portlet-ref>TestPortlet</portlet-ref>
</instance>
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-10-03 16:21:07 UTC (rev 12031)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2008-10-03 21:52:42 UTC (rev 12032)
@@ -268,6 +268,20 @@
</portlet-info>
</portlet>
<portlet>
+ <description>286 serveResource Demo Portlet</description>
+ <portlet-name>RepeatRefreshPortlet</portlet-name>
+ <display-name>286 serveResource Demo Portlet</display-name>
+ <portlet-class>org.jboss.portal.core.samples.basic.RepeatRefreshPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>286 serveResource Demo Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ </portlet>
+ <portlet>
<description>Async URL Portlet</description>
<portlet-name>AsyncURLPortlet</portlet-name>
<display-name>Async URL Portlet</display-name>
17 years, 7 months