<%@page language="java" contentType="text/html" session="true" import="java.util.*,org.opennms.netmgt.config.*,org.opennms.netmgt.config.poller.*,org.opennms.web.element.*,org.opennms.netmgt.EventConstants,org.opennms.netmgt.xml.event.Event,org.opennms.netmgt.utils.*,java.net.*,java.io.*" %> <%! //A singleton instance of a "Match-any" interface, which can be used for generic tests/removals etc. private static org.opennms.netmgt.config.poller.Interface matchAnyInterface; { matchAnyInterface=new org.opennms.netmgt.config.poller.Interface(); matchAnyInterface.setAddress("match-any"); } public void sendOutagesChangedEvent() throws ServletException { Event event = new Event(); event.setSource("Web UI"); event.setUei(EventConstants.SCHEDOUTAGES_CHANGED_EVENT_UEI); try { event.setHost(InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException uhE) { event.setHost("unresolved.host"); } event.setTime(EventConstants.formatToString(new java.util.Date())); try { EventProxy eventProxy = new TcpEventProxy(); eventProxy.send(event); } catch (Exception e) { throw new ServletException("Could not send event " + event.getUei(), e); } } %> <% HashMap shortDayNames=new HashMap(); shortDayNames.put("sunday","Sun"); shortDayNames.put("monday","Mon"); shortDayNames.put("tuesday","Tue"); shortDayNames.put("wednesday","Wed"); shortDayNames.put("thursday","Thu"); shortDayNames.put("friday","Fri"); shortDayNames.put("saturday","Sat"); shortDayNames.put("1","1st"); shortDayNames.put("2","2nd"); shortDayNames.put("3","3rd"); shortDayNames.put("4","4th"); shortDayNames.put("5","5th"); shortDayNames.put("6","6th"); shortDayNames.put("7","7th"); shortDayNames.put("8","8th"); shortDayNames.put("9","9th"); shortDayNames.put("10","10th"); shortDayNames.put("11","11th"); shortDayNames.put("12","12th"); shortDayNames.put("13","13th"); shortDayNames.put("14","14th"); shortDayNames.put("15","15th"); shortDayNames.put("16","16th"); shortDayNames.put("17","17th"); shortDayNames.put("18","18th"); shortDayNames.put("19","19th"); shortDayNames.put("20","20th"); shortDayNames.put("21","21st"); shortDayNames.put("22","22nd"); shortDayNames.put("23","23rd"); shortDayNames.put("24","24th"); shortDayNames.put("25","25th"); shortDayNames.put("26","26th"); shortDayNames.put("27","27th"); shortDayNames.put("28","28th"); shortDayNames.put("29","29th"); shortDayNames.put("30","30th"); shortDayNames.put("31","31st"); PollOutagesConfigFactory.init(); //Only init - do *not* reload PollOutagesConfigFactory pollFactory=PollOutagesConfigFactory.getInstance(); Outage theOutage; String nameParam=request.getParameter("name"); if(nameParam!=null) { //first time in - name is passed as a param. Find the outage, copy it, and shove it in the session //Also keep a copy of the name, for later saving (replacing the original with the edited copy) Outage tempOutage=pollFactory.getOutage(nameParam); CharArrayWriter writer=new CharArrayWriter(); tempOutage.marshal(writer); theOutage=Outage.unmarshal(new CharArrayReader(writer.toCharArray())); request.getSession().setAttribute("opennms.editoutage",theOutage); request.getSession().setAttribute("opennms.editoutage.origname", nameParam); } else if("true".equals(request.getParameter("addNew"))) { theOutage=new Outage(); //Nuke whitespace - it messes with all sorts of things theOutage.setName(request.getParameter("newName").trim()); theOutage.setType("specific"); request.getSession().setAttribute("opennms.editoutage",theOutage); request.getSession().removeAttribute("opennms.editoutage.origname"); } else { //Neither starting the edit, nor adding a new outage. theOutage=(Outage)request.getSession().getAttribute("opennms.editoutage"); if(theOutage==null) { //No name, and no outage in the session. Give up %> No outage name parameter, nor outage stored in the session. Cannot edit!
<% return; } } //Load the initial set of enabled outages from the external configuration // This will be overridden by a formSubmission to use the form values, but is necessary for the initial load of the page //It is more efficient to piggy back on this initial setup setp (creating the hashmaps) than doing it separately Set enabledOutages=new HashSet(); // ******* Notification outages config ********* Collection notificationOutages=NotifdConfigFactory.getInstance().getConfiguration().getOutageCalendarCollection(); if(notificationOutages.contains(theOutage.getName())) { enabledOutages.add("notifications"); } // ******* Threshd outages config ********* ThreshdConfigFactory.init(); Map thresholdOutages=new HashMap(); org.opennms.netmgt.config.threshd.Package[] thresholdingPackages=ThreshdConfigFactory.getInstance().getConfiguration().getPackage(); for(int i=0; i Scheduled Outage administration <% String breadcrumb1 = "Admin"; %> <% String breadcrumb2 = "Manage Scheduled Outages"; %> <% String breadcrumb3 = "Edit Outages"; %> <% Enumeration enum=request.getParameterNames(); while(enum.hasMoreElements()) { String paramName=(String)enum.nextElement(); %> <% } %>
"> ">
Name: <%=theOutage.getName()%>
Type:

