You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(927) |
Apr
(419) |
May
(352) |
Jun
(431) |
Jul
(463) |
Aug
(345) |
Sep
(304) |
Oct
(596) |
Nov
(466) |
Dec
(414) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(348) |
Feb
(313) |
Mar
(665) |
Apr
(688) |
May
(434) |
Jun
(311) |
Jul
(540) |
Aug
(554) |
Sep
(467) |
Oct
(341) |
Nov
(365) |
Dec
(272) |
2009 |
Jan
(386) |
Feb
(293) |
Mar
(279) |
Apr
(239) |
May
(229) |
Jun
(199) |
Jul
(186) |
Aug
(111) |
Sep
(196) |
Oct
(146) |
Nov
(116) |
Dec
(140) |
2010 |
Jan
(170) |
Feb
(159) |
Mar
(151) |
Apr
(161) |
May
(90) |
Jun
(56) |
Jul
(28) |
Aug
(22) |
Sep
(5) |
Oct
|
Nov
(23) |
Dec
(12) |
2011 |
Jan
(8) |
Feb
(8) |
Mar
(22) |
Apr
(24) |
May
(4) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bo...@hy...> - 2010-05-26 07:22:02
|
Author: bob Date: 2010-05-26 00:21:52 -0700 (Wed, 26 May 2010) New Revision: 14626 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14626 Modified: trunk/etc/version.properties Log: Release 4.4.0 build #1449 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-05-26 05:51:20 UTC (rev 14625) +++ trunk/etc/version.properties 2010-05-26 07:21:52 UTC (rev 14626) @@ -1,3 +1,3 @@ -#Tue May 25 13:48:28 PDT 2010 +#Tue May 25 22:38:53 PDT 2010 version=4.4.0 -build=1448 +build=1449 |
From: <pn...@hy...> - 2010-05-26 05:51:28
|
Author: pnguyen Date: 2010-05-25 22:51:20 -0700 (Tue, 25 May 2010) New Revision: 14625 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14625 Added: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/ManagedEntityNotFoundException.java Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VSphereUtil.java Log: throw ManagedEntityNotFoundException when managed entity (VM) cannot be found Added: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/ManagedEntityNotFoundException.java =================================================================== --- trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/ManagedEntityNotFoundException.java (rev 0) +++ trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/ManagedEntityNotFoundException.java 2010-05-26 05:51:20 UTC (rev 14625) @@ -0,0 +1,35 @@ +/* + * NOTE: This copyright does *not* cover user programs that use HQ + * program services by normal system calls through the application + * program interfaces provided as part of the Hyperic Plug-in Development + * Kit or the Hyperic Client Development Kit - this is merely considered + * normal use of the program, and does *not* fall under the heading of + * "derived work". + * + * Copyright (C) [2004-2010], Hyperic, Inc. + * This file is part of HQ. + * + * HQ is free software; you can redistribute it and/or modify + * it under the terms version 2 of the GNU General Public License as + * published by the Free Software Foundation. This program 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 General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + */ + +package org.hyperic.hq.plugin.vsphere; + +import org.hyperic.hq.product.PluginException; + +public class ManagedEntityNotFoundException extends PluginException { + + public ManagedEntityNotFoundException(String s) { + super(s); + } +} Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VSphereUtil.java =================================================================== --- trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VSphereUtil.java 2010-05-26 04:52:13 UTC (rev 14624) +++ trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VSphereUtil.java 2010-05-26 05:51:20 UTC (rev 14625) @@ -131,7 +131,7 @@ throw new PluginException(type + "/" + name + ": " + e, e); } if (obj == null) { - throw new PluginException(type + "/" + name + ": not found"); + throw new ManagedEntityNotFoundException(type + "/" + name + ": not found"); } return obj; } |
From: <pn...@hy...> - 2010-05-26 04:52:22
|
Author: pnguyen Date: 2010-05-25 21:52:13 -0700 (Tue, 25 May 2010) New Revision: 14624 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14624 Modified: trunk/src/org/hyperic/hq/authz/shared/AuthzConstants.java Log: add platformPrototypeVmwareVsphereVm Modified: trunk/src/org/hyperic/hq/authz/shared/AuthzConstants.java =================================================================== --- trunk/src/org/hyperic/hq/authz/shared/AuthzConstants.java 2010-05-26 00:20:32 UTC (rev 14623) +++ trunk/src/org/hyperic/hq/authz/shared/AuthzConstants.java 2010-05-26 04:52:13 UTC (rev 14624) @@ -146,6 +146,8 @@ public static final String serverPrototypeTypeName = "ServerPrototype"; public static final String servicePrototypeTypeName = "ServicePrototype"; public static final String appPrototypeTypeName = "ApplicationPrototype"; + + public static final String platformPrototypeVmwareVsphereVm = "VMware vSphere VM"; public static final String rootOpCAMAdmin = "administerCAM"; |
From: <sc...@hy...> - 2010-05-26 00:53:52
|
Author: scottmf Date: 2010-05-25 17:20:32 -0700 (Tue, 25 May 2010) New Revision: 14623 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14623 Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java Log: [HPD-477] removed getPlatformCountByContainmentRelation() in favor of a more straight forward way to calculate what we need using resource prototypes via getPlatformCountMinusVsphereVmPlatforms(). Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java =================================================================== --- trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-25 23:32:59 UTC (rev 14622) +++ trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-26 00:20:32 UTC (rev 14623) @@ -35,6 +35,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.hyperic.hq.authz.shared.AuthzConstants; import org.hyperic.hq.hqapi1.AgentApi; import org.hyperic.hq.hqapi1.HQApi; import org.hyperic.hq.hqapi1.ResourceApi; @@ -95,7 +96,7 @@ private static final String AGENT_PORT = "agent.setup.agentPort"; private static final String VC_TYPE = "VMware vCenter"; - private static final String VM_TYPE = "VMware vSphere VM"; + private static final String VM_TYPE = AuthzConstants.platformPrototypeVmwareVsphereVm; private static final String HOST_TYPE = "VMware vSphere Host"; private static final String POOL_TYPE = "VMware vSphere Resource Pool"; private static final String DEFAULT_POOL = "Resources"; Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java 2010-05-25 23:32:59 UTC (rev 14622) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceDAO.java 2010-05-26 00:20:32 UTC (rev 14623) @@ -457,4 +457,15 @@ .setParameter("svcProto", AuthzConstants.authzService) .list(); } + + int getPlatformCountMinusVsphereVmPlatforms() { + String sql = "select count(*) from Resource r " + + "where r.resourceType.id = :platProto " + + "and r.prototype.name != :vspherevm"; + return ((Integer) getSession().createQuery(sql) + .setInteger("platProto", AuthzConstants.authzPlatform.intValue()) + .setString("vspherevm", AuthzConstants.platformPrototypeVmwareVsphereVm) + .uniqueResult()).intValue(); + } + } Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-25 23:32:59 UTC (rev 14622) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-26 00:20:32 UTC (rev 14623) @@ -295,17 +295,5 @@ return results.size() == 1; } - - public int getPlatformCountByContainmentRelation() { - String sql = "select count(distinct r.id) from Resource r " + - "JOIN r.resourceType t " + - "JOIN r.fromEdges e " + - "WHERE r.resourceType.id = :authzPlatform " + - "AND e.relation = :relationId"; - return ((Integer) getSession().createQuery(sql) - .setInteger("authzPlatform", AuthzConstants.authzPlatform.intValue()) - .setInteger("relationId", AuthzConstants.RELATION_CONTAINMENT_ID.intValue()) - .uniqueResult()).intValue(); - } } Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-25 23:32:59 UTC (rev 14622) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-26 00:20:32 UTC (rev 14623) @@ -1118,13 +1118,12 @@ } /** - * @return returns the platform count of all distinct authzPlatforms in the - * containment relation from the edge table. - * @see {@link AuthzConstants.RELATION_CONTAINMENT_ID} + * @return the resource count with prototype of {@link AuthzConstants.authzPlatform} + * minus resources with the prototype of {@link AuthConstants.platformPrototypeVmwareVsphereVm} * @ejb:interface-method */ - public int getPlatformCountByContainmentRelation() { - return getResourceEdgeDAO().getPlatformCountByContainmentRelation(); + public int getPlatformCountMinusVsphereVmPlatforms() { + return getResourceDAO().getPlatformCountMinusVsphereVmPlatforms(); } public static ResourceManagerLocal getOne() { |
From: <pn...@hy...> - 2010-05-25 23:33:09
|
Author: pnguyen Date: 2010-05-25 16:32:59 -0700 (Tue, 25 May 2010) New Revision: 14622 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14622 Modified: trunk/sql/authz-data.xml Log: add "virtual" resource relation for new db installs Modified: trunk/sql/authz-data.xml =================================================================== --- trunk/sql/authz-data.xml 2010-05-25 23:19:32 UTC (rev 14621) +++ trunk/sql/authz-data.xml 2010-05-25 23:32:59 UTC (rev 14622) @@ -22,6 +22,7 @@ <table name="EAM_RESOURCE_RELATION"> <data ID="1" NAME="containment" IS_HIER="TRUE"/> <data ID="2" NAME="network" IS_HIER="TRUE"/> + <data ID="3" NAME="virtual" IS_HIER="TRUE"/> </table> <table name="EAM_SUBJECT"> |
From: <sc...@hy...> - 2010-05-25 23:19:40
|
Author: scottmf Date: 2010-05-25 16:19:32 -0700 (Tue, 25 May 2010) New Revision: 14621 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14621 Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java Log: [HPD-477] added getPlatformCountByContainmentRelation() Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-25 23:18:22 UTC (rev 14620) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-25 23:19:32 UTC (rev 14621) @@ -295,4 +295,17 @@ return results.size() == 1; } + + public int getPlatformCountByContainmentRelation() { + String sql = "select count(distinct r.id) from Resource r " + + "JOIN r.resourceType t " + + "JOIN r.fromEdges e " + + "WHERE r.resourceType.id = :authzPlatform " + + "AND e.relation = :relationId"; + + return ((Integer) getSession().createQuery(sql) + .setInteger("authzPlatform", AuthzConstants.authzPlatform.intValue()) + .setInteger("relationId", AuthzConstants.RELATION_CONTAINMENT_ID.intValue()) + .uniqueResult()).intValue(); + } } Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-25 23:18:22 UTC (rev 14620) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-25 23:19:32 UTC (rev 14621) @@ -1116,6 +1116,16 @@ } ZeventManager.getInstance().enqueueEventsAfterCommit(events); } + + /** + * @return returns the platform count of all distinct authzPlatforms in the + * containment relation from the edge table. + * @see {@link AuthzConstants.RELATION_CONTAINMENT_ID} + * @ejb:interface-method + */ + public int getPlatformCountByContainmentRelation() { + return getResourceEdgeDAO().getPlatformCountByContainmentRelation(); + } public static ResourceManagerLocal getOne() { try { |
Author: pnguyen Date: 2010-05-25 16:18:22 -0700 (Tue, 25 May 2010) New Revision: 14620 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14620 Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java trunk/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy Log: vsphere plugin - sync resource edges for vcenters, hosts, and vms Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java =================================================================== --- trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-25 21:36:14 UTC (rev 14619) +++ trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-25 23:18:22 UTC (rev 14620) @@ -38,13 +38,19 @@ import org.hyperic.hq.hqapi1.AgentApi; import org.hyperic.hq.hqapi1.HQApi; import org.hyperic.hq.hqapi1.ResourceApi; +import org.hyperic.hq.hqapi1.ResourceEdgeApi; import org.hyperic.hq.hqapi1.XmlUtil; import org.hyperic.hq.hqapi1.types.Agent; import org.hyperic.hq.hqapi1.types.AgentResponse; import org.hyperic.hq.hqapi1.types.AgentsResponse; import org.hyperic.hq.hqapi1.types.Resource; +import org.hyperic.hq.hqapi1.types.ResourceConfig; +import org.hyperic.hq.hqapi1.types.ResourceEdge; +import org.hyperic.hq.hqapi1.types.ResourceFrom; +import org.hyperic.hq.hqapi1.types.ResourceProperty; import org.hyperic.hq.hqapi1.types.ResourcePrototype; import org.hyperic.hq.hqapi1.types.ResourcePrototypeResponse; +import org.hyperic.hq.hqapi1.types.ResourceTo; import org.hyperic.hq.hqapi1.types.ResourcesResponse; import org.hyperic.hq.hqapi1.types.Response; import org.hyperic.hq.hqapi1.types.ResponseStatus; @@ -88,6 +94,7 @@ private static final String AGENT_IP = "agent.setup.agentIP"; private static final String AGENT_PORT = "agent.setup.agentPort"; + private static final String VC_TYPE = "VMware vCenter"; private static final String VM_TYPE = "VMware vSphere VM"; private static final String HOST_TYPE = "VMware vSphere Host"; private static final String POOL_TYPE = "VMware vSphere Resource Pool"; @@ -219,14 +226,16 @@ return type; } - private VSphereResource discoverVM(VSphereUtil vim, - VirtualMachine vm) + private VSphereResource discoverVM(VirtualMachine vm) throws Exception { - VirtualMachineRuntimeInfo runtime = vm.getRuntime(); - VirtualMachineConfigInfo info = vm.getConfig(); + if (info.isTemplate()) { + return null; //filter out template VMs + } + + VirtualMachineRuntimeInfo runtime = vm.getRuntime(); GuestInfo guest = vm.getGuest(); ResourcePool pool = vm.getResourcePool(); @@ -321,7 +330,7 @@ continue; //filter out template VMs } try { - VSphereResource platform = discoverVM(vim, vm); + VSphereResource platform = discoverVM(vm); if (platform == null) { continue; } @@ -408,7 +417,7 @@ return resources; } - private VSphereResource discoverHost(VSphereUtil vim, HostSystem host) + private VSphereResource discoverHost(HostSystem host) throws Exception { HostConfigInfo info = host.getConfig(); @@ -491,7 +500,7 @@ throws IOException, PluginException { List<Resource> resources = new ArrayList<Resource>(); - ResourcePrototype type = getResourceType(HOST_TYPE); + ResourcePrototype hostType = getResourceType(HOST_TYPE); try { ManagedEntity[] hosts = vim.find(VSphereUtil.HOST_SYSTEM); @@ -505,13 +514,27 @@ HostSystem host = (HostSystem)hosts[i]; try { - VSphereResource platform = discoverHost(vim, host); + VSphereResource platform = discoverHost(host); if (platform == null) { continue; } - platform.setResourcePrototype(type); + platform.setResourcePrototype(hostType); platform.setAgent(agent); mergeVSphereConfig(platform); + + // TODO: Uncomment and remove discoverVirtualMachines + /* + VirtualMachine[] hostVms = host.getVms(); + for (int v=0; v<hostVms.length; v++) { + VSphereResource vm = discoverVM(hostVms[v]); + if (vm != null) { + vm.setResourcePrototype(vmType); + vm.setAgent(agent); + mergeVSphereConfig(vm); + resources.add(vm); + } + */ + List<Resource> rpools = pools.get(host.getName()); if (rpools != null) { platform.getResource().addAll(rpools); @@ -554,5 +577,124 @@ } finally { VSphereUtil.dispose(vim); } + + if (!isDump) { + syncResourceEdges(); + } } + + private void syncResourceEdges() + throws IOException, PluginException { + ResourceApi rApi = getApi().getResourceApi(); + ResourceEdgeApi reApi = getApi().getResourceEdgeApi(); + + List<ResourceEdge> edges = new ArrayList<ResourceEdge>(); + + Resource vCenter = null; + ResourcePrototype vcType = getResourceType(VC_TYPE); + ResourcesResponse vcResponse = rApi.getResources(vcType, true, false); + assertSuccess(vcResponse, "Getting all " + VC_TYPE, false); + + for (Resource r : vcResponse.getResource()) { + for (ResourceConfig c : r.getResourceConfig()) { + if (VSphereUtil.PROP_URL.equals(c.getKey())) { + if (c.getValue().equals(VSphereUtil.getURL(this.props))) { + vCenter = r; + break; + } + } + } + } + + if (vCenter == null) { + if (log.isDebugEnabled()) { + log.debug("No VMware vCenter server found with url=" + + VSphereUtil.getURL(this.props)); + } + return; + } + + ResourcePrototype hostType = getResourceType(HOST_TYPE); + ResourcesResponse hostResponse = rApi.getResources(hostType, true, false); + assertSuccess(hostResponse, "Getting all " + HOST_TYPE, false); + + ResourceEdge edge = new ResourceEdge(); + ResourceFrom from = new ResourceFrom(); + ResourceTo to = new ResourceTo(); + + for (Resource r : hostResponse.getResource()) { + for (ResourceConfig c : r.getResourceConfig()) { + if (VSphereUtil.PROP_URL.equals(c.getKey())) { + if (c.getValue().equals(VSphereUtil.getURL(this.props))) { + to.getResource().add(r); + } + } + } + } + + if (log.isDebugEnabled()) { + log.debug("vc name=" + vCenter.getName() + + ", resourceId=" + vCenter.getId() + + ", host size=" + to.getResource().size()); + } + + from.setResource(vCenter); + edge.setRelation("virtual"); + edge.setResourceFrom(from); + edge.setResourceTo(to); + edges.add(edge); + + StatusResponse syncResponse = reApi.syncResourceEdges(edges); + assertSuccess(syncResponse, "Sync vCenter and host edges", false); + + ResourcePrototype vmType = getResourceType(VM_TYPE); + ResourcesResponse vmResponse = rApi.getResources(vmType, true, false); + assertSuccess(vmResponse, "Getting all " + VM_TYPE, false); + + Map<String, List<Resource>> hostVmMap = new HashMap<String, List<Resource>>(); + + for (Resource r : vmResponse.getResource()) { + String esxHost = null; + for (ResourceProperty p : r.getResourceProperty()) { + if ("esxHost".equals(p.getKey())) { + esxHost = p.getValue(); + break; + } + } + List<Resource> vmResources = hostVmMap.get(esxHost); + if (vmResources == null) { + vmResources = new ArrayList<Resource>(); + hostVmMap.put(esxHost, vmResources); + } + vmResources.add(r); + } + + edges.clear(); + + for (Resource r : hostResponse.getResource()) { + ResourceFrom parent = new ResourceFrom(); + parent.setResource(r); + + ResourceTo children = new ResourceTo(); + List<Resource> vmResources = hostVmMap.get(r.getName()); + if (vmResources != null) { + children.getResource().addAll(vmResources); + } + + ResourceEdge rEdge = new ResourceEdge(); + rEdge.setRelation("virtual"); + rEdge.setResourceFrom(parent); + rEdge.setResourceTo(children); + edges.add(rEdge); + + if (log.isDebugEnabled()) { + log.debug("host name=" + r.getName() + + ", resourceId=" + r.getId() + + ", vm size=" + children.getResource().size()); + } + } + + syncResponse = reApi.syncResourceEdges(edges); + assertSuccess(syncResponse, "Sync host and VM edges", false); + } } Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-25 21:36:14 UTC (rev 14619) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-25 23:18:22 UTC (rev 14620) @@ -6,7 +6,7 @@ * normal use of the program, and does *not* fall under the heading of * "derived work". * - * Copyright (C) [2004-2009], Hyperic, Inc. + * Copyright (C) [2004-2010], Hyperic, Inc. * This file is part of HQ. * * HQ is free software; you can redistribute it and/or modify @@ -40,6 +40,8 @@ import javax.ejb.FinderException; import javax.ejb.SessionBean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.hyperic.dao.DAOFactory; import org.hyperic.hibernate.PageInfo; import org.hyperic.hq.appdef.ConfigResponseDB; @@ -98,6 +100,7 @@ */ public class ResourceManagerEJBImpl extends AuthzSession implements SessionBean { + private final Log log = LogFactory.getLog(ResourceManagerEJBImpl.class); private Pager resourceTypePager = null; private ResourceEdgeDAO getResourceEdgeDAO() { @@ -798,14 +801,116 @@ AppdefEntityID[] children, boolean deleteExisting) throws PermissionException, ResourceEdgeCreateException { - - if (relation == null - || !relation.getId().equals(AuthzConstants.RELATION_NETWORK_ID)) { + + if (relation == null) { + throw new ResourceEdgeCreateException("Resource relation is null"); + } + + if (relation.getId().equals(AuthzConstants.RELATION_NETWORK_ID)) { + createNetworkResourceEdges(subject, + relation, + parent, + children, + deleteExisting); + } else if (relation.getId().equals(AuthzConstants.RELATION_VIRTUAL_ID)) { + createVirtualResourceEdges(subject, + relation, + parent, + children, + false); + } else { throw new ResourceEdgeCreateException( - "Only " + AuthzConstants.ResourceEdgeNetworkRelation - + " resource relationships are supported."); + "Unsupported resource relation: " + + relation.getName()); } + } + + private void createVirtualResourceEdges(AuthzSubject subject, + ResourceRelation relation, + AppdefEntityID parent, + AppdefEntityID[] children, + boolean deleteExisting) + throws PermissionException, ResourceEdgeCreateException { + //TODO: Add VM/host verification check ??? + Resource parentResource = findResource(parent); + + if (parentResource != null + && !parentResource.isInAsyncDeleteState() + && children != null + && children.length > 0) { + + try { + if (deleteExisting) { + removeResourceEdges(subject, relation, parentResource); + } + + ResourceEdgeDAO eDAO = getResourceEdgeDAO(); + Collection edges = findResourceEdges(relation, parentResource); + ResourceEdge existing = null; + Resource childResource = null; + + if (edges.isEmpty()) { + // create self-edge for parent of virtual hierarchy + eDAO.create(parentResource, parentResource, 0, relation); + } + for (int i=0; i< children.length; i++) { + //TODO: Add VM/host verification check ??? + childResource = findResource(children[i]); + + // Check if child resource already exists in VM hierarchy + // TODO: This needs to be optimized + existing = getParentResourceEdge(childResource, relation); + + if (existing != null) { + Resource existingParent = existing.getFrom(); + if (existingParent.getId().equals(parentResource.getId())) { + // already exists with same parent, so skip + log.info("Skipping. Virtual resource edge already exists: from id=" + + parentResource.getId() + + ", to id=" + childResource.getId()); + continue; + } else { + // already exists with different parent + // TODO: vMotion occurred + + log.info("Virtual resource edge exists with another resource: from id=" + + existingParent.getId() + + ", to id=" + childResource.getId() + + ", target from id=" + parentResource.getId()); + continue; + } + } + + if (childResource != null && !childResource.isInAsyncDeleteState()) { + eDAO.create(parentResource, childResource, 1, relation); + eDAO.create(childResource, parentResource, -1, relation); + + Collection ancestors = eDAO.findAncestorEdges(parentResource, relation); + + for (Iterator a=ancestors.iterator(); a.hasNext();) { + ResourceEdge ancestorEdge = (ResourceEdge)a.next(); + + int distance = ancestorEdge.getDistance() - 1; + + eDAO.create(childResource, ancestorEdge.getTo(), distance, relation); + eDAO.create(ancestorEdge.getTo(), childResource, -distance, relation); + } + } + } + } catch (Throwable t) { + throw new ResourceEdgeCreateException(t); + } + } + } + + private void createNetworkResourceEdges(AuthzSubject subject, + ResourceRelation relation, + AppdefEntityID parent, + AppdefEntityID[] children, + boolean deleteExisting) + throws PermissionException, ResourceEdgeCreateException { + if (parent == null || !parent.isPlatform()) { throw new ResourceEdgeCreateException("Only platforms are supported."); } Modified: trunk/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy =================================================================== --- trunk/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy 2010-05-25 21:36:14 UTC (rev 14619) +++ trunk/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy 2010-05-25 23:18:22 UTC (rev 14620) @@ -18,6 +18,7 @@ import org.hyperic.hq.authz.server.session.ResourceSortField import org.hyperic.hq.authz.server.session.Resource import org.hyperic.hq.authz.server.session.ResourceGroup +import org.hyperic.hq.authz.server.session.ResourceRelation import org.hyperic.hq.bizapp.server.session.AppdefBossEJBImpl as AppdefBoss import org.hyperic.util.pager.PageControl import org.hyperic.hq.authz.server.session.ResourceGroup.ResourceGroupCreateInfo @@ -452,13 +453,17 @@ } void createResourceEdges(String resourceRelation, AppdefEntityID parent, AppdefEntityID[] children, boolean deleteExisting) { - if (!resourceRelation.equals(AuthzConstants.ResourceEdgeNetworkRelation)) { - throw new IllegalArgumentException('Only ' - + AuthzConstants.ResourceEdgeNetworkRelation - + ' resource relationships are supported.') + ResourceRelation relation = null; + if (AuthzConstants.ResourceEdgeNetworkRelation.equals(resourceRelation)) { + relation = rman.getNetworkRelation() + } else if (AuthzConstants.ResourceEdgeVirtualRelation.equals(resourceRelation)) { + relation = rman.getVirtualRelation() + } else { + throw new IllegalArgumentException( + 'Unsupported resource relation: ' + resourceRelation) } - rman.createResourceEdges(user, rman.getNetworkRelation(), parent, children, deleteExisting) + rman.createResourceEdges(user, relation, parent, children, deleteExisting) } void removeResourceEdges(String resourceRelation, Resource resource) { |
From: <bo...@hy...> - 2010-05-25 21:36:22
|
Author: bob Date: 2010-05-25 14:36:14 -0700 (Tue, 25 May 2010) New Revision: 14619 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14619 Modified: trunk/etc/version.properties Log: Release 4.4.0 build #1448 Modified: trunk/etc/version.properties =================================================================== --- trunk/etc/version.properties 2010-05-25 18:58:25 UTC (rev 14618) +++ trunk/etc/version.properties 2010-05-25 21:36:14 UTC (rev 14619) @@ -1,3 +1,3 @@ -#Mon May 24 02:41:18 PDT 2010 +#Tue May 25 13:48:28 PDT 2010 version=4.4.0 -build=1447 +build=1448 |
From: <sc...@hy...> - 2010-05-25 00:24:17
|
Author: scottmf Date: 2010-05-24 17:22:54 -0700 (Mon, 24 May 2010) New Revision: 14617 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14617 Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java Log: [HPD-283] ignore any platform that has a nic with the macaddr of 00:00:00:00:00:00 since it is a transient state. The intention is to ignore them until this state is resolved Modified: trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java =================================================================== --- trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-24 18:41:49 UTC (rev 14616) +++ trunk/plugins/vsphere/src/org/hyperic/hq/plugin/vsphere/VCenterPlatformDetector.java 2010-05-25 00:22:54 UTC (rev 14617) @@ -268,6 +268,14 @@ if (nics != null) { for (int i=0; i<nics.length; i++) { String mac = nics[i].getMacAddress(); + if (mac.equals("00:00:00:00:00:00")) { + log.info("UUID=" + info.getUuid() + + " and NIC=" + nics[i].getIpAddress() + + " has macaddr=" + mac + + ". Ignoring entire platform since macaddr is invalid. " + + "Platform will be picked up when the macaddr is valid"); + return null; + } String[] ips = nics[i].getIpAddress(); if ((mac != null) && (ips != null) && (ips.length != 0)) { cprops.setValue("macAddress", mac); |
From: <no...@gi...> - 2010-05-24 23:30:56
|
Branch: refs/heads/hqapi-2.x Home: http://github.com/hyperic/hqapi Commit: eef8eb06c5cce316d0d482462e992553e4627822 http://github.com/hyperic/hqapi/commit/eef8eb06c5cce316d0d482462e992553e4627822 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M src/org/hyperic/hq/hqapi1/HQConnection.java Log Message: ----------- Fix URL generation error when first parameter is specified multiple times. Commit: beee14a60aa03b04fca181f0f0f652ca15432fd8 http://github.com/hyperic/hqapi/commit/beee14a60aa03b04fca181f0f0f652ca15432fd8 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M ChangeLog A hqu/hqapi1/app/AlertController.groovy A hqu/hqapi1/app/MetricdataController.groovy A src/org/hyperic/hq/hqapi1/AlertApi.java M src/org/hyperic/hq/hqapi1/HQApi.java M src/org/hyperic/hq/hqapi1/HQConnection.java A src/org/hyperic/hq/hqapi1/MetricDataApi.java M src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlAction_test.java M src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java A src/org/hyperic/hq/hqapi1/test/AlertDelete_test.java A src/org/hyperic/hq/hqapi1/test/AlertFindByResource_test.java A src/org/hyperic/hq/hqapi1/test/AlertFind_test.java A src/org/hyperic/hq/hqapi1/test/AlertFix_test.java A src/org/hyperic/hq/hqapi1/test/AlertTestBase.java M src/org/hyperic/hq/hqapi1/test/HQApiTestBase.java M src/org/hyperic/hq/hqapi1/test/MaintenanceTestBase.java M src/org/hyperic/hq/hqapi1/test/MetricData_test.java A src/org/hyperic/hq/hqapi1/tools/AlertCommand.java M src/org/hyperic/hq/hqapi1/tools/Shell.java M xsd/HQApi1.xsd Log Message: ----------- Back port AlertApi to 2.x branch. |
From: <no...@gi...> - 2010-05-24 23:30:56
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: eef8eb06c5cce316d0d482462e992553e4627822 http://github.com/hyperic/hqapi/commit/eef8eb06c5cce316d0d482462e992553e4627822 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M src/org/hyperic/hq/hqapi1/HQConnection.java Log Message: ----------- Fix URL generation error when first parameter is specified multiple times. Commit: beee14a60aa03b04fca181f0f0f652ca15432fd8 http://github.com/hyperic/hqapi/commit/beee14a60aa03b04fca181f0f0f652ca15432fd8 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M ChangeLog A hqu/hqapi1/app/AlertController.groovy A hqu/hqapi1/app/MetricdataController.groovy A src/org/hyperic/hq/hqapi1/AlertApi.java M src/org/hyperic/hq/hqapi1/HQApi.java M src/org/hyperic/hq/hqapi1/HQConnection.java A src/org/hyperic/hq/hqapi1/MetricDataApi.java M src/org/hyperic/hq/hqapi1/test/AlertDefinitionSyncControlAction_test.java M src/org/hyperic/hq/hqapi1/test/AlertDefinitionTestBase.java A src/org/hyperic/hq/hqapi1/test/AlertDelete_test.java A src/org/hyperic/hq/hqapi1/test/AlertFindByResource_test.java A src/org/hyperic/hq/hqapi1/test/AlertFind_test.java A src/org/hyperic/hq/hqapi1/test/AlertFix_test.java A src/org/hyperic/hq/hqapi1/test/AlertTestBase.java M src/org/hyperic/hq/hqapi1/test/HQApiTestBase.java M src/org/hyperic/hq/hqapi1/test/MaintenanceTestBase.java M src/org/hyperic/hq/hqapi1/test/MetricData_test.java A src/org/hyperic/hq/hqapi1/tools/AlertCommand.java M src/org/hyperic/hq/hqapi1/tools/Shell.java M xsd/HQApi1.xsd Log Message: ----------- Back port AlertApi to 2.x branch. Commit: 183ae6d14911fddb14abd952f8e883d220eca092 http://github.com/hyperic/hqapi/commit/183ae6d14911fddb14abd952f8e883d220eca092 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Log Message: ----------- Merge branch 'hqapi-2.x' |
From: <pn...@hy...> - 2010-05-24 18:41:59
|
Author: pnguyen Date: 2010-05-24 11:41:49 -0700 (Mon, 24 May 2010) New Revision: 14616 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14616 Added: trunk/plugins/vsphere/lib/activation.jar trunk/plugins/vsphere/lib/jsr173_1.0_api.jar Log: vsphere plugin - add hqapi dependency jars Added: trunk/plugins/vsphere/lib/activation.jar =================================================================== (Binary files differ) Property changes on: trunk/plugins/vsphere/lib/activation.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/vsphere/lib/jsr173_1.0_api.jar =================================================================== (Binary files differ) Property changes on: trunk/plugins/vsphere/lib/jsr173_1.0_api.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <kp...@hy...> - 2010-05-24 17:06:37
|
Author: kparikh Date: 2010-05-24 10:06:29 -0700 (Mon, 24 May 2010) New Revision: 14615 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14615 Removed: branches/HQ_4_4/ Log: Deleting temporary branch after 4.4 is merged into trunk. |
From: <no...@gi...> - 2010-05-24 16:54:00
|
Branch: refs/heads/hqapi-2.x Home: http://github.com/hyperic/hqapi Commit: e195f92b1070370972e4196fb4276b99dad1da19 http://github.com/hyperic/hqapi/commit/e195f92b1070370972e4196fb4276b99dad1da19 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M ChangeLog M hqu/hqapi1/plugin.properties Log Message: ----------- Bump to 2.5. |
From: <no...@gi...> - 2010-05-24 16:53:59
|
Branch: refs/heads/master Home: http://github.com/hyperic/hqapi Commit: e195f92b1070370972e4196fb4276b99dad1da19 http://github.com/hyperic/hqapi/commit/e195f92b1070370972e4196fb4276b99dad1da19 Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Changed paths: M ChangeLog M hqu/hqapi1/plugin.properties Log Message: ----------- Bump to 2.5. Commit: 23bb41dc6f1cbe59f43a04b6bcf3e5e138af6ddd http://github.com/hyperic/hqapi/commit/23bb41dc6f1cbe59f43a04b6bcf3e5e138af6ddd Author: Ryan Morgan <rm...@hy...> Date: 2010-05-24 (Mon, 24 May 2010) Log Message: ----------- Merge branch 'hqapi-2.x' |
From: <kp...@hy...> - 2010-05-24 16:15:03
|
Author: kparikh Date: 2010-05-24 09:14:54 -0700 (Mon, 24 May 2010) New Revision: 14613 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14613 Added: tags/HQ_4_3_0_GA/ Log: Tag 4.3.0 GA Copied: tags/HQ_4_3_0_GA (from rev 14602, trunk) |
From: <bo...@hy...> - 2010-05-24 10:27:02
|
Author: bob Date: 2010-05-24 03:26:43 -0700 (Mon, 24 May 2010) New Revision: 14612 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14612 Modified: branches/HQ_4_4/etc/version.properties Log: Release 4.4.0 build #1447 Modified: branches/HQ_4_4/etc/version.properties =================================================================== --- branches/HQ_4_4/etc/version.properties 2010-05-23 10:47:11 UTC (rev 14611) +++ branches/HQ_4_4/etc/version.properties 2010-05-24 10:26:43 UTC (rev 14612) @@ -1,3 +1,3 @@ -#Sun May 23 02:45:28 PDT 2010 +#Mon May 24 02:41:18 PDT 2010 version=4.4.0 -build=1446 +build=1447 |
From: <bo...@hy...> - 2010-05-23 10:47:26
|
Author: bob Date: 2010-05-23 03:47:11 -0700 (Sun, 23 May 2010) New Revision: 14611 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14611 Modified: branches/HQ_4_4/etc/version.properties Log: Release 4.4.0 build #1446 Modified: branches/HQ_4_4/etc/version.properties =================================================================== --- branches/HQ_4_4/etc/version.properties 2010-05-22 10:54:40 UTC (rev 14610) +++ branches/HQ_4_4/etc/version.properties 2010-05-23 10:47:11 UTC (rev 14611) @@ -1,3 +1,3 @@ -#Sat May 22 02:45:02 PDT 2010 +#Sun May 23 02:45:28 PDT 2010 version=4.4.0 -build=1445 +build=1446 |
From: <bo...@hy...> - 2010-05-22 10:54:52
|
Author: bob Date: 2010-05-22 03:54:40 -0700 (Sat, 22 May 2010) New Revision: 14610 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14610 Modified: branches/HQ_4_4/etc/version.properties Log: Release 4.4.0 build #1445 Modified: branches/HQ_4_4/etc/version.properties =================================================================== --- branches/HQ_4_4/etc/version.properties 2010-05-21 20:02:43 UTC (rev 14609) +++ branches/HQ_4_4/etc/version.properties 2010-05-22 10:54:40 UTC (rev 14610) @@ -1,3 +1,3 @@ -#Fri May 21 10:24:14 PDT 2010 +#Sat May 22 02:45:02 PDT 2010 version=4.4.0 -build=1444 +build=1445 |
From: <bo...@hy...> - 2010-05-21 20:02:51
|
Author: bob Date: 2010-05-21 13:02:43 -0700 (Fri, 21 May 2010) New Revision: 14609 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14609 Modified: branches/HQ_4_4/etc/version.properties Log: Updating version to 4.4 Modified: branches/HQ_4_4/etc/version.properties =================================================================== --- branches/HQ_4_4/etc/version.properties 2010-05-21 18:42:06 UTC (rev 14608) +++ branches/HQ_4_4/etc/version.properties 2010-05-21 20:02:43 UTC (rev 14609) @@ -1,3 +1,3 @@ #Fri May 21 10:24:14 PDT 2010 -version=4.3.0 +version=4.4.0 build=1444 |
From: <bo...@hy...> - 2010-05-21 18:42:15
|
Author: bob Date: 2010-05-21 11:42:06 -0700 (Fri, 21 May 2010) New Revision: 14608 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14608 Modified: branches/HQ_4_4/etc/version.properties Log: Release 4.3.0 build #1444 Modified: branches/HQ_4_4/etc/version.properties =================================================================== --- branches/HQ_4_4/etc/version.properties 2010-05-21 06:16:54 UTC (rev 14607) +++ branches/HQ_4_4/etc/version.properties 2010-05-21 18:42:06 UTC (rev 14608) @@ -1,3 +1,3 @@ -#Mon May 17 15:58:06 PDT 2010 +#Fri May 21 10:24:14 PDT 2010 version=4.3.0 -build=1443 +build=1444 |
From: <pn...@hy...> - 2010-05-21 06:17:04
|
Author: pnguyen Date: 2010-05-20 23:16:54 -0700 (Thu, 20 May 2010) New Revision: 14607 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14607 Modified: branches/HQ_4_4/build.xml Log: updated for vsphere plugin Modified: branches/HQ_4_4/build.xml =================================================================== --- branches/HQ_4_4/build.xml 2010-05-21 06:14:59 UTC (rev 14606) +++ branches/HQ_4_4/build.xml 2010-05-21 06:16:54 UTC (rev 14607) @@ -31,6 +31,7 @@ <!-- Native libs --> <property name="hq.bin" location="hq_bin" /> + <property name="hqapi.lib" location="ui_plugins/hqapi1/lib" /> <property name="lather.lib" location="${hq.bin}/lather_bin" /> <property name="sigar.lib" location="${hq.bin}/sigar_bin/lib" /> <property name="db2monitor.dir" location="${hq.bin}/db2monitor_bin"/> @@ -258,6 +259,7 @@ <include name="*/src"/> <exclude name="xen/src"/> <exclude name="vim/src"/> + <exclude name="vsphere/src"/> <exclude name="spring/src"/> </dirset> </src> @@ -270,15 +272,20 @@ <path refid="alljars" /> <path refid="testjars" /> <path location="${build.dir}/classes"/> + <path> + <fileset dir="${hqapi.lib}" includes="hqapi*.jar" /> + </path> </classpath> <src> <path location="${basedir}/plugins/xen/src" /> <path location="${basedir}/plugins/vim/src" /> + <path location="${basedir}/plugins/vsphere/src" /> <path location="${basedir}/plugins/spring/src/main/java" /> </src> <include name="org/hyperic/hq/plugin/xen/**"/> <include name="com/xensource/**"/> <include name="org/hyperic/hq/plugin/vim/**"/> + <include name="org/hyperic/hq/plugin/vsphere/**"/> <include name="org/hyperic/hq/plugin/spring/**"/> </hq-javac> </target> @@ -1021,6 +1028,8 @@ <!-- for CollectorThread --> <include name="backport-util-concurrent-3.1.jar"/> </fileset> + <!-- for vsphere plugin --> + <fileset dir="${hqapi.lib}" includes="hqapi*.jar" /> </copy> <!-- product.jmx.* has to be loaded from the plugin ClassLoader --> @@ -1148,6 +1157,8 @@ <hqplugin name="vmware"/> + <hqplugin name="vsphere"/> + <hqplugin name="xen"> <!-- XXX Xen sdk built w/ 1.6 + mods for Xen 4.0 compat --> <fileset dir="${build.dir}/classes" |
From: <pn...@hy...> - 2010-05-21 06:15:09
|
Author: pnguyen Date: 2010-05-20 23:14:59 -0700 (Thu, 20 May 2010) New Revision: 14606 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14606 Added: branches/HQ_4_4/plugins/vsphere/lib/License.txt branches/HQ_4_4/plugins/vsphere/lib/dom4j-1.6.1.jar branches/HQ_4_4/plugins/vsphere/lib/mo.jar Log: vsphere plugin - initial checkin from github (5/18/2010) Added: branches/HQ_4_4/plugins/vsphere/lib/License.txt =================================================================== --- branches/HQ_4_4/plugins/vsphere/lib/License.txt (rev 0) +++ branches/HQ_4_4/plugins/vsphere/lib/License.txt 2010-05-21 06:14:59 UTC (rev 14606) @@ -0,0 +1,30 @@ +dom4j - http://www.dom4j.org/dom4j-1.6.1/license.html + +mo.jar (vijava2b320090522) - http://sourceforge.net/projects/vijava + +Copyright (c) 2008 VMware, Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +* Neither the name of VMware, Inc. nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. Added: branches/HQ_4_4/plugins/vsphere/lib/dom4j-1.6.1.jar =================================================================== (Binary files differ) Property changes on: branches/HQ_4_4/plugins/vsphere/lib/dom4j-1.6.1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: branches/HQ_4_4/plugins/vsphere/lib/mo.jar =================================================================== (Binary files differ) Property changes on: branches/HQ_4_4/plugins/vsphere/lib/mo.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
Author: dcrutchf Date: 2010-05-20 14:22:43 -0700 (Thu, 20 May 2010) New Revision: 14604 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14604 Modified: branches/HQ_4_4/installer/data/db-upgrade.xml branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/AuthzSession.java branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java branches/HQ_4_4/src/org/hyperic/hq/authz/shared/AuthzConstants.java branches/HQ_4_4/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy Log: Added a resource relation for the virtual hierarchy Added methods for getting parent/child edges and querying edges by name Modified: branches/HQ_4_4/installer/data/db-upgrade.xml =================================================================== --- branches/HQ_4_4/installer/data/db-upgrade.xml 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/installer/data/db-upgrade.xml 2010-05-20 21:22:43 UTC (rev 14604) @@ -11241,105 +11241,105 @@ AND (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm WHERE rm.role_id = r.id AND rm.operation_id = 415) = 0 </statement> - <statement desc="Adding create server permission, if platform permissions have create or delete (i.e. full permission) and create server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 303 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 303) = 0 - </statement> + <statement desc="Adding create server permission, if platform permissions have create or delete (i.e. full permission) and create server permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 303 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 303) = 0 + </statement> <statement desc="Adding delete server permission, if platform permissions have create or delete (i.e. full permission) and delete server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 308 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 308) = 0 - </statement> - <statement desc="Adding modify server permission, if platform permissions have create or delete (i.e. full permission) and modify server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 307 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 307) = 0 - </statement> - <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and view server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 311 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 311) = 0 - </statement> - <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and manage alert server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 401 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 401) = 0 - </statement> - <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and control server permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 326 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 326) = 0 - </statement> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 308 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 308) = 0 + </statement> + <statement desc="Adding modify server permission, if platform permissions have create or delete (i.e. full permission) and modify server permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 307 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 307) = 0 + </statement> + <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and view server permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 311 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 311) = 0 + </statement> + <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and manage alert server permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 401 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 401) = 0 + </statement> + <statement desc="Adding view server permission, if platform permissions have create or delete (i.e. full permission) and control server permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 326 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 320 or rm.operation_id = 302)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 326) = 0 + </statement> <statement desc="Adding create service permission, if server permissions have create or delete (i.e. full permission) and create service permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 309 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 309) = 0 - </statement> - <statement desc="Adding delete service permission, if server permissions have create or delete (i.e. full permission) and delete service permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 314 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 314) = 0 - </statement> - <statement desc="Adding modify service permission, if server permissions have create or delete (i.e. full permission) and modify service permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 313 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 313) = 0 - </statement> - <statement desc="Adding view service permission, if server permissions have create or delete (i.e. full permission) and view service permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 315 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 315) = 0 - </statement> - <statement desc="Adding view service permission, if server permissions have create or delete (i.e. full permission) and manage alerts service permission does not exist..."> - INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) - SELECT distinct m.role_id, 402 FROM EAM_ROLE r - INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id - WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and - (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm - WHERE rm.role_id = r.id AND rm.operation_id = 402) = 0 - </statement> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 309 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 309) = 0 + </statement> + <statement desc="Adding delete service permission, if server permissions have create or delete (i.e. full permission) and delete service permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 314 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 314) = 0 + </statement> + <statement desc="Adding modify service permission, if server permissions have create or delete (i.e. full permission) and modify service permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 313 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 313) = 0 + </statement> + <statement desc="Adding view service permission, if server permissions have create or delete (i.e. full permission) and view service permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 315 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 315) = 0 + </statement> + <statement desc="Adding view service permission, if server permissions have create or delete (i.e. full permission) and manage alerts service permission does not exist..."> + INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) + SELECT distinct m.role_id, 402 FROM EAM_ROLE r + INNER JOIN EAM_ROLE_OPERATION_MAP m on r.id = m.role_id + WHERE (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND (rm.operation_id = 303 or rm.operation_id = 308)) = 2 and + (SELECT count(*) FROM EAM_ROLE_OPERATION_MAP rm + WHERE rm.role_id = r.id AND rm.operation_id = 402) = 0 + </statement> <statement desc="Adding view service permission, if server permissions have create or delete (i.e. full permission) and control service permission does not exist..."> INSERT INTO EAM_ROLE_OPERATION_MAP(ROLE_ID, OPERATION_ID) SELECT distinct m.role_id, 327 FROM EAM_ROLE r @@ -11467,6 +11467,13 @@ ]]> </groovy> </schemaSpec> + <schemaSpec version="3.196"> + <schema-directSQL> + <statement desc="Adding virtual resource relation..."> + INSERT INTO EAM_RESOURCE_RELATION(ID, NAME, IS_HIER) VALUES (3, 'virtual', 1) + </statement> + </schema-directSQL> + </schemaSpec> </dbupgrade> </target> </project> Modified: branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/AuthzSession.java =================================================================== --- branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/AuthzSession.java 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/AuthzSession.java 2010-05-20 21:22:43 UTC (rev 14604) @@ -189,6 +189,14 @@ return getResourceRelation(AuthzConstants.RELATION_NETWORK_ID); } + /** + * + * @ejb:interface-method + */ + public ResourceRelation getVirtualRelation() { + return getResourceRelation(AuthzConstants.RELATION_VIRTUAL_ID); + } + private ResourceRelation getResourceRelation(Integer relationId) { return getResourceRelationDAO().findById(relationId); } Modified: branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java =================================================================== --- branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceEdgeDAO.java 2010-05-20 21:22:43 UTC (rev 14604) @@ -201,6 +201,68 @@ .executeUpdate(); } + // Retrieve the parent of a given resource, if one exists, otherwise return null + ResourceEdge getParentEdge(Resource resource, ResourceRelation relation) { + String hql = "from ResourceEdge re " + + "where re.from=:from and distance=-1 and relation=:relation"; + Iterator iterator = getSession().createQuery(hql) + .setParameter("from", resource) + .setParameter("relation", relation) + .iterate(); + + if (iterator.hasNext()) { + return (ResourceEdge) iterator.next(); + } + + return null; + } + + // Retrieve the children of a given resource, base on the relation + List findChildEdges(Resource resource, ResourceRelation relation) { + String hql = "from ResourceEdge re " + + "where re.from=:from and distance=1 and relation=:relation"; + + return getSession().createQuery(hql) + .setParameter("from", resource) + .setParameter("relation", relation) + .list(); + } + + List findByName(String name, ResourceRelation relation) { + String hql = "from ResourceEdge re " + + "where re.from.name like :name and distance=0 and relation=:relation"; + + return getSession().createQuery(hql) + .setParameter("name", "%" + name + "%") + .setParameter("relation", relation) + .list(); + } + + // Checks whether or not a given resource has any direct children + boolean hasChildren(Resource resource, ResourceRelation relation) { + String hql = "select count(re) from ResourceEdge re " + + "where re.from=:from and distance=:distance and relation=:relation"; + + int result = ((Integer) getSession().createQuery(hql) + .setParameter("from", resource) + .setParameter("relation", relation) + .setInteger("distance", 1) + .iterate().next()).intValue(); + + return result > 0; + } + + // Returns the number of descendants of a given resource + int getDescendantCount(Resource resource, ResourceRelation relation) { + String hql = "select count(re) from ResourceEdge re " + + "where re.from=:from and distance > 0 and relation=:relation"; + + return ((Integer) getSession().createQuery(hql) + .setParameter("from", resource) + .setParameter("relation", relation) + .iterate().next()).intValue(); + } + boolean isResourceChildOf(Resource parent, Resource child) { String sql = "from ResourceEdge re " + "where re.from=:from and re.to=:to and distance=:distance and rel_id=:rel_id"; Modified: branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java =================================================================== --- branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/src/org/hyperic/hq/authz/server/session/ResourceManagerEJBImpl.java 2010-05-20 21:22:43 UTC (rev 14604) @@ -690,11 +690,67 @@ public boolean isResourceChildOf(Resource parent, Resource child) { return getResourceEdgeDAO().isResourceChildOf(parent, child); } + + /** + * + * @ejb:interface-method + */ + public boolean hasChildResourceEdges(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().hasChildren(resource, relation); + } + + /** + * + * @ejb:interface-method + */ + public int getDescendantResourceEdgeCount(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().getDescendantCount(resource, relation); + } + + /** + * + * @ejb:interface-method + */ + public Collection findChildResourceEdges(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().findChildEdges(resource, relation); + } + + /** + * + * @ejb:interface-method + */ + public Collection findDescendantResourceEdges(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().findDescendantEdges(resource, relation); + } + + /** + * + * @ejb:interface-method + */ + public Collection findAncestorResourceEdges(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().findAncestorEdges(resource, relation); + } /** * * @ejb:interface-method */ + public Collection findResourceEdgesByName(String name, ResourceRelation relation) { + return getResourceEdgeDAO().findByName(name, relation); + } + + /** + * + * @ejb:interface-method + */ + public ResourceEdge getParentResourceEdge(Resource resource, ResourceRelation relation) { + return getResourceEdgeDAO().getParentEdge(resource, relation); + } + + /** + * + * @ejb:interface-method + */ public List findResourceEdges(ResourceRelation relation, Integer resourceId, List platformTypeIds, @@ -947,7 +1003,7 @@ } ZeventManager.getInstance().enqueueEventsAfterCommit(events); } - + public static ResourceManagerLocal getOne() { try { return ResourceManagerUtil.getLocalHome().create(); Modified: branches/HQ_4_4/src/org/hyperic/hq/authz/shared/AuthzConstants.java =================================================================== --- branches/HQ_4_4/src/org/hyperic/hq/authz/shared/AuthzConstants.java 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/src/org/hyperic/hq/authz/shared/AuthzConstants.java 2010-05-20 21:22:43 UTC (rev 14604) @@ -190,8 +190,10 @@ // Resource Relation constants public static final Integer RELATION_CONTAINMENT_ID = new Integer(1); public static final Integer RELATION_NETWORK_ID = new Integer(2); + public static final Integer RELATION_VIRTUAL_ID = new Integer(3); public static final String ResourceEdgeContainmentRelation = "containment"; public static final String ResourceEdgeNetworkRelation = "network"; + public static final String ResourceEdgeVirtualRelation = "virtual"; // List of alert operations public static final String[] VIEW_ALERTS_OPS = Modified: branches/HQ_4_4/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy =================================================================== --- branches/HQ_4_4/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy 2010-05-18 23:37:47 UTC (rev 14603) +++ branches/HQ_4_4/src/org/hyperic/hq/hqu/rendit/helpers/ResourceHelper.groovy 2010-05-20 21:22:43 UTC (rev 14604) @@ -267,11 +267,13 @@ */ Collection findResourceEdges(String resourceRelation, Resource parent) { def edges = [] + if (resourceRelation.equals(AuthzConstants.ResourceEdgeNetworkRelation)) { edges = rman.findResourceEdges(rman.getNetworkRelation(), parent) } else if (resourceRelation.equals(AuthzConstants.ResourceEdgeContainmentRelation)) { edges = rman.findResourceEdges(rman.getContainmentRelation(), parent) } + return edges } @@ -314,7 +316,78 @@ } return edges } - + + /** + * Find the child resources of a resource using the virtual relation + * + * @return a List of {@link Resource}s + */ + Collection findChildResourcesByVirtualRelation(Resource resource) { + def resourceEdges = rman.findChildResourceEdges(resource, rman.getVirtualRelation()) + + return resourceEdges.collect { edge -> edge.to } + } + + /** + * Find all descendant resources of a resource using the virtual relation + * + * @return a List of {@link Resource}s + */ + Collection findDescendantResourcesByVirtualRelation(Resource resource) { + def resourceEdges = rman.findDescendantResourceEdges(resource, rman.getVirtualRelation()) + + return resourceEdges.collect { edge -> edge.to } + } + + /** + * Find all ancestors of a resource using the virtual relation + * + * @return a List of {@link Resource}s + */ + Collection findAncestorsByVirtualRelation(Resource resource) { + def resourceEdges = rman.findAncestorResourceEdges(resource, rman.getVirtualRelation()) + + return resourceEdges.collect { edge -> edge.to } + } + + /** + * Find all resources in a virtual relation that contain the supplied name string + * + * @return a List of {@link Resource}s + */ + Collection findResourcesByNameAndVirtualRelation(String name) { + def resourceEdges = rman.findResourceEdgesByName(name, rman.getVirtualRelation()) + + return resourceEdges.collect { edge -> edge.from } + } + + /** + * + */ + Resource getParentResourceByVirtualRelation(Resource resource) { + def resourceEdges = rman.getParentResourceEdge(resource, rman.getVirtualRelation()) + + return resourceEdges?.to + } + + /** + * Check whether or not a resource has children using the virtual relation + * + * @return boolean + */ + boolean hasChildResourcesByVirtualRelation(Resource resource) { + return rman.hasChildResourceEdges(resource, rman.getVirtualRelation()) + } + + /** + * Returns the number of descendant resources using the virtual relation + * + * @return boolean + */ + int getDescendantResourceCountByVirtualRelation(Resource resource) { + return rman.getDescendantResourceEdgeCount(resource, rman.getVirtualRelation()) + } + List findParentPlatformsByNetworkRelation(String prototype, String name, Boolean hasChildren) { def platformType = null def platformTypeIds = null |
From: Doug M. <do...@hy...> - 2010-05-19 20:13:04
|
SIGAR doesn't provide this info. Recommend you try: http://www.yourkit.com/ |