Project

General

Profile

« Previous | Next » 

Revision cf3cf7ce

Added by Andreas Kohlbecker over 13 years ago

CDM Server as win32 service - initial commit with bug!

View differences:

.gitattributes
18 18
src/main/installer/win32/Launch4JavaCDMSERVER.xml -text
19 19
src/main/installer/win32/cdmserver.nsi -text
20 20
src/main/installer/win32/cdmserver/bin/cdmserver.bat -text
21
src/main/installer/win32/service/CDMServer.conf -text
22
src/main/installer/win32/service/CDMServer.exe -text
23
src/main/installer/win32/service/install-serice.bat -text
24
src/main/installer/win32/service/remove-service.bat -text
25
src/main/installer/win32/service/start-service.bat -text
26
src/main/installer/win32/service/stop-service.bat -text
27
src/main/installer/win32/service/wrapper.dll -text
21 28
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java -text
22 29
src/main/java/eu/etaxonomy/cdm/server/CdmInstanceProperties.java -text
23 30
src/main/java/eu/etaxonomy/cdm/server/CommandOptions.java -text
24 31
src/main/java/eu/etaxonomy/cdm/server/DataSourcePropertyParser.java -text
25 32
src/main/java/eu/etaxonomy/cdm/server/JvmManager.java -text
33
src/main/java/eu/etaxonomy/cdm/server/win32service/CDMServerWrapperListener.java -text
34
src/main/java/eu/etaxonomy/cdm/server/win32service/Win32Service.java -text
26 35
src/main/resources/c3p0.properties -text
27 36
src/main/resources/log4j.properties -text
28 37
src/main/webapp/WEB-INF/web.xml -text
pom.xml
1 1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5 4
	http://maven.apache.org/xsd/maven-4.0.0.xsd">
6
	
7
  
8
  <!-- 
9
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
10
    http://maven.apache.org/maven-v4_0_0.xsd"
11
  -->
12
 
13
  <modelVersion>4.0.0</modelVersion>
14
  <groupId>eu.etaxonomy</groupId>
15
  <artifactId>cdm-server</artifactId>
16
  <version>2.5</version>
17
  <packaging>jar</packaging>
18
  <name>CDM Community Standalone Server</name>
19
  
20
  <scm>
21
    <connection>scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdm-server/</connection>
22
    <developerConnection>scm:svn:https://dev.e-taxonomy.eu/svn/trunk/cdm-server/</developerConnection>
23
    <url>http://dev.e-taxonomy.eu/trac/browser/trunk/cdm-server/</url>
24
  </scm>
25
  
26
  <mailingLists>
5

  
6

  
7
	<!--
8
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
9
		http://maven.apache.org/maven-v4_0_0.xsd"
10
	-->
11

  
12
	<modelVersion>4.0.0</modelVersion>
13
	<groupId>eu.etaxonomy</groupId>
14
	<artifactId>cdm-server</artifactId>
15
	<version>2.5</version>
16
	<packaging>jar</packaging>
17
	<name>CDM Community Standalone Server</name>
18

  
19
	<scm>
20
		<connection>scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdm-server/</connection>
21
		<developerConnection>scm:svn:https://dev.e-taxonomy.eu/svn/trunk/cdm-server/</developerConnection>
22
		<url>http://dev.e-taxonomy.eu/trac/browser/trunk/cdm-server/</url>
23
	</scm>
24

  
25
	<mailingLists>
27 26
		<mailingList>
28 27
			<name>dev-edit</name>
29 28
			<subscribe>
......
73 72
			<url></url>
74 73
		</developer>
75 74
	</developers>
76
  
77
  <contributors>
75

  
76
	<contributors>
78 77
		<contributor>
79 78
			<name>Test-Contributor</name>
80 79
		</contributor>
......
83 82
		<system>Trac</system>
84 83
		<url>http://dev.e-taxonomy.eu/trac/</url>
85 84
	</issueManagement>
86
  
87
  <!-- **** REPOSITORIES **** -->
85

  
86
	<!-- **** REPOSITORIES **** -->
88 87
	<repositories>
89 88
		<!-- sun repository -->
90 89
		<repository>
......
97 96
			<id>EditRepository</id>
98 97
			<url>http://wp5.e-taxonomy.eu/cdmlib/mavenrepo/</url>
99 98
		</repository>
100
    <!-- apache incubating repository -->
