Обновление модуля SingleServer: обновление по api
This commit is contained in:
@@ -20,14 +20,14 @@
|
|||||||
|
|
||||||
<groupId>asys</groupId>
|
<groupId>asys</groupId>
|
||||||
<artifactId>singleserver</artifactId>
|
<artifactId>singleserver</artifactId>
|
||||||
<version>0.3</version>
|
<version>0.4</version>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>asys</groupId>
|
<groupId>asys</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>0.6</version>
|
<version>0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.osgi</groupId>
|
<groupId>org.osgi</groupId>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import org.osgi.framework.BundleContext;
|
|||||||
import org.osgi.framework.ServiceRegistration;
|
import org.osgi.framework.ServiceRegistration;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@@ -60,20 +61,8 @@ public class Activator implements BundleActivator {
|
|||||||
final String propsFileName = "asys-singleserver.properties";
|
final String propsFileName = "asys-singleserver.properties";
|
||||||
Path propsPath = Paths.get(confDir).resolve(propsFileName);
|
Path propsPath = Paths.get(confDir).resolve(propsFileName);
|
||||||
if (Files.notExists(propsPath)) {
|
if (Files.notExists(propsPath)) {
|
||||||
propsPath.toFile().getParentFile().mkdirs();
|
|
||||||
|
|
||||||
InputStream resourceAsStream = getClass().getResourceAsStream("/"+propsFileName);
|
|
||||||
try {
|
try {
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(propsPath.toFile()));
|
ASysUtils.SaveResource("/"+propsFileName, propsPath.toFile());
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(resourceAsStream));
|
|
||||||
String line;
|
|
||||||
while ((line = br.readLine()) != null) {
|
|
||||||
bw.write(line);
|
|
||||||
bw.write("\n");
|
|
||||||
}
|
|
||||||
bw.flush();
|
|
||||||
bw.close();
|
|
||||||
br.close();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
@@ -82,7 +71,7 @@ public class Activator implements BundleActivator {
|
|||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
try {
|
try {
|
||||||
properties.load(new java.io.FileReader(propsPath.toFile()));
|
properties.load(new FileReader(propsPath.toFile()));
|
||||||
return properties;
|
return properties;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(); }
|
e.printStackTrace(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user