[pal-cvs 3227] [964] removed debug code.

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2008年 6月 5日 (木) 13:57:34 JST


Revision: 964
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=964
Author:   shinsuke
Date:     2008-06-05 13:57:34 +0900 (Thu, 05 Jun 2008)

Log Message:
-----------
removed debug code. fixed null url problem.

Modified Paths:
--------------
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/PALAdminConstants.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/filter/UserManagementFilter.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SecurityProviderLogic.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java


-------------- next part --------------
Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/PALAdminConstants.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/PALAdminConstants.java	2008-06-05 02:36:18 UTC (rev 963)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/PALAdminConstants.java	2008-06-05 04:57:34 UTC (rev 964)
@@ -18,7 +18,6 @@
 import org.apache.jetspeed.om.folder.Folder;
 
 public class PALAdminConstants {
-    public static final boolean DEBUG = false;
 
     public static final String PREFIX = "jp.sf.pal.admin.";
 

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/filter/UserManagementFilter.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/filter/UserManagementFilter.java	2008-06-05 02:36:18 UTC (rev 963)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/filter/UserManagementFilter.java	2008-06-05 04:57:34 UTC (rev 964)
@@ -73,56 +73,55 @@
     public void init(PortletFilterConfig filterConfig) throws PortletException {
         PortletConfig portletConfig = filterConfig.getPortletConfig();
         PortletContext portletContext = portletConfig.getPortletContext();
-        if (!PALAdminConstants.DEBUG) {
-            // securityProvider
-            securityProvider = (SecurityProvider) portletContext
-                    .getAttribute(PALAdminConstants.CPS_SECURITY_PROVIDER_COMPONENT);
-            if (securityProvider == null) {
-                throw new PortletException(
-                        "Failed to find the Security Provider on portlet initialization");
-            }
 
-            // userManager
-            userManager = (UserManager) portletContext
-                    .getAttribute(CommonPortletServices.CPS_USER_MANAGER_COMPONENT);
-            if (userManager == null) {
-                throw new PortletException(
-                        "Failed to find the User Manager on portlet initialization");
-            }
+        // securityProvider
+        securityProvider = (SecurityProvider) portletContext
+                .getAttribute(PALAdminConstants.CPS_SECURITY_PROVIDER_COMPONENT);
+        if (securityProvider == null) {
+            throw new PortletException(
+                    "Failed to find the Security Provider on portlet initialization");
+        }
 
-            // groupManager
-            groupManager = (GroupManager) portletContext
-                    .getAttribute(CommonPortletServices.CPS_GROUP_MANAGER_COMPONENT);
-            if (groupManager == null) {
-                throw new PortletException(
-                        "Failed to find the Group Manager on portlet initialization");
-            }
+        // userManager
+        userManager = (UserManager) portletContext
+                .getAttribute(CommonPortletServices.CPS_USER_MANAGER_COMPONENT);
+        if (userManager == null) {
+            throw new PortletException(
+                    "Failed to find the User Manager on portlet initialization");
+        }
 
-            // roleManager
-            roleManager = (RoleManager) portletContext
-                    .getAttribute(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
-            if (roleManager == null) {
-                throw new PortletException(
-                        "Failed to find the Role Manager on portlet initialization");
-            }
+        // groupManager
+        groupManager = (GroupManager) portletContext
+                .getAttribute(CommonPortletServices.CPS_GROUP_MANAGER_COMPONENT);
+        if (groupManager == null) {
+            throw new PortletException(
+                    "Failed to find the Group Manager on portlet initialization");
+        }
 
-            // profiler
-            profiler = (Profiler) portletContext
-                    .getAttribute(CommonPortletServices.CPS_PROFILER_COMPONENT);
-            if (null == profiler) {
-                throw new PortletException(
-                        "Failed to find the Profiler on portlet initialization");
-            }
+        // roleManager
+        roleManager = (RoleManager) portletContext
+                .getAttribute(CommonPortletServices.CPS_ROLE_MANAGER_COMPONENT);
+        if (roleManager == null) {
+            throw new PortletException(
+                    "Failed to find the Role Manager on portlet initialization");
+        }
 
-            // pageManager
-            pageManager = (PageManager) portletContext
-                    .getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
-            if (null == pageManager) {
-                throw new PortletException(
-                        "Failed to find the Page Manager on portlet initialization");
-            }
+        // profiler
+        profiler = (Profiler) portletContext
+                .getAttribute(CommonPortletServices.CPS_PROFILER_COMPONENT);
+        if (null == profiler) {
+            throw new PortletException(
+                    "Failed to find the Profiler on portlet initialization");
+        }
 
+        // pageManager
+        pageManager = (PageManager) portletContext
+                .getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPONENT);
+        if (null == pageManager) {
+            throw new PortletException(
+                    "Failed to find the Page Manager on portlet initialization");
         }
+
     }
 
     /*

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SecurityProviderLogic.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SecurityProviderLogic.java	2008-06-05 02:36:18 UTC (rev 963)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SecurityProviderLogic.java	2008-06-05 04:57:34 UTC (rev 964)
@@ -260,14 +260,6 @@
     //
 
     public List<User> getUsers(UserPager pager) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<User> list = new ArrayList<User>();
-            User entity = new User();
-            entity.setName("USER");
-            list.add(entity);
-            return list;
-        }
 
         if (pager.getAuthenticationProviderName() == null) {
             pager
@@ -334,10 +326,6 @@
     }
 
     public void insertUser(User user) throws CommonException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         if (PALAdminUtil.isEmpty(user.getName())
                 || PALAdminUtil.isEmpty(user.getPassword())) {
@@ -483,10 +471,6 @@
     }
 
     public void deleteUser(User user) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         try {
             getUserManager().removeUser(user.getName());
@@ -715,14 +699,6 @@
     //
 
     public List<Role> getRoles(RolePager pager) {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<Role> list = new ArrayList<Role>();
-            Role r = new Role();
-            r.setName("ROLE");
-            list.add(r);
-            return list;
-        }
 
         List<Role> roleList = new ArrayList<Role>();
         List<Principal> principals = getRoleSecurityHandler()
@@ -752,10 +728,6 @@
     }
 
     public void insertRole(Role role) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         try {
             getRoleManager().addRole(role.getName());
@@ -765,10 +737,6 @@
     }
 
     public void deleteRole(Role role) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         try {
             getRoleManager().removeRole(role.getName());
@@ -778,12 +746,6 @@
     }
 
     public List<String> getRoleNames() {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<String> list = new ArrayList<String>();
-            list.add("ROLE");
-            return list;
-        }
 
         List<String> roleList = new ArrayList<String>();
         List<Principal> principals = getRoleSecurityHandler()
@@ -820,14 +782,6 @@
     //
 
     public List<Group> getGroups(GroupPager pager) {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<Group> list = new ArrayList<Group>();
-            Group entity = new Group();
-            entity.setName("GROUP");
-            list.add(entity);
-            return list;
-        }
 
         List<Group> groupList = new ArrayList<Group>();
         List<Principal> principals = getGroupSecurityHandler()
@@ -857,10 +811,6 @@
     }
 
     public void insertGroup(Group group) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         try {
             getGroupManager().addGroup(group.getName());
@@ -870,10 +820,6 @@
     }
 
     public void deleteGroup(Group group) throws PALAdminException {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            return;
-        }
 
         try {
             getGroupManager().removeGroup(group.getName());
@@ -883,12 +829,6 @@
     }
 
     public List<String> getGroupNames() {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<String> list = new ArrayList<String>();
-            list.add("GROUP");
-            return list;
-        }
 
         List<String> groupList = new ArrayList<String>();
         List<Principal> principals = getGroupSecurityHandler()
@@ -904,12 +844,6 @@
 
     //TODO String to User
     public List<String> getGroupNamesForUsername(String username) {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<String> list = new ArrayList<String>();
-            list.add("GROUP");
-            return list;
-        }
 
         List<String> groupList = new ArrayList<String>();
         Set<Principal> principals = getSecurityProvider()
@@ -923,12 +857,6 @@
     }
 
     public List<String> getRoleNamesForUsername(String username) {
-        //Debug
-        if (PALAdminConstants.DEBUG) {
-            List<String> list = new ArrayList<String>();
-            list.add("GROUP");
-            return list;
-        }
 
         List<String> roleList = new ArrayList<String>();
         Set<Principal> principals = getSecurityProvider()

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java	2008-06-05 02:36:18 UTC (rev 963)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java	2008-06-05 04:57:34 UTC (rev 964)
@@ -655,16 +655,19 @@
     }
 
     public String getReturnPathURL(String mode, String returnPath) {
-        //"${req.scheme}://${req.serverName}:${req.serverPort}${req.contextPath}/
         HttpServletRequest request = getSiteEditorLogic().getRequestContext()
                 .getRequest();
         StringBuffer buf = new StringBuffer();
-        buf.append(request.getScheme()).append("://").append(
-                request.getServerName()).append(":").append(
-                request.getServerPort()).append(request.getContextPath());
-
-        if (!buf.toString().endsWith("/")) {
-            buf.append(mode);
+        if (request.getScheme() != null) {
+            //"${req.scheme}://${req.serverName}:${req.serverPort}${req.contextPath}/
+            buf.append(request.getScheme()).append("://").append(
+                    request.getServerName()).append(":").append(
+                    request.getServerPort()).append(request.getContextPath());
+            if (!buf.toString().endsWith("/")) {
+                buf.append(mode);
+            } else {
+                buf.append(mode.substring(1));
+            }
         } else {
             buf.append(mode.substring(1));
         }
@@ -677,16 +680,18 @@
     }
 
     public String getViewURL(String path) {
-        //"${req.scheme}://${req.serverName}:${req.serverPort}${req.contextPath}/
         HttpServletRequest request = getSiteEditorLogic().getRequestContext()
                 .getRequest();
         StringBuffer buf = new StringBuffer();
-        buf.append(request.getScheme()).append("://").append(
-                request.getServerName()).append(":").append(
-                request.getServerPort()).append(request.getContextPath());
+        if (request.getScheme() != null) {
+            //"${req.scheme}://${req.serverName}:${req.serverPort}${req.contextPath}/
+            buf.append(request.getScheme()).append("://").append(
+                    request.getServerName()).append(":").append(
+                    request.getServerPort()).append(request.getContextPath());
 
-        if (!buf.toString().endsWith("/")) {
-            buf.append("/");
+            if (!buf.toString().endsWith("/")) {
+                buf.append("/");
+            }
         }
         buf.append("configure/");
 


pal-cvs メーリングリストの案内
Zurück zum Archiv-Index