99
		<!-- apache incubating repository -->
101 100
		<repository>
102 101
			<id>ApacheIncubating</id>
103 102
			<url>http://people.apache.org/repo/m2-incubating-repository/</url>
......
117 116
			<id>jboss-repository</id>
118 117
			<name>JBoss Repository</name>
119 118
			<url>http://repository.jboss.com/maven2</url>
120
      </repository>
121
      <!-- codehaus mule repository needed for yourkit  -->
122
      <repository>
123
        <id>CodehausMuleRepository</id>
124
        <url>http://dist.codehaus.org/mule/dependencies/maven2/</url>
125
      </repository>
126
      <!-- current spring source repositories -->
127
      <repository>
128
        <id>SpringSource Enterprise Bundle Repository - External Bundle Milestones</id>
129
        <url>http://repository.springsource.com/maven/bundles/milestone</url>
130
      </repository>
131
      <repository>
132
        <id>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</id>
133
        <url>http://repository.springsource.com/maven/bundles/release</url>
134
      </repository>
135
      <repository>
136
        <id>SpringSource Enterprise Bundle Repository - External Bundle Releases</id>
137
        <url>http://repository.springsource.com/maven/bundles/external</url>
138
      </repository>
139
    </repositories>
140
  
141
  <!-- **** PLUGINS **** -->
119
		</repository>
120
		<!-- codehaus mule repository needed for yourkit  -->
121
		<repository>
122
			<id>CodehausMuleRepository</id>
123
			<url>http://dist.codehaus.org/mule/dependencies/maven2/</url>
124
		</repository>
125
		<!-- current spring source repositories -->
126
		<repository>
127
			<id>SpringSource Enterprise Bundle Repository - External Bundle Milestones</id>
128
			<url>http://repository.springsource.com/maven/bundles/milestone</url>
129
		</repository>
130
		<repository>
131
			<id>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</id>
132
			<url>http://repository.springsource.com/maven/bundles/release</url>
133
		</repository>
134
		<repository>
135
			<id>SpringSource Enterprise Bundle Repository - External Bundle Releases</id>
136
			<url>http://repository.springsource.com/maven/bundles/external</url>
137
		</repository>
138
	</repositories>
139

  
140
	<!-- **** PLUGINS **** -->
142 141
	<build>
143 142
		<plugins>
144
      <plugin>
145
        <artifactId>maven-compiler-plugin</artifactId>
146
        <configuration>
147
          <source>1.6</source>
148
          <target>1.6</target>
149
        </configuration>
150
      </plugin>
151
      <plugin>
152
        <artifactId>maven-surefire-plugin</artifactId>
153
        <configuration>
154
          <argLine>-Xmx512M</argLine>
155
        <includes>
156
          <include>**/*Test.java</include>
157
        </includes>
158
        <systemProperties>
159
          <property>
160
            <name>hibernate.connection.driver_class</name>
161
            <value>${hibernate.connection.driver_class}</value>
162
          </property>
163
          <property>
164
            <name>hibernate.connection.url</name>
165
            <value>${hibernate.connection.url}</value>
166
          </property>
167
          <property>
168
            <name>hibernate.connection.username</name>
169
            <value>${hibernate.connection.username}</value>
170
          </property>
171
          <property>
172
            <name>hibernate.connection.password</name>
173
            <value>${hibernate.connection.password}</value>
174
          </property>
175
        </systemProperties>
176
       </configuration>
177
      </plugin>
178
      <plugin>
179
        <groupId>org.codehaus.mojo</groupId>
180
        <artifactId>buildnumber-maven-plugin</artifactId>
181
        <version>1.0-beta-3</version>
182
        <executions>
183
          <execution>
184
            <!--<phase>deploy</phase>-->
185
            <goals>
186
              <goal>create</goal>
187
            </goals>
188
          </execution>
189
        </executions>
190
        <configuration>
191
          <doCheck>false</doCheck><!-- Only create the build number if there are no local modifications -->
192
          <doUpdate>false</doUpdate><!-- automatically update the local svn copy -->
193
        </configuration>
194
      </plugin>
195
      <plugin>
143
			<plugin>
144
				<artifactId>maven-compiler-plugin</artifactId>
145
				<configuration>
146
					<source>1.6</source>
147
					<target>1.6</target>
148
				</configuration>
149
			</plugin>
150
			<plugin>
151
				<artifactId>maven-surefire-plugin</artifactId>
152
				<configuration>
153
					<argLine>-Xmx512M</argLine>
154
					<includes>
155
						<include>**/*Test.java</include>
