no message
This commit is contained in:
@@ -81,7 +81,7 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
}
|
||||
//-DVMTestingChecker
|
||||
public abstract int getPort();
|
||||
protected abstract void Session() throws Exception;
|
||||
protected abstract void SafeSession() throws Exception;
|
||||
protected void startAdditionalThreads() {
|
||||
}
|
||||
public void ActivateDB() {
|
||||
@@ -229,7 +229,7 @@ public abstract class RepositoryServer<D extends Database> {
|
||||
CloneObject();
|
||||
break;
|
||||
default:
|
||||
Session();
|
||||
SafeSession();
|
||||
break;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -190,20 +190,6 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
//--
|
||||
} else throw new RepositoryRefuseException("Внутренняя ошибка. Не удалось распаковать проект");
|
||||
}
|
||||
void GetComponentsVersionsInfo() throws Exception {
|
||||
Vector<String> types = (Vector<String>) request.object;
|
||||
Vector<ComponentVersionsInfoJson> res = new Vector<>();
|
||||
for (String sType : types) {
|
||||
ComponentType componentType = ComponentType.valueOf(sType);
|
||||
File actualVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "version.txt").toFile();
|
||||
File minimalVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
|
||||
ComponentVersionsInfoJson info = new ComponentVersionsInfoJson(componentType);
|
||||
info.actual_version = Utils_.removeCharacters(Utils.ReadAllText(actualVersionFile), "\n", "\r");
|
||||
info.minimal_version = Utils_.removeCharacters(Utils.ReadAllText(minimalVersionFile), "\n", "\r");
|
||||
res.add(info);
|
||||
}
|
||||
response.object = res;
|
||||
}
|
||||
void AppendBugReportField() throws Exception {
|
||||
BugReportAdditionJson transport = (BugReportAdditionJson) request.object;
|
||||
if (db.bugReports.containsKey(transport.id)) {
|
||||
@@ -215,6 +201,71 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
response.object = actual;
|
||||
} else throw new RepositoryRefuseException("Баг репорт с ключом " + transport.id + " не существует.");
|
||||
}
|
||||
void ReceiveAllArchives() throws Exception {
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
File archives = new File(Utils_.getDateName("Bugs"));
|
||||
if (zip.Do("Bugs", archives.getAbsolutePath())) {
|
||||
response.object = Utils_.fileToBytes(archives);
|
||||
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
|
||||
}
|
||||
void ReceiveBugReportsDatabase() throws Exception{
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
}
|
||||
void ReceiveBugReport() throws Exception {
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
|
||||
response.object = Utils_.fileToBytes(bugArchive);
|
||||
}
|
||||
void UpdateBugReport() throws Exception {
|
||||
BugReport oldBugReport = (BugReport) request.object;
|
||||
if (db.bugReports.containsKey(oldBugReport.id)) {
|
||||
BugReport bugReport = db.bugReports.get(oldBugReport.id);
|
||||
bugReport.SynchronizeFields(oldBugReport);
|
||||
bugReport.change_date = new Date().getTime();
|
||||
db.Update(bugReport);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Баг репорт с ключом " + oldBugReport.id + " не существует.");
|
||||
}
|
||||
//--
|
||||
void CheckSubscriberRole() throws Exception {
|
||||
Account account = (Account) request.object;
|
||||
Subscriber subscriber = null;
|
||||
if (db.subscribers.containsKey(account.email)) {
|
||||
subscriber = db.subscribers.get(account.email);
|
||||
} else {
|
||||
subscriber = new Subscriber();
|
||||
subscriber.name = account.name;
|
||||
subscriber.address = account.email;
|
||||
subscriber.mailOn = 1;
|
||||
db.Insert(subscriber);
|
||||
}
|
||||
response.object = subscriber; //возвращаем информацию о подписчике.
|
||||
}
|
||||
void GetComponentsBackUps() throws Exception {
|
||||
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
//--
|
||||
if (backupsDirectory.exists()) {
|
||||
File[] files = backupsDirectory.listFiles(File::isFile);
|
||||
if (files != null) {
|
||||
Vector<RemoteFile> res = new Vector<>();
|
||||
for (File file : files)
|
||||
res.add(new RemoteFile(file.getAbsolutePath(), false)); //тут всегда линух.
|
||||
response.object = res;
|
||||
} else throw new RepositoryRefuseException("Не удалось получить список предыдущих версий");
|
||||
} else {
|
||||
//баги еще не создавались. штатная ситуация.
|
||||
response.object = new Vector<>();
|
||||
}
|
||||
}
|
||||
void CheckURLRegistered() throws Exception {
|
||||
String[] data = request.arg.split("\n");
|
||||
String email = data[0];
|
||||
String machineURL = data[1];
|
||||
String login = data[2];
|
||||
response.object = db.workspaces.findWorkspace(email, machineURL, login);
|
||||
}
|
||||
void GetComponentChangesLog() throws Exception {
|
||||
response.object = Utils_.fileToBytes(Paths.get(Utils_.getHomePath(), "Components", request.arg, "changes.txt").toFile());
|
||||
}
|
||||
void PublishComponent() throws Exception {
|
||||
ComponentPublicationInfoJson info = (ComponentPublicationInfoJson) request.object;
|
||||
File componentHome = Utils_.getFile(Utils_.getHomePath(), "Components", info.componentType.toString());
|
||||
@@ -256,49 +307,19 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
bufferWriter_.close();
|
||||
}
|
||||
}
|
||||
void CheckSubscriberRole() throws Exception {
|
||||
Account account = (Account) request.object;
|
||||
Subscriber subscriber = null;
|
||||
if (db.subscribers.containsKey(account.email)) {
|
||||
subscriber = db.subscribers.get(account.email);
|
||||
} else {
|
||||
subscriber = new Subscriber();
|
||||
subscriber.name = account.name;
|
||||
subscriber.address = account.email;
|
||||
subscriber.mailOn = 1;
|
||||
db.Insert(subscriber);
|
||||
void GetComponentsVersionsInfo() throws Exception {
|
||||
Vector<String> types = (Vector<String>) request.object;
|
||||
Vector<ComponentVersionsInfoJson> res = new Vector<>();
|
||||
for (String sType : types) {
|
||||
ComponentType componentType = ComponentType.valueOf(sType);
|
||||
File actualVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "version.txt").toFile();
|
||||
File minimalVersionFile = Paths.get(Utils_.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
|
||||
ComponentVersionsInfoJson info = new ComponentVersionsInfoJson(componentType);
|
||||
info.actual_version = Utils_.removeCharacters(Utils.ReadAllText(actualVersionFile), "\n", "\r");
|
||||
info.minimal_version = Utils_.removeCharacters(Utils.ReadAllText(minimalVersionFile), "\n", "\r");
|
||||
res.add(info);
|
||||
}
|
||||
response.object = subscriber; //возвращаем информацию о подписчике.
|
||||
}
|
||||
void ReceiveAllArchives() throws Exception {
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
File archives = new File(Utils_.getDateName("Bugs"));
|
||||
if (zip.Do("Bugs", archives.getAbsolutePath())) {
|
||||
response.object = Utils_.fileToBytes(archives);
|
||||
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
|
||||
}
|
||||
void GetComponentsBackUps() throws Exception {
|
||||
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
|
||||
//--
|
||||
if (backupsDirectory.exists()) {
|
||||
File[] files = backupsDirectory.listFiles(File::isFile);
|
||||
if (files != null) {
|
||||
Vector<RemoteFile> res = new Vector<>();
|
||||
for (File file : files)
|
||||
res.add(new RemoteFile(file.getAbsolutePath(), false)); //тут всегда линух.
|
||||
response.object = res;
|
||||
} else throw new RepositoryRefuseException("Не удалось получить список предыдущих версий");
|
||||
} else {
|
||||
//баги еще не создавались. штатная ситуация.
|
||||
response.object = new Vector<>();
|
||||
}
|
||||
}
|
||||
void ReceiveBugReportsDatabase() throws Exception{
|
||||
response.object = Utils_.fileToBytes(db.getFile());
|
||||
}
|
||||
void ReceiveBugReport() throws Exception {
|
||||
File bugArchive = Utils_.getFile(Utils_.getHomePath(), "Bugs", request.arg);
|
||||
response.object = Utils_.fileToBytes(bugArchive);
|
||||
response.object = res;
|
||||
}
|
||||
void ReceiveComponent() throws Exception {
|
||||
String[] packed1 = request.arg.split("\n");
|
||||
@@ -307,29 +328,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
Print("Получить компонент " + packed1[0]);
|
||||
response.object = Utils_.fileToBytes(componentFile1);
|
||||
}
|
||||
void CheckURLRegistered() throws Exception {
|
||||
String[] data = request.arg.split("\n");
|
||||
String email = data[0];
|
||||
String machineURL = data[1];
|
||||
String login = data[2];
|
||||
response.object = db.workspaces.findWorkspace(email, machineURL, login);
|
||||
}
|
||||
void GetComponentChangesLog() throws Exception {
|
||||
response.object = Utils_.fileToBytes(Paths.get(Utils_.getHomePath(), "Components", request.arg, "changes.txt").toFile());
|
||||
}
|
||||
void UpdateBugReport() throws Exception {
|
||||
BugReport oldBugReport = (BugReport) request.object;
|
||||
if (db.bugReports.containsKey(oldBugReport.id)) {
|
||||
BugReport bugReport = db.bugReports.get(oldBugReport.id);
|
||||
bugReport.SynchronizeFields(oldBugReport);
|
||||
bugReport.change_date = new Date().getTime();
|
||||
db.Update(bugReport);
|
||||
} else
|
||||
throw new RepositoryRefuseException("Баг репорт с ключом " + oldBugReport.id + " не существует.");
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
protected void Session() throws Exception {
|
||||
protected void SafeSession() throws Exception {
|
||||
switch (code) {
|
||||
// ПРОХОДЫ НЕЗАВИСИМЫЕ ОТ ВЕРСИИ
|
||||
case CheckSubscriberRole:
|
||||
@@ -353,7 +354,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
|
||||
case GetComponentChangesLog:
|
||||
GetComponentChangesLog();
|
||||
break;
|
||||
//------------------------------------------------------------------------>>>>
|
||||
//------------------------------------------------------------------------>>>>
|
||||
case ReceiveAllArchives:
|
||||
ReceiveAllArchives();
|
||||
break;
|
||||
|
||||
@@ -762,7 +762,7 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
protected void Session() throws Exception {
|
||||
protected void SafeSession() throws Exception {
|
||||
switch (code) {
|
||||
case PerformAutoSapforTesting:
|
||||
PerformAutoSapforTesting();
|
||||
|
||||
Reference in New Issue
Block a user