Nodes:
<% org.opennms.netmgt.config.poller.Node[] nodeList=theOutage.getNode(); for(int i=0; i<% if(thisNode!=null) { %> <% } else { %> <% } %> <% } %>
<%=thisNode.getLabel()%>Can't find node with id:<%=nodeId%>
Interfaces:
<% if(!hasMatchAny) { %> <% org.opennms.netmgt.config.poller.Interface[] interfaceList=theOutage.getInterface(); for(int i=0; i <% } } } %>
<%=thisInterface.getHostname()%>
<% } //end if has match any %>
OR
<% if(hasMatchAny) { %> Applies to ALL nodes/interfaces<% } else { %><% }%>

Times:
Add time
:: ->
::
Add time :: ->
::
<% Time[] outageTimes=theOutage.getTime(); for(int i=0; i <% } %>
<%=(thisTime.getDay()!=null)?shortDayNames.get(thisTime.getDay())+" ":""%><%=thisTime.getBegins()%> - <%=thisTime.getEnds()%>

Applies to:
<% Iterator keys=pollingOutages.keySet().iterator(); boolean doneTitle=false; while(keys.hasNext()) { org.opennms.netmgt.config.poller.Package thisKey=(org.opennms.netmgt.config.poller.Package)keys.next(); Collection pollingPackage=(Collection)pollingOutages.get(thisKey); String name="polling-"+thisKey.getName(); %> <% doneTitle=true; } keys=thresholdOutages.keySet().iterator(); doneTitle=false; while(keys.hasNext()) { org.opennms.netmgt.config.threshd.Package thisKey=(org.opennms.netmgt.config.threshd.Package)keys.next(); Collection thresholdPackage=(Collection)thresholdOutages.get(thisKey); String name="threshold-"+thisKey.getName(); %> <% doneTitle=true; } keys=collectionOutages.keySet().iterator(); doneTitle=false; while(keys.hasNext()) { org.opennms.netmgt.config.collectd.Package thisKey=(org.opennms.netmgt.config.collectd.Package)keys.next(); Collection collectPackage=(Collection)collectionOutages.get(thisKey); String name="collect-"+thisKey.getName(); %> <% doneTitle=true; } %>
Notifications name="notifications">
<%=!doneTitle?"Status polling":""%> <%=thisKey.getName()%> >
<%=!doneTitle?"Threshold checking":""%> <%=thisKey.getName()%> >
<%=!doneTitle?"Data collection":""%> <%=thisKey.getName()%> >