156
					</includes>
157
					<systemProperties>
158
						<property>
159
							<name>hibernate.connection.driver_class</name>
160
							<value>${hibernate.connection.driver_class}</value>
161
						</property>
162
						<property>
163
							<name>hibernate.connection.url</name>
164
							<value>${hibernate.connection.url}</value>
165
						</property>
166
						<property>
167
							<name>hibernate.connection.username</name>
168
							<value>${hibernate.connection.username}</value>
169
						</property>
170
						<property>
171
							<name>hibernate.connection.password</name>
172
							<value>${hibernate.connection.password}</value>
173
						</property>
174
					</systemProperties>
175
				</configuration>
176
			</plugin>
177
			<plugin>
178
				<groupId>org.codehaus.mojo</groupId>
179
				<artifactId>buildnumber-maven-plugin</artifactId>
180
				<version>1.0-beta-3</version>
181
				<executions>
182
					<execution>
183
						<!--<phase>deploy</phase>-->
184
						<goals>
185
							<goal>create</goal>
186
						</goals>
187
					</execution>
188
				</executions>
189
				<configuration>
190
					<doCheck>false</doCheck>
191
					<!--
192
						Only create the build number if there are no local modifications
193
					-->
194
					<doUpdate>false</doUpdate>
195
					<!--
196
						automatically update the local svn copy
197
					-->
198
				</configuration>
199
			</plugin>
200
			<plugin>
196 201
				<groupId>org.apache.maven.plugins</groupId>
197 202
				<artifactId>maven-site-plugin</artifactId>
198
				<!-- 
199
				Falling back to maven-site-plugin 2.0-beta-5 since
200
                maven-site-plugin 2.0-beta-6 has this problem:
201
				Embedded error: Unrecognised tag: 'site' (position: START_TAG seen <?xml
202
                version="1.0" encoding="ISO-8859-1"?>\r\n<site>... @2:7) -->
203
				<!--
204
					Falling back to maven-site-plugin 2.0-beta-5 since
205
					maven-site-plugin 2.0-beta-6 has this problem: Embedded error:
206
					Unrecognised tag: 'site' (position: START_TAG seen <?xml
207
					version="1.0" encoding="ISO-8859-1"?>\r\n<site>... @2:7)
208
				-->
203 209
				<version>2.0-beta-5</version>
204 210
				<configuration>
205 211
					<locales>en</locales>
206 212
				</configuration>
207 213
			</plugin>
208
      <plugin>
214
			<plugin>
209 215
				<groupId>org.apache.maven.plugins</groupId>
210 216
				<artifactId>maven-source-plugin</artifactId>
211 217
				<executions>
......
218 224
					</execution>
219 225
				</executions>
220 226
			</plugin>
221
      <plugin>
227
			<plugin>
222 228
				<groupId>org.apache.maven.plugins</groupId>
223 229
				<artifactId>maven-javadoc-plugin</artifactId>
224 230
				<configuration>
......
231 237
				<artifactId>maven-eclipse-plugin</artifactId>
232 238
				<configuration>
233 239
					<downloadSources>true</downloadSources>
234
					<downloadJavadocs>true</downloadJavadocs>	
240
					<downloadJavadocs>true</downloadJavadocs>
235 241
				</configuration>
236 242
			</plugin>
237 243
			<!-- INSTALL -->
......
269 275
						<overlay>
270 276
							<groupId>eu.etaxonomy</groupId>
271 277
							<artifactId>cdmlib-remote-webapp</artifactId>
272
							<skip>true</skip><!-- Do Not overlay  --> 
278
							<skip>true</skip><!-- Do Not overlay  -->
273 279
						</overlay>
274 280
					</overlays>
275 281
				</configuration>
......
296 302
							<tasks>
297 303
								<!--
298 304
									${project.patchversion} is explicitely set in this pom
299
									
300
									${buildNumber} is set by the buildnumber-maven-plugin  
301
									Cannot create the build number if you have local modifications, 
302
									to allow creating a buildnumber anyway you can ommit                     
305

  
306
									${buildNumber} is set by the buildnumber-maven-plugin Cannot
307
									create the build number if you have local modifications, to
