From: <cl...@hy...> - 2008-09-29 23:59:43
|
Author: clee Date: 2008-09-29 16:59:39 -0700 (Mon, 29 Sep 2008) New Revision: 11343 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=11343 Modified: trunk/src/org/hyperic/hq/authz/shared/PermissionManager.java trunk/src/org/hyperic/hq/authz/shared/PermissionManagerImpl.java trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java Log: Keep things simple by not converting to ResourceValue Modified: trunk/src/org/hyperic/hq/authz/shared/PermissionManager.java =================================================================== --- trunk/src/org/hyperic/hq/authz/shared/PermissionManager.java 2008-09-29 23:46:50 UTC (rev 11342) +++ trunk/src/org/hyperic/hq/authz/shared/PermissionManager.java 2008-09-29 23:59:39 UTC (rev 11343) @@ -35,6 +35,7 @@ import org.hyperic.hq.authz.server.session.AuthzSession; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.server.session.PagerProcessor_operation; +import org.hyperic.hq.authz.server.session.Resource; import org.hyperic.hq.authz.server.session.ResourceType; import org.hyperic.hq.events.shared.MaintenanceEventManagerInterface; import org.hyperic.util.pager.PageControl; @@ -141,7 +142,7 @@ * @return array of authz Resources * @exception FinderException */ - public abstract ResourceValue[] + public abstract Resource[] findOperationScopeBySubjectBatch(AuthzSubject whoami, ResourceValue[] resArr, String[] opArr) Modified: trunk/src/org/hyperic/hq/authz/shared/PermissionManagerImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/shared/PermissionManagerImpl.java 2008-09-29 23:46:50 UTC (rev 11342) +++ trunk/src/org/hyperic/hq/authz/shared/PermissionManagerImpl.java 2008-09-29 23:59:39 UTC (rev 11343) @@ -63,7 +63,7 @@ public class PermissionManagerImpl extends PermissionManager { - private static Log _log = + private static final Log _log = LogFactory.getLog(PermissionManagerImpl.class.getName()); private String _falseToken = null; @@ -171,7 +171,7 @@ return scope; } - public ResourceValue[] + public Resource[] findOperationScopeBySubjectBatch(AuthzSubject whoami, ResourceValue[] resArr, String[] opArr) @@ -181,13 +181,9 @@ throw new IllegalArgumentException("At least one resource required"); } - ArrayList resLocArr = new ArrayList(resArr.length); - - for (int x = 0; x < resArr.length; x++) { - resLocArr.add(lookupResource(resArr[x])); - } + Set resLocArr = toPojos(resArr); - return (ResourceValue[]) fromLocals(resLocArr, ResourceValue.class); + return (Resource[]) resLocArr.toArray(new Resource[resLocArr.size()]); } public List findViewableResources(AuthzSubject subj, String resType, Modified: trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java 2008-09-29 23:46:50 UTC (rev 11342) +++ trunk/src/org/hyperic/hq/control/server/session/ControlManagerEJBImpl.java 2008-09-29 23:59:39 UTC (rev 11343) @@ -59,6 +59,7 @@ import org.hyperic.hq.appdef.shared.PlatformManagerLocal; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.server.session.AuthzSubjectManagerEJBImpl; +import org.hyperic.hq.authz.server.session.Resource; import org.hyperic.hq.authz.shared.AuthzConstants; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.authz.shared.PermissionManager; @@ -99,14 +100,14 @@ */ public class ControlManagerEJBImpl implements SessionBean { - private final Log log = + private final Log _log = LogFactory.getLog(ControlManagerEJBImpl.class.getName()); private ControlPluginManager _controlManager; private ControlScheduleManagerLocal _controlScheduleManager; private ControlHistoryDAO getControlHistoryDAO() { - return DAOFactory.getDAOFactory().getControlHistoryDAO(); + return new ControlHistoryDAO(DAOFactory.getDAOFactory()); } /** @ejb:create-method */ @@ -117,7 +118,7 @@ _controlManager = (ControlPluginManager)ProductManagerEJBImpl. getOne().getPluginManager(ProductPlugin.TYPE_CONTROL); } catch (Exception e) { - this.log.error("Unable to get plugin manager", e); + this._log.error("Unable to get plugin manager", e); } // Get a reference to the control scheduler ejb @@ -609,10 +610,10 @@ // fetch authz resources and add to return list try { PermissionManager pm = PermissionManagerFactory.getInstance(); - ResourceValue[] authz = + Resource[] authz = pm.findOperationScopeBySubjectBatch( caller, resArr, opArr); for (int x=0;x<authz.length;x++) { - retVal.add(AppdefUtil.resValToAppdefEntityId(authz[x])); + retVal.add(new AppdefEntityID(authz[x])); } } catch (FinderException e) { // returns empty list as advertised @@ -649,8 +650,7 @@ .checkModifyPermission(caller, id); return; default: - throw new InvalidAppdefTypeException("Unknown type: " - + type); + throw new InvalidAppdefTypeException("Unknown type: " + type); } } |