labelingsystem-server
Version 0.1.0.0
|
|
static final List< String > | fileList = new ArrayList<String>() |
|
static int | maxDumps = 100 |
|
◆ getDump()
Response getDump |
( |
@PathParam("repo") String |
repo | ) |
|
91 String dumpFile = Dump.writeFile(repo);
92 JSONObject
out =
new JSONObject();
93 out.put(
"file", dumpFile);
94 return Response.ok(
out).header(
"Content-Type",
"application/json;charset=UTF-8").build();
96 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e,
"v1.rest.DumpResource"))
97 .header(
"Content-Type",
"application/json;charset=UTF-8").build();
References Logging.getMessageJSON(), and Dump.writeFile().
◆ getList()
58 fileDir = ConfigProperties.getPropertyParam(
"dump_server");
59 String html_header =
"<html>";
60 html_header +=
"<head>";
61 html_header +=
"</head>";
62 html_header +=
"<body>";
63 String html_footer =
"</body>";
64 html_footer +=
"</html>";
66 out =
"<h1>Index of Labeling System Dumps</h1>";
68 out +=
"<table style=\"width:75%\" border='1'>";
69 out +=
"<tr><th>Name</th><th>Last modified</th><th>Size</th></tr>";
72 +
"<td width='25%'><a href='" + ConfigProperties.getPropertyParam(
"dump_web") + file.split(
"#")[0] +
"'>" + file.split(
"#")[0] +
"</a></td>"
73 +
"<td width='25%'>" + file.split(
"#")[2] +
"</td>"
74 +
"<td width='25%'>" + file.split(
"#")[1] +
" KB</td>"
79 return Response.ok(html_header +
out + html_footer).header(
"Content-Type",
"text/html;charset=UTF-8").build();
81 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e,
"v1.rest.DumpResource"))
82 .header(
"Content-Type",
"application/json;charset=UTF-8").build();
References Logging.getMessageJSON(), and ConfigProperties.getPropertyParam().
◆ getNumberOfStatements()
static int getNumberOfStatements |
( |
| ) |
throws MalformedURLException, IOException |
|
static |
228 HttpURLConnection con = (HttpURLConnection) obj.openConnection();
229 con.setRequestMethod(
"GET");
230 BufferedReader in =
new BufferedReader(
231 new InputStreamReader(con.getInputStream()));
233 StringBuilder response =
new StringBuilder();
234 while ((inputLine = in.readLine()) !=
null) {
235 response.append(inputLine);
238 int size = Integer.parseInt(response.toString());
241 throw new NullPointerException();
Referenced by LSDump.writeFile().
◆ getStatus()
Response getStatus |
( |
@QueryParam("mode") String |
mode | ) |
|
106 JSONObject outObject =
new JSONObject();
107 outObject.put(
"message",
out);
108 return Response.ok(outObject).header(
"Content-Type",
"application/json;charset=UTF-8").build();
110 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e,
"v1.rest.DumpResource"))
111 .header(
"Content-Type",
"application/json;charset=UTF-8").build();
References Logging.getMessageJSON().
◆ listDumpFilesDeleteForMax()
static void listDumpFilesDeleteForMax |
( |
| ) |
throws IOException |
|
static |
204 File directory =
new File(
fileDir);
205 File[] files = directory.listFiles((FileFilter) FileFileFilter.FILE);
206 Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
207 for (File file : files) {
208 if (!file.getName().contains(
"labelingsystem-latest")) {
216 Files.deleteIfExists(fileDelete.toPath());
Referenced by LSDump.writeFile().
◆ listFilesForFolder()
void listFilesForFolder |
( |
| ) |
|
193 File directory =
new File(
fileDir);
194 File[] files = directory.listFiles((FileFilter) FileFileFilter.FILE);
195 Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
196 for (File file : files) {
197 double filesize = (file.length() / 1024);
198 fileList.add(file.getName() +
"#" + filesize +
"#" +
new Date(file.lastModified()));
◆ start()
void start |
( |
| ) |
throws InterruptedException, IOException |
155 (
new Thread(
new LSDump())).
start();
156 long currentTime = System.currentTimeMillis();
157 SimpleDateFormat sdf =
new SimpleDateFormat(
"MMM dd yyyy HH:mm:ss");
158 Date resultdate =
new Date(currentTime);
159 System.out.println(
"started at: " + sdf.format(resultdate));
◆ startDumping()
Response startDumping |
( |
| ) |
|
119 fileDir = ConfigProperties.getPropertyParam(
"dump_server");
120 filePath = ConfigProperties.getPropertyParam(
"dump_web");
121 downloadLink = ConfigProperties.getPropertyParam(
"ts_server") +
"/repositories/" + ConfigProperties.getPropertyParam(
"repository") +
"/statements?Accept=text/plain";
122 size_url = ConfigProperties.getPropertyParam(
"ts_server") +
"/repositories/" + ConfigProperties.getPropertyParam(
"repository") +
"/size";
127 JSONObject outObject =
new JSONObject();
128 outObject.put(
"message",
out);
129 return Response.ok(outObject).header(
"Content-Type",
"application/json;charset=UTF-8").build();
133 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e,
"v1.rest.DumpResource"))
134 .header(
"Content-Type",
"application/json;charset=UTF-8").build();
References Logging.getMessageJSON(), and ConfigProperties.getPropertyParam().
◆ status()
void status |
( |
| ) |
throws InterruptedException, IOException |
165 SimpleDateFormat sdf =
new SimpleDateFormat(
"MMM dd yyyy HH:mm:ss");
168 out =
"started at: " + sdf.format(resultdate);
170 out =
"started at: " + sdf.format(resultdate) +
", last dump at: " +
lastDumpTime +
", last dump: " +
lastDump;
173 out =
"dumping not started";
◆ stop()
179 long currentTime = System.currentTimeMillis();
180 SimpleDateFormat sdf =
new SimpleDateFormat(
"MMM dd yyyy HH:mm:ss");
181 Date resultdate =
new Date(currentTime);
182 System.out.println(
"stopped at: " + sdf.format(resultdate));
184 out =
"stopped at: " + sdf.format(resultdate);
186 out =
"dumping not started";
◆ stopDumping()
143 JSONObject outObject =
new JSONObject();
144 outObject.put(
"message",
out);
145 return Response.ok(outObject).header(
"Content-Type",
"application/json;charset=UTF-8").build();
149 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(Logging.getMessageJSON(e,
"v1.rest.DumpResource"))
150 .header(
"Content-Type",
"application/json;charset=UTF-8").build();
References Logging.getMessageJSON().
◆ downloadLink
◆ dumbNo
◆ dumping
◆ fileDir
◆ fileList
final List<String> fileList = new ArrayList<String>() |
|
staticprivate |
◆ filePath
◆ lastDump
◆ lastDumpTime
◆ maxDumps
◆ mode
◆ numberOfTriples
String numberOfTriples = "" |
|
static |
◆ out
◆ size_url
◆ sleepTimeInMills
long sleepTimeInMills = 43200000 |
|
static |
◆ startTime
long startTime = System.currentTimeMillis() |
|
static |
◆ tmpDirPath
◆ tmpDirPath2
◆ tmpDirString
String tmpDirString = "tmpDir_1" |
|
static |
◆ tmpDirString2
String tmpDirString2 = "tmpDir_2" |
|
static |
static int maxDumps
Definition: DumpResource.java:51
static String lastDumpTime
Definition: DumpResource.java:49
static String fileDir
Definition: DumpResource.java:39
static String lastDump
Definition: DumpResource.java:48
static String size_url
Definition: DumpResource.java:46
static String downloadLink
Definition: DumpResource.java:45
void stop()
Definition: DumpResource.java:177
void listFilesForFolder()
Definition: DumpResource.java:190
static long startTime
Definition: DumpResource.java:37
static String tmpDirPath
Definition: DumpResource.java:43
static String out
Definition: DumpResource.java:36
static boolean dumping
Definition: DumpResource.java:38
static String filePath
Definition: DumpResource.java:40
void status()
Definition: DumpResource.java:163
static String tmpDirPath2
Definition: DumpResource.java:44
void start()
Definition: DumpResource.java:154
static final List< String > fileList
Definition: DumpResource.java:50