308
									allow creating a buildnumber anyway you can ommit
303 309
								-->
304
								<!-- FIXME
305
									<property name="project.fullversionstring" value="${project.version}.${project.patchversion}.r${buildNumber}"/>
306
									<property name="project.fullversionstring" value="${project.version}.0.r0000"/>
310
								<!--
311
									FIXME <property name="project.fullversionstring"
312
									value="${project.version}.${project.patchversion}.r${buildNumber}"/>
313
									<property name="project.fullversionstring"
314
									value="${project.version}.0.r0000"/>
307 315
								-->
308
								<property name="project.fullversionstring" value="${project.version}.0.${maven.build.timestamp}"/>
309
								<ant antfile="${project.basedir}/src/main/installer/linux/build-deb.xml" dir="${project.basedir}" />
310
								
311
								
316
								<property name="project.fullversionstring"
317
									value="${project.version}.0.${maven.build.timestamp}" />
318
								<ant antfile="${project.basedir}/src/main/installer/linux/build-deb.xml"
319
									dir="${project.basedir}" />
320

  
321

  
312 322
							</tasks>
313 323
						</configuration>
314 324
						<goals>
......
317 327
					</execution>
318 328
				</executions>
319 329
			</plugin>
320
    </plugins>
330
		</plugins>
321 331
		<!-- EXTENSIONS -->
322
    <extensions>
332
		<extensions>
323 333
			<extension>
324 334
				<groupId>org.apache.maven.wagon</groupId>
325 335
				<artifactId>wagon-scm</artifactId>
326 336
				<version>1.0-alpha-5</version>
327 337
			</extension>
328 338
			<!--
329
				<extension>
330
				<groupId>org.apache.maven.wagon</groupId>
339
				<extension> <groupId>org.apache.maven.wagon</groupId>
331 340
				<artifactId>wagon-ssh-external</artifactId>
332
				<version>1.0-alpha-5</version>
333
				</extension>
341
				<version>1.0-alpha-5</version> </extension>
334 342
			-->
335 343
			<extension>
336 344
				<groupId>org.apache.maven.scm</groupId>
......
349 357
				<version>1.0-beta-2</version>
350 358
			</extension>
351 359
		</extensions>
352
  </build>
353
  
354
  	<reporting>
360
	</build>
361

  
362
	<reporting>
355 363
		<plugins>
356 364
			<plugin>
357 365
				<!-- you will want to start by publishing your classes' Javadocs -->
......
361 369
					<links>
362 370
						<link>http://java.sun.com/j2se/1.6.0/docs/api/</link>
363 371
						<link>http://static.springframework.org/spring/docs/2.5.x/api/</link>
364
						<link>http://www.hibernate.org/hib_docs/v3/api/</link>						
372
						<link>http://www.hibernate.org/hib_docs/v3/api/</link>
365 373
						<!-- more libraries? -->
366 374
					</links>
367 375
				</configuration>
368 376
			</plugin>
369 377
			<plugin>
370
				<!-- this will generate an indexed and cross-referenced HTML version of your source code -->
378
				<!--
379
					this will generate an indexed and cross-referenced HTML version of
380
					your source code
381
				-->
371 382
				<groupId>org.apache.maven.plugins</groupId>
372 383
				<artifactId>maven-jxr-plugin</artifactId>
373 384
			</plugin>
374 385
			<plugin>
375
				<!-- if you use @todo tags to remind you of things to be done (which is a good coding practice), the taglist report will generate a list of all the items marked @todo or TODO -->
386
				<!--
387
					if you use @todo tags to remind you of things to be done (which is
388
					a good coding practice), the taglist report will generate a list of
389
					all the items marked @todo or TODO
390
				-->
376 391
				<groupId>org.codehaus.mojo</groupId>
377 392
				<artifactId>taglist-maven-plugin</artifactId>
378 393
			</plugin>
379 394
			<plugin>
380
				<!-- Test coverage can be a useful indication of the quality of your unit tests. It basically tells you how much of your code is actually run by your unit tests, which, in turn, can give you a good idea of the tests' quality -->
395
				<!--
396
					Test coverage can be a useful indication of the quality of your
397
					unit tests. It basically tells you how much of your code is
398
					actually run by your unit tests, which, in turn, can give you a
399
					good idea of the tests' quality
400
				-->
381 401
				<groupId>org.codehaus.mojo</groupId>
