Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-server / src / main / webapp / manage / index.jsp @ 63a64042

History | View | Annotate | Download (8.26 KB)

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> (Clicking 'reload' during the sever startup phase, will interrupt the automatic startup of all instances.)</div>
65
                <div class="container">
66
                  <table>
67
                    <tr>
68
                      <th>#</th>
69
                      <th>Path</th>
70
                      <th></th>
71
                      <th>Database Url</th>
72
                      <th>Status</th>
73
                                            <th>Operation</th>
74
                      <th>OAI-PMH Provider</th>
75
                    </tr>
76
                    <%
77
                        java.util.List<CdmInstance> instances = bootloader.getCdmInstances();
78
                        if (instances != null) {
79
                            int i = 0;
80
                            for (CdmInstance instance : instances) {
81
                                i++;
82
                                Configuration instanceConfig = instance.getConfiguration();
83

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

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

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

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

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

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

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

    
164
      </div>
165
      <!-- /main -->
166
    </div>
167
    <!-- /main-wrapper -->
168
  </div>
169
  <!-- /page -->
170
  <script type="text/javascript" src="../js/jquery.js"></script>
171
  <script type="text/javascript" src="../js/oai-pmh-status.js"></script>
172
  <script type="text/javascript" src="../js/memory-status.js"></script>
173
  <script type="text/javascript" src="../js/instance-status.js"></script>
174
  <script type="text/javascript" src="../js/redirect-to-rewriter.js"></script>
175
</body>
176
</html>
Add picture from clipboard (Maximum size: 40 MB)