Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / java / org / txm / groovy / core / InstallGroovyFiles.java @ 989

History | View | Annotate | Download (3.5 kB)

1
package org.txm.groovy.core;
2

    
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.HashMap;
6

    
7
import org.txm.PostTXMHOMEInstallationStep;
8
import org.txm.objects.Workspace;
9
import org.txm.utils.BundleUtils;
10
import org.txm.utils.DeleteDir;
11
import org.txm.utils.io.FileCopy;
12

    
13
public class InstallGroovyFiles extends PostTXMHOMEInstallationStep {
14

    
15
        @Override
16
        public boolean install(Workspace workspace) {
17
                File txmhomedir = workspace.getLocation();
18
                
19
                String createfolders[] = {"scripts/groovy/lib", "scripts/groovy/user", "scripts/groovy/system"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
20
                
21
                for (String folder : createfolders) {
22
                        new File(txmhomedir, folder).mkdirs();
23
                }
24
                File scriptsDirectory = new File(txmhomedir, "scripts/groovy");
25
                File userDirectory = new File(scriptsDirectory, "user");
26
                File systemDirectory = new File(scriptsDirectory, "system");
27
                
28
                
29
                
30
//                HashMap<String, String> publishedImports = new HashMap<String, String>();
31
//                String IMPORTERPACKAGE="org/txm/scriptsimporter/";
32
//                publishedImports.put(IMPORTERPACKAGE+"alceste","alcesteLoader.groovy");
33
//                publishedImports.put(IMPORTERPACKAGE+"discours","discoursLoader.groovy");
34
//                publishedImports.put(IMPORTERPACKAGE+"bfm","bfmLoader.groovy");
35
//                publishedImports.put(IMPORTERPACKAGE+"frantext","frantextLoader.groovy");
36
//                publishedImports.put(IMPORTERPACKAGE+"hyperbase","hyperbaseLoader.groovy");
37
//                publishedImports.put(IMPORTERPACKAGE+"txt","txtLoader.groovy");
38
//                publishedImports.put(IMPORTERPACKAGE+"xml","xmlLoader.groovy");
39
//                publishedImports.put(IMPORTERPACKAGE+"xtz","xtzLoader.groovy");
40
//                publishedImports.put(IMPORTERPACKAGE+"factiva","factivaLoader.groovy");
41
//                publishedImports.put(IMPORTERPACKAGE+"factiva","factivamailLoader.groovy");
42
//                publishedImports.put(IMPORTERPACKAGE+"xmltxm","xmltxmLoader.groovy");
43
//                publishedImports.put(IMPORTERPACKAGE+"transcriber","transcriberLoader.groovy");
44
//                publishedImports.put(IMPORTERPACKAGE+"tmx","tmxLoader.groovy");
45
//                publishedImports.put(IMPORTERPACKAGE+"doc","docLoader.groovy");
46
//                publishedImports.put(IMPORTERPACKAGE+"cqp","cqpLoader.groovy");
47
//                
48
//                
49
//                for (String p : publishedImports.keySet()) {
50
//                        BundleUtils.copyFiles(bundle_id, "src/", "groovy/"+p, publishedImports.get(p), importDirectory);
51
//                }
52
//                
53
//                // copy published macros
54
//                macroDirectory.mkdirs();
55
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "macro/", macroDirectory);
56
//                
57
//                // copy sample Groovy scripts
58
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "export/", samplesDirectory);
59
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "functions/", samplesDirectory);
60
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "importer/", samplesDirectory);
61
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "sw/", samplesDirectory);
62
//                BundleUtils.copyFiles(bundle_id, "src/", "groovy/org/txm", "tal/", samplesDirectory);
63
                
64
                String bundle_id = "org.txm.groovy.core";
65
                BundleUtils.copyFiles(bundle_id, "src/", "groovy", "", userDirectory);
66
                
67
                bundle_id = "org.txm.core";
68
                File scriptsPackageDirectory = new File(userDirectory, "org/txm/importer/scripts");
69
                scriptsPackageDirectory.mkdirs();
70
                BundleUtils.copyFiles(bundle_id, "src/java/", "org/txm/importer/scripts", "", scriptsPackageDirectory);
71
                
72
                try {
73
                        FileCopy.copyFiles(userDirectory, systemDirectory);
74
                } catch (IOException e) {
75
                        // TODO Auto-generated catch block
76
                        e.printStackTrace();
77
                }
78
                
79
                return scriptsDirectory.exists();
80
        }
81

    
82
        @Override
83
        public String getName() {
84
                return "Groovy (org.txm.groovy.core)";
85
        }
86
}