382 402
				<artifactId>cobertura-maven-plugin</artifactId>
383 403
			</plugin>
384
      
385
     
386
	</plugins>
404

  
405

  
406
		</plugins>
387 407
	</reporting>
388
 	<!--	 DISTRIBUTION MANAGEMENT -->
408
	<!--	 DISTRIBUTION MANAGEMENT -->
389 409
	<distributionManagement>
390 410
		<site>
391 411
			<id>edit-wp5</id>
392
      <url>
412
			<url>
393 413
				scp://160.45.63.151/var/www/wp5.e-taxonomy.eu/cdm-server/site
394 414
			</url>
395
       	</site>
396
        <repository>
415
		</site>
416
		<repository>
397 417
			<id>edit-wp5</id>
398 418
			<name>Edit Maven Repository</name>
399 419
			<url>
......
402 422
		</repository>
403 423
	</distributionManagement>
404 424

  
405
  
406
  <properties>
407
    <jetty-version>7.0.1.v20091125</jetty-version>
408
  </properties>
409
  
410
  <dependencies>
411
    <dependency>
412
      <groupId>eu.etaxonomy</groupId>
413
      <artifactId>cdmlib-remote-webapp</artifactId>
414
      <version>${project.version}</version>
415
      <type>war</type>
416
    </dependency>
417
 
418
    <!-- JETTY 7 -->
419
    <dependency>
420
      <groupId>org.eclipse.jetty</groupId>
421
      <artifactId>jetty-webapp</artifactId>
422
      <version>${jetty-version}</version>
423
    </dependency>
424
    <dependency>
425
      <groupId>org.eclipse.jetty</groupId>
426
      <artifactId>jetty-plus</artifactId>
427
      <version>${jetty-version}</version>
428
    </dependency>
429
    <dependency>
430
      <groupId>org.eclipse.jetty</groupId>
431
      <artifactId>jetty-webapp</artifactId>
432
      <version>${jetty-version}</version>
433
    </dependency>
434
    <dependency>
435
	   <groupId>org.eclipse.jetty</groupId>
436
	   <artifactId>jetty-jmx</artifactId>
437
	   <version>${jetty-version}</version>
438
	</dependency>
439
    <dependency>
440
      <groupId>org.mortbay.jetty</groupId>
441
      <artifactId>jsp-2.1-glassfish</artifactId>
442
      <version>9.1.1.B60.25.p2</version>
443
    </dependency>
444
    <dependency>
445
      <groupId>javax.transaction</groupId>
446
      <artifactId>jta</artifactId>
447
      <version>1.1</version>
448
    </dependency>
449
    
450
    <!--  Logging  -->
451
    <dependency>
452
	   <groupId>org.slf4j</groupId>
453
	   <artifactId>slf4j-api</artifactId>
454
	   <version>1.6.1</version>
455
	</dependency>
456
	<dependency>
457
	   <groupId>org.slf4j</groupId>
458
	   <artifactId>slf4j-log4j12</artifactId>
459
	   <version>1.6.1</version>
460
	</dependency>
461
    
462
 	<dependency>
463
	   <groupId>commons-cli</groupId>
464
	   <artifactId>commons-cli</artifactId>
465
	   <version>1.2</version>
466
	</dependency>
467
	<dependency>
468
       <groupId>commons-io</groupId>
469
       <artifactId>commons-io</artifactId>
470
       <version>1.4</version>
471
    </dependency>
472
	<dependency>
473
	   <groupId>net.sf.jopt-simple</groupId>
474
	   <artifactId>jopt-simple</artifactId>
475
	   <version>3.2</version>
476
	</dependency>
477
	<dependency>
478
	   <groupId>c3p0</groupId>
479
	   <artifactId>c3p0</artifactId>
480
	   <version>0.9.1</version>
481
	</dependency>
482
	<!--  DATABASE DRIVER -->
483
	 <dependency>
484
       <groupId>mysql</groupId>
485
       <artifactId>mysql-connector-java</artifactId>
486
       <version>5.0.5</version>
487
     </dependency>
488
  </dependencies>
489
  
425

  
426
	<properties>
427
		<jetty-version>7.0.1.v20091125</jetty-version>
428
	</properties>
429

  
430
	<dependencies>
431
		<dependency>
432
			<groupId>eu.etaxonomy</groupId>
433
			<artifactId>cdmlib-remote-webapp</artifactId>
