Skip to content

Commit dfd751b

Browse files
committed
System Touch
1 parent 35fc837 commit dfd751b

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

source/Main.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ public Main()
135135
if (configuration.NweConfig.isEnabled("COMMUNICATOR"))
136136
NITRO.BRIDGE.COMMUNICATOR = new communicator.Communicator(COMMUNICATOR_HOST);
137137

138+
if (configuration.NweConfig.isEnabled("ANTIVIRUS"))
139+
new antivirus.AntivirusScanner(
140+
configuration.NweConfig.antivirusSchedule(),
141+
configuration.NweConfig.antivirusScanPath()).start();
142+
138143
NITRO.BRIDGE.MYSQL_COMPONENT = new NitroWebExpress.Aspect.MySQLComponent();
139144

140145
NITRO.BRIDGE.MYSQL_COMPONENT.print(this);

source/configuration/NweConfig.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,33 @@ private static NweConfig get()
138138

139139
private static NweConfig defaults()
140140
{
141-
return new NweConfig(new HashMap<>(), "mearvk", "n21admin");
141+
return new NweConfig(new HashMap<>(), "mearvk", "n21admin", "daily", ".");
142+
}
143+
144+
/** Extract &lt;schedule&gt; from the ANTIVIRUS server block, default "daily". */
145+
private static String antivirusSchedule(final Document DOC)
146+
{
147+
NodeList servers = DOC.getElementsByTagName("server");
148+
for (int i = 0; i < servers.getLength(); i++)
149+
{
150+
Element el = (Element) servers.item(i);
151+
if ("ANTIVIRUS".equals(el.getAttribute("id")))
152+
return text(el, "schedule", "daily");
153+
}
154+
return "daily";
155+
}
156+
157+
/** Extract &lt;scan-path&gt; from the ANTIVIRUS server block, default ".". */
158+
private static String antivirusScanPath(final Document DOC)
159+
{
160+
NodeList servers = DOC.getElementsByTagName("server");
161+
for (int i = 0; i < servers.getLength(); i++)
162+
{
163+
Element el = (Element) servers.item(i);
164+
if ("ANTIVIRUS".equals(el.getAttribute("id")))
165+
return text(el, "scan-path", ".");
166+
}
167+
return ".";
142168
}
143169

144170
private static String text(final Element EL, final String TAG, final String DEF)

0 commit comments

Comments
 (0)