Topic Text   Topic Comments (0)   Topic Properties   Topic Information test@tes...
Topic title: test Tuesday May 4, 2010 05:15:25

Download topic text | View in monospace font | Tab width set to 8 (change to 4)

Files in topic:  
[Jump to] Core.NotificationManager/src/com/dhyan/component/notification/NotificationConstants.java  6048   {+2,-0}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/MapSymbolVO.java  6048   {+41,-2}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/ResourceConfigurationUtil.java  0   {+76,-0}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/datamodel/Resourcedetails.java  6048   {+40,-0}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/ejb/ResourceManagerFacade.java  6048   {+91,-41}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/interfaces/ResourceManager.java  6048   {+1,-1}
[Jump to] Core.ResourceManager/src/com/dhyan/nms/server/resource/interfaces/ResourceManagerFacadeLocal.java  6048   {+5,-5}
[Jump to] Core.SecurityManager/build.xml  6048   {+1,-0}
[Jump to] Core.SecurityManager/src/com/dhyan/component/security/LoginCheck.java  6048   {+72,-5}
[Jump to] Core.SecurityManager/src/com/dhyan/component/security/UserDetails.java  0   {+84,-0}
[Jump to] Core.SecurityManager/src/com/dhyan/component/security/UserSession.java  0   {+106,-0}
[Jump to] Core.SecurityManager/src/com/dhyan/component/security/useradmin/ejb/SecurityFacadeBean.java  6048   {+204,-18}
[Jump to] Core.SecurityManager/src/com/dhyan/component/security/useradmin/interfaces/SecurityFacadeLocal.java  6048   {+19,-0}
[Jump to] Core.ServerDetails/resources/FaultConfiguration.properties  0   {+4,-0}
[Jump to] Core.ServerDetails/resources/ResourceConfiguration.properties  0   {+6,-0}
[Jump to] Core.ServerDetails/resources/ThreadSchedulerConfig.xml  6048   {+1,-0}
[Jump to] Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/AlarmManager.java  6048   {+33,-0}
[Jump to] Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/ejb/AlarmReportFacadeBean.java  6048   {+1,-1}
[Jump to] Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/purging/PurgeAlarmByCountScheduler.java  6048   {+1,-1}
[Jump to] Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/purging/PurgeAlarmByIntervalScheduler.java  6048   {+1,-1}
[Jump to] Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/ejb/SyslogParserSessionBean.java  6048   {+1,-1}
[Jump to] Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/jj/SysLogParser.jj  6048   {+1,-1}
[Jump to] Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/purging/PurgeSyslogByCountScheduler.java  6048   {+1,-1}
[Jump to] Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/purging/PurgeSyslogByIntervalScheduler.java  6048   {+1,-1}
[Jump to] Lib.SmartGrid/WebContent/webresource/webcomponents/smartgrid/scripts/DNMSSmartGrid.js  6048   {+1,-1}
[Jump to] Perf.DataCollection/src/com/dhyan/nms/server/performance/datacollection/ejb/DataCollectionFacade.java  6048   {+1,-1}
[Jump to] Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/HistoricalDataObject.java  6048   {+18,-0}
[Jump to] Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/ejb/ReportingFacade.java  6048   {+21,-2}
[Jump to] Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/BaseHistoricalDataRetriever.java  6048   {+204,-17}
[Jump to] Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/SnmpHistoricalDataRetriever.java  6048   {+153,-90}
[Jump to] Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/SnmpHistoricalDataRetrieverOracle.java  0   {+361,-0}
[Jump to] Perf.ThresholdManager/.classpath  6048   {+1,-0}
[Jump to] Perf.ThresholdManager/build.xml  6048   {+1,-0}
[Jump to] Perf.ThresholdManager/src/com/dhyan/nms/server/performance/threshold/ThresholdAssociation.java  6048   {+25,-0}
[Jump to] Perf.ThresholdManager/src/com/dhyan/nms/server/performance/threshold/ejb/ThresholdAssociationMDBean.java  6048   {+2,-26}
[Jump to] Tools.DBOperation/src/com/dhyan/nms/server/dboperation/RestoreOperationProcess.java  6048   {+1,-1}
[Jump to] Util.XmlUtility/src/com/dhyan/nms/client/model/WebTreeNode.java  6048   {+23,-1}
[Jump to] Util.XmlUtility/src/com/dhyan/nms/client/model/WebTreeResourceNode.java  6048   {+1,-0}
[Jump to] Web.BaseModule/WebContent/WEB-INF/properties/loginManager.properties  6048   {+2,-0}
[Jump to] Web.BaseModule/WebContent/jsp/DNMSIndex.jsp  6048   {+1,-1}
[Jump to] Web.BaseModule/WebContent/webresource/webbase/scripts/LoginManager.js  6048   {+26,-4}
[Jump to] Web.BaseModule/WebContent/webresource/webcomponents/divider/theme/grey/css/divider.css  6048   {+1,-1}
[Jump to] Web.BaseModule/WebContent/webresource/webcomponents/table/scripts/Table.js  6048   {+2,-0}
[Jump to] Web.BaseModule/WebContent/webresource/webcomponents/table/scripts/VerticalTable.js  6048   {+12,-0}
[Jump to] Web.BaseModule/src/com/dhyan/nms/client/webclient/webbase/notification/SecurityUserKillNotificationProcessor.java  0   {+48,-0}
[Jump to] Web.BaseModule/src/com/dhyan/nms/client/webclient/webbase/struts/HTTPSessionListner.java  6048   {+2,-0}
[Jump to] Web.BaseModule/src/com/dhyan/nms/client/webclient/webbase/struts/UserDetails.java  6048   {+0,-84}
[Jump to] Web.BaseModule/src/com/dhyan/nms/client/webclient/webbase/struts/UserSession.java  6048   {+0,-105}
[Jump to] Web.Chart/src/com/dhyan/component/chart/datasethandlers/BarChart2ColumnDataSetHandler.java  6048   {+2,-2}
[Jump to] Web.Chart/src/com/dhyan/component/chart/datasethandlers/BarChart3ColumnDataSetHandler.java  6048   {+1,-1}
[Jump to] Web.Chart/src/com/dhyan/component/chart/datasethandlers/PieChartDataSetHandler.java  6048   {+1,-2}
[Jump to] Web.Fault/WebContent/jsp/fault/SyslogDetails.jsp  6048   {+31,-6}
[Jump to] Web.Fault/WebContent/webresource/fault/scripts/DNMSAlarmForwarder.js  6048   {+2,-2}
[Jump to] Web.Fault/WebContent/webresource/fault/scripts/DNMSFault.js  6048   {+2,-2}
[Jump to] Web.Fault/WebContent/webresource/fault/scripts/FaultTabUtility.js  6048   {+2,-4}
[Jump to] Web.Inventory/WebContent/jsp/inventory/InventoryDetails.jsp  6048   {+1,-1}
[Jump to] Web.Inventory/WebContent/resources/conf/ResourceConfiguration.xml  6048   {+4,-2}
[Jump to] Web.Inventory/src/com/dhyan/nms/client/webclient/inventory/struts/InventoryDetailsAction.java  6048   {+12,-4}
[Jump to] Web.MIBBrowser/WebContent/jsp/mibbrowser/MIBBrowser.jsp  6048   {+21,-21}
[Jump to] Web.Performance/WebContent/jsp/performance/AddTaskSchedule.jsp  6048   {+3,-3}
[Jump to] Web.Performance/WebContent/webresource/dashboard/scripts/DashboardConfigurator.js  6048   {+2,-1}
[Jump to] Web.Performance/WebContent/webresource/performance/scripts/PerformanceStatisticsManager.js  6048   {+11,-4}
[Jump to] Web.Performance/WebContent/webresource/performance/scripts/StatisticsCharts.js  6048   {+13,-23}
[Jump to] Web.Performance/WebContent/webresource/performance/scripts/TaskScheduleManager.js  6048   {+1,-1}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/dashboard/retriever/AvailabilityDashboardRetriever.java  6048   {+2,-0}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/dashboard/retriever/DashboardRetrieverIfc.java  6048   {+1,-1}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/dashboard/retriever/PMStatsDashboardRetriever.java  6048   {+2,-0}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/dashboard/struts/DashboardHistoricalChart.java  6048   {+6,-0}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/performance/struts/PerformanceChartWebUtil.java  6048   {+0,-2}
[Jump to] Web.Performance/src/com/dhyan/nms/client/webclient/performance/struts/PerformanceStatisticsAction.java  6048   {+2,-0}
[Jump to] Web.Security/.classpath  6048   {+22,-20}
[Jump to] Web.Security/WebContent/WEB-INF/properties/SecurityManagerAction.properties  6048   {+5,-1}
[Jump to] Web.Security/WebContent/WEB-INF/properties/groupManagement.properties  6048   {+4,-1}
[Jump to] Web.Security/WebContent/webresource/security/scripts/SecurityGroupManager.js  6048   {+135,-40}
[Jump to] Web.Security/WebContent/webresource/security/scripts/SecurityUserManager.js  6048   {+14,-0}
[Jump to] Web.Security/build.xml  6048   {+6,-0}
[Jump to] Web.Security/src/com/dhyan/nms/client/webclient/security/struts/LogoutAction.java  6048   {+1,-1}
[Jump to] Web.Security/src/com/dhyan/nms/client/webclient/security/struts/SecurityManagerAction.java  6048   {+164,-101}
[Jump to] Web.Security/src/com/dhyan/nms/client/webclient/security/util/SecurityHelper.java  0   {+213,-0}
[Jump to] Web.Topology/WebContent/jsp/topology/NewGroup.jsp  6048   {+10,-1}
[Jump to] Web.Topology/WebContent/webresource/topology/scripts/ResourceTreeManager.js  6048   {+17,-2}
[Jump to] Web.Topology/WebContent/webresource/topology/scripts/TopologyMapHelper.js  6048   {+1,-1}
[Jump to] Web.Topology/src/com/dhyan/nms/client/webclient/resourcetreemanager/struts/ResourceManagerAction.java  6048   {+1,-1}
[Jump to] dnms/resources/conf/server/deploy/hornetq.sar/hornetq-jms.xml  6048   {+5,-0}
[Jump to] dnms/resources/dbspecific/derby/schema/dnms_audittrails.sql  6048   {+2,-2}
[Jump to] dnms/resources/dbspecific/derby/schema/dnms_security.sql  6048   {+4,-4}
[Jump to] dnms/resources/dbspecific/derby/schema/dnms_topology.sql  6048   {+1,-0}
[Jump to] dnms/resources/dbspecific/mssql/schema/dnms_audittrails.sql  6048   {+2,-2}
[Jump to] dnms/resources/dbspecific/mssql/schema/dnms_security.sql  6048   {+4,-4}
[Jump to] dnms/resources/dbspecific/mssql/schema/dnms_topology.sql  6048   {+1,-0}
[Jump to] dnms/resources/dbspecific/mysql/schema/dnms_audittrails.sql  6048   {+2,-2}
[Jump to] dnms/resources/dbspecific/mysql/schema/dnms_security.sql  6048   {+4,-4}
[Jump to] dnms/resources/dbspecific/mysql/schema/dnms_topology.sql  6048   {+1,-0}
[Jump to] dnms/resources/dbspecific/oracle/schema/dnms_audittrails.sql  6048   {+2,-2}
[Jump to] dnms/resources/dbspecific/oracle/schema/dnms_security.sql  6048   {+4,-4}
[Jump to] dnms/resources/dbspecific/oracle/schema/dnms_topology.sql  6048   {+1,-0}

[Add General Comment] to topic.

File Core.NotificationManager/src/com/dhyan/component/notification/NotificationConstants.java (Revision 6048) [Add File Comment] [Top] [>>]
 
