1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.facade.install;
18
19 import COM.FutureTense.Interfaces.ICS;
20
21 import com.fatwire.gst.foundation.facade.sql.Row;
22 import com.fatwire.gst.foundation.facade.sql.SqlHelper;
23
24 import static com.fatwire.gst.foundation.facade.sql.SqlHelper.quote;
25
26
27
28
29
30
31
32 public class AssetListenerInstall {
33 public static final String REGISTRY_TABLE = "AssetListener_reg";
34
35
36
37
38
39
40
41
42 public static void register(ICS ics, String classname, boolean blocking) {
43 String id = ics.genID(true);
44 String listener = classname;
45 SqlHelper
46 .execute(ics, REGISTRY_TABLE, "DELETE FROM " + REGISTRY_TABLE + " WHERE listener = " + quote(listener));
47 SqlHelper.execute(ics, REGISTRY_TABLE, "INSERT INTO " + REGISTRY_TABLE + " (id, listener, blocking) VALUES ("
48 + quote(id) + "," + quote(listener) + "," + quote(blocking ? "Y" : "N") + ")");
49 }
50
51 public static boolean isRegistered(ICS ics, String classname) {
52 for (Row row : SqlHelper.select(ics, REGISTRY_TABLE, "SELECT * FROM "+REGISTRY_TABLE+" WHERE listener = " + quote(classname))) {
53 return true;
54 }
55 return false;
56 }
57
58 }