summaryrefslogtreecommitdiffstats
path: root/src/core/transport/http/server/IIS/axis2_iis_regedit.js
blob: 3889c1eb884ec5a20a0a8099763e78c750e113fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
var WshShell = WScript.CreateObject("WScript.Shell");

/* You can change the following values to suite your requirements */
/* Axis2/C repo location. axis2.xml, modules folder and services folder should be in this dir */
var axis2c_home             = WshShell.CurrentDirectory;
/* Log level. Possible values are trace, error, info, critical, user, debug and warning */
var log_level               = "debug";
/* Full path to the log file */
var log_file                = axis2c_home + "/logs/axis2.log";
/* Services URL prefix. This is the folder where services are hosted. Optional */
var services_url_prefix;
/* Max log file size */
var max_log_file_size;
/* Axis2 location */
var axis2_location;

/* Don't change anything below */
var axis2c_home_str         = "axis2c_home";
var log_level_str           = "log_level";
var log_file_str            = "log_file";
var services_url_prefix_str = "services_url_prefix";
var max_log_file_size_str   = "max_log_file_size";
var axis2_location_str      = "axis2_location"

var reg_location            = "HKLM\\Software\\Apache Axis2C\\IIS ISAPI Redirector\\"
/* If specified get the values from the command prompt */
var args = WScript.Arguments;
if (args.length > 0) {
    axis2c_home = args.Item(0);
    if (axis2c_home) {
            log_file = axis2c_home + "/logs/axis2.log";
    }
}
if (args.length > 1) {
    log_level = args.Item(1);
}
if (args.length > 2) {
    log_file = args.Item(2);
}
if (args.length > 3) {
    services_url_prefix = args.Item(3);
}
if (args.length > 4) {
    max_log_file_size = args.Item(4);
}
if (args.length > 5) {
    axis2_location = args.Item(5);
}
/* Write the axis2c_home entry. This is used by Axis2/C to find the repo location */
WshShell.RegWrite (reg_location + axis2c_home_str, axis2c_home, "REG_SZ");
/* Write the log_level registry entry */
WshShell.RegWrite (reg_location + log_level_str, log_level, "REG_SZ");
/* Write the log file name */
WshShell.RegWrite (reg_location + log_file_str, log_file, "REG_SZ");
/* Write the services url prefix. We write this only if specified */
try {
    var services_url_prefix_key = WshShell.RegRead (reg_location + services_url_prefix_str);
    if (services_url_prefix_key) {
        WshShell.RegDelete (reg_location + services_url_prefix_str);    
    }
} catch (e) {}
if (services_url_prefix) {
    WshShell.RegWrite (reg_location + services_url_prefix_str, services_url_prefix, "REG_SZ");
}
/* We write max_log_file_size only if specified */
try {
    var max_log_file_size_key = WshShell.RegRead (reg_location + max_log_file_size_str);
    if (max_log_file_size_key) {
        WshShell.RegDelete (reg_location + max_log_file_size_str);    
    }
} catch (e) {}
if (max_log_file_size) {
    WshShell.RegWrite (reg_location + max_log_file_size_str, max_log_file_size, "REG_SZ");
}

try{
    var axis2_location_key = WshShell.RegRead (reg_location + axis2_location_str);
    if (axis2_location_key) {
            WshShell.RegDelete (reg_location + axis2_location_str);    
    }
} catch (e) {}
if (axis2_location) {
    WshShell.RegWrite (reg_location + axis2_location_str, axis2_location, "REG_SZ");
}