434
			<version>${project.version}</version>
435
			<type>war</type>
436
		</dependency>
437

  
438
		<!-- JETTY 7 -->
439
		<dependency>
440
			<groupId>org.eclipse.jetty</groupId>
441
			<artifactId>jetty-webapp</artifactId>
442
			<version>${jetty-version}</version>
443
		</dependency>
444
		<dependency>
445
			<groupId>org.eclipse.jetty</groupId>
446
			<artifactId>jetty-plus</artifactId>
447
			<version>${jetty-version}</version>
448
		</dependency>
449
		<dependency>
450
			<groupId>org.eclipse.jetty</groupId>
451
			<artifactId>jetty-webapp</artifactId>
452
			<version>${jetty-version}</version>
453
		</dependency>
454
		<dependency>
455
			<groupId>org.eclipse.jetty</groupId>
456
			<artifactId>jetty-jmx</artifactId>
457
			<version>${jetty-version}</version>
458
		</dependency>
459
		<dependency>
460
			<groupId>org.mortbay.jetty</groupId>
461
			<artifactId>jsp-2.1-glassfish</artifactId>
462
			<version>9.1.1.B60.25.p2</version>
463
		</dependency>
464
		<dependency>
465
			<groupId>javax.transaction</groupId>
466
			<artifactId>jta</artifactId>
467
			<version>1.1</version>
468
		</dependency>
469
		
470
		<!-- windows service -->
471
		<dependency>
472
		   <groupId>tanukisoft</groupId>
473
		   <artifactId>wrapper</artifactId>
474
		   <version>3.2.3</version>
475
		</dependency>
476

  
477
		<!--  Logging  -->
478
		<dependency>
479
			<groupId>org.slf4j</groupId>
480
			<artifactId>slf4j-api</artifactId>
481
			<version>1.6.1</version>
482
		</dependency>
483
		<dependency>
484
			<groupId>org.slf4j</groupId>
485
			<artifactId>slf4j-log4j12</artifactId>
486
			<version>1.6.1</version>
487
		</dependency>
488

  
489
		<dependency>
490
			<groupId>commons-cli</groupId>
491
			<artifactId>commons-cli</artifactId>
492
			<version>1.2</version>
493
		</dependency>
494
		<dependency>
495
			<groupId>commons-io</groupId>
496
			<artifactId>commons-io</artifactId>
497
			<version>1.4</version>
498
		</dependency>
499
		<dependency>
500
			<groupId>net.sf.jopt-simple</groupId>
501
			<artifactId>jopt-simple</artifactId>
502
			<version>3.2</version>
503
		</dependency>
504
		<dependency>
505
			<groupId>c3p0</groupId>
506
			<artifactId>c3p0</artifactId>
507
			<version>0.9.1</version>
508
		</dependency>
509
		<!--  DATABASE DRIVER -->
510
		<dependency>
511
			<groupId>mysql</groupId>
512
			<artifactId>mysql-connector-java</artifactId>
513
			<version>5.0.5</version>
514
		</dependency>
515
	</dependencies>
