Skip to content

Commit 3bf79bd

Browse files
committed
Updated for release 5.3.0
1 parent 78cf7bf commit 3bf79bd

9 files changed

Lines changed: 204 additions & 205 deletions

File tree

.classpath

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="lib" path="lib/javax.servlet-api.jar"/>
10+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/activation.jar"/>
11+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/dtd.jar"/>
12+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/h2-1.4.200.jar"/>
13+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/javax.mail.jar"/>
14+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/json.jar"/>
15+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/jsoup.jar"/>
16+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/mapdb.jar"/>
17+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/openxliff.jar"/>
18+
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/swordfish.jar"/>
19+
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
20+
</classpath>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ js
88
WebContent/WEB-INF/classes
99
.scannerwork
1010
docs/out
11+
/bin/

.project

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>RemoteTM</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.jdt.core.javabuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.wst.validation.validationbuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
26+
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
27+
<nature>org.eclipse.jdt.core.javanature</nature>
28+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
29+
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
30+
</natures>
31+
<filteredResources>
32+
<filter>
33+
<id>1650286223979</id>
34+
<name></name>
35+
<type>30</type>
36+
<matcher>
37+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
38+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
39+
</matcher>
40+
</filter>
41+
</filteredResources>
42+
</projectDescription>
3.06 KB
Binary file not shown.
3.35 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
"devDependencies": {
1414
"cssnano": "^4.1.10",
1515
"parcel-bundler": "^1.12.4",
16-
"typescript": "^4.6.3"
16+
"typescript": "^4.6.4"
1717
},
1818
"scripts": {
1919
"build": "tsc",
2020
"bundle": "parcel build index.html --no-source-maps --out-dir build/release --public-url ./"
2121
},
2222
"dependencies": {
23-
"@types/node": "^17.0.24"
23+
"@types/node": "^17.0.32"
2424
}
2525
}

src/com/maxprograms/remotetm/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private Constants() {
1919
}
2020

2121
public static final String VERSION = "5.3.0";
22-
public static final String BUILD = "20220417_1038";
22+
public static final String BUILD = "20220511_1233";
2323

2424
public static final String STATUS = "status";
2525
public static final String OK = "OK";

src/com/maxprograms/remotetm/TmManager.java

Lines changed: 3 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,16 @@
1717
import java.nio.file.Files;
1818
import java.sql.SQLException;
1919
import java.util.Iterator;
20-
import java.util.List;
2120
import java.util.Map;
2221
import java.util.Set;
2322
import java.util.concurrent.ConcurrentHashMap;
2423

25-
import javax.xml.parsers.ParserConfigurationException;
26-
2724
import com.maxprograms.remotetm.utils.Utils;
2825
import com.maxprograms.swordfish.tm.InternalDatabase;
29-
import com.maxprograms.swordfish.tm.Match;
30-
import com.maxprograms.xml.Element;
31-
32-
import org.xml.sax.SAXException;
3326

