bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / native / iis / installer / iisfilter.vbs
1 '
2 ' Licensed to the Apache Software Foundation (ASF) under one or more
3 ' contributor license agreements.  See the NOTICE file distributed with
4 ' this work for additional information regarding copyright ownership.
5 ' The ASF licenses this file to You under the Apache License, Version 2.0
6 ' (the "License"); you may not use this file except in compliance with
7 ' the License.  You may obtain a copy of the License at
8 '
9 '     http://www.apache.org/licenses/LICENSE-2.0
10 '
11 ' Unless required by applicable law or agreed to in writing, software
12 ' distributed under the License is distributed on an "AS IS" BASIS,
13 ' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ' See the License for the specific language governing permissions and
15 ' limitations under the License.
16 '
17
18 ' =========================================================================
19 ' Description: Install script for Tomcat ISAPI redirector                              
20 ' Author:      Mladen Turk <mturk@apache.org>                           
21 ' Version:     $Revision: 572120 $                                           
22 ' =========================================================================
23
24 '
25 ' Get a handle to the filters for the server - we process all errors
26 '
27 On Error Resume Next
28
29 filterName = "jakarta"
30 filterLib = "bin\isapi_redirect.dll"
31   
32 Function IISInstallFilter(filterDir, filterObject)
33
34     Dim filters
35     Set filters = GetObject(filterObject)
36     If err Then err.clear
37     info "Got Filters " + filters.FilterLoadOrder
38     
39     '
40     ' Create the filter - if it fails then delete it and try again
41     '
42     name = filterName
43     info "Creating Filter  - " + filterName
44     Dim filter
45     Set filter = filters.Create( "IISFilter", filterName )
46     If err Then
47         err.clear
48         info "Filter exists - deleting"
49         filters.delete "IISFilter", filterName
50         If err Then
51             info "Error Deleting Filter"
52             IISInstallFilter = 0
53             Exit Function
54         End If
55         Set filter = filters.Create( "IISFilter", filterName )
56         If Err Then
57             info "Error Creating Filter"
58             IISInstallFilter = 0
59             Exit Function
60         End If
61     End If
62     
63     '
64     ' Set the filter info and save it
65     '
66     filter.FilterPath = filterDir + filterLib
67 '    filter.FilterEnabled = true
68     filter.FilterDescription = "Jakarta Isapi Redirector"
69     filter.NotifyOrderHigh = true
70     filter.SetInfo
71     info "Created Filter " + filterDir + filterLib
72     
73     '
74     ' Set the load order - only if it's not in the list already
75     '
76     On Error goto 0
77     loadOrders = filters.FilterLoadOrder
78     list = Split( loadOrders, "," )
79     found = false
80     For each item in list
81         If Trim( item ) = filterName Then found = true
82     Next
83     
84     If found = false Then 
85         info "Filter is not in load order - adding now."
86         If Len(loadOrders) <> 0  Then loadOrders = loadOrders + ","
87         filters.FilterLoadOrder = loadOrders + filterName
88         filters.SetInfo
89         info "Added Filter " + filterName 
90     Else
91         info "Filter already exists in load order - no update required."
92     End If
93     IISInstallFilter = 1
94 End Function
95
96
97 ' Helper function for snafus
98 '
99 Function fail(message)
100 '       MsgBox " " + message
101         WScript.Quit(1)
102 End function
103
104 '
105 ' Helper function for info
106 '
107 Function info(message)
108 '       MsgBox " " + message
109 End Function 
110
111 info "Installing IIS Filter " + Session.Property("INSTALLDIR")
112 Dim rv
113 rv = 0
114 rv = IISInstallFilter(Session.Property("INSTALLDIR"), "IIS://LocalHost/W3SVC/1/Filters")
115 If rv = 0 Then    
116     rv = IISInstallFilter(Session.Property("INSTALLDIR"), "/LM/W3SVC/Filters")
117 End If
118 If rv = 0 Then
119     rv = IISInstallFilter(Session.Property("INSTALLDIR"), "/LM/W3SVC/1/Filters")
120 End If