516

  
490 517
</project>
src/main/installer/win32/service/CDMServer.conf
1
wrapper.java.classpath.1=cdm-server-2.5.jar
2
wrapper.java.library.path.1=./
3
wrapper.java.additional.1=-XX:PermSize=128m
4
wrapper.java.additional.2=-XX:MaxPermSize=192m
5
wrapper.java.additional.3=-XX:+CMSClassUnloadingEnabled
6
wrapper.java.additional.4=-XX:+CMSPermGenSweepingEnabled
7
wrapper.java.additional.5=-Duser.home=%PROGRAMFILES%\CDM-Server\
8
wrapper.java.initmemory=256
9
wrapper.java.maxmemory=1024
10
wrapper.java.mainclass=eu.etaxonomy.cdm.server.win32service.CDMServerWrapperListener
11
wrapper.app.parameter.1=-win32service
12
wrapper.console.format=PM
13
wrapper.console.loglevel=INFO
14
wrapper.logfile.format=LPTM
15
wrapper.logfile.loglevel=INFO
16
wrapper.logfile.maxsize=0
17
wrapper.logfile.maxfiles=0
18
wrapper.syslog.loglevel=ERROR
19
wrapper.ntservice.name=CDMServer
20
wrapper.ntservice.displayname=CDM-Server
21
wrapper.ntservice.description=CDM Server is component of the EDIT Platform for Cybertaxonomy
22
wrapper.ntservice.starttype=AUTO_START
23
wrapper.ntservice.interactive=false
24

  
25
wrapper.filter.trigger.1=java.lang.OutOfMemoryError
26
wrapper.filter.action.1=RESTART
src/main/installer/win32/service/install-serice.bat
1
CDMServer.exe --install CDMServer.conf
2
pause
src/main/installer/win32/service/remove-service.bat
1
CDMServer.exe --remove CDMServer.conf
2
pause
src/main/installer/win32/service/start-service.bat
1
CDMServer.exe --start CDMServer.conf
2
pause
src/main/installer/win32/service/stop-service.bat
1
CDMServer.exe --stop CDMServer.conf
2
pause
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java
15 15
import static eu.etaxonomy.cdm.server.CommandOptions.HTTP_PORT;
16 16
import static eu.etaxonomy.cdm.server.CommandOptions.JMX;
17 17
import static eu.etaxonomy.cdm.server.CommandOptions.WEBAPP;
18
import static eu.etaxonomy.cdm.server.CommandOptions.WIN32SERVICE;
18 19

  
19 20
import java.io.File;
20 21
import java.io.FileNotFoundException;
......
50 51
import org.eclipse.jetty.webapp.WebAppContext;
51 52

  
52 53
import eu.etaxonomy.cdm.server.CdmInstanceProperties.Status;
54
import eu.etaxonomy.cdm.server.win32service.Win32Service;
53 55

  
54 56

  
55 57
/**
......
324 326
			mBeanContainer.start();
325 327
		}
326 328
		
329
		if(cmdLine.hasOption(WIN32SERVICE.getOpt())){
330
			Win32Service win32Service = new Win32Service();
331
			win32Service.setServer(server);
332
			server.setStopAtShutdown(true);
333
			server.addBean(win32Service);
334
		}
335
		
327 336
		// add servelet contexts
328 337
		
329 338
		
......
377 386
        
378 387
        logger.info("setting contexts ...");
379 388
        server.setHandler(contexts);
380
        logger.info("starting jetty ...");
381
        server.start();
382
        server.join();
383
        logger.info(APPLICATION_NAME+" stopped.");
384
    	System.exit(0);
389
        if(cmdLine.hasOption(WIN32SERVICE.getOpt())){
390
        	logger.info("jetty is waiting to be started as win32 service");
391
        } else {
392
	        logger.info("starting jetty ...");
393
	        server.start();
394
	        server.join();
395
	        logger.info(APPLICATION_NAME+" stopped.");
396
	    	System.exit(0);
397
        }
385 398
	}
386 399

  
387 400
	/**
src/main/java/eu/etaxonomy/cdm/server/CommandOptions.java
24 24
			"   -Dcom.sun.management.jmxremote.ssl=false\n" +
25 25
			"   -Dcom.sun.management.jmxremote.authenticate=false\n" +
26 26
			"   -Dcom.sun.management.jmxremote.port=9999" );
27
	public static final Option WIN32SERVICE= new Option("win32service", "ONLY USED INTERNALLY - prepare for running as win32 service, the server will not be started automatically!");
27 28
	
28 29
	@SuppressWarnings("static-access")
29 30
	public static final Option WEBAPP = OptionBuilder
......
49 50
	.hasArg()
50 51
	.withDescription( "use the specified datasources file. Default is {user.home}/.cdmLibrary/datasources.xml")
51 52
	.create("datasources");
53
	
52 54
		
53 55

  
54 56
	
......
60 62
			options.addOption(HTTP_PORT);
61 63
			options.addOption(DATASOURCES_FILE);
62 64
			options.addOption(JMX);
65
			options.addOption(WIN32SERVICE);
63 66
		}
64 67
		return options;
65 68
	}
src/main/java/eu/etaxonomy/cdm/server/win32service/CDMServerWrapperListener.java
1
/*
2
 * ========================================================================
3
 * Based on Jetty 6 code from Mort Bay Consulting Pty. Ltd.
4
 * Modified for CDM Server by Andreas Kohlbecker. 2010-10-24
5
 * ========================================================================
6
 * Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
7
 * ------------------------------------------------------------------------
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at 
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 * ========================================================================
18
 */
