Project

General

Profile

Download (8.13 KB) Statistics
| Branch: | Tag: | Revision:
1
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
3
<%@page import="eu.etaxonomy.cdm.server.Bootloader"%>
4
<%@page import="java.util.Set"%>
5
<%@page import="java.net.URL"%>
6
<%@page import="eu.etaxonomy.cdm.server.instance.Configuration"%>
7
<%@page import="eu.etaxonomy.cdm.server.instance.CdmInstance"%>
8
<%@page import="eu.etaxonomy.cdm.server.instance.Status"%>
9
<%@page import="eu.etaxonomy.cdm.server.JvmManager"%>
10
<%@page import="java.io.IOException"%>
11
<%!// the servelt context must use the class loader of the Bootloader class otherwise
12
    // getting the status will not work in mulithreading environments !!!
13
    Bootloader bootloader = Bootloader.getBootloader();%>
14

    
15
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
16

    
17
<head>
18
<title>CDM Server</title>
19
<link type="text/css" rel="stylesheet" media="all"  href="../css/style.css" />
20
<link type="text/css" rel="stylesheet" media="all"  href="../css/server.css" />
21
</head>
22
<body class="layout-main">
23
  <div id="page" class="clearfix">
24
    <div id="header-wrapper">
25
      <div id="header" class="clearfix">
26
        <div id="header-first">
27
          <div id="logo"></div>
28
          <h1>CDM Server</h1>
29
        </div>
30
        <!-- /header-first -->
31
      </div>
32
      <!-- /header -->
33
    </div>
34
    <!-- /header-wrapper -->
35

    
36
    <div id="primary-menu-wrapper" class="clearfix">
37
      <div id="primary-menu">
38
        <div id="version"><%=bootloader.readCdmRemoteVersion()%></div>
39
      </div>
40
      <!-- /primary_menu -->
41
    </div>
42
    <!-- /primary-menu-wrapper -->
43

    
44
    <div id="main-wrapper">
45
      <div id="main" class="clearfix">
46

    
47
        <div id="sidebar-first"></div>
48
        <!-- /sidebar-first -->
49

    
50
        <div id="content-wrapper">
51
          <div id="content">
52
            <!-- ============================= -->
53
            <div class="block-wrapper">
54
              <h2 class="title block-title pngfix">Server Status</h2>
55
              <div class="block" id="status">
56
                <!-- The memory status will be rendered by memory-status.js -->
57
              </div>
58
            </div>
59

    
60

    
61
            <div class="block-wrapper">
62
              <div class="block" id="instances">
63
                <h2 class="title block-title pngfix">CDM Server Instances</h2>
64
                <div><a class="redirect-rewrite" href="Action.jsp?&redirectTo=./&action=reloadConfig">Reload configuration</a> (When clicked during the sever startup phase, the automatic startup up all instances listed in the configuration will be interrupted)</div>
65
                <div class="container">
66
                  <table>
67
                    <tr>
68
                      <th>Path</th>
69
                      <th></th>
70
                      <th>Database Url</th>
71
                      <th>Status</th>
72
                                            <th>Operation</th>
73
                      <th>OAI-PMH Provider</th>
74
                    </tr>
75
                    <%
76
                        java.util.List<CdmInstance> instances = bootloader.getCdmInstances();
