Project

General

Profile

« Previous | Next » 

Revision 929a8c09

Added by Andreas Kohlbecker almost 11 years ago

refactoring in preparation for #3471 (cdmlib-remote-webapp instances can be stopped / started individually)

View differences:

src/main/webapp/manage/BootloaderService.jsp
1 1
<%@page import="org.codehaus.jackson.node.ArrayNode"
2 2
%><%@ page contentType="application/json;charset=UTF-8" language="java"
3 3
%><%@page import="eu.etaxonomy.cdm.server.Bootloader"
4
%><%@page import="eu.etaxonomy.cdm.server.instance.CdmInstance"
4 5
%><%@page import="java.util.Set"
5 6
%><%@page import="java.net.URL"
6 7
%><%@page import="org.codehaus.jackson.map.ObjectMapper"
7 8
%><%@page import="org.codehaus.jackson.JsonNode"
8 9
%><%@page import="org.codehaus.jackson.node.ObjectNode"
9
%><%@page import="eu.etaxonomy.cdm.server.CdmInstanceProperties"
10
%><%
11
//////////////////////////////////////////////////////////////////////////////////
10
%><%@page import="eu.etaxonomy.cdm.server.instance.Configuration"
11
%><%//////////////////////////////////////////////////////////////////////////////////
12 12
//
13 13
// The BootloaderService service exposes the Bootloader.getConfigAndStatus()
14 14
// property as webservice. Before beeing serialized to JSON the ConfigAndStatus
......
22 22
    response.setHeader("Content-Type", "application/json;charset=UTF-8");
23 23

  
24 24
  // the servelt context must use the class loader of the Bootloader class otherwise
25
  // getting the status will not work in mulithreading environments !!!
25
  // getting the status will not work in multihreading environments !!!
26 26
  Bootloader bootloader = Bootloader.getBootloader();
27
  java.util.List<CdmInstanceProperties> configAndStatus = bootloader.getConfigAndStatus();
28
  if(configAndStatus != null){
27
  java.util.List<CdmInstance> instances = bootloader.getCdmInstances();
28
  if(instances != null){
29 29
   int i = 0;
30 30

  
31 31
   ArrayNode arrayNode = jsonMapper.createArrayNode();
32 32

  
33
   for(CdmInstanceProperties props : configAndStatus){
33
   for(CdmInstance instance: instances){
34 34
    i++;
35
    String basePath = request.getContextPath() + "/" + props.getDataSourceName();
35
    Configuration props = instance.getConfiguration();
36
    String basePath = request.getContextPath() + "/" + props.getInstanceName();
36 37
      URL fullURL = new URL(request.getScheme(),
37 38
                  request.getServerName(),
38 39
                  request.getServerPort(),
......
47 48
      arrayNode.add(jsonNode);
48 49
   }
49 50
   out.append(arrayNode.toString());
50
  }
51
%>
51
  }%>

Also available in: Unified diff