Line 27 | Parallel Line 27 | Parallel
27 public static final String NOTIFICATION_TOPIC_DISCOVERY_PROGRESS = "topic/discoveryprogress"; 27 public static final String NOTIFICATION_TOPIC_DISCOVERY_PROGRESS = "topic/discoveryprogress";
28 public static final String NOTIFICATION_TOPIC_DBBACKUP = "topic/databasebackup"; 28 public static final String NOTIFICATION_TOPIC_DBBACKUP = "topic/databasebackup";
29 public static final String NOTIFICATION_TOPIC_DBBACKUP_PROGRESS = "topic/progressupdate"; 29 public static final String NOTIFICATION_TOPIC_DBBACKUP_PROGRESS = "topic/progressupdate";
30 public static final String NOTIFICATION_TOPIC_SECURITY_KILL_USER = "topic/securityKillUserTopic";
30 31
31 public static final String NOTIFICATION_SECURITY_USER_JS = "SecurityUserManager.securityUserNotificationHandler"; 32 public static final String NOTIFICATION_SECURITY_USER_JS = "SecurityUserManager.securityUserNotificationHandler";
32 public static final String NOTIFICATION_SECURITY_GROUP_JS = "SecurityGroupManager.securityGroupNotificationHandler"; 33 public static final String NOTIFICATION_SECURITY_GROUP_JS = "SecurityGroupManager.securityGroupNotificationHandler";
 
 
Line 48 | Parallel Line 49 | Parallel
48 public static final String NOTIFICATION_RESOURCE_GROUP_MOVED_JS = "groupMovedNotificationHandler"; 49 public static final String NOTIFICATION_RESOURCE_GROUP_MOVED_JS = "groupMovedNotificationHandler";
49 public static final String NOTIFICATION_RESOURCE_GROUP_UPDATED_JS = "groupUpdatedNotificationHandler"; 50 public static final String NOTIFICATION_RESOURCE_GROUP_UPDATED_JS = "groupUpdatedNotificationHandler";
50 public static final String NOTIFICATION_RESOURCE_GROUP_DELETED_JS = "groupDeletedNotificationHandler"; 51 public static final String NOTIFICATION_RESOURCE_GROUP_DELETED_JS = "groupDeletedNotificationHandler";
52 public static final String NOTIFICATION_SECURITY_KILL_USER_JS = "SecurityUserManager.securityKillUserNotificationHandler";
51 53
52 public static final String NOTIFICATION_WEB_RESOURCE = "webresource"; 54 public static final String NOTIFICATION_WEB_RESOURCE = "webresource";
53 public static final String NOTIFICATION_WEB_RESOURCE_ADDED = "webresourceadded"; 55 public static final String NOTIFICATION_WEB_RESOURCE_ADDED = "webresourceadded";
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/MapSymbolVO.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 14 | Parallel Line 14 | Parallel
14 { 14 {
15 private static final Log LOGGER = LogFactory.getLog(MapSymbolVO.class); 15 private static final Log LOGGER = LogFactory.getLog(MapSymbolVO.class);
16 private String name; 16 private String name;
17 private String displayName;
17 private String groupName; 18 private String groupName;
18 private long groupId; 19 private long groupId;
19 private String ipaddress; 20 private String ipaddress;
 
 
Line 564 | Parallel Line 565 | Parallel
564 } 565 }
565 566
566 /** 567 /**
568 * @return the displayName
569 */
570 public String getDisplayName()
571 {
572 return displayName;
573 }
574
575 /**
576 * @param displayNameParam the displayName to set
577 */
578 public void setDisplayName(final String displayNameParam)
579 {
580 this.displayName = displayNameParam;
581 }
582
583 /**
567 * Convert MapSymbolVO to GoogleMap JSON Details 584 * Convert MapSymbolVO to GoogleMap JSON Details
568 * @return JSONObject JSONObject 585 * @return JSONObject JSONObject
569 */ 586 */
570 public JSONObject toGMapJSON() 587 public JSONObject toGMapJSON()
571 { 588 {
572 JSONObject resultJSON = this.toResourceDetailsJSON(); // Get the Resource related JSON then go on with GMap related JSON values. 589 JSONObject resultJSON = this.toResourceDetailsJSON(); // Get the
590 // Resource
591 // related JSON
592 // then go on
593 // with GMap
594 // related JSON
595 // values.
573 try 596 try
574 { 597 {
575 resultJSON.put("groupId", this.getGroupId()); 598 resultJSON.put("groupId", this.getGroupId());
 
 
Line 585 | Parallel Line 608 | Parallel
585 { 608 {
586 resultJSON.put("name", this.getName()); 609 resultJSON.put("name", this.getName());
587 } 610 }
611 if (this.getDisplayName() != null)
612 {
613 resultJSON.put("displayName", this.getDisplayName());
614 }
588 if (this.getGroupName() != null) 615 if (this.getGroupName() != null)
589 { 616 {
590 resultJSON.put("groupName", this.getGroupName()); 617 resultJSON.put("groupName", this.getGroupName());
 
 
Line 635 | Parallel Line 662 | Parallel
635 } 662 }
636 663
637 /** 664 /**
638 * returns only the resource details which are needed to construct the Grid Map View. 665 * returns only the resource details which are needed to construct the Grid
666 * Map View.
639 * @return JSONObject JSONObject 667 * @return JSONObject JSONObject
640 */ 668 */
641 public JSONObject toResourceDetailsJSON() 669 public JSONObject toResourceDetailsJSON()
 
 
Line 651 | Parallel Line 679 | Parallel
651 { 679 {
652 resultJSON.put("resourceName", this.getName()); 680 resultJSON.put("resourceName", this.getName());
653 } 681 }
682 if (this.getDisplayName() != null)
683 {
684 resultJSON.put("displayName", this.getDisplayName());
685 }
686 else if (this.getName() != null && this.getIpaddress() != null)
687 {
688
689 this.setDisplayName(this.getName() + "-" + this.getIpaddress());
690 resultJSON.put("displayName", this.getDisplayName());
691 }
654 if (this.getIpaddress() != null) 692 if (this.getIpaddress() != null)
655 { 693 {
656 resultJSON.put("ipAddress", this.getIpaddress()); 694 resultJSON.put("ipAddress", this.getIpaddress());
 
 
Line 683 | Parallel Line 721 | Parallel
683 } 721 }
684 return resultJSON; 722 return resultJSON;
685 } 723 }
724
686 } 725 }
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/ResourceConfigurationUtil.java (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 package com.dhyan.nms.server.resource;
2
3 import java.io.File;
4 import java.io.FileInputStream;
5 import java.io.IOException;
6 import java.util.Properties;
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9 import com.dhyan.nms.conf.ServerSettings;
10
11 public final class ResourceConfigurationUtil
12 {
13
14 private static Log log = LogFactory.getLog(ResourceConfigurationUtil.class.getName());
15 private static ResourceConfigurationUtil resourceConfigurator = null;
16 private static final String RESOURCE_CONFIG_FILE = ServerSettings.getConfDir() + File.separatorChar + "ResourceConfiguration.properties";
17
18 private Properties resourceProperties = null;
19
20 private ResourceConfigurationUtil()
21 {
22 loadResourceConfigurationProperties();
23 }
24
25 /**
26 * Singleton
27 * @return PerformanceTasksCreator
28 */
29 public static synchronized ResourceConfigurationUtil getInstance()
30 {
31 if (resourceConfigurator == null)
32 {
33 resourceConfigurator = new ResourceConfigurationUtil();
34 }
35 return resourceConfigurator;
36 }
37
38 /**
39 * Reinitialize this class to null
40 */
41 public static void reInitialize()
42 {
43 resourceConfigurator = null;
44 }
45
46 /**
47 * @param key format
48 * @return Value associated with the key
49 */
50 public String getValue(final String key)
51 {
52 return resourceProperties.getProperty(key);
53 }
54
55 /**
56 * @return true if resource name only is considered for displaying purpose
57 */
58 public boolean isResourceNameOnly()
59 {
60 return resourceProperties.getProperty("resourceDetails.displayName.Format").equals("RESOURCE_NAME_ONLY");
61 }
62
63 private void loadResourceConfigurationProperties()
64 {
65 try
66 {
67 resourceProperties = new Properties();
68 resourceProperties.load(new FileInputStream(new File(RESOURCE_CONFIG_FILE)));
69 }
70 catch (IOException e)
71 {
72 log.error("Error in load Resource Configuration Properties " + e.getStackTrace());
73 }
74 }
75
76 }
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/datamodel/Resourcedetails.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 20 | Parallel Line 20 | Parallel
20 import org.apache.log4j.Category; 20 import org.apache.log4j.Category;
21 21
22 import com.dhyan.nms.datamodel.common.EJBBaseEntity; 22 import com.dhyan.nms.datamodel.common.EJBBaseEntity;
23 import com.dhyan.nms.server.resource.ResourceConfigurationUtil;
23 /** 24 /**
24 * @author kesavan 25 * @author kesavan
25 */ 26 */
 
 
Line 123 | Parallel Line 124 | Parallel
123 private String ipaddress; 124 private String ipaddress;
124 @Column(name = "subnetmask", nullable = false) 125 @Column(name = "subnetmask", nullable = false)
125 private String subnetmask; 126 private String subnetmask;
127 @Column(name = "displayname", nullable = false)
128 private String displayName;
126 @Column(name = "resourcename", nullable = false) 129 @Column(name = "resourcename", nullable = false)
127 private String resourcename; 130 private String resourcename;
128 @Transient 131 @Transient
 
 
Line 133 | Parallel Line 136 | Parallel
133 */ 136 */
134 public Resourcedetails() 137 public Resourcedetails()
135 { 138 {
139
136 } 140 }
137 141
138 /** 142 /**
 
 
Line 186 | Parallel Line 190 | Parallel
186 this.resourcename = resourcenameArg; 190 this.resourcename = resourcenameArg;
187 } 191 }
188 192
193
194
189 /** 195 /**
196 * function to find how the displayName should be
197 */
198 public final void insertDisplayName()
199 {
200 if(ResourceConfigurationUtil.getInstance().isResourceNameOnly())
201 {
202 this.displayName=this.resourcename;
203 }
204 else
205 {
206 this.displayName=this.resourcename+"-"+this.ipaddress;
207 }
208 }
209
210 /**
190 * Get resource id 211 * Get resource id
191 * @return resourceid 212 * @return resourceid
192 */ 213 */
 
 
Line 324 | Parallel Line 345 | Parallel
324 } 345 }
325 } 346 }
326 347
348
349
327 /** 350 /**
328 * Set resourcename 351 * Set resourcename
329 * @param resourcenameArg resourcename 352 * @param resourcenameArg resourcename
 
 
Line 461 | Parallel Line 484 | Parallel
461 { 484 {
462 this.snmpCommunity = snmpCommunityA; 485 this.snmpCommunity = snmpCommunityA;
463 } 486 }
487 /**
488 *
489 * @return displayName displayName
490 */
491 public String getDisplayName()
492 {
493 return displayName;
464 } 494 }
495
496 /**
497 *
498 * @param displaynameParam displaynameParam
499 */
500 public void setDisplayName(final String displaynameParam)
501 {
502 this.displayName = displaynameParam;
503 }
504 }
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/ejb/ResourceManagerFacade.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 74 | Parallel Line 74 | Parallel
74 private static final String DELETE_NW_ELEMENT = "Delete Network Element - "; 74 private static final String DELETE_NW_ELEMENT = "Delete Network Element - ";
75 private static final String DELETE_NW_ELEMENT_GROUP = "Delete Network Element Group - "; 75 private static final String DELETE_NW_ELEMENT_GROUP = "Delete Network Element Group - ";
76 private static final String ERROR_MESSAGE_RES_ALREADY_EXIST = "Network Element Name Already Exist "; 76 private static final String ERROR_MESSAGE_RES_ALREADY_EXIST = "Network Element Name Already Exist ";
77 private static final String GROUP_NAME = "Group name '";
78 private static final String ALREADY_EXIST = "' already exist ";
79 private static final String GROUP = "group"; 77 private static final String GROUP = "group";
80 private static final String IPADDRESS = "ipaddress"; 78 private static final String IPADDRESS = "ipaddress";
81 private static final Log LOG = LogFactory.getLog(ResourceManagerFacade.class); 79 private static final Log LOG = LogFactory.getLog(ResourceManagerFacade.class);
 
 
Line 93 | Parallel Line 91 | Parallel
93 private static final String QUERY_SELECT_FROM_RESGROUP = "select resourcegroupid from RESOURCEGROUP where parentgroupid="; 91 private static final String QUERY_SELECT_FROM_RESGROUP = "select resourcegroupid from RESOURCEGROUP where parentgroupid=";
94 private static final String RESOURCEGROUPID = "resourcegroupid"; 92 private static final String RESOURCEGROUPID = "resourcegroupid";
95 private static final String RESOURCEID = "resourceid"; 93 private static final String RESOURCEID = "resourceid";
94 private static final String DISPLAYNAME = "displayName";
95
96 private static final String RESOURCENAME = "resourcename"; 96 private static final String RESOURCENAME = "resourcename";
97 private static final String RESOURCETYPEID = "resourcetypeid"; 97 private static final String RESOURCETYPEID = "resourcetypeid";
98 private static final String UPDATE_NW_ELEMENT = "Update Network Element - "; 98 private static final String UPDATE_NW_ELEMENT = "Update Network Element - ";
 
 
Line 366 | Parallel Line 366 | Parallel
366 { 366 {
367 resourceDetailsVO.setResourceName(resourceDetailsVO.getIPAddress()); 367 resourceDetailsVO.setResourceName(resourceDetailsVO.getIPAddress());
368 } 368 }
369 resourceDetailsVO.insertDisplayName();
369 this.em.persist(resourceDetailsVO); 370 this.em.persist(resourceDetailsVO);
370 this.em.persist(new Resourceviewdetails(resourceDetailsVO.getResourceid(), 1, p.x, p.y)); 371 this.em.persist(new Resourceviewdetails(resourceDetailsVO.getResourceid(), 1, p.x, p.y));
371 this.addTopologyAuditTrailInfo(resourceDetailsVO.getResourceid(), RoleConstants.DEFAULT_ROLE_FOR_CLIENT, 372 this.addTopologyAuditTrailInfo(resourceDetailsVO.getResourceid(), RoleConstants.DEFAULT_ROLE_FOR_CLIENT,
 
 
Line 442 | Parallel Line 443 | Parallel
442 { 443 {
443 Resourcedetails resourceDetails = this.em.find(Resourcedetails.class, Long.valueOf(property.getValue()).longValue()); 444 Resourcedetails resourceDetails = this.em.find(Resourcedetails.class, Long.valueOf(property.getValue()).longValue());
444 resourceDetails.setResourceGroupID(groupID); 445 resourceDetails.setResourceGroupID(groupID);
446 resourceDetails.insertDisplayName();
445 this.em.merge(resourceDetails); 447 this.em.merge(resourceDetails);
446 movedResourcesToBeNotified.add(resourceDetails); 448 movedResourcesToBeNotified.add(resourceDetails);
447 } 449 }
 
 
Line 943 | Parallel Line 945 | Parallel
943 { 945 {
944 for (Long resourceId : res_list) 946 for (Long resourceId : res_list)
945 { 947 {
946 final_list.add(getResourceDetails(resourceId)); 948 Resourcedetails rd = getResourceDetails(resourceId);
949 final_list.add(rd);
947 } 950 }
948 } 951 }
949 return final_list; 952 return final_list;
 
 
Line 1291 | Parallel Line 1294 | Parallel
1291 } 1294 }
1292 1295
1293 /** 1296 /**
1294 * @param parentGroupId parentGroupId 1297 * @param groupid groupid
1295 * @return List of Resource Id 1298 * @return HashMap
1296 */ 1299 */
1297 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER") 1300 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER")
1298 public final List<Long> getImmedieteSubGroupResources(final long parentGroupId) 1301 public final HashMap<String, String> getAllImmediateSubGroups(final long groupid)
1299 { 1302 {
1300 Collection<Resourcegroup> resource_group_list = getResourceGroupByGroupID(parentGroupId); 1303 HashMap<String, String> groupMap = new HashMap<String, String>();
1301 String tempReturnValue = null;
1302 List<Long> returnValue = new ArrayList<Long>();
1303 try 1304 try
1304 { 1305 {
1305 if (resource_group_list != null && resource_group_list.size() > 0) 1306 Collection<Resourcegroup> group_list =
1307 em.createNamedQuery(Resourcegroup.FINDBY_PARENTGROUPID).setParameter("parentgroupid", groupid).getResultList();
1308 for (Resourcegroup resourceGroup : group_list)
1306 { 1309 {
1307 for (Resourcegroup resGroup : resource_group_list) 1310 if (resourceGroup.getResourcegroupid() != groupid)
1308 { 1311 {
1309 List<Long> resList = 1312 groupMap.put(resourceGroup.getName(), this.getAllSubGroupsAsString(resourceGroup.getResourcegroupid()));
1310 em.createNamedQuery("Resourcedetails.findByGroupID").setParameter(RESOURCEGROUPID, resGroup.getResourcegroupid()).getResultList(); 1313 }
1311 if (resList != null && resList.size() > 0) 1314 }
1315 }
1316 catch (Exception e)
1312 { 1317 {
1313 returnValue.addAll(resList); 1318 ResourceManagerFacade.LOG.error(e);
1314 } 1319 }
1320 return groupMap;
1315 } 1321 }
1322
1323 private String getAllSubGroupsAsString(final long groupid)
1324 {
1325 ArrayList<Long> groupMap = (ArrayList<Long>) this.getAllSubGroups(groupid);
1326 StringBuilder resGroupIdString = new StringBuilder();
1327 resGroupIdString.append(groupid);
1328 if (groupMap != null && groupMap.size() > 0)
1329 {
1330 for (Long resourceGroupId : groupMap)
1331 {
1332 resGroupIdString.append(", ").append(resourceGroupId + "");
1316 } 1333 }
1317 } 1334 }
1335 return resGroupIdString.toString();
1336 }
1337
1338 /**
1339 * @param nodeId nodeId
1340 * @return HashMap
1341 */
1342 private Collection<Long> getAllSubGroups(final long groupid)
1343 {
1344 ArrayList<Long> groupMap = new ArrayList<Long>();
1345 try
1346 {
1347 List<Resourcegroup> group_list = em.createNamedQuery(Resourcegroup.FINDBY_PARENTGROUPID).setParameter("parentgroupid", groupid).getResultList();
1348 if (group_list != null)
1349 {
1350 for (Resourcegroup resourceGroup : group_list)
1351 {
1352 if (resourceGroup.getResourcegroupid() != groupid)
1353 {
1354 groupMap.add(resourceGroup.getResourcegroupid());
1355 Collection<Long> sub_group_list = this.getAllSubGroups(resourceGroup.getResourcegroupid());
1356 if (sub_group_list != null && sub_group_list.size() > 0)
1357 {
1358 groupMap.addAll(sub_group_list);
1359 }
1360 }
1361 }
1362 }
1363 }
1318 catch (Exception e) 1364 catch (Exception e)
1319 { 1365 {
1320 LOG.error("Failure in getting ImmedieteSubGroupResources :" + e.getMessage()); 1366 ResourceManagerFacade.LOG.error(e);
1321 } 1367 }
1322 return returnValue; 1368 return groupMap;
1323 } 1369 }
1324 1370
1325 /** 1371 /**
 
 
Line 1327 | Parallel Line 1373 | Parallel
1327 * @return HashMap 1373 * @return HashMap
1328 */ 1374 */
1329 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER") 1375 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER")
1330 public final HashMap<String, String> getImmedieteSubGroups(final long nodeId) 1376 public final HashMap<String, String> getImmediateSubGroups(final long nodeId)
1331 { 1377 {
1332 HashMap<String, String> groupMap = new HashMap<String, String>(); 1378 HashMap<String, String> groupMap = new HashMap<String, String>();
1333 Statement stmt = null; 1379 Statement stmt = null;
 
 
Line 2230 | Parallel Line 2276 | Parallel
2230 { 2276 {
2231 try 2277 try
2232 { 2278 {
2279 resourceDetailsVO.insertDisplayName();
2233 em.merge(resourceDetailsVO); 2280 em.merge(resourceDetailsVO);
2234 } 2281 }
2235 catch (javax.persistence.OptimisticLockException oe) 2282 catch (javax.persistence.OptimisticLockException oe)
 
 
Line 2389 | Parallel Line 2436 | Parallel
2389 Connection connection = null; 2436 Connection connection = null;
2390 PreparedStatement statement = null; 2437 PreparedStatement statement = null;
2391 ResultSet resultSet = null; 2438 ResultSet resultSet = null;
2392 String query = null; 2439 StringBuilder query = null;
2393 Collection resourcecoll = new ArrayList(); 2440 Collection resourcecoll = new ArrayList();
2394 try 2441 try
2395 { 2442 {
 
 
Line 2401 | Parallel Line 2448 | Parallel
2401 " (SELECT RESOURCEDETAILS.* FROM RESOURCEDETAILS, RESOURCEUSERMAP WHERE " 2448 " (SELECT RESOURCEDETAILS.* FROM RESOURCEDETAILS, RESOURCEUSERMAP WHERE "
2402 + " RESOURCEDETAILS.resourceid = RESOURCEUSERMAP.resourceid AND RESOURCEUSERMAP.userid = " + userid + ") RESOURCEDETAILS "; 2449 + " RESOURCEDETAILS.resourceid = RESOURCEUSERMAP.resourceid AND RESOURCEUSERMAP.userid = " + userid + ") RESOURCEDETAILS ";
2403 } 2450 }
2404 query = 2451 query = new StringBuilder(" SELECT RESOURCEDETAILS.displayname as displayName,");
2405 " SELECT RESOURCEDETAILS.resourceid as resourceid, RESOURCEDETAILS.resourcegroupid as resourcegroupid, " 2452 query.append("RESOURCEDETAILS.resourceid as resourceid, RESOURCEDETAILS.resourcegroupid as resourcegroupid, ");
2406 + " RESOURCEDETAILS.resourcestatusid as resourcestatusid, RESOURCEDETAILS.resourcetypeid as resourcetypeid, " 2453 query.append(" RESOURCEDETAILS.resourcestatusid as resourcestatusid, RESOURCEDETAILS.resourcetypeid as resourcetypeid, ");
2407 + " RESOURCEDETAILS.ipaddress as ipaddress, RESOURCEDETAILS.resourcename as resourcename, " 2454 query.append(" RESOURCEDETAILS.ipaddress as ipaddress, RESOURCEDETAILS.resourcename as resourcename, ");
2408 + " RESOURCEGROUP.name as groupname, RESOURCEVIEWDETAILS.xposition as xposition, " 2455 query.append(" RESOURCEGROUP.name as groupname, RESOURCEVIEWDETAILS.xposition as xposition, ");
2409 + " RESOURCEVIEWDETAILS.yposition as yposition, DEVICELOCATIONDETAILS.street as street, " 2456 query.append(" RESOURCEVIEWDETAILS.yposition as yposition, DEVICELOCATIONDETAILS.street as street, ");
2410 + " DEVICELOCATIONDETAILS.suite as suite, DEVICELOCATIONDETAILS.zip as zip, DEVICELOCATIONDETAILS.city as city, " 2457 query.append(" DEVICELOCATIONDETAILS.suite as suite, DEVICELOCATIONDETAILS.zip as zip, DEVICELOCATIONDETAILS.city as city, ");
2411 + " DEVICELOCATIONDETAILS.state as state, DEVICELOCATIONDETAILS.country as country, " 2458 query.append(" DEVICELOCATIONDETAILS.state as state, DEVICELOCATIONDETAILS.country as country, ");
2412 + " DEVICELOCATIONDETAILS.latitude as latitude, DEVICELOCATIONDETAILS.longitude as longitude, " 2459 query.append(" DEVICELOCATIONDETAILS.latitude as latitude, DEVICELOCATIONDETAILS.longitude as longitude, ");
2413 + " RESOURCETYPE.type as resourcetype, RESOURCETYPE.iconname as iconname, RESOURCESTATUS.statusname as statusname , " 2460 query.append(" RESOURCETYPE.type as resourcetype, RESOURCETYPE.iconname as iconname, RESOURCESTATUS.statusname as statusname , ");
2414 + " RESOURCESTATUS.colorname as statuscolor, RESOURCEREACHABILITYSTATUS.icmpstatus FROM (SELECT RESOURCESTATUS.resourcestatusid " 2461 query.append(" RESOURCESTATUS.colorname as statuscolor, RESOURCEREACHABILITYSTATUS.icmpstatus FROM (SELECT RESOURCESTATUS.resourcestatusid ");
2415 + " as resourcestatusid, RESOURCESTATUS.status as statusname, COLORDETAILS.colorname as colorname FROM " 2462 query.append(" as resourcestatusid, RESOURCESTATUS.status as statusname, COLORDETAILS.colorname as colorname FROM ");
2416 + " RESOURCESTATUS, COLORDETAILS WHERE RESOURCESTATUS.statuscolorid = COLORDETAILS.colorid) RESOURCESTATUS, " + resourcesDetails 2463 query.append(" RESOURCESTATUS, COLORDETAILS WHERE RESOURCESTATUS.statuscolorid = COLORDETAILS.colorid) RESOURCESTATUS, ");
2417 + " LEFT JOIN RESOURCEVIEWDETAILS ON RESOURCEDETAILS.resourceid = RESOURCEVIEWDETAILS.resourceid " 2464 query.append(resourcesDetails);
2418 + " LEFT JOIN DEVICELOCATIONDETAILS ON RESOURCEDETAILS.resourceid = DEVICELOCATIONDETAILS.deviceid " 2465 query.append(" LEFT JOIN RESOURCEVIEWDETAILS ON RESOURCEDETAILS.resourceid = RESOURCEVIEWDETAILS.resourceid ");
2419 + " LEFT JOIN RESOURCEREACHABILITYSTATUS" + " ON RESOURCEDETAILS.resourceid = RESOURCEREACHABILITYSTATUS.resourceid, (SELECT" 2466 query.append(" LEFT JOIN DEVICELOCATIONDETAILS ON RESOURCEDETAILS.resourceid = DEVICELOCATIONDETAILS.deviceid ");
2420 + " RESOURCEGROUP.name as name, RESOURCEGROUP.resourcegroupid as resourcegroupid FROM " 2467 query.append(" LEFT JOIN RESOURCEREACHABILITYSTATUS" + " ON RESOURCEDETAILS.resourceid = RESOURCEREACHABILITYSTATUS.resourceid, (SELECT");
2421 + " RESOURCEGROUP WHERE RESOURCEGROUP.resourcegroupid != 0 AND RESOURCEGROUP.resourcegroupid = ?) RESOURCEGROUP, " 2468 query.append(" RESOURCEGROUP.name as name, RESOURCEGROUP.resourcegroupid as resourcegroupid FROM ");
2422 + " RESOURCETYPE WHERE RESOURCEDETAILS.resourcetypeid = RESOURCETYPE.resourcetypeid " 2469 query.append(" RESOURCEGROUP WHERE RESOURCEGROUP.resourcegroupid != 0 AND RESOURCEGROUP.resourcegroupid = ?) RESOURCEGROUP, ");
2423 + " AND RESOURCEDETAILS.resourcestatusid = RESOURCESTATUS.resourcestatusid " 2470 query.append(" RESOURCETYPE WHERE RESOURCEDETAILS.resourcetypeid = RESOURCETYPE.resourcetypeid ");
2424 + " AND RESOURCEDETAILS.resourcegroupid = RESOURCEGROUP.resourcegroupid ORDER BY RESOURCEDETAILS.resourceid"; 2471 query.append(" AND RESOURCEDETAILS.resourcestatusid = RESOURCESTATUS.resourcestatusid ");
2425 statement = connection.prepareStatement(query); 2472 query.append(" AND RESOURCEDETAILS.resourcegroupid = RESOURCEGROUP.resourcegroupid ORDER BY RESOURCEDETAILS.resourceid");
2473 statement = connection.prepareStatement(query.toString());
2426 statement.setLong(1, groupId); 2474 statement.setLong(1, groupId);
2427 resultSet = statement.executeQuery(); 2475 resultSet = statement.executeQuery();
2428 while (resultSet.next()) 2476 while (resultSet.next())
 
 
Line 2469 | Parallel Line 2517 | Parallel
2469 stmt = con.createStatement(); 2517 stmt = con.createStatement();
2470 stmt.executeUpdate(query); 2518 stmt.executeUpdate(query);
2471 Resourcedetails local = new Resourcedetails(0, 1, ResourceConstants.EMS_SERVER_TYPE, ipAddress, maskIpaddress, "EMSServer"); 2519 Resourcedetails local = new Resourcedetails(0, 1, ResourceConstants.EMS_SERVER_TYPE, ipAddress, maskIpaddress, "EMSServer");
2520 local.insertDisplayName();
2472 em.persist(local); 2521 em.persist(local);
2473 em.persist(new Resourceviewdetails(local.getResourceid(), 1, -1, -1)); 2522 em.persist(new Resourceviewdetails(local.getResourceid(), 1, -1, -1));
2474 return local.getResourceid(); 2523 return local.getResourceid();
 
 
Line 2488 | Parallel Line 2537 | Parallel
2488 private MapSymbolVO setMapSymbolVOFromResultSet(final ResultSet resultSet) throws Exception 2537 private MapSymbolVO setMapSymbolVOFromResultSet(final ResultSet resultSet) throws Exception
2489 { 2538 {
2490 MapSymbolVO resource = new MapSymbolVO(); 2539 MapSymbolVO resource = new MapSymbolVO();
2540 resource.setDisplayName(resultSet.getString(DISPLAYNAME));
2491 resource.setResourceID(resultSet.getLong(RESOURCEID)); 2541 resource.setResourceID(resultSet.getLong(RESOURCEID));
2492 resource.setName(resultSet.getString(RESOURCENAME)); 2542 resource.setName(resultSet.getString(RESOURCENAME));
2493 resource.setIpaddress(resultSet.getString(IPADDRESS)); 2543 resource.setIpaddress(resultSet.getString(IPADDRESS));
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/interfaces/ResourceManager.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 172 | Parallel Line 172 | Parallel
172 * @param nodeId Node Id 172 * @param nodeId Node Id
173 * @return Hashmap 173 * @return Hashmap
174 */ 174 */
175 HashMap<String, String> getImmedieteSubGroups(long nodeId); 175 HashMap<String, String> getImmediateSubGroups(long nodeId);
176 176
177 /** 177 /**
178 * @param resourceid resourceid 178 * @param resourceid resourceid
 
File Core.ResourceManager/src/com/dhyan/nms/server/resource/interfaces/ResourceManagerFacadeLocal.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 4 | Parallel Line 4 | Parallel
4 import java.util.ArrayList; 4 import java.util.ArrayList;
5 import java.util.Collection; 5 import java.util.Collection;
6 import java.util.HashMap; 6 import java.util.HashMap;
7 import java.util.List;
8 7
9 import javax.ejb.Local; 8 import javax.ejb.Local;
10 9
 
 
Line 180 | Parallel Line 179 | Parallel
180 * @param nodeId nodeId 179 * @param nodeId nodeId
181 * @return LinkDetailVO 180 * @return LinkDetailVO
182 */ 181 */
183 HashMap<String, String> getImmedieteSubGroups(final long nodeId); 182 HashMap<String, String> getImmediateSubGroups(final long nodeId);
184 183
185 /** 184 /**
186 * @param resourceid resourceid 185 * @param resourceid resourceid
 
 
Line 500 | Parallel Line 499 | Parallel
500 Integer findGroupNodeIndex(final long groupId) throws Exception; 499 Integer findGroupNodeIndex(final long groupId) throws Exception;
501 500
502 /** 501 /**
503 * @param parentGroupId parentGroupId 502 * @param groupid groupid
504 * @return List of Resource Id 503 * @return List of SubGroups
505 */ 504 */
506 List<Long> getImmedieteSubGroupResources(final long parentGroupId); 505 HashMap<String, String> getAllImmediateSubGroups(final long groupid);
506
507 } 507 }
 
File Core.SecurityManager/build.xml (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 22 | Parallel Line 22 | Parallel
22 <include name="jboss-ejb3-ext-api.jar"/> 22 <include name="jboss-ejb3-ext-api.jar"/>
23 <include name="jboss.jar"/> 23 <include name="jboss.jar"/>
24 <include name="jbosssx.jar"/> 24 <include name="jbosssx.jar"/>
25 <include name="servlet-api.jar"/>
25 </fileset> 26 </fileset>
26 <fileset dir="${jboss.lib.dir}"> 27 <fileset dir="${jboss.lib.dir}">
27 <include name="jboss-j2se.jar"/> 28 <include name="jboss-j2se.jar"/>
 
File Core.SecurityManager/src/com/dhyan/component/security/LoginCheck.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 11 | Parallel Line 11 | Parallel
11 import java.util.Date; 11 import java.util.Date;
12 import java.util.Hashtable; 12 import java.util.Hashtable;
13 import java.util.Iterator; 13 import java.util.Iterator;
14 import java.util.List;
14 import java.util.Properties; 15 import java.util.Properties;
15 16
17 import javax.management.MBeanServer;
18 import javax.management.MBeanServerFactory;
19 import javax.management.ObjectName;
16 import javax.security.auth.login.FailedLoginException; 20 import javax.security.auth.login.FailedLoginException;
17 import javax.security.auth.login.LoginException; 21 import javax.security.auth.login.LoginException;
18 import javax.xml.transform.Transformer; 22 import javax.xml.transform.Transformer;
 
 
Line 39 | Parallel Line 43 | Parallel
39 import com.dhyan.nms.EMSEventConstants; 43 import com.dhyan.nms.EMSEventConstants;
40 import com.dhyan.nms.EMSEventTypes; 44 import com.dhyan.nms.EMSEventTypes;
41 import com.dhyan.nms.conf.ServerSettings; 45 import com.dhyan.nms.conf.ServerSettings;
46 import com.dhyan.nms.startup.license.LicensingInfo;
42 import com.dhyan.nms.util.Base64Encoder; 47 import com.dhyan.nms.util.Base64Encoder;
43 import com.dhyan.nms.util.DBManager; 48 import com.dhyan.nms.util.DBManager;
44 49
 
 
Line 100 | Parallel Line 105 | Parallel
100 public final boolean login() throws LoginException 105 public final boolean login() throws LoginException
101 { 106 {
102 // See if shared credentials exist 107 // See if shared credentials exist
108 boolean login_status = false;
103 try 109 try
104 { 110 {
105 return super.login(); 111 login_status = super.login();
106 } 112 }
107 catch (Exception e) 113 catch (Exception e)
108 { 114 {
109 String[] info = getUsernameAndPassword(); 115 String[] info = getUsernameAndPassword();
110 String username = info[0];
111 String password = info[1];
112 116
113 String expectedPassword = getUsersPassword();
114
115 if (getUsername() == null) 117 if (getUsername() == null)
116 { 118 {
117 return false; 119 return false;
 
 
Line 150 | Parallel Line 152 | Parallel
150 { 152 {
151 throw new FailedLoginException(SecurityConstants.USER_NOT_EXIST); 153 throw new FailedLoginException(SecurityConstants.USER_NOT_EXIST);
152 } 154 }
155 }
153 156
157 // License Count check
158 if (isUserSessionCountExceeds())
159 {
160 throw new FailedLoginException("LicenseCountExceeds");
154 } 161 }
162
163 return login_status;
155 } 164 }
156 165
157 private boolean getUserStauts(final String userName) 166 private boolean getUserStauts(final String userName)
 
 
Line 590 | Parallel Line 599 | Parallel
590 return roleSets; 599 return roleSets;
591 } 600 }
592 601
602 /**
603 * To check whether the no of active session count exceeds actual count.
604 * @return true if logged in user session count exceeds actual count otherwise false.
605 */
606 private boolean isUserSessionCountExceeds()
607 {
608 try
609 {
610 String username = getUsername().toLowerCase();
611 if (username.equals(DEFAULTUSER))
612 {
613 return false;
614 }
615 int loggedInUserCount = this.getLoggedUserListCount();
616 if (loggedInUserCount > 0)
617 {
618 int licensedUserCount = Integer.parseInt(LicensingInfo.getInstance().getUserCount()) - 1;
619 return loggedInUserCount > licensedUserCount;
620 }
621 }
622 catch (Exception e)
623 {
624 LOG.error("Error getting checking UserCountExceeds, Caused by(" + e.getMessage() + ")");
625 }
626 return false;
627 }
628
629 /**
630 * Method to get the current logged in user list count
631 * @return no of users currently logged in
632 * @throws Exception Exception
633 */
634 private int getLoggedUserListCount() throws Exception
635 {
636 int active_users_count = 0;
637 MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
638 String jaasmgrname = "jboss.security:service=JaasSecurityManager";
639 ObjectName jaasmgr = new ObjectName(jaasmgrname);
640 Object[] params =
641 {"SecurityPolicy" };
642 String[] signature =
643 {"java.lang.String" };
644 List<SimplePrincipal> loggedusers = (List<SimplePrincipal>) server.invoke(jaasmgr, "getAuthenticationCachePrincipals", params, signature);
645 for (SimplePrincipal active_user : loggedusers)
646 {
647 if ((active_user != null) && (active_user.getName() != null) && (!active_user.getName().toLowerCase().equals("null"))
648 && (!active_user.getName().toLowerCase().equals("defaultuser")))
649 {
650 UserDetails userDetails = UserSession.getInstance().getUserDetails(active_user.getName());
651 if (userDetails != null)
652 {
653 active_users_count = active_users_count + 1;
654 }
655 }
656 }
657 return active_users_count;
658 }
659
593 private String getConfigFilePath(final String fileName) 660 private String getConfigFilePath(final String fileName)
594 { 661 {
595 try 662 try
 
File Core.SecurityManager/src/com/dhyan/component/security/UserDetails.java (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 package com.dhyan.component.security;
2
3 import java.security.Principal;
4
5 import javax.servlet.http.HttpSession;
6
7 public final class UserDetails
8 {
9 private String userName = null;
10 private String lastLoginTime = null;
11 private String hostName = null;
12 private Principal principal = null;
13 private HttpSession session = null;
14 /**
15 * @return the session
16 */
17 public HttpSession getSession()
18 {
19 return session;
20 }
21 /**
22 * @param sessionParam the session to set
23 */
24 public void setSession(final HttpSession sessionParam)
25 {
26 this.session = sessionParam;
27 }
28 /**
29 * @return the lastLoginTime
30 */
31 public String getLastLoginTime()
32 {
33 return lastLoginTime;
34 }
35 /**
36 * @param paramLastLoginTime the lastLoginTime to set
37 */
38 public void setLastLoginTime(final String paramLastLoginTime)
39 {
40 this.lastLoginTime = paramLastLoginTime;
41 }
42 /**
43 * @return the hostName
44 */
45 public String getHostName()
46 {
47 return hostName;
48 }
49 /**
50 * @param paramHostName the paramHostName to set
51 */
52 public void setHostName(final String paramHostName)
53 {
54 this.hostName = paramHostName;
55 }
56 /**
57 * @return the userName
58 */
59 public String getUserName()
60 {
61 return userName;
62 }
63 /**
64 * @param paramUserName the userName to set
65 */
66 public void setUserName(final String paramUserName)
67 {
68 this.userName = paramUserName;
69 }
70 /**
71 * @return the principal
72 */
73 public Principal getPrincipal()
74 {
75 return principal;
76 }
77 /**
78 * @param paramPrincipal the principal to set
79 */
80 public void setPrincipal(final Principal paramPrincipal)
81 {
82 this.principal = paramPrincipal;
83 }
84 }
 
File Core.SecurityManager/src/com/dhyan/component/security/UserSession.java (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 package com.dhyan.component.security;
2
3 import java.security.Principal;
4 import java.text.SimpleDateFormat;
5 import java.util.Date;
6 import java.util.Hashtable;
7
8 import javax.servlet.http.HttpSession;
9
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
12
13
14
15 public final class UserSession
16 {
17 private static final Log LOGGER = LogFactory.getLog(UserSession.class.getName());
18 private static SimpleDateFormat dateFormat = new SimpleDateFormat("MMM-dd-yyyy HH:mm:ss:SSS");
19 private static UserSession userSession = null;
20 private Hashtable<String, UserDetails> userDetailList = null;
21
22 private UserSession()
23 {
24 this.userDetailList = new Hashtable<String, UserDetails>();
25 }
26
27 /**
28 * Get Singleton Instance
29 * @return Singleton Instance
30 */
31 public static synchronized UserSession getInstance()
32 {
33 if (UserSession.userSession == null)
34 {
35 UserSession.userSession = new UserSession();
36 }
37 return UserSession.userSession;
38 }
39
40 /**
41 * Get the Logged In user details
42 * @param uNameSessionKey User Name + Session Id
43 * @return User details
44 */
45 public UserDetails getUserDetails(final String uNameSessionKey)
46 {
47 if (uNameSessionKey != null)
48 {
49 return this.userDetailList.get(uNameSessionKey.toLowerCase());
50 }
51 return null;
52 }
53
54 /**
55 * Get the User Principal for killing user
56 * @param uNameSessionKey User Name + Session Id
57 * @return Principal
58 */
59 public Principal getUserPrincipal(final String uNameSessionKey)
60 {
61 Principal principal = null;
62 if (uNameSessionKey != null)
63 {
64 UserDetails userDetails = (UserDetails) this.userDetailList.get(uNameSessionKey.toLowerCase());
65 principal = userDetails.getPrincipal();
66 }
67 return principal;
68 }
69
70 /**
71 * Remove a User Details
72 * @param userNameArg User Name
73 */
74 public void removeUserSession(final String userNameArg)
75 {
76 LOGGER.info("In Removing User Details >>>> " + this.userDetailList.toString() + " >>>>>>> user Name is " + userNameArg);
77 this.userDetailList.get(userNameArg.toLowerCase()).getSession().invalidate();
78 this.userDetailList.remove(userNameArg.toLowerCase());
79 }
80
81 /**
82 * Set the User Session
83 * @param paramHostName remote host name
84 * @param paramPrincipal Principal Object
85 * @param session HTTP Session
86 */
87 public void setUserDetails(final String paramHostName,
88 final Principal paramPrincipal,
89 final HttpSession session)
90 {
91 try
92 {
93 String sessionKey = paramPrincipal.getName().toLowerCase();
94 UserDetails userDetails = new UserDetails();
95 userDetails.setLastLoginTime(dateFormat.format(new Date()));
96 userDetails.setHostName(paramHostName);
97 userDetails.setPrincipal(paramPrincipal);
98 userDetails.setSession(session);
99 this.userDetailList.put(sessionKey, userDetails);
100 }
101 catch (Exception e)
102 {
103 UserSession.LOGGER.error("Error in setting User Session Objects, caused by " + e.getMessage());
104 }
105 }
106 }
 
File Core.SecurityManager/src/com/dhyan/component/security/useradmin/ejb/SecurityFacadeBean.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 3 | Parallel Line 3 | Parallel
3 package com.dhyan.component.security.useradmin.ejb; 3 package com.dhyan.component.security.useradmin.ejb;
4 4
5 import java.sql.Connection; 5 import java.sql.Connection;
6 import java.sql.PreparedStatement;
6 import java.sql.ResultSet; 7 import java.sql.ResultSet;
7 import java.sql.Statement; 8 import java.sql.Statement;
8 import java.util.ArrayList; 9 import java.util.ArrayList;
 
 
Line 10 | Parallel Line 11 | Parallel
10 import java.util.Collection; 11 import java.util.Collection;
11 import java.util.Date; 12 import java.util.Date;
12 import java.util.HashMap; 13 import java.util.HashMap;
14 import java.util.HashSet;
13 import java.util.List; 15 import java.util.List;
14 import java.util.Properties; 16 import java.util.Properties;
15 import java.util.TimeZone; 17 import java.util.TimeZone;
 
 
Line 1349 | Parallel Line 1351 | Parallel
1349 } 1351 }
1350 1352
1351 /** 1353 /**
1352 * Method to removeGroup 1354 * Method to get users in this group who are not associated with other
1355 * groups
1353 * @param groupId group id 1356 * @param groupId group id
1354 * @throws Exception Exception 1357 * @throws Exception Exception
1358 * @return Collection of users
1355 */ 1359 */
1356 @RolesAllowed( 1360 @RolesAllowed(
1357 {"DEFAULT_ROLE_FOR_SERVER", "SEC_DEL_GRP" }) 1361 {"DEFAULT_ROLE_FOR_SERVER", "SEC_DEL_GRP" })
1358 public void removeGroups(final Long[] groupId) throws Exception 1362 public Collection<String> getUserOnlyInThisGroups(final Long[] groupId) throws Exception
1359 { 1363 {
1360 log.info("Removing Group : "); 1364 log.info("getting users in this group who are not associated with other groups ");
1361 int defaultgroupid = (int) getGroupID("Operator"); 1365 Connection con = null;
1366 PreparedStatement psUser = null;
1367 Groupdetails group_details = null;
1368 ResultSet resultSet = null;
1369 Collection<String> userNames = new HashSet<String>();
1370
1371 try
1372 {
1373 con = DBManager.getInstance().getConnection();
1374
1375 String userSelectQuery =
1376 " SELECT usr.username FROM USERDETAILS AS usr, USERGROUPMAP AS mapping WHERE mapping.groupid =? and mapping.userid=usr.userid "
1377 + " AND ( SELECT COUNT(*) FROM USERGROUPMAP AS mapping where usr.userid=mapping.userid ) = 1 ";
1378 psUser = con.prepareStatement(userSelectQuery);
1362 for (Long group_id : groupId) 1379 for (Long group_id : groupId)
1363 { 1380 {
1364 Groupdetails group_details = getGroupDetails(group_id); 1381 group_details = getGroupDetails(group_id);
1365 if (group_details != null) 1382 psUser.setLong(1, group_id);
1383
1384 // addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP,
1385 // "Delete Group " + group_details.getGroupname(),
1386 // RoleConstants.OPERATION_SUCCESS);
1387 // MessageObject securityGroupMO = new
1388 // MessageObject(NotificationConstants.NOTIFICATION_WEB_SECURITYGROUP,
1389 // group_details);
1390 // PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SECURITY_GROUP,
1391 // securityGroupMO,
1392 // PublisherManager.NONDURABLETOPIC);
1393
1394 resultSet = psUser.executeQuery();
1395 while (resultSet.next())
1366 { 1396 {
1367 try 1397 try
1368 { 1398 {
1369 Collection<Usergroupmap> usergroupmap = 1399 userNames.add(resultSet.getString(1));
1370 em.createNamedQuery("Usergroupmap.findByGroupid").setParameter(GROUPID, (int) group_details.getGroupid()).getResultList(); 1400 }
1371 for (Usergroupmap local : usergroupmap) 1401 catch (Exception e)
1372 { 1402 {
1373 local.setGroupid(defaultgroupid); 1403 log.error(e);
1374 } 1404 }
1375 removeRolefromgroupmap(group_details.getGroupid()); 1405 }
1376 em.remove(group_details); 1406 }
1407
1408 }
1409 catch (Exception e)
1410 {
1411 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete group " + group_details.getGroupname(), RoleConstants.OPERATION_FAILED);
1412 log.error(e);
1413 }
1414 finally
1415 {
1416 JDBCUtil.safeClose(resultSet);
1417 JDBCUtil.safeClose(psUser);
1418 JDBCUtil.safeClose(con);
1419
1420 }
1421
1422 return userNames;
1423 }
1424
1425 /**
1426 * Method to removeGroup
1427 * @param groupId group id
1428 * @throws Exception Exception
1429 */
1430 @RolesAllowed(
1431 {"DEFAULT_ROLE_FOR_SERVER", "SEC_DEL_GRP" })
1432 public void removeGroups(final Long[] groupId) throws Exception
1433 {
1434 log.info("Removing Group : ");
1435 Connection con = null;
1436 PreparedStatement psUser = null;
1437 PreparedStatement psGroup = null;
1438 Groupdetails group_details = null;
1439 try
1440 {
1441 con = DBManager.getInstance().getConnection();
1442
1443 String userDeleteQuery =
1444 " DELETE usr FROM USERDETAILS AS usr, USERGROUPMAP AS mapping WHERE mapping.groupid =? and mapping.userid=usr.userid "
1445 + " AND ( SELECT COUNT(*) FROM USERGROUPMAP AS mapping where usr.userid=mapping.userid ) = 1 ";
1446 String groupDeleteQuery = " DELETE grp FROM GROUPDETAILS as grp WHERE grp.groupid = ? ";
1447 psUser = con.prepareStatement(userDeleteQuery);
1448 psGroup = con.prepareStatement(groupDeleteQuery);
1449 for (Long group_id : groupId)
1450 {
1451 group_details = getGroupDetails(group_id);
1452 psUser.setLong(1, group_id);
1453 psGroup.setLong(1, group_id);
1454 psUser.executeUpdate();
1455 psGroup.executeUpdate();
1377 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete Group " + group_details.getGroupname(), RoleConstants.OPERATION_SUCCESS); 1456 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete Group " + group_details.getGroupname(), RoleConstants.OPERATION_SUCCESS);
1378 MessageObject securityGroupMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_SECURITYGROUP, group_details); 1457 MessageObject securityGroupMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_SECURITYGROUP, group_details);
1379 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SECURITY_GROUP, securityGroupMO, 1458 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SECURITY_GROUP, securityGroupMO,
1380 PublisherManager.NONDURABLETOPIC); 1459 PublisherManager.NONDURABLETOPIC);
1381 /*
1382 * NotificationManager.getInstance().sendNotification(NotificationConstants
1383 * .NOTIFICATION_WEB_SECURITYGROUP, UPDATE,
1384 * NotificationManager.HIGH_PRIORITY);
1385 */
1386 } 1460 }
1461
1462 }
1387 catch (Exception e) 1463 catch (Exception e)
1388 { 1464 {
1389 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete group " + group_details.getGroupname(), RoleConstants.OPERATION_FAILED); 1465 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete group " + group_details.getGroupname(), RoleConstants.OPERATION_FAILED);
1390 log.error(e); 1466 log.error(e);
1391 } 1467 }
1468 finally
1469 {
1470 JDBCUtil.safeClose(psUser);
1471 JDBCUtil.safeClose(psGroup);
1472 JDBCUtil.safeClose(con);
1392 } 1473 }
1474
1475 // log.info("Removing Group : ");
1476 // int defaultgroupid = (int) getGroupID("Operator");
1477 // for (Long group_id : groupId)
1478 // {
1479 // Groupdetails group_details = getGroupDetails(group_id);
1480 // if (group_details != null)
1481 // {
1482 // try
1483 // {
1484 //
1485 //
1486 //
1487 // Collection<Usergroupmap> usergroupmap =
1488 // em.createNamedQuery("Usergroupmap.findByGroupid").setParameter(GROUPID,
1489 // (int) group_details.getGroupid()).getResultList();
1490 // for (Usergroupmap local : usergroupmap)
1491 // {
1492 // local.setGroupid(defaultgroupid);
1493 // }
1494 // removeRolefromgroupmap(group_details.getGroupid());
1495 // em.remove(group_details);
1496 // addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete Group "
1497 // + group_details.getGroupname(), RoleConstants.OPERATION_SUCCESS);
1498 // MessageObject securityGroupMO = new
1499 // MessageObject(NotificationConstants.NOTIFICATION_WEB_SECURITYGROUP,
1500 // group_details);
1501 // PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SECURITY_GROUP,
1502 // securityGroupMO,
1503 // PublisherManager.NONDURABLETOPIC);
1504 // /*
1505 // *
1506 // NotificationManager.getInstance().sendNotification(NotificationConstants
1507 // * .NOTIFICATION_WEB_SECURITYGROUP, UPDATE,
1508 // * NotificationManager.HIGH_PRIORITY);
1509 // */
1510 // }
1511 // catch (Exception e)
1512 // {
1513 // addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete group "
1514 // + group_details.getGroupname(), RoleConstants.OPERATION_FAILED);
1515 // log.error(e);
1516 // }
1517 // }
1518 // }
1393 } 1519 }
1394 }
1395 1520
1396 /** 1521 /**
1397 * Method to update Group 1522 * Method to update Group
 
 
Line 1887 | Parallel Line 2012 | Parallel
1887 } 2012 }
1888 2013
1889 /** 2014 /**
2015 * Method to get users in this group who are associated with other groups
2016 * @param groupId group id
2017 * @throws Exception Exception
2018 * @return Collection of roles
2019 */
2020 @RolesAllowed(
2021 {"DEFAULT_ROLE_FOR_SERVER", "SECURITY_MGR" })
2022 public Collection<String> getUsersAssociatedWithOtherGroups(final Long[] groupId) throws Exception
2023 {
2024 log.info("getting users in this group who are associated with other groups ");
2025 Connection con = null;
2026 PreparedStatement psUser = null;
2027 Groupdetails group_details = null;
2028 ResultSet resultSet = null;
2029 Collection<String> userNames = new HashSet<String>();
2030
2031 try
2032 {
2033 con = DBManager.getInstance().getConnection();
2034
2035 String userSelectQuery =
2036 " SELECT usr.username FROM USERDETAILS AS usr, USERGROUPMAP AS mapping WHERE mapping.groupid =? and mapping.userid=usr.userid "
2037 + " AND ( SELECT COUNT(*) FROM USERGROUPMAP AS mapping where usr.userid=mapping.userid ) > 1 ";
2038 psUser = con.prepareStatement(userSelectQuery);
2039 for (Long group_id : groupId)
2040 {
2041 group_details = getGroupDetails(group_id);
2042 psUser.setLong(1, group_id);
2043 resultSet = psUser.executeQuery();
2044 while (resultSet.next())
2045 {
2046 try
2047 {
2048 userNames.add(resultSet.getString(1));
2049 }
2050 catch (Exception e)
2051 {
2052 log.error(e);
2053 }
2054 }
2055 }
2056
2057 }
2058 catch (Exception e)
2059 {
2060 addSecurityAuditTrailInfo(RoleConstants.SEC_DEL_GRP, "Delete group " + group_details.getGroupname(), RoleConstants.OPERATION_FAILED);
2061 log.error(e);
2062 }
2063 finally
2064 {
2065 JDBCUtil.safeClose(resultSet);
2066 JDBCUtil.safeClose(psUser);
2067 JDBCUtil.safeClose(con);
2068
2069 }
2070
2071 return userNames;
2072
2073 }
2074
2075 /**
1890 * Method to add audit Trail 2076 * Method to add audit Trail
1891 * @param obj Object 2077 * @param obj Object
1892 */ 2078 */
 
File Core.SecurityManager/src/com/dhyan/component/security/useradmin/interfaces/SecurityFacadeLocal.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 1 | Parallel Line 1 | Parallel
1 package com.dhyan.component.security.useradmin.interfaces; 1 package com.dhyan.component.security.useradmin.interfaces;
2 2
3 import java.util.Collection;
4
3 import javax.ejb.Local; 5 import javax.ejb.Local;
4 6
5 import com.dhyan.component.security.useradmin.datamodel.Userdetails; 7 import com.dhyan.component.security.useradmin.datamodel.Userdetails;
 
 
Line 314 | Parallel Line 316 | Parallel
314 void removeGroups(Long[] groupId) throws java.lang.Exception; 316 void removeGroups(Long[] groupId) throws java.lang.Exception;
315 317
316 /** 318 /**
319 * Method to get users in this group who are not associated with other
320 * groups
321 * @param groupId group id
322 * @throws Exception Exception
323 * @return Collection of users
324 */
325 Collection<String> getUserOnlyInThisGroups(final Long[] groupId) throws Exception;
326
327 /**
328 * Method to get users in this group who are associated with other groups
329 * @param groupId group id
330 * @throws Exception Exception
331 * @return Collection of users
332 */
333 Collection<String> getUsersAssociatedWithOtherGroups(final Long[] groupId) throws Exception;
334
335 /**
317 * Returns all GroupdetailObject instances available in the DB as a 336 * Returns all GroupdetailObject instances available in the DB as a
318 * Collection. 337 * Collection.
319 * @param gInfo gInfo 338 * @param gInfo gInfo
 
File Core.ServerDetails/resources/FaultConfiguration.properties (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 # This property is for getting alarm assciated sylog retrieval time range.
2 # Default value is 5 Seconds.
3 alarmDetailView.timeRange.lowerLimitInMillis = 300000
4 alarmDetailView.timeRange.upperLimitInMillis = 300000
 
File Core.ServerDetails/resources/ResourceConfiguration.properties (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 #This property is for configuring display name for resource details
2 #possible values are
3 #RESOURCE_NAME_ONLY for resource name only
4 #RESOURCE_NAME_IPADDRESS for <resource name>-<IP Address>
5
6 resourceDetails.displayName.Format = RESOURCE_NAME_ONLY
 
File Core.ServerDetails/resources/ThreadSchedulerConfig.xml (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 7 | Parallel Line 7 | Parallel
7 <threadname name="DISCOVERYSCHEDULER" threadcount="10" minimumcount="1" maximumcount="30"/> 7 <threadname name="DISCOVERYSCHEDULER" threadcount="10" minimumcount="1" maximumcount="30"/>
8 <threadname name="REPORT" threadcount="5" minimumcount="1" maximumcount="30"/> 8 <threadname name="REPORT" threadcount="5" minimumcount="1" maximumcount="30"/>
9 <threadname name="CONFIGURATION" threadcount="5" minimumcount="1" maximumcount="30"/> 9 <threadname name="CONFIGURATION" threadcount="5" minimumcount="1" maximumcount="30"/>
10 <threadname name="THRESHOLDASSOCIATION" threadcount="25" minimumcount="1" maximumcount="25"/>
10 <threadname name="FLOWREVIEW" threadcount="25" minimumcount="1" maximumcount="30"/> 11 <threadname name="FLOWREVIEW" threadcount="25" minimumcount="1" maximumcount="30"/>
11 <threadname name="OTHERS" threadcount="5" minimumcount="1" maximumcount="30"/> 12 <threadname name="OTHERS" threadcount="5" minimumcount="1" maximumcount="30"/>
12 <threadname name="SCHEDULER" threadcount="20" minimumcount="1" maximumcount="30"/> 13 <threadname name="SCHEDULER" threadcount="20" minimumcount="1" maximumcount="30"/>
 
File Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/AlarmManager.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 1 | Parallel Line 1 | Parallel
1 package com.dhyan.nms.server.fault.alarmmanager; 1 package com.dhyan.nms.server.fault.alarmmanager;
2 2
3 import java.io.File;
4 import java.io.FileInputStream;
3 import java.util.ArrayList; 5 import java.util.ArrayList;
4 import java.util.HashMap; 6 import java.util.HashMap;
7 import java.util.Properties;
5 8
6 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.Log;
7 import org.apache.commons.logging.LogFactory; 10 import org.apache.commons.logging.LogFactory;
8 11
9 import com.dhyan.nms.EMSEventConstants; 12 import com.dhyan.nms.EMSEventConstants;
13 import com.dhyan.nms.conf.ServerSettings;
10 import com.dhyan.nms.server.fault.alarmcorrelator.AbstractAlarmCorrelator; 14 import com.dhyan.nms.server.fault.alarmcorrelator.AbstractAlarmCorrelator;
11 import com.dhyan.nms.server.fault.alarmcorrelator.CorrelatedAlarmInfo; 15 import com.dhyan.nms.server.fault.alarmcorrelator.CorrelatedAlarmInfo;
12 import com.dhyan.nms.server.fault.alarmcorrelator.DefaultAlarmCorrelatorImpl; 16 import com.dhyan.nms.server.fault.alarmcorrelator.DefaultAlarmCorrelatorImpl;
 
 
Line 37 | Parallel Line 41 | Parallel
37 public final class AlarmManager 41 public final class AlarmManager
38 { 42 {
39 private static final Log LOG = LogFactory.getLog(AlarmManager.class); 43 private static final Log LOG = LogFactory.getLog(AlarmManager.class);
44 private static final String FAULT_CONFIG_FILE = ServerSettings.getConfDir() + File.separatorChar + "FaultConfiguration.properties";
40 private static AlarmManager manager = null; 45 private static AlarmManager manager = null;
41 private HashMap<Long, AbstractAlarmCorrelator> alarmCorrHashMap = null; 46 private HashMap<Long, AbstractAlarmCorrelator> alarmCorrHashMap = null;
42 private AbstractAlarmCorrelator defaultCorrelatorIfc = null; 47 private AbstractAlarmCorrelator defaultCorrelatorIfc = null;
 
 
Line 47 | Parallel Line 52 | Parallel
47 private ArrayList<String> publishFieldList = null; 52 private ArrayList<String> publishFieldList = null;
48 private boolean publishClearedAlarms = false; 53 private boolean publishClearedAlarms = false;
49 private Alarmspecification[] alarmSpecList = null; 54 private Alarmspecification[] alarmSpecList = null;
55 private Properties faultProperties = new Properties();
50 56
51 /** 57 /**
52 * No-args constructor. All the member variables are initialized. 58 * No-args constructor. All the member variables are initialized.
 
 
Line 61 | Parallel Line 67 | Parallel
61 parseAlarmCorrelation(); 67 parseAlarmCorrelation();
62 loadPublishersFields(); 68 loadPublishersFields();
63 parseAlarmClassification(); 69 parseAlarmClassification();
70 loadAlarmConfigurationDetails();
64 } 71 }
65 72
66 /** 73 /**
 
 
Line 120 | Parallel Line 127 | Parallel
120 } 127 }
121 } 128 }
122 129
130 private void loadAlarmConfigurationDetails()
131 {
132 try
133 {
134 faultProperties.load(new FileInputStream(new File(FAULT_CONFIG_FILE)));
135 }
136 catch (Exception e)
137 {
138 LOG.error("Failure in loading loadAlarmConfigurationDetails :" + e.getMessage());
139 }
140 }
141
123 /** 142 /**
143 * Method to get Alarm Configuration Details based on the given key.
144 * @param key Key
145 * @return Configuration value
146 */
147 public String getAlarmConfigurationDetails(final String key)
148 {
149 if (faultProperties != null)
150 {
151 return faultProperties.getProperty(key);
152 }
153 return null;
154 }
155
156 /**
124 * Method to retrieve trap details based on given alarm information. 157 * Method to retrieve trap details based on given alarm information.
125 * @param alarmDetails alarmDetails 158 * @param alarmDetails alarmDetails
126 * @return Trap 159 * @return Trap
 
File Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/ejb/AlarmReportFacadeBean.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 59 | Parallel Line 59 | Parallel
59 { 59 {
60 ResourceManagerFacadeLocal resourceMgr = (ResourceManagerFacadeLocal) LocalLookupManager.getLocalObject(ResourceManagerFacadeLocal.class); 60 ResourceManagerFacadeLocal resourceMgr = (ResourceManagerFacadeLocal) LocalLookupManager.getLocalObject(ResourceManagerFacadeLocal.class);
61 HashMap<String, String> subGroups = new HashMap<String, String>(); 61 HashMap<String, String> subGroups = new HashMap<String, String>();
62 subGroups = resourceMgr.getImmedieteSubGroups(groupID); 62 subGroups = resourceMgr.getImmediateSubGroups(groupID);
63 ArrayList<String> groupNameList = new ArrayList<String>(subGroups.keySet()); 63 ArrayList<String> groupNameList = new ArrayList<String>(subGroups.keySet());
64 Iterator<String> groupNameIter = groupNameList.iterator(); 64 Iterator<String> groupNameIter = groupNameList.iterator();
65 Iterator<String> chart_iterator = chartVariables.iterator(); 65 Iterator<String> chart_iterator = chartVariables.iterator();
 
File Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/purging/PurgeAlarmByCountScheduler.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 37 | Parallel Line 37 | Parallel
37 alarmSession = (AlarmSessionLocal) LocalLookupManager.getLocalObject(AlarmSessionLocal.class); 37 alarmSession = (AlarmSessionLocal) LocalLookupManager.getLocalObject(AlarmSessionLocal.class);
38 alarmSession.purgeAlarmsByCount(-1, null, purgeinterval.getPurgecount()); 38 alarmSession.purgeAlarmsByCount(-1, null, purgeinterval.getPurgecount());
39 } 39 }
40 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTALARM, null); 40 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTALARM, "success");
41 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_ALARMS, securityMO, PublisherManager.NONDURABLETOPIC); 41 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_ALARMS, securityMO, PublisherManager.NONDURABLETOPIC);
42 } 42 }
43 catch (Exception e) 43 catch (Exception e)
 
File Fault.AlarmManager/src/com/dhyan/nms/server/fault/alarmmanager/purging/PurgeAlarmByIntervalScheduler.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 39 | Parallel Line 39 | Parallel
39 alarmSession = (AlarmSessionLocal) LocalLookupManager.getLocalObject(AlarmSessionLocal.class); 39 alarmSession = (AlarmSessionLocal) LocalLookupManager.getLocalObject(AlarmSessionLocal.class);
40 alarmSession.purgeAlarmsByInterval(-1, null, delTime); 40 alarmSession.purgeAlarmsByInterval(-1, null, delTime);
41 } 41 }
42 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTALARM, null); 42 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTALARM, "success");
43 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_ALARMS, securityMO, PublisherManager.NONDURABLETOPIC); 43 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_ALARMS, securityMO, PublisherManager.NONDURABLETOPIC);
44 } 44 }
45 catch (Exception e) 45 catch (Exception e)
 
File Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/ejb/SyslogParserSessionBean.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 741 | Parallel Line 741 | Parallel
741 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER") 741 @RolesAllowed("DEFAULT_ROLE_FOR_SERVER")
742 public final void purgeSyslogsByInterval(final int filterId, final DVLExporterVO exporterVO, final long timeinterval) 742 public final void purgeSyslogsByInterval(final int filterId, final DVLExporterVO exporterVO, final long timeinterval)
743 { 743 {
744 String commonQuery = "FROM SYSLOG AND logtime <= " + (System.currentTimeMillis() - timeinterval); 744 String commonQuery = "FROM SYSLOG WHERE logtime <= " + (System.currentTimeMillis() - timeinterval);
745 purgeAndArchive(commonQuery, filterId, exporterVO); 745 purgeAndArchive(commonQuery, filterId, exporterVO);
746 } 746 }
747 747
 
File Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/jj/SysLogParser.jj (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 183 | Parallel Line 183 | Parallel
183 | 183 |
184 <NUMBER :(["0"-"9"])+> 184 <NUMBER :(["0"-"9"])+>
185 | 185 |
186 <STRING : (["a"-"z","A"-"Z","0"-"9","_","-","(",")","@","=",".",":",";","\\","\"","\'","[","]","!","#","$","%","^","&","*","+","{","}","|",":",":","?","`","~"])+> 186 <STRING : (["a"-"z","A"-"Z","0"-"9","_","-","(",")","@","=",".",":",";","\\","\"",",","/","\'","[","]","!","#","$","%","^","&","*","+","{","}","|",":",":","?","`","~"])+>
187 | 187 |
188 <SPACE : ["\u0020"]> 188 <SPACE : ["\u0020"]>
189 } 189 }
 
File Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/purging/PurgeSyslogByCountScheduler.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 36 | Parallel Line 36 | Parallel
36 sessionLocal = (SyslogParserSessionLocal) LocalLookupManager.getLocalObject(SyslogParserSessionLocal.class); 36 sessionLocal = (SyslogParserSessionLocal) LocalLookupManager.getLocalObject(SyslogParserSessionLocal.class);
37 sessionLocal.purgeSyslogsByCount(-1, null, purgeinterval.getPurgecount()); 37 sessionLocal.purgeSyslogsByCount(-1, null, purgeinterval.getPurgecount());
38 } 38 }
39 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTSYSLOG, null); 39 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTSYSLOG, "success");
40 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SYSLOGS, securityMO, PublisherManager.NONDURABLETOPIC); 40 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SYSLOGS, securityMO, PublisherManager.NONDURABLETOPIC);
41 } 41 }
42 catch (Exception e) 42 catch (Exception e)
 
File Fault.SyslogService/src/com/dhyan/nms/server/fault/listener/syslog/purging/PurgeSyslogByIntervalScheduler.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 38 | Parallel Line 38 | Parallel
38 sessionLocal = (SyslogParserSessionLocal) LocalLookupManager.getLocalObject(SyslogParserSessionLocal.class); 38 sessionLocal = (SyslogParserSessionLocal) LocalLookupManager.getLocalObject(SyslogParserSessionLocal.class);
39 sessionLocal.purgeSyslogsByInterval(-1, null, delTime); 39 sessionLocal.purgeSyslogsByInterval(-1, null, delTime);
40 } 40 }
41 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTSYSLOG, null); 41 MessageObject securityMO = new MessageObject(NotificationConstants.NOTIFICATION_WEB_FAULTSYSLOG, "success");
42 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SYSLOGS, securityMO, PublisherManager.NONDURABLETOPIC); 42 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_SYSLOGS, securityMO, PublisherManager.NONDURABLETOPIC);
43 } 43 }
44 catch (Exception e) 44 catch (Exception e)
 
File Lib.SmartGrid/WebContent/webresource/webcomponents/smartgrid/scripts/DNMSSmartGrid.js (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 1940 | Parallel Line 1940 | Parallel
1940 // 1940 //
1941 this._colors['imageCellImage'].className= 'imageCellImageTD'; 1941 this._colors['imageCellImage'].className= 'imageCellImageTD';
1942 var imageDIV = document.createElement("IMG"); 1942 var imageDIV = document.createElement("IMG");
1943 imageDIV.setAttribute('alt', 'na'); 1943 //imageDIV.setAttribute('alt', 'na');
1944 imageDIV.setAttribute('height', '16px'); 1944 imageDIV.setAttribute('height', '16px');
1945 imageDIV.setAttribute('width', '16px'); 1945 imageDIV.setAttribute('width', '16px');
1946 imageDIV.setAttribute('src', nodeImage); 1946 imageDIV.setAttribute('src', nodeImage);
 
File Perf.DataCollection/src/com/dhyan/nms/server/performance/datacollection/ejb/DataCollectionFacade.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 1074 | Parallel Line 1074 | Parallel
1074 } 1074 }
1075 try 1075 try
1076 { 1076 {
1077 MessageObject msgObject = new MessageObject("UPDATE", null); 1077 MessageObject msgObject = new MessageObject("UPDATE", "success");
1078 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_PERF_TASK, msgObject, 1078 PublisherManager.getInstance().sendMessage(NotificationConstants.NOTIFICATION_TOPIC_PERF_TASK, msgObject,
1079 PublisherManager.NONDURABLETOPIC); 1079 PublisherManager.NONDURABLETOPIC);
1080 } 1080 }
 
File Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/HistoricalDataObject.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 2 | Parallel Line 2 | Parallel
2 2
3 import java.io.Serializable; 3 import java.io.Serializable;
4 import java.util.ArrayList; 4 import java.util.ArrayList;
5 import java.util.HashMap;
5 6
6 import com.dhyan.nms.server.performance.datacollection.datamodel.Derivedobject; 7 import com.dhyan.nms.server.performance.datacollection.datamodel.Derivedobject;
7 import com.dhyan.nms.server.performance.datacollection.datamodel.Perfobjdatacollgroupmap; 8 import com.dhyan.nms.server.performance.datacollection.datamodel.Perfobjdatacollgroupmap;
 
 
Line 32 | Parallel Line 33 | Parallel
32 private String entityLevel = null; 33 private String entityLevel = null;
33 private ArrayList<String> selectedIndices = null; 34 private ArrayList<String> selectedIndices = null;
34 private boolean isDerivedObject = false; 35 private boolean isDerivedObject = false;
36 private HashMap<String, String> subGroupList = null;
35 37
36 /** 38 /**
37 * @return the entityLevel 39 * @return the entityLevel
 
 
Line 370 | Parallel Line 372 | Parallel
370 { 372 {
371 this.isDerivedObject = isDerivedObjectA; 373 this.isDerivedObject = isDerivedObjectA;
372 } 374 }
375
376 /**
377 * @return the subGroupList
378 */
379 public final HashMap<String, String> getSubGroupList()
380 {
381 return subGroupList;
373 } 382 }
383
384 /**
385 * @param subGroupListParam the subGroupList to set
386 */
387 public final void setSubGroupList(final HashMap<String, String> subGroupListParam)
388 {
389 this.subGroupList = subGroupListParam;
390 }
391 }
 
File Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/ejb/ReportingFacade.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 26 | Parallel Line 26 | Parallel
26 import org.apache.commons.logging.LogFactory; 26 import org.apache.commons.logging.LogFactory;
27 import org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil; 27 import org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil;
28 28
29 import com.dhyan.nms.conf.ServerSettings;
29 import com.dhyan.nms.server.performance.datacollection.DerivedMetricHandler; 30 import com.dhyan.nms.server.performance.datacollection.DerivedMetricHandler;
30 import com.dhyan.nms.server.performance.datacollection.datamodel.Datacollectiongroupindex; 31 import com.dhyan.nms.server.performance.datacollection.datamodel.Datacollectiongroupindex;
31 import com.dhyan.nms.server.performance.datacollection.datamodel.Derivedobject; 32 import com.dhyan.nms.server.performance.datacollection.datamodel.Derivedobject;
 
 
Line 46 | Parallel Line 47 | Parallel
46 import com.dhyan.nms.server.performance.reportmanager.datamodel.Trendingaggmap; 47 import com.dhyan.nms.server.performance.reportmanager.datamodel.Trendingaggmap;
47 import com.dhyan.nms.server.performance.reportmanager.datamodel.Trendinginfo; 48 import com.dhyan.nms.server.performance.reportmanager.datamodel.Trendinginfo;
48 import com.dhyan.nms.server.performance.reportmanager.interfaces.ReportingFacadeLocal; 49 import com.dhyan.nms.server.performance.reportmanager.interfaces.ReportingFacadeLocal;
50 import com.dhyan.nms.server.performance.reportmanager.retriever.BaseHistoricalDataRetriever;
49 import com.dhyan.nms.server.performance.reportmanager.retriever.SnmpHistoricalDataRetriever; 51 import com.dhyan.nms.server.performance.reportmanager.retriever.SnmpHistoricalDataRetriever;
52 import com.dhyan.nms.server.performance.reportmanager.retriever.SnmpHistoricalDataRetrieverOracle;
50 import com.dhyan.nms.server.protocol.snmp.SNMPGetTableRequest; 53 import com.dhyan.nms.server.protocol.snmp.SNMPGetTableRequest;
51 import com.dhyan.nms.server.protocol.snmp.SNMPTableResponse; 54 import com.dhyan.nms.server.protocol.snmp.SNMPTableResponse;
52 import com.dhyan.nms.server.protocol.snmp.SnmpAdapter; 55 import com.dhyan.nms.server.protocol.snmp.SnmpAdapter;
 
 
Line 101 | Parallel Line 104 | Parallel
101 List<Object[]> resultList = null; 104 List<Object[]> resultList = null;
102 String keyString = null; 105 String keyString = null;
103 String xAxisTitle = null; 106 String xAxisTitle = null;
107 BaseHistoricalDataRetriever retriever = null;
104 if (historicalDTO.isCanGroupAll()) 108 if (historicalDTO.isCanGroupAll())
105 { 109 {
106 historicalPlotData = new Hashtable<String, Collection<CollectedDataValueVO>>(); 110 historicalPlotData = new Hashtable<String, Collection<CollectedDataValueVO>>();
 
 
Line 115 | Parallel Line 119 | Parallel
115 chartPanel = new ChartPanelVO(); 119 chartPanel = new ChartPanelVO();
116 historicalPlotData = new Hashtable<String, Collection<CollectedDataValueVO>>(); 120 historicalPlotData = new Hashtable<String, Collection<CollectedDataValueVO>>();
117 } 121 }
118 SnmpHistoricalDataRetriever retriever = new SnmpHistoricalDataRetriever(); 122 if (ServerSettings.getDatabase() == ServerSettings.ORACLE)
123 {
124 retriever = new SnmpHistoricalDataRetrieverOracle();
125 }
126 else
127 {
128 retriever = new SnmpHistoricalDataRetriever();
129 }
119 resultList = (List<Object[]>) retriever.getHistoricalStatisticsData(historicalDTO, historicalDataObjectHash, true); 130 resultList = (List<Object[]>) retriever.getHistoricalStatisticsData(historicalDTO, historicalDataObjectHash, true);
120 for (Object[] object : resultList) 131 for (Object[] object : resultList)
121 { 132 {
 
 
Line 445 | Parallel Line 456 | Parallel
445 { 456 {
446 Collection<Object[]> standardTrendHistoricalDataList = null; 457 Collection<Object[]> standardTrendHistoricalDataList = null;
447 Collection<Object[]> returnHistoricalDataList = new ArrayList<Object[]>(); 458 Collection<Object[]> returnHistoricalDataList = new ArrayList<Object[]>();
459 BaseHistoricalDataRetriever retriever = null;
448 try 460 try
449 { 461 {
450 SnmpHistoricalDataRetriever retriever = new SnmpHistoricalDataRetriever(); 462 if (ServerSettings.getDatabase() == ServerSettings.ORACLE)
463 {
464 retriever = new SnmpHistoricalDataRetrieverOracle();
465 }
466 else
467 {
468 retriever = new SnmpHistoricalDataRetriever();
469 }
451 standardTrendHistoricalDataList = retriever.getHistoricalStatisticsData(historicalDTO, historicalDataObjectHash, isResourceNameRequired); 470 standardTrendHistoricalDataList = retriever.getHistoricalStatisticsData(historicalDTO, historicalDataObjectHash, isResourceNameRequired);
452 if (standardTrendHistoricalDataList != null && standardTrendHistoricalDataList.size() > 0) 471 if (standardTrendHistoricalDataList != null && standardTrendHistoricalDataList.size() > 0)
453 { 472 {
 
File Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/BaseHistoricalDataRetriever.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 14 | Parallel Line 14 | Parallel
14 import com.dhyan.component.filter.interfaces.FilterFacadeLocal; 14 import com.dhyan.component.filter.interfaces.FilterFacadeLocal;
15 import com.dhyan.component.quickfilter.FilterGroupParamVO; 15 import com.dhyan.component.quickfilter.FilterGroupParamVO;
16 import com.dhyan.component.quickfilter.FilterParamVO; 16 import com.dhyan.component.quickfilter.FilterParamVO;
17 import com.dhyan.nms.conf.ServerSettings;
17 import com.dhyan.nms.server.dashboard.datamodel.Dashboardgroupby; 18 import com.dhyan.nms.server.dashboard.datamodel.Dashboardgroupby;
18 import com.dhyan.nms.server.dashboard.interfaces.DashboardGroupbySessionBeanLocal; 19 import com.dhyan.nms.server.dashboard.interfaces.DashboardGroupbySessionBeanLocal;
19 import com.dhyan.nms.server.performance.datacollection.DBUtil; 20 import com.dhyan.nms.server.performance.datacollection.DBUtil;
 
 
Line 106 | Parallel Line 107 | Parallel
106 if (DBUtil.isTableExists(table_name)) 107 if (DBUtil.isTableExists(table_name))
107 { 108 {
108 trendHistoricalDataList = null; 109 trendHistoricalDataList = null;
110 Dashboardgroupby dashboardgroupby = getGroupAllValue(historicalDataObject.getGroupById());
111 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
112 {
113 if (historicalDataObject.getSubGroupList() != null && historicalDataObject.getSubGroupList().size() > 0)
114 {
115 trendHistoricalDataList =
116 getReportDataForSubGroups(historicalDTO, historicalDataObject, trendingType, isShowTypeEnabled,
117 isResourceNameRequired, dashboardgroupby);
118 }
119 }
120 else
121 {
109 if (isShowTypeEnabled) 122 if (isShowTypeEnabled)
110 { 123 {
111 historicalDataObject = updateTopBottomInformation(historicalDTO, historicalDataObject, trendingType, isResourceNameRequired); 124 historicalDataObject =
125 updateTopBottomInformation(historicalDTO, historicalDataObject, trendingType, isResourceNameRequired,
126 dashboardgroupby);
112 } 127 }
113 metricQueryBuilder = 128 metricQueryBuilder =
114 getQueryForMetric(historicalDTO, historicalDataObject, trendingType, isShowTypeEnabled, isResourceNameRequired); 129 getQueryForMetric(historicalDTO, historicalDataObject, trendingType, isShowTypeEnabled, isResourceNameRequired,
130 dashboardgroupby);
115 LOG.info("----------------------> Query :" + metricQueryBuilder); 131 LOG.info("----------------------> Query :" + metricQueryBuilder);
116 trendHistoricalDataList = reportFacade.executeQuery(metricQueryBuilder.toString()); 132 trendHistoricalDataList = reportFacade.executeQuery(metricQueryBuilder.toString());
117 } 133 }
134 }
118 trendingType = getPreviousTrending(trendingType); 135 trendingType = getPreviousTrending(trendingType);
119 } 136 }
120 while ((trendHistoricalDataList == null || trendHistoricalDataList.size() <= 0) && trendingType != null); 137 while ((trendHistoricalDataList == null || trendHistoricalDataList.size() <= 0) && trendingType != null);
 
 
Line 133 | Parallel Line 150 | Parallel
133 return returnHistoricalDataList; 150 return returnHistoricalDataList;
134 } 151 }
135 152
153 private Collection<Object[]> getReportDataForSubGroups(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject historicalDataObject,
154 final String trendingType, final boolean isShowTypeEnabled, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby)
155 throws Exception
156 {
157 ReportingFacadeLocal reportFacade = (ReportingFacadeLocal) LocalLookupManager.getLocalObject(ReportingFacadeLocal.class);
158 Collection<Object[]> trendHistoricalDataList = new ArrayList<Object[]>();
159 ArrayList<String> subGroupTopBottomList = null;
160 StringBuilder metricQueryBuilder = null;
161 HashMap<String, String> selectiveList = null;
162 HashMap<String, String> subGroupList = historicalDataObject.getSubGroupList();
163 if (isShowTypeEnabled && subGroupList.size() > historicalDTO.getCount())
164 {
165 subGroupTopBottomList = getTopBottomValueofSubGroup(historicalDTO, historicalDataObject, trendingType, isShowTypeEnabled, dashboardgroupby);
166 }
167 for (String groupKey : subGroupList.keySet())
168 {
169 selectiveList = new HashMap<String, String>();
170 selectiveList.put(groupKey, subGroupList.get(groupKey));
171 if (subGroupTopBottomList != null && subGroupTopBottomList.size() > 0)
172 {
173 if (subGroupTopBottomList.contains(groupKey))
174 {
175 historicalDataObject.setSubGroupList(selectiveList);
176 metricQueryBuilder =
177 getQueryForMetric(historicalDTO, historicalDataObject, trendingType, false, isResourceNameRequired, dashboardgroupby);
178 LOG.info("Executing SubQuery :" + metricQueryBuilder);
179 Collection<Object[]> tmpDataList = reportFacade.executeQuery(metricQueryBuilder.toString());
180 if (tmpDataList != null && tmpDataList.size() > 0)
181 {
182 trendHistoricalDataList.addAll(tmpDataList);
183 }
184 }
185 }
186 else
187 {
188 historicalDataObject.setSubGroupList(selectiveList);
189 metricQueryBuilder =
190 getQueryForMetric(historicalDTO, historicalDataObject, trendingType, false, isResourceNameRequired, dashboardgroupby);
191 LOG.info("Executing SubQuery :" + metricQueryBuilder);
192 Collection<Object[]> tmpDataList = reportFacade.executeQuery(metricQueryBuilder.toString());
193 if (tmpDataList != null && tmpDataList.size() > 0)
194 {
195 trendHistoricalDataList.addAll(tmpDataList);
196 }
197 }
198 }
199 return trendHistoricalDataList;
200 }
201
136 /** 202 /**
137 * Method to form the complete set of query for every metric. 203 * Method to form the complete set of query for every metric.
138 * @param historicalDTO - HistoricalDataTransferObjectGroup 204 * @param historicalDTO - HistoricalDataTransferObjectGroup
 
 
Line 143 | Parallel Line 209 | Parallel
143 * @return Query 209 * @return Query
144 */ 210 */
145 protected StringBuilder getQueryForMetric(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject historicalDataObject, 211 protected StringBuilder getQueryForMetric(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject historicalDataObject,
146 final String trendingType, final boolean isShowTypeSelected, final boolean isResourceNameRequired) throws Exception 212 final String trendingType, final boolean isShowTypeSelected, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby)
213 throws Exception
147 { 214 {
215
148 StringBuilder metricQueryBuilder = new StringBuilder(); 216 StringBuilder metricQueryBuilder = new StringBuilder();
149 setSelectFromClause(metricQueryBuilder, historicalDTO, historicalDataObject, trendingType, isResourceNameRequired); 217 setSelectFromClause(metricQueryBuilder, historicalDTO, historicalDataObject, trendingType, isResourceNameRequired,
150 setWhereClauseForResource(metricQueryBuilder, historicalDTO, historicalDataObject, trendingType); 218 dashboardgroupby, isShowTypeSelected);
219 setWhereClauseForResource(metricQueryBuilder, historicalDTO, historicalDataObject, trendingType, dashboardgroupby);
220 setWhereClauseForGroup(metricQueryBuilder, historicalDTO, historicalDataObject, trendingType, dashboardgroupby);
221 setWhereCluaseForTopQuery(metricQueryBuilder, historicalDTO, historicalDataObject, isShowTypeSelected, trendingType, isResourceNameRequired,
222 dashboardgroupby);
151 setManagementFilterClause(metricQueryBuilder, historicalDTO, historicalDataObject); 223 setManagementFilterClause(metricQueryBuilder, historicalDTO, historicalDataObject);
152 setQuickFilterClause(metricQueryBuilder, historicalDTO, historicalDataObject); 224 setQuickFilterClause(metricQueryBuilder, historicalDTO, historicalDataObject);
153 setWhereClauseForInstance(metricQueryBuilder, historicalDTO, historicalDataObject); 225 setWhereClauseForInstance(metricQueryBuilder, historicalDTO, historicalDataObject);
154 setGroupByClause(metricQueryBuilder, historicalDTO, historicalDataObject, isShowTypeSelected, trendingType, isResourceNameRequired); 226 setGroupByClause(metricQueryBuilder, historicalDTO, historicalDataObject, isShowTypeSelected, trendingType, isResourceNameRequired, dashboardgroupby);
155 setOrderByClause(metricQueryBuilder, historicalDTO, isShowTypeSelected); 227 setOrderByClause(metricQueryBuilder, historicalDTO, isShowTypeSelected);
156 setWhereClauseForTop(metricQueryBuilder, historicalDTO, historicalDataObject, isShowTypeSelected); 228 setWhereClauseForTop(metricQueryBuilder, historicalDTO, historicalDataObject, isShowTypeSelected);
157 return metricQueryBuilder; 229 return metricQueryBuilder;
 
 
Line 204 | Parallel Line 276 | Parallel
204 * @return Updated HistoricalDataTransferObject 276 * @return Updated HistoricalDataTransferObject
205 */ 277 */
206 protected HashMap<String, HistoricalDataObject> updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, 278 protected HashMap<String, HistoricalDataObject> updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO,
207 final HashMap<String, HistoricalDataObject> historicalDataObjectHash, final String trendingType, final boolean isResourceNameRequired) 279 final HashMap<String, HistoricalDataObject> historicalDataObjectHash, final String trendingType, final boolean isResourceNameRequired,
208 throws Exception 280 final Dashboardgroupby dashboardgroupby) throws Exception
209 { 281 {
210 HistoricalDataObject historicalDataObject = null; 282 HistoricalDataObject historicalDataObject = null;
211 for (String key : historicalDataObjectHash.keySet()) 283 for (String key : historicalDataObjectHash.keySet())
212 { 284 {
213 historicalDataObject = historicalDataObjectHash.get(key); 285 historicalDataObject = historicalDataObjectHash.get(key);
214 updateTopBottomInformation(historicalDTO, historicalDataObject, trendingType, isResourceNameRequired); 286 updateTopBottomInformation(historicalDTO, historicalDataObject, trendingType, isResourceNameRequired, dashboardgroupby);
215 } 287 }
216 return historicalDataObjectHash; 288 return historicalDataObjectHash;
217 } 289 }
 
 
Line 413 | Parallel Line 485 | Parallel
413 try 485 try
414 { 486 {
415 ReportingFacadeLocal reportFacade = (ReportingFacadeLocal) LocalLookupManager.getLocalObject(ReportingFacadeLocal.class); 487 ReportingFacadeLocal reportFacade = (ReportingFacadeLocal) LocalLookupManager.getLocalObject(ReportingFacadeLocal.class);
416 int index = 0;
417 Collection portStats = reportFacade.executeQuery(query); 488 Collection portStats = reportFacade.executeQuery(query);
418 if (portStats != null && portStats.size() > 0) 489 if (portStats != null && portStats.size() > 0)
419 { 490 {
 
 
Line 425 | Parallel Line 496 | Parallel
425 topNValues = topNValues + COMMA; 496 topNValues = topNValues + COMMA;
426 } 497 }
427 topNValues = topNValues + SINGLE_QUOTES + portstat.toString() + SINGLE_QUOTES; 498 topNValues = topNValues + SINGLE_QUOTES + portstat.toString() + SINGLE_QUOTES;
428 index = index + 1; 499 }
429 if (index >= count) 500 }
501
502 }
503 catch (Exception e)
430 { 504 {
431 break; 505 LOG.error(e);
432 } 506 }
507 return topNValues;
433 } 508 }
509
510 /**
511 * Method to find the Top/Bottom n value. This will execute the query and
512 * return Top or bottom 'n' value.
513 * @param query - Query
514 * @return - Top/Bottom n value as string
515 */
516 protected ArrayList<String> getTopNvalueFromList(final String query)
517 {
518 ArrayList<String> topNValues = new ArrayList<String>();
519 try
520 {
521 ReportingFacadeLocal reportFacade = (ReportingFacadeLocal) LocalLookupManager.getLocalObject(ReportingFacadeLocal.class);
522 Collection portStats = reportFacade.executeQuery(query);
523 if (portStats != null && portStats.size() > 0)
524 {
525 for (Object portstat : portStats)
526 {
527 topNValues.add(portstat.toString());
434 } 528 }
529 }
435 530
436 } 531 }
437 catch (Exception e) 532 catch (Exception e)
 
 
Line 494 | Parallel Line 589 | Parallel
494 } 589 }
495 590
496 /** 591 /**
592 * Compute top/bottom values of subgroup
593 * @param historicalDTO historicalDTO
594 * @param perfObject perfObject
595 * @param trendingType trendingType
596 * @param isResourceNameRequired isResourceNameRequired
597 * @param dashboardgroupby dashboardgroupby
598 * @return ArrayList<String>
599 * @throws Exception Exception
600 */
601 public ArrayList<String> getTopBottomValueofSubGroup(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject perfObject,
602 final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby) throws Exception
603 {
604 try
605 {
606 StringBuilder queryBuilder = new StringBuilder();
607 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType;
608 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject);
609 queryBuilder.append("SELECT LEGEND FROM ( ");
610 boolean isFirst = true;
611 for (String groupKey : perfObject.getSubGroupList().keySet())
612 {
613 if (!isFirst)
614 {
615 queryBuilder.append(" UNION ");
616 }
617 queryBuilder.append("(SELECT '").append(groupKey).append("' as legend,").append(perfObject.getAggregateType()).append(metricName).append(
618 "as metricValue FROM RESOURCEDETAILS res, ");
619 queryBuilder.append(" RESOURCEGROUP subgroup, ").append(dynamicTableName).append(" metric ");
620 setWhereClauseForResource(queryBuilder, historicalDTO, perfObject, trendingType, dashboardgroupby);
621 setManagementFilterClause(queryBuilder, historicalDTO, perfObject);
622 setQuickFilterClause(queryBuilder, historicalDTO, perfObject);
623 queryBuilder.append(" and res.resourcegroupid in (").append(perfObject.getSubGroupList().get(groupKey)).append(")");
624 if (ServerSettings.getDatabase() == ServerSettings.ORACLE)
625 {
626 queryBuilder.append(" AND rownum <= ").append(historicalDTO.getCount());
627 }
628 queryBuilder.append(" GROUP BY LEGEND )");
629 isFirst = false;
630 }
631 queryBuilder.append(") TOPDATA ORDER BY TOPDATA.metricValue");
632 if (historicalDTO.getSortOrder() == 1)
633 {
634 queryBuilder.append(" DESC");
635 }
636 if (ServerSettings.getDatabase() != ServerSettings.ORACLE)
637 {
638 queryBuilder.append(" LIMIT ").append(historicalDTO.getCount());
639 }
640 LOG.info("-----------------> SUBGROUP Top Query :" + queryBuilder.toString());
641 return getTopNvalueFromList(queryBuilder.toString());
642 }
643 catch (Exception e)
644 {
645 LOG.error(e);
646 }
647 return null;
648 }
649
650 /**
651 * To set Top/Bottom query
652 * @param metricQueryBuilder metricQueryBuilder
653 * @param historicalDTO historicalDTO
654 * @param perfObject perfObject
655 * @param isShowTypeSelected isShowTypeSelected
656 * @param trendingType trendingType
657 * @param isResourceNameRequired isResourceNameRequired
658 * @param dashboardgroupby dashboardgroupby
659 * @throws Exception Exception
660 */
661 public abstract void setWhereCluaseForTopQuery(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
662 HistoricalDataObject perfObject, boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired,
663 final Dashboardgroupby dashboardgroupby) throws Exception;
664
665 /**
497 * This method will find the Top or Bottom n values and update them in the 666 * This method will find the Top or Bottom n values and update them in the
498 * same object. 667 * same object.
499 * @param perfObject - HistoricalDataTransferObject 668 * @param perfObject - HistoricalDataTransferObject
500 * @param historicalDTO - HistoricalDataTransferObjectGroup 669 * @param historicalDTO - HistoricalDataTransferObjectGroup
501 * @param trendingType - Trending Type 670 * @param trendingType - Trending Type
502 * @param isResourceNameRequired - isResourceNameRequired 671 * @param isResourceNameRequired - isResourceNameRequired
672 * @param dashboardgroupby Dashboardgroupby
503 * @return Updated HistoricalDataTransferObject 673 * @return Updated HistoricalDataTransferObject
504 * @throws Exception Exception 674 * @throws Exception Exception
505 */ 675 */
506 public abstract HistoricalDataObject updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, HistoricalDataObject perfObject, 676 public abstract HistoricalDataObject updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, HistoricalDataObject perfObject,
507 final String trendingType, final boolean isResourceNameRequired) throws Exception; 677 final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby) throws Exception;
508 678
509 /** 679 /**
510 * This method will form the Select statement query for appropriate 680 * This method will form the Select statement query for appropriate
 
 
Line 514 | Parallel Line 684 | Parallel
514 * @param historicalDTO - HistoricalDataTransferObjectGroup 684 * @param historicalDTO - HistoricalDataTransferObjectGroup
515 * @param trendingType - Trending Type 685 * @param trendingType - Trending Type
516 * @param isResourceNameRequired - isResourceNameRequired 686 * @param isResourceNameRequired - isResourceNameRequired
687 * @param dashboardgroupby Dashboardgroupby
688 * @param isShowTypeSelected isShowTypeSelected
517 * @throws Exception Exception 689 * @throws Exception Exception
518 */ 690 */
519 public abstract void setSelectFromClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 691 public abstract void setSelectFromClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
520 HistoricalDataObject perfObject, String trendingType, final boolean isResourceNameRequired) throws Exception; 692 HistoricalDataObject perfObject, String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby,
693 final boolean isShowTypeSelected) throws Exception;
521 694
522 /** 695 /**
523 * This method will form the Filter condition for appropriate collection 696 * This method will form the Filter condition for appropriate collection
 
 
Line 557 | Parallel Line 730 | Parallel
557 * @param perfObject - HistoricalDataObject 730 * @param perfObject - HistoricalDataObject
558 * @param trendingType - trendingType 731 * @param trendingType - trendingType
559 * @param historicalDTO - HistoricalDataTransferObjectGroup 732 * @param historicalDTO - HistoricalDataTransferObjectGroup
733 * @param dashboardgroupby Dashboardgroupby
560 */ 734 */
561 public abstract void setWhereClauseForResource(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 735 public abstract void setWhereClauseForResource(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
562 HistoricalDataObject perfObject, final String trendingType); 736 HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby);
563 737
564 /** 738 /**
565 * This method will form the Resource condition for appropriate collection 739 * This method will form the Resource condition for appropriate collection
 
 
Line 580 | Parallel Line 754 | Parallel
580 * @param isShowTypeSelected - Top / Bottom enabled 754 * @param isShowTypeSelected - Top / Bottom enabled
581 * @param trendingType - Trending Type 755 * @param trendingType - Trending Type
582 * @param isResourceNameRequired isResourceNameRequired 756 * @param isResourceNameRequired isResourceNameRequired
757 * @param dashboardgroupby Dashboardgroupby
583 */ 758 */
584 public abstract void setGroupByClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, HistoricalDataObject perfObject, 759 public abstract void setGroupByClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, HistoricalDataObject perfObject,
585 boolean isShowTypeSelected, String trendingType, boolean isResourceNameRequired); 760 boolean isShowTypeSelected, String trendingType, boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby);
586 761
587 /** 762 /**
588 * This method will form the Order by condition for appropriate collection 763 * This method will form the Order by condition for appropriate collection
 
 
Line 592 | Parallel Line 767 | Parallel
592 * @param isShowTypeSelected - Top / Bottom enabled 767 * @param isShowTypeSelected - Top / Bottom enabled
593 */ 768 */
594 public abstract void setOrderByClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, boolean isShowTypeSelected); 769 public abstract void setOrderByClause(StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, boolean isShowTypeSelected);
770
771 /**
772 * This method will form the Resource condition for appropriate collection
773 * type.
774 * @param metricQueryBuilder - Query to be updated
775 * @param perfObject - HistoricalDataObject
776 * @param trendingType - trendingType
777 * @param historicalDTO - HistoricalDataTransferObjectGroup
778 * @param dashboardgroupby Dashboardgroupby
779 */
780 public abstract void setWhereClauseForGroup(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
781 final HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby);
595 } 782 }
 
File Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/SnmpHistoricalDataRetriever.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 19 | Parallel Line 19 | Parallel
19 * @param historicalDTO - HistoricalDataTransferObjectGroup 19 * @param historicalDTO - HistoricalDataTransferObjectGroup
20 * @param trendingType - Trending Type 20 * @param trendingType - Trending Type
21 * @param isResourceNameRequired - isResourceNameRequired 21 * @param isResourceNameRequired - isResourceNameRequired
22 * @param isShowTypeSelected isShowTypeSelected
23 * @param dashboardgroupby dashboardgroupby
22 * @throws Exception Exception 24 * @throws Exception Exception
23 */ 25 */
24 @Override 26 @Override
25 public void setSelectFromClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 27 public void setSelectFromClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
26 final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired) throws Exception 28 final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby,
29 final boolean isShowTypeSelected) throws Exception
27 { 30 {
28 metricQueryBuilder.append("Select a.value, a.time, a.legend from "); 31 String legend = getLegend(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
29 String legend = getLegend(perfObject, trendingType, isResourceNameRequired);
30 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType; 32 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType;
31 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject); 33 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject);
34 metricQueryBuilder.append("SELECT ").append(perfObject.getAggregateType()).append(metricName);
32 if (trendingType.trim().length() > 0) 35 if (trendingType.trim().length() > 0)
33 { 36 {
34 metricQueryBuilder.append("(SELECT ").append(perfObject.getAggregateType()).append(metricName); 37 metricQueryBuilder.append(VALUE).append(" , metric.todate time,");
35 metricQueryBuilder.append(VALUE).append(" , metric.todate time,res.resourcename as resname,").append(
36 legend + " as legend FROM RESOURCEDETAILS res , RESOURCEGROUP subgroup, ");
37 metricQueryBuilder.append(dynamicTableName).append(" metric ");
38 } 38 }
39 else 39 else
40 { 40 {
41 metricQueryBuilder.append("(SELECT ").append(perfObject.getAggregateType()).append(metricName); 41 metricQueryBuilder.append(VALUE).append(" , metric.timeofcollection time,");
42 metricQueryBuilder.append(VALUE).append(" , metric.timeofcollection time,res.resourcename as resname,").append(legend).append( 42 }
43 " as legend " + " FROM RESOURCEDETAILS res, RESOURCEGROUP subgroup, "); 43 metricQueryBuilder.append(legend).append(" as legend FROM RESOURCEDETAILS res, ");
44 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
45 {
46 metricQueryBuilder.append("RESOURCEGROUP subgroup, ");
47 }
44 metricQueryBuilder.append(dynamicTableName).append(" metric "); 48 metricQueryBuilder.append(dynamicTableName).append(" metric ");
49 if (isShowTypeSelected)
50 {
51 metricQueryBuilder.append(COMMA).append(getTopBottomQuery(historicalDTO, perfObject, trendingType, isResourceNameRequired, dashboardgroupby));
45 } 52 }
46 } 53 }
47 54
48 private String getLegend(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired) 55 private String getLegend(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired,
56 final Dashboardgroupby dashboardgroupby)
49 { 57 {
50 Dashboardgroupby dashboardgroupby = getGroupAllValue(perfObject.getGroupById());
51 String legend = null; 58 String legend = null;
52 String column_name = perfObject.getDisplayName(); 59 String column_name = perfObject.getDisplayName();
53 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP)) 60 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
54 { 61 {
55 legend = "subgroup.name"; 62 legend = "'" + perfObject.getSubGroupList().keySet().iterator().next() + "'";
56 } 63 }
57 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE)) 64 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE))
58 { 65 {
 
 
Line 60 | Parallel Line 67 | Parallel
60 } 67 }
61 else 68 else
62 { 69 {
63 if (isResourceNameRequired)
64 {
65 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0) 70 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
66 { 71 {
67 legend = 72 legend =
 
 
Line 73 | Parallel Line 78 | Parallel
73 legend = "CONCAT(CONCAT(res.resourcename,'_'),'" + column_name + "')"; 78 legend = "CONCAT(CONCAT(res.resourcename,'_'),'" + column_name + "')";
74 } 79 }
75 } 80 }
76 else
77 {
78 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
79 {
80 legend = "CONCAT(CONCAT('" + column_name + "','_')," + this.getInstanceAsDBString(perfObject.getInstanceColumnName()) + CLOSE_BRACE;
81 }
82 else
83 {
84 legend = "CONCAT('" + column_name + "','')";
85 }
86 }
87 }
88 return legend; 81 return legend;
89 } 82 }
90 83
 
 
Line 95 | Parallel Line 88 | Parallel
95 * @param perfObject - HistoricalDataObject 88 * @param perfObject - HistoricalDataObject
96 * @param trendingType - trendingType 89 * @param trendingType - trendingType
97 * @param historicalDTO - HistoricalDataTransferObjectGroup 90 * @param historicalDTO - HistoricalDataTransferObjectGroup
91 * @param dashboardgroupby dashboardgroupby
98 */ 92 */
99 @Override 93 @Override
100 public void setWhereClauseForResource(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 94 public void setWhereClauseForResource(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
101 final HistoricalDataObject perfObject, final String trendingType) 95 final HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby)
102 { 96 {
97 metricQueryBuilder.append(" WHERE res.resourceid = metric.resourceid ");
98 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
99 {
100 metricQueryBuilder.append("and res.resourcegroupid = subgroup.resourcegroupid");
101 }
103 if (trendingType.trim().length() > 0) 102 if (trendingType.trim().length() > 0)
104 { 103 {
105 metricQueryBuilder.append(" WHERE metric.resourceid = res.resourceid and res.resourcegroupid = subgroup.resourcegroupid").append( 104 metricQueryBuilder.append(" and metric.fromdate >= ").append(historicalDTO.getPeriodFrom()).append(" and metric.todate <= ").append(
106 " and metric.fromdate >= ").append(historicalDTO.getPeriodFrom()).append(" and metric.todate <= ").append(historicalDTO.getPeriodTo()); 105 historicalDTO.getPeriodTo());
107 } 106 }
108 else 107 else
109 { 108 {
110 metricQueryBuilder.append( 109 metricQueryBuilder.append(" and metric.timeofcollection >= ").append(historicalDTO.getPeriodFrom()).append(" and metric.timeofcollection <= ")
111 " WHERE metric.resourceid = res.resourceid and res.resourcegroupid = subgroup.resourcegroupid and metric.timeofcollection >= ").append( 110 .append(historicalDTO.getPeriodTo());
112 historicalDTO.getPeriodFrom()).append(" and metric.timeofcollection <= ").append(historicalDTO.getPeriodTo());
113 } 111 }
112 if (perfObject.getEntityLevel() != null
113 && (!perfObject.getEntityLevel().equalsIgnoreCase(GROUP) && !dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP)))
114 {
114 metricQueryBuilder.append( 115 metricQueryBuilder.append(
115 " and res.resourceid in (" + perfObject.getResources().toString().substring(1, perfObject.getResources().toString().length() - 1)).append( 116 " and res.resourceid in (" + perfObject.getResources().toString().substring(1, perfObject.getResources().toString().length() - 1)).append(
116 CLOSE_BRACE); 117 CLOSE_BRACE);
117 } 118 }
119 }
118 120
119 /** 121 /**
122 * This method will form the Resource condition for appropriate collection
123 * type.
124 * @param metricQueryBuilder - Query to be updated
125 * @param perfObject - HistoricalDataObject
126 * @param trendingType - trendingType
127 * @param historicalDTO - HistoricalDataTransferObjectGroup
128 * @param dashboardgroupby dashboardgroupby
129 */
130 @Override
131 public void setWhereClauseForGroup(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
132 final HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby)
133 {
134 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
135 {
136 String key = perfObject.getSubGroupList().keySet().iterator().next();
137 metricQueryBuilder.append(" and subgroup.resourcegroupid in (" + perfObject.getSubGroupList().get(key)).append(CLOSE_BRACE);
138 }
139 }
140
141 /**
120 * This method will form the Top/Bottom condition for appropriate collection 142 * This method will form the Top/Bottom condition for appropriate collection
121 * type. 143 * type.
122 * @param metricQueryBuilder - Query to be updated 144 * @param metricQueryBuilder - Query to be updated
 
 
Line 128 | Parallel Line 150 | Parallel
128 public void setWhereClauseForTop(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 150 public void setWhereClauseForTop(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
129 final HistoricalDataObject perfObject, final boolean isShowTypeSelected) 151 final HistoricalDataObject perfObject, final boolean isShowTypeSelected)
130 { 152 {
131 metricQueryBuilder.append(") a "); 153 /*
132 if (isShowTypeSelected && perfObject.getTopBottomDetails() != null && perfObject.getTopBottomDetails().trim().length() > 0) 154 * if (isShowTypeSelected && perfObject.getTopBottomDetails() != null &&
133 { 155 * perfObject.getTopBottomDetails().trim().length() > 0) {
134 metricQueryBuilder.append("WHERE a.legend in (" + perfObject.getTopBottomDetails() + CLOSE_BRACE); 156 * metricQueryBuilder.append(" HAVING legend in (" +
157 * perfObject.getTopBottomDetails() + CLOSE_BRACE); }
158 */
135 } 159 }
136 }
137 160
138 /** 161 /**
139 * This method will form the Filter condition for appropriate collection 162 * This method will form the Filter condition for appropriate collection
 
 
Line 168 | Parallel Line 191 | Parallel
168 final HistoricalDataObject perfObject) 191 final HistoricalDataObject perfObject)
169 { 192 {
170 // TODO Auto-generated method stub 193 // TODO Auto-generated method stub
194
171 } 195 }
172 196
173 /** 197 /**
 
 
Line 179 | Parallel Line 203 | Parallel
179 * @param isShowTypeSelected - Top / Bottom enabled 203 * @param isShowTypeSelected - Top / Bottom enabled
180 * @param trendingType - Trending Type 204 * @param trendingType - Trending Type
181 * @param isResourceNameRequired isResourceNameRequired 205 * @param isResourceNameRequired isResourceNameRequired
206 * @param dashboardgroupby dashboardgroupby
182 */ 207 */
183 @Override 208 @Override
184 public void setGroupByClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 209 public void setGroupByClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
185 final HistoricalDataObject perfObject, final boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired) 210 final HistoricalDataObject perfObject, final boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired,
211 final Dashboardgroupby dashboardgroupby)
186 { 212 {
187 metricQueryBuilder.append(" GROUP BY " + getGroupByFieldString(perfObject, trendingType, isResourceNameRequired)); 213 metricQueryBuilder.append(" GROUP BY ");
188 if (trendingType.trim().length() > 0) 214 if (trendingType.trim().length() > 0)
189 { 215 {
190 metricQueryBuilder.append(", metric.todate"); 216 metricQueryBuilder.append("metric.todate");
191 } 217 }
192 else 218 else
193 { 219 {
194 metricQueryBuilder.append(", metric.timeofcollection"); 220 metricQueryBuilder.append("metric.timeofcollection");
195 } 221 }
222 String group_by_value = getGroupByFieldString(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
223 if (group_by_value != null && group_by_value.length() > 0)
224 {
225 metricQueryBuilder.append(COMMA).append(group_by_value);
226 }
196 227
197 } 228 }
198 229
199 private String getGroupByFieldString(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired) 230 private String getGroupByFieldString(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired,
231 final Dashboardgroupby dashboardgroupby)
200 { 232 {
201 Dashboardgroupby dashboardgroupby = getGroupAllValue(perfObject.getGroupById());
202 String group_by_fields = null; 233 String group_by_fields = null;
203 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP)) 234 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
204 { 235 {
205 group_by_fields = "subgroup.name"; 236 // group_by_fields = "subgroup.name";
237 group_by_fields = null;
206 } 238 }
207 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE)) 239 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE))
208 { 240 {
 
 
Line 212 | Parallel Line 244 | Parallel
212 { 244 {
213 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0) 245 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
214 { 246 {
215 group_by_fields = perfObject.getInstanceColumnName(); 247 group_by_fields = perfObject.getInstanceColumnName() + COMMA + RESOURCE_NAME;
216 } 248 }
217 } 249 }
218 if (isResourceNameRequired)
219 {
220 if (group_by_fields != null)
221 {
222 if (group_by_fields.indexOf(RESOURCE_NAME) <= 0)
223 {
224 group_by_fields += ",res.resourcename";
225 }
226 }
227 else
228 {
229 group_by_fields = RESOURCE_NAME;
230 }
231 }
232 return group_by_fields; 250 return group_by_fields;
233 } 251 }
234 252
 
 
Line 252 | Parallel Line 270 | Parallel
252 * @param historicalDTO - HistoricalDataTransferObjectGroup 270 * @param historicalDTO - HistoricalDataTransferObjectGroup
253 * @param trendingType - Trending Type 271 * @param trendingType - Trending Type
254 * @param isResourceNameRequired - isResourceNameRequired 272 * @param isResourceNameRequired - isResourceNameRequired
273 * @param dashboardgroupby dashboardgroupby
255 * @return Updated HistoricalDataTransferObject 274 * @return Updated HistoricalDataTransferObject
256 * @throws Exception Exception 275 * @throws Exception Exception
257 */ 276 */
258 @Override 277 @Override
259 public HistoricalDataObject updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject perfObject, 278 public HistoricalDataObject updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject perfObject,
260 final String trendingType, final boolean isResourceNameRequired) throws Exception 279 final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby) throws Exception
261 { 280 {
281 return perfObject;
282 }
283
284 /**
285 * This method will form the Resource condition for appropriate collection
286 * type.
287 * @param metricQueryBuilder - Query to be updated
288 * @param perfObject - HistoricalDataObject
289 * @param historicalDTO - HistoricalDataTransferObjectGroup
290 */
291 @Override
292 public void setWhereClauseForInstance(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
293 final HistoricalDataObject perfObject)
294 {
295 if (perfObject.getSelectedIndices() != null)
296 {
297 String[] selected_indices = perfObject.getSelectedIndices().toArray(new String[perfObject.getSelectedIndices().size()]);
298 String instance_string = this.getSelectedInstanceListAsString(selected_indices);
299 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
300 {
301 metricQueryBuilder.append(" AND CONCAT(CONCAT(metric.resourceid,'_'),").append(this.getInstanceAsDBString(perfObject.getInstanceColumnName()))
302 .append(") in (").append(instance_string).append(CLOSE_BRACE);
303 }
304 }
305 }
306
307 /**
308 * This method will find the Top or Bottom n values and update them in the
309 * same object.
310 * @param perfObject - HistoricalDataTransferObject
311 * @param historicalDTO - HistoricalDataTransferObjectGroup
312 * @param trendingType - Trending Type
313 * @param isResourceNameRequired - isResourceNameRequired
314 * @param dashboardgroupby dashboardgroupby
315 * @return Updated HistoricalDataTransferObject
316 * @throws Exception Exception
317 */
318 public String getTopBottomQuery(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject perfObject, final String trendingType,
319 final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby) throws Exception
320 {
321 StringBuilder queryBuilder = new StringBuilder();
262 try 322 try
263 { 323 {
264 StringBuilder queryBuilder = new StringBuilder();
265 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType; 324 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType;
266 String legend = getLegend(perfObject, trendingType, isResourceNameRequired); 325 String legend = getLegend(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
267 queryBuilder.append("SELECT ").append(legend).append(" FROM RESOURCEDETAILS res, RESOURCEGROUP subgroup, ").append(dynamicTableName).append( 326 queryBuilder.append("( SELECT DISTINCT(").append(legend).append(") as legend FROM RESOURCEDETAILS res, ");
268 " metric "); 327 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
269 setWhereClauseForResource(queryBuilder, historicalDTO, perfObject, trendingType); 328 {
329 queryBuilder.append(" RESOURCEGROUP subgroup, ");
330 }
331 queryBuilder.append(dynamicTableName).append(" metric ");
332 setWhereClauseForResource(queryBuilder, historicalDTO, perfObject, trendingType, dashboardgroupby);
270 setManagementFilterClause(queryBuilder, historicalDTO, perfObject); 333 setManagementFilterClause(queryBuilder, historicalDTO, perfObject);
271 setQuickFilterClause(queryBuilder, historicalDTO, perfObject); 334 setQuickFilterClause(queryBuilder, historicalDTO, perfObject);
272 setWhereClauseForInstance(queryBuilder, historicalDTO, perfObject); 335 setWhereClauseForInstance(queryBuilder, historicalDTO, perfObject);
273 queryBuilder.append(" group by ").append(getGroupByFieldString(perfObject, trendingType, isResourceNameRequired)); 336 String group_by_value = getGroupByFieldString(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
337 if (group_by_value != null && group_by_value.length() > 0)
338 {
339 queryBuilder.append(" GROUP BY ").append(group_by_value);
340 }
274 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject); 341 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject);
275 queryBuilder.append(" order by ").append(perfObject.getAggregateType()).append(metricName); 342 queryBuilder.append(" ORDER BY ").append(perfObject.getAggregateType()).append(metricName);
276 if (historicalDTO.getSortOrder() == 1) 343 if (historicalDTO.getSortOrder() == 1)
277 { 344 {
278 queryBuilder.append(" DESC"); 345 queryBuilder.append(" DESC");
279 } 346 }
280 LOG.info("-----------------> Top Query :" + queryBuilder.toString()); 347 queryBuilder.append(" LIMIT ").append(historicalDTO.getCount());
281 String topNValues = getTopNvalueFromList(queryBuilder.toString(), historicalDTO.getCount()); 348 queryBuilder.append(" ) TOPDATA ");
282 if (topNValues != null && topNValues.trim().length() > 0) 349 LOG.info("****************> Top Query :" + queryBuilder.toString());
283 {
284 perfObject.setTopBottomDetails(topNValues);
285 } 350 }
286 }
287 catch (Exception e) 351 catch (Exception e)
288 { 352 {
289 LOG.error(e); 353 LOG.error(e);
290 } 354 }
291 return perfObject; 355 return queryBuilder.toString();
292 } 356 }
293 357
294 /** 358 /**
295 * This method will form the Resource condition for appropriate collection 359 * To set Top/Bottom query
296 * type. 360 * @param metricQueryBuilder metricQueryBuilder
297 * @param metricQueryBuilder - Query to be updated 361 * @param historicalDTO historicalDTO
298 * @param perfObject - HistoricalDataObject 362 * @param perfObject perfObject
299 * @param historicalDTO - HistoricalDataTransferObjectGroup 363 * @param isShowTypeSelected isShowTypeSelected
364 * @param trendingType trendingType
365 * @param isResourceNameRequired isResourceNameRequired
366 * @param dashboardgroupby dashboardgroupby
367 * @throws Exception Exception
300 */ 368 */
301 @Override 369 @Override
302 public void setWhereClauseForInstance(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, 370 public void setWhereCluaseForTopQuery(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
303 final HistoricalDataObject perfObject) 371 final HistoricalDataObject perfObject, final boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired,
372 final Dashboardgroupby dashboardgroupby) throws Exception
304 { 373 {
305 if (perfObject.getSelectedIndices() != null) 374 if (isShowTypeSelected)
306 { 375 {
307 String[] selected_indices = perfObject.getSelectedIndices().toArray(new String[perfObject.getSelectedIndices().size()]); 376 metricQueryBuilder.append(" and TOPDATA.legend = " + getLegend(perfObject, trendingType, isResourceNameRequired, dashboardgroupby) + " ");
308 String instance_string = this.getSelectedInstanceListAsString(selected_indices);
309 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
310 {
311 metricQueryBuilder.append(" AND CONCAT(CONCAT(metric.resourceid,'_'),").append(this.getInstanceAsDBString(perfObject.getInstanceColumnName()))
312 .append(") in (").append(instance_string).append(CLOSE_BRACE);
313 } 377 }
314 } 378 }
315 } 379 }
316 }
 