77
                        if (instances != null) {
78
                            int i = 0;
79
                            for (CdmInstance instance : instances) {
80
                                i++;
81
                                Configuration instanceConfig = instance.getConfiguration();
82

    
83
                                String basePath = bootloader.constructContextPath(instanceConfig);
84
                                /*  URL fullURL = new URL(request.getScheme(),
85
                                         request.getServerName(),
86
                                         request.getServerPort(),
87
                                         basePath); */
88

    
89
                                //String fullURL = "../" + basePath;
90

    
91
                                // prepare actions parameters
92
                                String action = null;
93
                                String actionParams = null;
94
                                if(instance.getStatus().equals(Status.started) || instance.getStatus().equals(Status.starting)){
95
                                    action = "stop";
96
/* diusabled due to  #3910 (eu.etaxonomy.cdm.database.ICdmDataSource is not compatible to javax.sql.DataSource)
97
} else if(instance.getStatus().equals(Status.incompatible_version)){
98
                                    action = "update"; */
99
                                } else if(!instance.getStatus().equals(Status.removed) && !instance.getStatus().equals(Status.uninitialized)){
100
                                    action = "start";
101
                                }
102
                                if(action != null){
103
                                    actionParams = "instanceName=" + instanceConfig.getInstanceName() + "&redirectTo=./&action=" + action;
104
                                }
105

    
106
                                // styling
107
                                String oddOrEven = i % 2 == 0 ? "odd" : "even";
108

    
109
                                // render a table row
110
                                out.append("<tr id=\"" + basePath + "\" class=\"entry " + oddOrEven + "\">");
111
                                out.append("<td class=\"base-url\"><a href=\"" + basePath + "/\">" + basePath + "</a></td>");
112
                                out.append("<td class=\"test-url\"><a href=\"" + basePath + "/portal/classification\">Test</a></td>");
113
                                out.append("<td class=\"db-url\">" + instanceConfig.getDataSourceUrl() + "</td>");
114
                                out.append("<td class=\"status " + instance.getStatus() + "\">" + instance.getStatus() + "</td>");
115
                                out.append("<td class=\"operation\">" + (actionParams != null ?
116
                                        "<a class=\"redirect-rewrite\" href=\"Action.jsp?" + actionParams + "\">" + action + "</a>"
117
                                        : "&nbsp;")
118
                                        + "</td>");
119

    
120
                                // OAI-PMH Status will be requested using javascript
121
                                out.append("<td class=\"oai-pmh\">requesting status ...</td>");
122
                                out.append("</tr>");
123
                                out.append("<tr id=\"" + basePath + "-messages\" class=\"messages " + oddOrEven + "\">");
124
                                out.append("<td></td><td class=\"error messages\" colspan=\"5\">");
125
                                for (String problem : instance.getProblems()) {
126
                                    out.append("<div>" + problem + "</div>");
127
                                }
128
                                out.append("</td>");
129
                                out.append("</tr>");
130
                            }
131
                        }
132
                    %>
133
                  </table>
134
                </div>
135
              </div>
136
            </div>
137
            <%
138
                /*
139
                 <div class="block-wrapper">
140
                 <div class="block" id="test">
141
                 <h2 class="title block-title pngfix">Test your CDM Server (using the default data base)</h2>
142
                 <form name="input" action="/default/portal/taxon/find" method="get">
143
                 <input type="text" name="query"></br>
144
                 <input type="submit" value="submit">
145
                 </form>
146
                 </div>
147
                 </div><!-- test -->
148
                 */
149
            %>
150
            <!-- ============================= -->
151
          </div>
152
          <!-- /content -->
153
        </div>
154
        <!-- /content-wrapper -->
155

    
156
        <div id="footer" class="clearfix">
157
          The CDM Server is a component of the <a
158
            href="http://wp5.e-taxonomy.eu/">EDIT Platform for
159
            Cybertaxonomy</a>.
160
        </div>
161
        <!-- /footer -->
162

    
163
      </div>
164
      <!-- /main -->
165
    </div>
166
    <!-- /main-wrapper -->
167
  </div>
168
  <!-- /page -->
169
  <script type="text/javascript" src="../js/jquery.js"></script>
170
  <script type="text/javascript" src="../js/oai-pmh-status.js"></script>
171
  <script type="text/javascript" src="../js/memory-status.js"></script>
172
  <script type="text/javascript" src="../js/instance-status.js"></script>
173
  <script type="text/javascript" src="../js/redirect-to-rewriter.js"></script>
174
</body>
175
</html>
(4-4/4)