1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal;
|
10
|
|
11
|
import java.io.File;
|
12
|
import java.io.IOException;
|
13
|
import java.net.URI;
|
14
|
|
15
|
import eu.etaxonomy.drush.DrushExecuter;
|
16
|
|
17
|
/**
|
18
|
*
|
19
|
* @author a.kohlbecker
|
20
|
*
|
21
|
*/
|
22
|
public class DataPortalContext {
|
23
|
|
24
|
URI siteUri;
|
25
|
String siteName; //TODO read with drush: $ drush vget site_name
|
26
|
String themeName;
|
27
|
File drupalRoot;
|
28
|
String sshHost;
|
29
|
String sshUser;
|
30
|
|
31
|
public DataPortalContext(URI siteUri, String siteName, String drupalRoot, String sshHost, String sshUser) {
|
32
|
this.siteUri = siteUri;
|
33
|
this.siteName = siteName;
|
34
|
this.drupalRoot = new File(drupalRoot);
|
35
|
this.sshHost = sshHost;
|
36
|
this.sshUser = sshUser;
|
37
|
}
|
38
|
|
39
|
public URI getSiteUri() {
|
40
|
return siteUri;
|
41
|
}
|
42
|
|
43
|
public String getSiteName() {
|
44
|
return siteName;
|
45
|
}
|
46
|
|
47
|
|
48
|
/**
|
49
|
*
|
50
|
* @param pageHeader
|
51
|
*
|
52
|
* @return The drupal site title as it is produced by drupal
|
53
|
*/
|
54
|
public String prepareTitle(String pageHeader) {
|
55
|
return pageHeader + " | " + getSiteName();
|
56
|
}
|
57
|
|
58
|
public DrushExecuter drushExecuter() throws IOException, InterruptedException {
|
59
|
DrushExecuter dex = new DrushExecuter();
|
60
|
dex.setDrupalRoot(drupalRoot);
|
61
|
dex.setSiteURI(siteUri);
|
62
|
dex.setSshHost(sshHost);
|
63
|
dex.setSshUser(sshUser);
|
64
|
return dex;
|
65
|
}
|
66
|
|
67
|
}
|