File Perf.ReportManager/src/com/dhyan/nms/server/performance/reportmanager/retriever/SnmpHistoricalDataRetrieverOracle.java (Revision 0) [Add File Comment] [<<] [Top] [>>]
 
1 package com.dhyan.nms.server.performance.reportmanager.retriever;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5
6 import com.dhyan.nms.server.dashboard.datamodel.Dashboardgroupby;
7 import com.dhyan.nms.server.performance.reportmanager.HistoricalDataObject;
8 import com.dhyan.nms.server.performance.reportmanager.HistoricalDataTransferObject;
9
10 public class SnmpHistoricalDataRetrieverOracle extends BaseHistoricalDataRetriever
11 {
12 private static final Log LOG = LogFactory.getLog(SnmpHistoricalDataRetrieverOracle.class);
13
14 /**
15 * This method will form the Select statement query for appropriate
16 * collection type.
17 * @param metricQueryBuilder - Query to be updated
18 * @param perfObject - HistoricalDataTransferObject
19 * @param historicalDTO - HistoricalDataTransferObjectGroup
20 * @param trendingType - Trending Type
21 * @param isResourceNameRequired - isResourceNameRequired
22 * @param isShowTypeSelected isShowTypeSelected
23 * @param dashboardgroupby dashboardgroupby
24 * @throws Exception Exception
25 */
26 @Override
27 public void setSelectFromClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
28 final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby,
29 final boolean isShowTypeSelected) throws Exception
30 {
31 metricQueryBuilder.append("Select a.value, a.time, a.legend from ");
32 String legend = getLegend(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
33 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType;
34 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject);
35 metricQueryBuilder.append("(SELECT ").append(perfObject.getAggregateType()).append(metricName);
36 if (trendingType.trim().length() > 0)
37 {
38 metricQueryBuilder.append(VALUE).append(" , metric.todate time,res.resourcename as resname,");
39 }
40 else
41 {
42 metricQueryBuilder.append(VALUE).append(" , metric.timeofcollection time,res.resourcename as resname,");
43 }
44 metricQueryBuilder.append(legend).append(" as legend FROM RESOURCEDETAILS res, ");
45 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
46 {
47 metricQueryBuilder.append("RESOURCEGROUP subgroup, ");
48 }
49 metricQueryBuilder.append(dynamicTableName).append(" metric ");
50 }
51
52 private String getLegend(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired,
53 final Dashboardgroupby dashboardgroupby)
54 {
55 String legend = null;
56 String column_name = perfObject.getDisplayName();
57 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
58 {
59 legend = "'" + perfObject.getSubGroupList().keySet().iterator().next() + "'";
60 }
61 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE))
62 {
63 legend = RESOURCE_NAME;
64 }
65 else
66 {
67 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
68 {
69 legend =
70 "CONCAT(CONCAT(CONCAT(CONCAT(res.resourcename,'_'),'" + column_name + "'),'_'),"
71 + this.getInstanceAsDBString(perfObject.getInstanceColumnName()) + CLOSE_BRACE;
72 }
73 else
74 {
75 legend = "CONCAT(CONCAT(res.resourcename,'_'),'" + column_name + "')";
76 }
77 }
78 return legend;
79 }
80
81 /**
82 * This method will form the Resource condition for appropriate collection
83 * type.
84 * @param metricQueryBuilder - Query to be updated
85 * @param perfObject - HistoricalDataObject
86 * @param trendingType - trendingType
87 * @param historicalDTO - HistoricalDataTransferObjectGroup
88 * @param dashboardgroupby dashboardgroupby
89 */
90 @Override
91 public void setWhereClauseForResource(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
92 final HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby)
93 {
94 metricQueryBuilder.append(" WHERE res.resourceid = metric.resourceid ");
95 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
96 {
97 metricQueryBuilder.append("and res.resourcegroupid = subgroup.resourcegroupid");
98 }
99 if (trendingType.trim().length() > 0)
100 {
101 metricQueryBuilder.append(" and metric.fromdate >= ").append(historicalDTO.getPeriodFrom()).append(" and metric.todate <= ").append(
102 historicalDTO.getPeriodTo());
103 }
104 else
105 {
106 metricQueryBuilder.append(" and metric.timeofcollection >= ").append(historicalDTO.getPeriodFrom()).append(" and metric.timeofcollection <= ")
107 .append(historicalDTO.getPeriodTo());
108 }
109 if (perfObject.getEntityLevel() != null
110 && (!perfObject.getEntityLevel().equalsIgnoreCase(GROUP) && !dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP)))
111 {
112 metricQueryBuilder.append(
113 " and res.resourceid in (" + perfObject.getResources().toString().substring(1, perfObject.getResources().toString().length() - 1)).append(
114 CLOSE_BRACE);
115 }
116 }
117
118 /**
119 * This method will form the Resource condition for appropriate collection
120 * type.
121 * @param metricQueryBuilder - Query to be updated
122 * @param perfObject - HistoricalDataObject
123 * @param trendingType - trendingType
124 * @param historicalDTO - HistoricalDataTransferObjectGroup
125 * @param dashboardgroupby dashboardgroupby
126 */
127 @Override
128 public void setWhereClauseForGroup(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
129 final HistoricalDataObject perfObject, final String trendingType, final Dashboardgroupby dashboardgroupby)
130 {
131 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
132 {
133 String key = perfObject.getSubGroupList().keySet().iterator().next();
134 metricQueryBuilder.append(" and subgroup.resourcegroupid in (" + perfObject.getSubGroupList().get(key)).append(CLOSE_BRACE);
135 }
136 }
137
138 /**
139 * This method will form the Top/Bottom condition for appropriate collection
140 * type.
141 * @param metricQueryBuilder - Query to be updated
142 * @param perfObject - HistoricalDataTransferObject
143 * @param historicalDTO - HistoricalDataTransferObjectGroup
144 * @param isShowTypeSelected - Top / Bottom enabled
145 */
146 @Override
147 public void setWhereClauseForTop(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
148 final HistoricalDataObject perfObject, final boolean isShowTypeSelected)
149 {
150 metricQueryBuilder.append(") a ");
151 if (isShowTypeSelected && perfObject.getTopBottomDetails() != null && perfObject.getTopBottomDetails().trim().length() > 0)
152 {
153 metricQueryBuilder.append("WHERE a.legend in (" + perfObject.getTopBottomDetails() + CLOSE_BRACE);
154 }
155 }
156
157 /**
158 * This method will form the Filter condition for appropriate collection
159 * type.
160 * @param metricQueryBuilder - Query to be updated
161 * @param perfObject - HistoricalDataTransferObject
162 * @param historicalDTO - HistoricalDataTransferObjectGroup
163 */
164 @Override
165 public void setManagementFilterClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
166 final HistoricalDataObject perfObject)
167 {
168 if (historicalDTO.getFilterId() != null && historicalDTO.getFilterId().intValue() > 0)
169 {
170 String valueFilter = getFilterValueQuery(historicalDTO.getFilterId().intValue());
171 if (valueFilter != null && valueFilter.length() > 0)
172 {
173 metricQueryBuilder.append(AND + valueFilter + SPACE);
174 }
175 }
176 }
177
178 /**
179 * This method will form the Filter condition for appropriate collection
180 * type.
181 * @param metricQueryBuilder - Query to be updated
182 * @param perfObject - HistoricalDataObject
183 * @param historicalDTO - HistoricalDataTransferObjectGroup
184 */
185 @Override
186 public void setQuickFilterClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
187 final HistoricalDataObject perfObject)
188 {
189 // TODO Auto-generated method stub
190 }
191
192 /**
193 * This method will form the Group by condition for appropriate collection
194 * type.
195 * @param metricQueryBuilder - Query to be updated
196 * @param historicalDTO - HistoricalDataTransferObjectGroup
197 * @param perfObject - HistoricalDataTransferObject
198 * @param isShowTypeSelected - Top / Bottom enabled
199 * @param trendingType - Trending Type
200 * @param isResourceNameRequired isResourceNameRequired
201 * @param dashboardgroupby dashboardgroupby
202 */
203 @Override
204 public void setGroupByClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
205 final HistoricalDataObject perfObject, final boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired,
206 final Dashboardgroupby dashboardgroupby)
207 {
208 metricQueryBuilder.append(" GROUP BY " + getGroupByFieldString(perfObject, trendingType, isResourceNameRequired, dashboardgroupby));
209 if (trendingType.trim().length() > 0)
210 {
211 metricQueryBuilder.append(", metric.todate");
212 }
213 else
214 {
215 metricQueryBuilder.append(", metric.timeofcollection");
216 }
217
218 }
219
220 private String getGroupByFieldString(final HistoricalDataObject perfObject, final String trendingType, final boolean isResourceNameRequired,
221 final Dashboardgroupby dashboardgroupby)
222 {
223 String group_by_fields = null;
224 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
225 {
226 group_by_fields = "subgroup.name";
227 }
228 else if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(RESOURCE))
229 {
230 group_by_fields = RESOURCE_NAME;
231 }
232 else
233 {
234 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
235 {
236 group_by_fields = perfObject.getInstanceColumnName();
237 }
238 }
239 if (isResourceNameRequired)
240 {
241 if (group_by_fields != null && group_by_fields.indexOf(RESOURCE_NAME) < 0)
242 {
243 group_by_fields += COMMA + RESOURCE_NAME;
244 }
245 else
246 {
247 group_by_fields = RESOURCE_NAME;
248 }
249 }
250 return group_by_fields;
251 }
252
253 /**
254 * This method will form the Order by condition for appropriate collection
255 * type.
256 * @param metricQueryBuilder - Query to be updated
257 * @param historicalDTO - HistoricalDataTransferObjectGroup
258 * @param isShowTypeSelected - Top / Bottom enabled
259 */
260 @Override
261 public void setOrderByClause(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO, final boolean isShowTypeSelected)
262 {
263 // TODO Auto-generated method stub
264 }
265
266 /**
267 * This method will find the Top or Bottom n values and update them in the
268 * same object.
269 * @param perfObject - HistoricalDataTransferObject
270 * @param historicalDTO - HistoricalDataTransferObjectGroup
271 * @param trendingType - Trending Type
272 * @param isResourceNameRequired - isResourceNameRequired
273 * @param dashboardgroupby dashboardgroupby
274 * @return Updated HistoricalDataTransferObject
275 * @throws Exception Exception
276 */
277 @Override
278 public HistoricalDataObject updateTopBottomInformation(final HistoricalDataTransferObject historicalDTO, final HistoricalDataObject perfObject,
279 final String trendingType, final boolean isResourceNameRequired, final Dashboardgroupby dashboardgroupby) throws Exception
280 {
281 try
282 {
283 StringBuilder queryBuilder = new StringBuilder();
284 String dynamicTableName = perfObject.getDataStorageTableName() + trendingType;
285 String legend = getLegend(perfObject, trendingType, isResourceNameRequired, dashboardgroupby);
286 queryBuilder.append("SELECT DISTINCT(").append(legend).append(") FROM RESOURCEDETAILS res, ");
287 if (dashboardgroupby != null && dashboardgroupby.getGroupbyshortname().equalsIgnoreCase(GROUP))
288 {
289 queryBuilder.append(" RESOURCEGROUP subgroup, ");
290 }
291 queryBuilder.append(dynamicTableName).append(" metric ");
292 setWhereClauseForResource(queryBuilder, historicalDTO, perfObject, trendingType, dashboardgroupby);
293 setManagementFilterClause(queryBuilder, historicalDTO, perfObject);
294 setQuickFilterClause(queryBuilder, historicalDTO, perfObject);
295 setWhereClauseForInstance(queryBuilder, historicalDTO, perfObject);
296 queryBuilder.append(" AND rownum <= ").append(historicalDTO.getCount());
297 queryBuilder.append(" GROUP BY ").append(getGroupByFieldString(perfObject, trendingType, isResourceNameRequired, dashboardgroupby));
298 String metricName = getMetricName(perfObject.getColumnName(), perfObject.getAggregateType(), trendingType, perfObject);
299 queryBuilder.append(" ORDER BY ").append(perfObject.getAggregateType()).append(metricName);
300 if (historicalDTO.getSortOrder() == 1)
301 {
302 queryBuilder.append(" DESC");
303 }
304 LOG.info("-----------------> Top Query :" + queryBuilder.toString());
305 String topNValues = getTopNvalueFromList(queryBuilder.toString(), historicalDTO.getCount());
306 if (topNValues != null && topNValues.trim().length() > 0)
307 {
308 perfObject.setTopBottomDetails(topNValues);
309 }
310 }
311 catch (Exception e)
312 {
313 LOG.error(e);
314 }
315 return perfObject;
316 }
317
318 /**
319 * This method will form the Resource condition for appropriate collection
320 * type.
321 * @param metricQueryBuilder - Query to be updated
322 * @param perfObject - HistoricalDataObject
323 * @param historicalDTO - HistoricalDataTransferObjectGroup
324 */
325 @Override
326 public void setWhereClauseForInstance(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
327 final HistoricalDataObject perfObject)
328 {
329 if (perfObject.getSelectedIndices() != null)
330 {
331 String[] selected_indices = perfObject.getSelectedIndices().toArray(new String[perfObject.getSelectedIndices().size()]);
332 String instance_string = this.getSelectedInstanceListAsString(selected_indices);
333 if (perfObject.getInstanceColumnName() != null && perfObject.getInstanceColumnName().length() > 0)
334 {
335 metricQueryBuilder.append(" AND CONCAT(CONCAT(metric.resourceid,'_'),").append(this.getInstanceAsDBString(perfObject.getInstanceColumnName()))
336 .append(") in (").append(instance_string).append(CLOSE_BRACE);
337 }
338 }
339 }
340
341 /**
342 * To set Top/Bottom query
343 * @param metricQueryBuilder metricQueryBuilder
344 * @param historicalDTO historicalDTO
345 * @param perfObject perfObject
346 * @param isShowTypeSelected isShowTypeSelected
347 * @param trendingType trendingType
348 * @param isResourceNameRequired isResourceNameRequired
349 * @param dashboardgroupby dashboardgroupby
350 * @throws Exception Exception
351 */
352 @Override
353 public void setWhereCluaseForTopQuery(final StringBuilder metricQueryBuilder, final HistoricalDataTransferObject historicalDTO,
354 final HistoricalDataObject perfObject, final boolean isShowTypeSelected, final String trendingType, final boolean isResourceNameRequired,
355 final Dashboardgroupby dashboardgroupby) throws Exception
356 {
357 // TODO Auto-generated method stub
358
359 }
360
361 }
 