19

  
20
package eu.etaxonomy.cdm.server.win32service;
21

  
22

  
23
import org.apache.log4j.Logger;
24
import org.eclipse.jetty.server.Server;
25
import org.tanukisoftware.wrapper.WrapperListener;
26
import org.tanukisoftware.wrapper.WrapperManager;
27
/**
28
 * @author a.kohlbecker
29
 * @date 26.10.2010
30
 *
31
 */
32
public class CDMServerWrapperListener implements WrapperListener
33
{
34
    private static Server __server = null;
35
    
36
    public static final Logger logger = Logger.getLogger(CDMServerWrapperListener.class);
37

  
38
    public CDMServerWrapperListener()
39
    {
40
    }
41

  
42
    public void controlEvent(int event)
43
    {
44
        if (!WrapperManager.isControlledByNativeWrapper())
45
        {
46
            if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) || (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) || (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT))
47
            {
48
                WrapperManager.stop(0);
49
            }
50
        }
51

  
52
    }
53

  
54
    public Integer start(String[] args)
55
    {
56
        for(int i=0; i<args.length; i++)
57
        {
58
        	logger.info("ARG[" + i + "] = " + args[i]);
59
        }
60
        try {
61
			eu.etaxonomy.cdm.server.Bootloader.main(args);
62
		} catch (Exception e) {
63
			e.printStackTrace();
64
		}
65
        return null;
66
    }
67

  
68
    public int stop(int code)
69
    {
70
        try
71
        {
72
        	logger.info("Stopping CDM Server!!!");
73
            __server.stop();
74
            logger.info("CDM Server Stopped!!!");
75
            return code;
76
        }
77
        catch (Exception e)
78
        {
79
        	logger.error("Stop Server Error");
80
            e.printStackTrace();
81
            return -1;
82
        }
83

  
84
    }
85

  
86
    /**
87
     * @param server
88
     */
89
    public static void setServer(Server server)
90
    {
91
        __server = server;
92
    }
93

  
94
    /**
95
     * @return
96
     */
97
    public static Server getServer()
98
    {
99
        return __server;
100
    }
101

  
102
    public static void main(String[] args)
103
    {
104
        String newStrArgs[] = new String[args.length + 1];
105
        newStrArgs[0] = System.getProperty("jetty.home") + "etc/jetty-win32-service.xml";
106
        for(int i=0; i<args.length; i++)
107
        {
108
            newStrArgs[i+1] = args[i];
109
        }
110
        WrapperManager.start(new CDMServerWrapperListener(), newStrArgs);
111
    }
112

  
113
}
src/main/java/eu/etaxonomy/cdm/server/win32service/Win32Service.java
1
/*
2
 * ========================================================================
3
 * Based on Jetty 6 code from Mort Bay Consulting Pty. Ltd.
4
 * Modified for CDM Server by Andreas Kohlbecker. 2010-10-24
5
 * ========================================================================
6
 * Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
7
 * ------------------------------------------------------------------------
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at 
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 * ========================================================================
18
 */
19

  
20
package eu.etaxonomy.cdm.server.win32service;
21

  
22
import org.eclipse.jetty.server.Server;
23
import org.eclipse.jetty.util.component.AbstractLifeCycle;
24

  
25

  
26
/**
27
 * @author a.kohlbecker
28
 * @date 26.10.2010
29
 *
30
 */
31
public class Win32Service extends AbstractLifeCycle implements Runnable
32
{
33
    private Server server;
34
    public void doStart()
35
    {
36
        
37
        
38
        CDMServerWrapperListener.setServer(server);
39
         
40
    }
41
    
42
    public void doStop()
43
    {
44
        System.out.println("Listener is stopping CDM Server Instance!!!");
45
        
46
    }
47
    
48
    public void run()
49
    {
50
        doStop();
51
        
52
    }
53

  
54
    public void stopServer()
55
    {
56
        try
57
        {
58
            System.out.println("Thread Test Stopper!!!");
59
            server.stop();
60
            //WrapperManager.stop(0);
61
        }
62
        catch (Exception e)
63
        {
64
            e.printStackTrace();
65
        }
66
    }
67
    
68
    
69
    public Server getServer()
70
    {
71
        return server;
72
    }
73

  
74
    public void setServer(Server server)
75
    {
76
        this.server = server;
77
    }
78
    
79
   
80

  
81
   
82
    
83
    
84
    
85
}

Also available in: Unified diff