3427
public class TmManager {
3528

36-
static final String MEMORIES = "memories";
29+
public static final String MEMORIES = "memories";
3730
static final String CLOSED = "Memory is closed";
3831

3932
private TmManager() {
@@ -43,16 +36,6 @@ private TmManager() {
4336
private static Map<String, InternalDatabase> databases;
4437
private static Map<String, Integer> count;
4538

46-
public static int storeTMX(String memory, String tmx, String project, String client, String subject)
47-
throws IOException, SQLException, SAXException, ParserConfigurationException {
48-
if (!isOpen(memory)) {
49-
openMemory(memory);
50-
}
51-
int imported = databases.get(memory).storeTMX(tmx, project, client, subject);
52-
Files.deleteIfExists(new File(tmx).toPath());
53-
return imported;
54-
}
55-
5639
public static void createMemory(String memory) throws SQLException, IOException {
5740
File memoriesFolder = new File(RemoteTM.getWorkFolder(), MEMORIES);
5841
if (!memoriesFolder.exists()) {
@@ -87,7 +70,7 @@ public static void removeMemory(String memory) throws SQLException, IOException
8770

8871
public static void close(String memory) throws SQLException, IOException {
8972
if (!isOpen(memory)) {
90-
return;
73+
throw new IOException(CLOSED);
9174
}
9275
if (databases.containsKey(memory)) {
9376
int users = count.get(memory);
@@ -102,21 +85,7 @@ public static void close(String memory) throws SQLException, IOException {
10285
}
10386
}
10487

105-
public static String exportMemory(String memory, String name, Set<String> languages, String srcLang)
106-
throws SQLException, IOException {
107-
if (!isOpen(memory)) {
108-
openMemory(memory);
109-
}
110-
File tempFolder = new File(RemoteTM.getWorkFolder(), "tmp");
111-
File tmx = new File(tempFolder, name + ".tmx");
112-
if (tmx.exists()) {
113-
Files.delete(tmx.toPath());
114-
}
115-
databases.get(memory).exportMemory(tmx.getAbsolutePath(), languages, srcLang);
116-
return tmx.getName();
117-
}
118-
119-
public static void openMemory(String memory) throws SQLException, IOException {
88+
public static void setOpen(String memory) throws SQLException, IOException {
12089
if (databases == null) {
12190
databases = new ConcurrentHashMap<>();
12291
count = new ConcurrentHashMap<>();
@@ -141,86 +110,10 @@ public static void closeMemories() throws SQLException, IOException {
141110
}
142111
}
143112

144-
public static Set<String> getAllClients(String memory) throws IOException, SQLException {
145-
if (!isOpen(memory)) {
146-
openMemory(memory);
147-
}
148-
return databases.get(memory).getAllClients();
149-
}
150-
151-
public static Set<String> getAllLanguages(String memory) throws SQLException, IOException {
152-
if (!isOpen(memory)) {
153-
openMemory(memory);
154-
}
155-
return databases.get(memory).getAllLanguages();
156-
}
157-
158-
public static Set<String> getAllProjects(String memory) throws IOException, SQLException {
159-
if (!isOpen(memory)) {
160-
openMemory(memory);
161-
}
162-
return databases.get(memory).getAllProjects();
163-
}
164-
165-
public static Set<String> getAllSubjects(String memory) throws IOException, SQLException {
166-
if (!isOpen(memory)) {
167-
openMemory(memory);
168-
}
169-
return databases.get(memory).getAllSubjects();
170-
}
171-
172-
public static void storeTu(String memory, Element tu) throws SQLException, IOException {
173-
if (!isOpen(memory)) {
174-
openMemory(memory);
175-
}
176-
databases.get(memory).storeTu(tu);
177-
}
178-
179-
public static Element getTu(String memory, String tuid)
180-
throws IOException, SQLException, SAXException, ParserConfigurationException {
181-
if (!isOpen(memory)) {
182-
openMemory(memory);
183-
}
184-
return databases.get(memory).getTu(tuid);
185-
}
186-
187-
public static void removeTu(String memory, String tuid) throws IOException, SQLException {
188-
if (!isOpen(memory)) {
189-
openMemory(memory);
190-
}
191-
databases.get(memory).removeTu(tuid);
192-
}
193-
194113
public static void commit(String memory) throws SQLException, IOException {
195114
if (!isOpen(memory)) {
196115
throw new IOException(CLOSED);
197116
}
198117
databases.get(memory).commit();
199118
}
200-
201-
public static List<Match> searchTranslation(String memory, String searchStr, String srcLang, String tgtLang,
202-
int similarity, boolean caseSensitive)
203-
throws IOException, SAXException, ParserConfigurationException, SQLException {
204-
if (!isOpen(memory)) {
205-
openMemory(memory);
206-
}
207-
return databases.get(memory).searchTranslation(searchStr, srcLang, tgtLang, similarity, caseSensitive);
208-
}
209-
210-
public static List<Element> searchAll(String memory, String searchStr, String srcLang, int similarity,
211-
boolean caseSensitive) throws IOException, SAXException, ParserConfigurationException, SQLException {
212-
if (!isOpen(memory)) {
213-
openMemory(memory);
214-
}
215-
return databases.get(memory).searchAll(searchStr, srcLang, similarity, caseSensitive);
216-
}
217-
218-
public static List<Element> concordanceSearch(String memory, String searchStr, String srcLang, int limit,
219-
boolean isRegexp, boolean caseSensitive)
220-
throws SQLException, SAXException, IOException, ParserConfigurationException {
221-
if (!isOpen(memory)) {
222-
openMemory(memory);
223-
}
224-
return databases.get(memory).concordanceSearch(searchStr, srcLang, limit, isRegexp, caseSensitive);
225-
}
226119
}

0 commit comments

Comments
 (0)