File Perf.ThresholdManager/.classpath (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 8 | Parallel Line 8 | Parallel
8 <classpathentry combineaccessrules="false" kind="src" path="/Perf.DataCollection"/> 8 <classpathentry combineaccessrules="false" kind="src" path="/Perf.DataCollection"/>
9 <classpathentry combineaccessrules="false" kind="src" path="/Core.SecurityManager"/> 9 <classpathentry combineaccessrules="false" kind="src" path="/Core.SecurityManager"/>
10 <classpathentry combineaccessrules="false" kind="src" path="/Core.ColorDetails"/> 10 <classpathentry combineaccessrules="false" kind="src" path="/Core.ColorDetails"/>
11 <classpathentry combineaccessrules="false" kind="src" path="/Lib.ThreadPoolManager"/>
11 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> 12 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
12 <attributes> 13 <attributes>
13 <attribute name="owner.project.facets" value="jst.java"/> 14 <attribute name="owner.project.facets" value="jst.java"/>
 
File Perf.ThresholdManager/build.xml (Revision 6048) [Add File Comment] [<<] [Top] [>>]
 
Line 37 | Parallel Line 37 | Parallel
37 <path refid="jms.project.path"/> 37 <path refid="jms.project.path"/>
38 <path refid="resource.manager.project.path"/> 38 <path refid="resource.manager.project.path"/>
39 <path refid="security.manager.project.path"/> 39 <path refid="security.manager.project.path"/>
40 <path refid="threadpool.manager.project.path"/>
40 </path> 41 </path>
41 42
42 </target> 43 </target>
 
File Perf.ThresholdManager/src/com/dhyan/nms/server/performance/threshold/ThresholdAssociation.java (Revision 6048) [Add File Comment] [<<] [Top] [>>]