Project

General

Profile

« Previous | Next » 

Revision 2b300e92

Added by Andreas Kohlbecker over 13 years ago

  • ID 2b300e926a3bed70c902f8b55323eb4105ca1b92
  • Child 1f67b02a

cdm-server as separate project

View differences:

.gitattributes
1
* text=auto !eol
2
/LICENSE.TXT -text
3
ide/eclipse/Bootloader[!!-~]-[!!-~]Help.launch -text
4
ide/eclipse/Bootloader.launch -text
5
ide/eclipse/run[!!-~]cdm-server.jar[!!-~]in[!!-~]debugmode.launch -text
6
ide/eclipse/run[!!-~]cdm-server.jar.launch -text
7
/pom.xml -text
8
src/main/assembly/assembly.xml -text
9
src/main/installer/lib/ant-deb-task-0.0.1.jar -text
10
src/main/installer/linux/Makefile -text
11
src/main/installer/linux/build-deb.xml -text
12
src/main/installer/linux/cdmserver -text
13
src/main/installer/linux/copyright -text
14
src/main/installer/linux/postinst -text
15
src/main/installer/linux/postrm -text
16
src/main/installer/templates/.cdmLibrary/datasources.xml -text
17
src/main/installer/templates/copyright.txt -text
18
src/main/installer/win32/Launch4JavaCDMSERVER.xml -text
19
src/main/installer/win32/cdmserver.nsi -text
20
src/main/installer/win32/cdmserver/bin/cdmserver.bat -text
21
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java -text
22
src/main/java/eu/etaxonomy/cdm/server/CdmInstanceProperties.java -text
23
src/main/java/eu/etaxonomy/cdm/server/CommandOptions.java -text
24
src/main/java/eu/etaxonomy/cdm/server/DataSourcePropertyParser.java -text
25
src/main/java/eu/etaxonomy/cdm/server/JvmManager.java -text
26
src/main/resources/c3p0.properties -text
27
src/main/resources/log4j.properties -text
28
src/main/webapp/WEB-INF/web.xml -text
29
src/main/webapp/css/server.css -text
30
src/main/webapp/css/style.css -text
31
src/main/webapp/favicon.ico -text
32
src/main/webapp/index.html -text
33
src/main/webapp/index.jsp -text
34
src/main/webapp/js/jquery.js -text
35
src/main/webapp/js/jquery.min.js -text
36
src/main/webapp/js/oai-pmh-status.js -text
37
src/main/webapp/robots.txt -text
.gitignore
1
/.classpath
2
/.project
3
/.settings
4
/dist
5
/target
LICENSE.TXT
1
The contents of this file are subject to the Mozilla Public License
2
Version 1.1 (the "License"); you may not use this file except in
3
compliance with the License. You may obtain a copy of the License at
4
http://www.mozilla.org/MPL/
5

  
6
Software distributed under the License is distributed on an "AS IS"
7
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8
License for the specific language governing rights and limitations
9
under the License.
ide/eclipse/Bootloader - Help.launch
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/cdm-server/src/main/java/eu/etaxonomy/cdm/server/Bootloader.java"/>
5
</listAttribute>
6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7
<listEntry value="1"/>
8
</listAttribute>
9
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="eu.etaxonomy.cdm.server.Bootloader"/>
10
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-help"/>
11
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="cdm-server"/>
12
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024M&#13;&#10;&#13;&#10;-XX:PermSize=128m &#13;&#10;-XX:MaxPermSize=192m&#13;&#10;&#13;&#10;-XX:+UseConcMarkSweepGC &#13;&#10;-XX:+CMSClassUnloadingEnabled &#13;&#10;-XX:+CMSPermGenSweepingEnabled"/>
13
</launchConfiguration>
ide/eclipse/Bootloader.launch
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4
<listEntry value="/cdm-server/src/main/java/eu/etaxonomy/cdm/server/Bootloader.java"/>
5
</listAttribute>
6
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7
<listEntry value="1"/>
8
</listAttribute>
9
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
10
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-remote&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-commons&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-ext&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-model&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-persistence&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-services&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;cdmlib-io&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
11
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="eu.etaxonomy.cdm.server.Bootloader"/>
12
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-webapp=D:\workspaces\cdmlib-trunk\cdmlib-remote\target\cdmserver\&#13;&#10;-jmx"/>
13
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="cdm-server"/>
14
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024M&#13;&#10;&#13;&#10;-XX:PermSize=128m &#13;&#10;-XX:MaxPermSize=192m&#13;&#10;&#13;&#10;-XX:+UseConcMarkSweepGC &#13;&#10;-XX:+CMSClassUnloadingEnabled &#13;&#10;-XX:+CMSPermGenSweepingEnabled&#13;&#10;&#13;&#10;-Dorg.eclipse.jetty.util.log.DEBUG=false&#13;&#10;&#13;&#10;-Dcom.sun.management.jmxremote.ssl=false&#13;&#10;-Dcom.sun.management.jmxremote.authenticate=false&#13;&#10;-Dcom.sun.management.jmxremote.port=9999"/>
15
</launchConfiguration>
ide/eclipse/run cdm-server.jar in debugmode.launch
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
3
<stringAttribute key="bad_container_name" value="run_cdm-server_jar"/>
4
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\Programme\Java\jdk1.6.0_11\bin\java.exe"/>
5
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n&#13;&#10;&#13;&#10;-Xmx1024M&#13;&#10;&#13;&#10;-XX:PermSize=128m &#13;&#10;-XX:MaxPermSize=192m&#13;&#10;&#13;&#10;-XX:+UseConcMarkSweepGC &#13;&#10;-XX:+CMSClassUnloadingEnabled &#13;&#10;-XX:+CMSPermGenSweepingEnabled&#13;&#10;&#13;&#10;-jar cdm-server-2.4.jar"/>
6
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/cdm-server/target}"/>
7
</launchConfiguration>
ide/eclipse/run cdm-server.jar.launch
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
3
<stringAttribute key="bad_container_name" value="run_cdm-server_jar"/>
4
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="C:\Programme\Java\jdk1.6.0_11\bin\java.exe"/>
5
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Xmx1500M&#13;&#10;&#13;&#10;-XX:PermSize=128m &#13;&#10;-XX:MaxPermSize=196m&#13;&#10;&#13;&#10;-XX:+UseConcMarkSweepGC &#13;&#10;-XX:+CMSClassUnloadingEnabled &#13;&#10;-XX:+CMSPermGenSweepingEnabled&#13;&#10;&#13;&#10;-Dlog4j.configDebug=true&#13;&#10;&#13;&#10;-jar cdm-server-2.4.jar -jmx"/>
6
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/cdm-server/target}"/>
7
</launchConfiguration>
pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
  
4
  <!-- 
5
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
6
    http://maven.apache.org/maven-v4_0_0.xsd"
7
  -->
8
  <parent>
9
    <groupId>eu.etaxonomy</groupId>
10
    <artifactId>cdmlib-parent</artifactId>
11
    <version>2.5</version>
12
	<relativePath>pom.xml</relativePath>
13
  </parent>
14
  
15
  <modelVersion>4.0.0</modelVersion>
16
  <artifactId>cdm-server</artifactId>
17
  <packaging>jar</packaging>
18
  <name>CDM Community Standalone Server</name>
19
  
20
  <properties>
21
    <jetty-version>7.0.1.v20091125</jetty-version>
22
  </properties>
23
  
24
  <dependencies>
25
    <dependency>
26
      <groupId>eu.etaxonomy</groupId>
27
      <artifactId>cdmlib-remote-webapp</artifactId>
28
      <version>${project.version}</version>
29
      <type>war</type>
30
    </dependency>
31
 
32
    <!-- JETTY 7 -->
33
    <dependency>
34
      <groupId>org.eclipse.jetty</groupId>
35
      <artifactId>jetty-webapp</artifactId>
36
      <version>${jetty-version}</version>
37
    </dependency>
38
    <dependency>
39
      <groupId>org.eclipse.jetty</groupId>
40
      <artifactId>jetty-plus</artifactId>
41
      <version>${jetty-version}</version>
42
    </dependency>
43
    <dependency>
44
      <groupId>org.eclipse.jetty</groupId>
45
      <artifactId>jetty-webapp</artifactId>
46
      <version>${jetty-version}</version>
47
    </dependency>
48
    <dependency>
49
	   <groupId>org.eclipse.jetty</groupId>
50
	   <artifactId>jetty-jmx</artifactId>
51
	   <version>${jetty-version}</version>
52
	</dependency>
53
    <dependency>
54
      <groupId>org.mortbay.jetty</groupId>
55
      <artifactId>jsp-2.1-glassfish</artifactId>
56
      <version>9.1.1.B60.25.p2</version>
57
    </dependency>
58
    <dependency>
59
      <groupId>javax.transaction</groupId>
60
      <artifactId>jta</artifactId>
61
      <version>1.1</version>
62
    </dependency>
63
    
64
    <!--  Logging  -->
65
    <dependency>
66
	   <groupId>org.slf4j</groupId>
67
	   <artifactId>slf4j-api</artifactId>
68
	   <version>1.6.1</version>
69
	</dependency>
70
	<dependency>
71
	   <groupId>org.slf4j</groupId>
72
	   <artifactId>slf4j-log4j12</artifactId>
73
	   <version>1.6.1</version>
74
	</dependency>
75
    
76
 	<dependency>
77
	   <groupId>commons-cli</groupId>
78
	   <artifactId>commons-cli</artifactId>
79
	   <version>1.2</version>
80
	</dependency>
81
	<dependency>
82
       <groupId>commons-io</groupId>
83
       <artifactId>commons-io</artifactId>
84
    </dependency>
85
	<dependency>
86
	   <groupId>net.sf.jopt-simple</groupId>
87
	   <artifactId>jopt-simple</artifactId>
88
	   <version>3.2</version>
89
	</dependency>
90
	<dependency>
91
	   <groupId>c3p0</groupId>
92
	   <artifactId>c3p0</artifactId>
93
	   <version>0.9.1</version>
94
	</dependency>
95
	<!--  DATABASE DRIVER -->
96
	 <dependency>
97
       <groupId>mysql</groupId>
98
       <artifactId>mysql-connector-java</artifactId>
99
       <version>5.0.5</version>
100
     </dependency>
101
  </dependencies>
102
  
103
  
104
  <build>
105
    <plugins>
106
      <!-- INSTALL -->
107
       <plugin>
108
        <artifactId>maven-assembly-plugin</artifactId>
109
        <configuration>
110
          <appendAssemblyId>false</appendAssemblyId>
111
          <descriptors>
112
            <descriptor>src/main/assembly/assembly.xml</descriptor>
113
          </descriptors>
114
          <archive>
115
            <manifest>
116
                <mainClass>eu.etaxonomy.cdm.server.Bootloader</mainClass>
117
            </manifest>
118
          </archive>
119
        </configuration>
120
        <executions>
121
          <execution>
122
            <id>make-assembly</id>
123
            <phase>install</phase>
124
            <goals>
125
              <goal>attached</goal>
126
            </goals>
127
          </execution>
128
        </executions>
129
      </plugin>
130
      <!-- package the default webapp -->
131
      <plugin>
132
	      <groupId>org.apache.maven.plugins</groupId>
133
	      <artifactId>maven-war-plugin</artifactId>
134
	      <version>2.1-beta-1</version>
135
	      <configuration>
136
	          <warName>default-webapp</warName>
137
		      <overlays>
138
		          <overlay>
139
			           <groupId>eu.etaxonomy</groupId>
140
					   <artifactId>cdmlib-remote-webapp</artifactId>
141
					   <skip>true</skip><!-- Do Not overlay  --> 
142
			      </overlay>
143
		      </overlays>
144
	      </configuration>
145
	      <executions>
146
	          <execution>
147
	            <phase>package</phase>
148
		        <goals>
149
		          <goal>war</goal>
150
		        </goals>
151
	          </execution>
152
            </executions>
153
      </plugin>
154
      <!-- DEPLOY -->
155
      <plugin>
156
          <artifactId>maven-antrun-plugin</artifactId>
157
          <version>1.3</version>
158
            <executions>
159
              <execution>
160
                <phase>install</phase>
161
                 <!--
162
                  must run after winstone-maven-plugin
163
                -->
164
                <configuration>
165
                  <tasks>
166
                    <!--
167
                     ${project.patchversion} is explicitely set in this pom
168
                      
169
                     ${buildNumber} is set by the buildnumber-maven-plugin  
170
                     Cannot create the build number if you have local modifications, 
171
                     to allow creating a buildnumber anyway you can ommit                     
172
                    -->
173
                    <!-- FIXME
174
                    <property name="project.fullversionstring" value="${project.version}.${project.patchversion}.r${buildNumber}"/>
175
                    <property name="project.fullversionstring" value="${project.version}.0.r0000"/>
176
                     -->
177
                   <property name="project.fullversionstring" value="${project.version}.0.${maven.build.timestamp}"/>
178
                   <ant antfile="${project.basedir}/src/main/installer/linux/build-deb.xml" dir="${project.basedir}" />
179
                   
180
                   
181
                  </tasks>
182
                </configuration>
183
                <goals>
184
                  <goal>run</goal>
185
                </goals>
186
              </execution>
187
            </executions>
188
        </plugin>
189
     
190
    </plugins>
191
  </build>
192
</project>
src/main/assembly/assembly.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<assembly>
3
	<id>cdmserver-standalone</id>
4
	<formats>
5
		<format>jar</format>
6
	</formats>
7
	<includeBaseDirectory>false</includeBaseDirectory>
8
	<fileSets>
9
		<fileSet>
10
			<directory>target/classes</directory>
11
			<outputDirectory />
12
		</fileSet>
13
		<fileSet>
14
			<directory>${project.build.directory}</directory>
15
			<includes>
16
				<include>*.war</include>
17
			</includes>
18
			<outputDirectory />
19
		</fileSet>
20
		<fileSet>
21
			<includes>
22
				<include>${project.basedir}/LICENSE*</include>
23
			</includes>
24
			<outputDirectory />
25
		</fileSet>
26
	</fileSets>
27
	<dependencySets>
28
		<dependencySet>
29
			<unpack>true</unpack>
30
			<outputDirectory />
31
			<outputFileNameMapping />
32
		</dependencySet>
33
		<dependencySet>
34
			<outputDirectory />
35
			<outputFileNameMapping>cdmserver.war</outputFileNameMapping>
36
			<includes>
37
				<include>eu.etaxonomy:cdmlib-remote-webapp</include>
38
			</includes>
39
		</dependencySet>
40
	</dependencySets>
41
</assembly>
src/main/installer/linux/Makefile
1
install :
2
	cp ./cdmserver $(DESTDIR)/usr/bin/
3
	cp datasources.xml $(DESTDIR)/usr/bin/
4
	cp cdmserver-standalone.jar $(DESTDIR)/usr/bin/
5
	#cp cdmserver.properties $(DESTDIR)/usr/bin/
6
clean:
src/main/installer/linux/build-deb.xml
1
<project name="Java application deb packager" default="deb_package">
2

  
3
	<echo>basedir: ${basedir}</echo>
4
	<!-- UNUSED
5
  <tstamp>
6
    <format property="project.buildtimestamp" pattern="yyyyMMddkkmmss"/>
7
  </tstamp>
8
  -->
9
	
10
	<!-- Package Name & Version -->
11
	<property name="package.name" value="cdmserver" />
12
	<!-- ${project.fullversionstring} must be passed as parameter --> 
13
	<property name="version.cdmserver" value="${project.fullversionstring}" />
14
	<property name="version.debian" value="5" />
15
	<echo>upstream-version = version.cdmserver: ${version.cdmserver}</echo>
16
	<echo>debian-version = version.debian: ${version.debian}</echo>
17
	
18
	<!-- Various Filenames -->
19
	<property name="cdmserverscript.filename" value="cdmserver" />
20
	<property name="datasources.filename" value="datasources.xml" />
21
	<property name="cdmserver.filename" value="cdm-server-2.4.jar" />
22
  <property name="cdmserver.destinationfilename" value="cdm-server.jar" />
23

  
24
	<!-- Various Paths -->
25
	<property name="installer.path" value="src/main/installer" />
26
	<property name="cdmserver.target.path" value="target" />
27
	<property name="dest.path" value="usr/bin" />
28
	<property name="linux.installer.path" value="${installer.path}/linux" />
29
	<!-- location -->
30
	<property name="basedirToRemoteRoot" value="../../../.." />
31
	<!--
32
    <property name="initscript.path" location="${installer.path}/linux/initscript" />
33
	<property name="cdmlibremote.path" value="../../../.." />
34
	-->
35
	<property name="cdmserverscript.path" value="${installer.path}/templates" />
36
	<!-- location -->
37
	<property name="cdmserver.path" value="${installer.path}/templates" />
38
	<!-- location -->
39
	<property name="datasources.path" value="${installer.path}/templates/.cdmLibrary" />
40
	<!-- location -->
41
	<property name="postinst.path" value="${linux.installer.path}"/>
42
	<!-- location -->
43
	<property name="postrm.path" value="${linux.installer.path}"/>
44
	<!-- location -->
45
	<property name="ant-deb-task.path" value="${linux.installer.path}/../lib"/>
46
	<!-- location -->
47

  
48
	<!-- create distribution target -->
49
	<path id="ant-deb-task.classpath">
50
		<fileset dir="${basedir}/${ant-deb-task.path}" includes="*.jar" />
51
	</path>	
52
  <taskdef resource="ant_deb_task.properties" classpathref="ant-deb-task.classpath">
53
	</taskdef>
54

  
55
	<target name="deb_package" description="build the deb file">
56
		<mkdir dir="dist" />
57
		<deb todir="dist" package="${package.name}" 
58
			section="graphics" postinst="${postinst.path}/postinst" 
59
			postrm="${postinst.path}/postrm">
60
			<version upstream="${version.cdmserver}" debian="${version.debian}" />
61
			<maintainer name="BGBM Team" email="editsupport@bgbm.de" />
62
			<description synopsis="CDM Server: The CDM model for the EDIT Biodiversity Project">
63
CDM Server is a cross platform blablabla, visit www.bgbm.de for more info.
64
            </description>
65

  
66
			<tarfileset file="${linux.installer.path}/${cdmserverscript.filename}" prefix="${dest.path}" />
67
			<tarfileset file="${datasources.path}/${datasources.filename}" prefix="${dest.path}" />
68
			<tarfileset file="${cdmserver.target.path}/${cdmserver.filename}" fullpath="${dest.path}/${cdmserver.destinationfilename}" />
69

  
70
		</deb>
71
	</target>
72
	<!--
73
	 <target name="clean" description="remove all work folders">
74
	 	  <delete dir="dist"/>
75
	 </target>
76
	 -->
77
</project>
src/main/installer/linux/cdmserver
1
#! /bin/sh
2
### BEGIN INIT INFO
3
# Provides:          CDM Server
4
# Required-Start:    $local_fs $remote_fs
5
# Required-Stop:     $local_fs $remote_fs
6
# Default-Start:     2 3 4 5
7
# Default-Stop:      0 1 6
8
# Short-Description: Starts CDMServer daemon
9
# Description:       Starts CDMServer daemon which provides a RESTful webservice to access CDM Stores
10
### END INIT INFO
11

  
12
# install init script:		update-rc.d cdmserver defaults
13
# uninstall init script:	update-rc.d -f cdmserver remove
14

  
15
# Author: Andreas Kohlbecker
16

  
17
# Do NOT "set -e"
18

  
19
# PATH should only include /usr/* if it runs after the mountnfs.sh script
20
PATH=/usr/sbin:/usr/bin:/sbin:/bin
21
#CDM_HOME=/home/cdm
22
CDM_HOME=/opt/cdmserver
23
CDM_LIBRARY=$CDM_HOME".cdmLibrary"
24
DESC="CDM Server"
25
NAME=cdmserver
26
LOG="$CDM_HOME/$NAME.log"
27
DAEMON=/usr/bin/java
28
DAEMON_ARGS="-Xmx1024M -XX:PermSize=128m -XX:MaxPermSize=192m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Duser.home=$CDM_HOME -jar "$CDM_HOME/cdm-server.jar""
29
PIDFILE=/var/run/$NAME.pid
30
SCRIPTNAME=/etc/init.d/$NAME
31

  
32
# Exit if the package is not installed
33
[ -x "$DAEMON" ] || exit 0
34

  
35
# Read configuration variable file if it is present
36
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
37

  
38
# Load the VERBOSE setting and other rcS variables
39
[ -f /etc/default/rcS ] && . /etc/default/rcS
40

  
41
# Define LSB log_* functions.
42
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43
. /lib/lsb/init-functions
44

  
45

  
46
pid_of_cdmserver() {
47
    cat "$PIDFILE"
48
}
49

  
50
#
51
# Function that starts the daemon/service
52
#
53
do_start()
54
{
55
  #[ -e "$LOG" ] && cnt=`wc -l "$LOG" | awk '{ print $1 }'` || cnt=1
56
	# Return
57
	#   0 if daemon has been started
58
	#   1 if daemon was already running
59
	#   2 if daemon could not be started
60
	# log_daemon_msg "Starting $DESC" "$NAME with $DAEMON_ARGS"
61
	echo -ne "Starting $DESC" "$NAME with $DAEMON_ARGS"
62
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
63
		|| return 1
64
	start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --background --exec $DAEMON -- \
65
		$DAEMON_ARGS \
66
		|| return 2
67
	# Add code here, if necessary, that waits for the process to be ready
68
	# to handle requests from services started subsequently which depend
69
	# on this one.  As a last resort, sleep for some time.
70
        #while { pid_of_cdmserver > /dev/null ; } &&
71
        #        ! { tail +$cnt "$LOG" | grep -q 'Winstone Servlet Engine .* running' ; } ; do
72
        #      sleep 1
73
        #done
74

  
75
}
76

  
77
#
78
# Function that stops the daemon/service
79
#
80
do_stop()
81
{
82
	# Return
83
	#   0 if daemon has been stopped
84
	#   1 if daemon was already stopped
85
	#   2 if daemon could not be stopped
86
	#   other if a failure occurred
87
	log_daemon_msg "Stopping $DESC" "$NAME"
88
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
89
	RETVAL="$?"
90
	[ "$RETVAL" = 2 ] && return 2
91
	# Wait for children to finish too if this is a daemon that forks
92
	# and if the daemon is only ever run from this initscript.
93
	# If the above conditions are not satisfied then add some other code
94
	# that waits for the process to drop all resources that could be
95
	# needed by services started subsequently.  A last resort is to
96
	# sleep for some time.
97
	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
98
	[ "$?" = 2 ] && return 2
99
	# Many daemons don't delete their pidfiles when they exit.
100
	rm -f $PIDFILE
101
	return "$RETVAL"
102
}
103

  
104
#
105
# Function that sends a SIGHUP to the daemon/service
106
#
107
do_reload() {
108
	#
109
	# If the daemon can reload its configuration without
110
	# restarting (for example, when it is sent a SIGHUP),
111
	# then implement that here.
112
	#
113
	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
114
	return 0
115
}
116

  
117
case "$1" in
118
  start)
119
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
120
	do_start
121
	case "$?" in
122
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
123
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
124
	esac
125
	;;
126
  debug)
127
    DAEMON_ARGS=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 $DAEMON_ARGS"
128
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting in debug mode $DESC" "$NAME"
129
    do_start
130
    case "$?" in
131
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
132
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
133
    esac
134
    ;;
135
  stop)
136
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
137
	do_stop
138
	case "$?" in
139
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
140
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
141
	esac
142
	;;
143
  #reload|force-reload)
144
	#
145
	# If do_reload() is not implemented then leave this commented out
146
	# and leave 'force-reload' as an alias for 'restart'.
147
	#
148
	#log_daemon_msg "Reloading $DESC" "$NAME"
149
	#do_reload
150
	#log_end_msg $?
151
	#;;
152
  restart|force-reload)
153
	#
154
	# If the "reload" option is implemented then remove the
155
	# 'force-reload' alias
156
	#
157
	log_daemon_msg "Restarting $DESC" "$NAME"
158
	do_stop
159
	case "$?" in
160
	  0|1)
161
		do_start
162
		case "$?" in
163
			0) log_end_msg 0 ;;
164
			1) log_end_msg 1 ;; # Old process is still running
165
			*) log_end_msg 1 ;; # Failed to start
166
		esac
167
		;;
168
	  *)
169
	  	# Failed to stop
170
		log_end_msg 1
171
		;;
172
	esac
173
	;;
174
  *)
175
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
176
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|debug}" >&2
177
	exit 3
178
	;;
179
esac
180

  
181
:
src/main/installer/linux/copyright
1
This package was debianized by Francisco <editsupport@bgbm.org> on
2
Tue, 12 Jan 2010 11:19:53 +0100.
3

  
4
It was downloaded from <url://example.com>
5

  
6
Upstream Author(s):
7

  
8
    <put author's name and email here>
9
    <likewise for another author>
10

  
11
Copyright:
12

  
13
    <Copyright (C) 2010 EDIT>
14
    <likewise for another author>
15

  
16
License:
17

  
18
    	The contents of this file are subject to the Mozilla Public License
19
 	Version 1.1 (the "License"); you may not use this file except in
20
 	compliance with the License. You may obtain a copy of the License at
21
 	http://www.mozilla.org/MPL/
22
 	
23
 	Software distributed under the License is distributed on an "AS IS"
24
 	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
25
 	License for the specific language governing rights and limitations
26
 	under the License.
27

  
28
The Debian packaging is (C) 2010,<editsupport@bgbm.org> and
29
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
30

  
31
# Please also look if there are files or directories which have a
32
# different copyright/license attached and list them here.
src/main/installer/linux/postinst
1
#!/bin/sh
2
# postinst script for cdmserver
3
#
4
# see: dh_installdeb(1)
5

  
6
set -e
7

  
8
#
9
#variables
10
#
11
CDM_HOME="/opt/cdmserver/"
12
CDM_LIBRARY=$CDM_HOME".cdmLibrary"
13
CDM_LOG="/var/log/cdmserver/"
14
bindir="/etc/init.d/"
15
TMP="/usr/bin/"
16

  
17
SERVERSCRIPT="cdmserver"
18
SERVERJAR="cdm-server.jar"
19
SERVERCONF="datasources.xml"
20
PROPERTIES="cdmserver.properties"
21

  
22
CDM_USER=cdmuser
23
CDM_GROUP=cdmgroup
24
CDM_USER_HOME=/opt/cdmserver/
25
#CDM_USER_HOME=/root/cdmserver/
26

  
27
#
28
#functions
29
#
30
userExist(){
31
    grep $1 /etc/passwd > /dev/null
32
    [ $? -eq 0 ] && return $TRUE || return $FALSE
33
}
34

  
35
groupExist(){
36
    grep $1 /etc/group > /dev/null
37
    [ $? -eq 0 ] && return $TRUE || return $FALSE
38
}
39

  
40

  
41
# summary of how this script can be called:
42
#        * <postinst> `configure' <most-recently-configured-version>
43
#        * <old-postinst> `abort-upgrade' <new version>
44
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
45
#          <new-version>
46
#        * <postinst> `abort-remove'
47
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
48
#          <failed-install-package> <version> `removing'
49
#          <conflicting-package> <version>
50
# for details, see http://www.debian.org/doc/debian-policy/ or
51
# the debian-policy package
52

  
53
case "$1" in
54
    configure)
55

  
56
    #
57
    # adding the user
58
    # if the user already exist will be deleted
59
    #
60
    if ( userExist $CDM_USER )
61
    then
62
    echo USER ALREADY EXITS!!!!
63
    userdel $CDM_USER
64
    fi
65
   
66
    #
67
    # adding the group
68
    # if the group already exist will be deleted
69
    #
70
    if ( groupExist $CDM_GROUP  )
71
    then
72
        echo GROUP ALREADY EXISTS!!!!
73
        groupdel $CDM_GROUP
74
    fi
75
    groupadd $CDM_GROUP
76

  
77
    useradd -G cdmgroup -d $CDM_USER_HOME $CDM_USER
78

  
79
    #installing the script
80
    cp $TMP$SERVERSCRIPT $bindir
81
    chmod 755 $bindir$SERVERSCRIPT
82
    chown $CDM_USER:$CDM_GROUP $bindir$SERVERSCRIPT
83
    update-rc.d $SERVERSCRIPT defaults 98 02
84

  
85
    #creating the directories
86
    if [ ! -d $CDM_HOME ]; then
87
        mkdir -p $CDM_HOME
88
    fi
89
    if [ ! -d $CDM_LIBRARY ]; then
90
        mkdir -p $CDM_LIBRARY
91
    fi
92
    if [ ! -d $CDM_LOG ]; then
93
        mkdir -p $CDM_LOG
94
    fi
95

  
96
    #installing the server and the configfile
97
    cp $TMP$SERVERCONF $CDM_LIBRARY
98
    cp $TMP$SERVERJAR $CDM_HOME
99
    #cp $TMP$PROPERTIES $CDM_LIBRARY
100
    #mkdir -p /root/.cdmLibrary
101
    #cp $TMP$SERVERCONF /root/.cdmLibrary/
102
    cp $TMP$SERVERCONF $CDM_LIBRARY
103

  
104
    #starting the script
105
    $bindir$SERVERSCRIPT start
106

  
107

  
108
    ;;
109

  
110
    abort-upgrade|abort-remove|abort-deconfigure)
111
    ;;
112

  
113
    *)
114
        echo "postinst called with unknown argument \`$1'" >&2
115
        exit 1
116
    ;;
117
esac
118

  
119
# dh_installdeb will replace this with shell code automatically
120
# generated by other debhelper scripts.
121

  
122
#DEBHELPER#
123

  
124
exit 0
125

  
126

  
src/main/installer/linux/postrm
1
#!/bin/sh
2
# postrm script for cdmserver
3
#
4
# see: dh_installdeb(1)
5

  
6
set -e
7

  
8
#variables
9
CDM_HOME="/opt/cdmserver/"
10
CDM_LIBRARY=$CDM_HOME".cdmLibrary"
11
LOG="/var/log/cdmserver/"
12
bindir="/etc/init.d/"
13

  
14
SERVERSCRIPT="cdmserver"
15
SERVERJAR="cdm-server.jar"
16
SERVERCONF="datasources.xml"
17

  
18
CDM_USER="cdmuser"
19
CDM_GROUP="cdmgroup"
20

  
21
#
22
#functions
23
#
24
userExist(){
25
    grep $1 /etc/passwd > /dev/null
26
    [ $? -eq 0 ] && return $TRUE || return $FALSE
27
}
28

  
29
groupExist(){
30
    grep $1 /etc/group > /dev/null
31
    [ $? -eq 0 ] && return $TRUE || return $FALSE
32
}
33

  
34

  
35
# summary of how this script can be called:
36
#        * <postrm> `remove'
37
#        * <postrm> `purge'
38
#        * <old-postrm> `upgrade' <new-version>
39
#        * <new-postrm> `failed-upgrade' <old-version>
40
#        * <new-postrm> `abort-install'
41
#        * <new-postrm> `abort-install' <old-version>
42
#        * <new-postrm> `abort-upgrade' <old-version>
43
#        * <disappearer's-postrm> `disappear' <overwriter>
44
#          <overwriter-version>
45
# for details, see http://www.debian.org/doc/debian-policy/ or
46
# the debian-policy package
47

  
48
do_remove(){
49

  
50
    #stopping the server
51
    if [ -e $bindir$SERVERSCRIPT ]
52
    then
53
    $bindir$SERVERSCRIPT stop
54
    fi
55
    
56
   
57
    
58
    #removing the user and group
59
    if ( userExist $CDM_USER  )
60
    then
61
    userdel $CDM_USER
62
    fi
63

  
64
    if ( groupExist $CDM_GROUP  )
65
    then
66
    groupdel $CDM_GROUP
67
    fi
68
    
69
    # remove the binary
70
    rm $CDM_HOME$SERVERJAR
71
    
72
    return $TRUE
73
    
74
}
75

  
76
do_purge(){
77
    do_remove
78
    
79
    #removing the daemon script
80
    rm -f $bindir$SERVERSCRIPT
81
    update-rc.d -f $SERVERSCRIPT remove
82
    
83
    #removing the directories
84
    rm -rf $CDM_LIBRARY
85
    rm -rf $CDM_HOME
86

  
87
    return $TRUE
88
}
89

  
90
case "$1" in
91
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
92
        do_remove
93
    ;;
94
    purge)
95
        do_purge
96
    ;;
97
    *)
98
        echo "postrm called with unknown argument \`$1'" >&2
99
        exit 1
100
    ;;
101
esac
102

  
103
# dh_installdeb will replace this with shell code automatically
104
# generated by other debhelper scripts.
105

  
106
#DEBHELPER#
107

  
108
exit 0
109

  
110

  
src/main/installer/templates/.cdmLibrary/datasources.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:tx="http://www.springframework.org/schema/tx"
5
    xmlns:context="http://www.springframework.org/schema/context"
6
    xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
7
    http://www.springframework.org/schema/context   http://www.springframework.org/schema/context/spring-context-2.5.xsd
8
    http://www.springframework.org/schema/tx   http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
9
    ">
10
    
11
    <!-- ======================================================
12
       NOTICE: 
13
       
14
       For each bean defined herein the cdm server will create
15
       and start an internal cdm server instance.
16
        
17
       These id of the datasource beans are being used as name 
18
       and root path for the dem server instances
19
       
20
       ======================================================-->
21
       
22
     <!-- ======================================================
23
       !!! THIS IS A TEMPLATE !!!
24
       
25
       In order to use it you must edit the 'url', 'username', 'password'
26
       and also 'driverClass' if you are not using mySQL.
27
       ======================================================-->
28
 
29
    <!-- the default data sources can be mapped to a specific URL root folder   -->
30
    <bean id="myCDMServerInstance1"  lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
31
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
32
        <property name="user" value="edit"/>
33
        <property name="password" value="wp5"/>
34
        <property name="jdbcUrl" value="jdbc:mysql://192.168.1.100/myCDMdatabase_1"/>
35
    </bean>
36
    <!-- additional data sources mapped to other URL rot folders -->
37
    <!--  
38
        <bean id="myCDMServerInstance2"  lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
39
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
40
        <property name="user" value="user"/>
41
        <property name="password" value="123"/>
42
        <property name="jdbcUrl" value="jdbc:mysql://192.168.1.100/myCDMdatabase_2"/>
43
    </bean>
44
     <bean id="myCDMServerInstance3"  lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
45
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
46
        <property name="user" value="user"/>
47
        <property name="password" value="123"/>
48
        <property name="jdbcUrl" value="jdbc:mysql://192.168.1.100/myCDMdatabase_3"/>
49
    </bean>
50
    
51
    <bean id="palmae"  lazy-init="true" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
52
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
53
        <property name="username" value="edit"/>
54
        <property name="password" value="wp5"/>
55
        <property name="url" value="jdbc:mysql://160.45.63.201/cdm_edit_palmae_b"/>
56
    </bean>
57
    
58
    -->
59
</beans>
src/main/installer/templates/copyright.txt
1
This package was debianized by Francisco <editsupport@bgbm.org> on
2
Tue, 12 Jan 2010 11:19:53 +0100.
3

  
4
It was downloaded from <url://example.com>
5

  
6
Upstream Author(s):
7

  
8
    <put author's name and email here>
9
    <likewise for another author>
10

  
11
Copyright:
12

  
13
    <Copyright (C) 2010 EDIT>
14
    <likewise for another author>
15

  
16
License:
17

  
18
    	The contents of this file are subject to the Mozilla Public License
19
 	Version 1.1 (the "License"); you may not use this file except in
20
 	compliance with the License. You may obtain a copy of the License at
21
 	http://www.mozilla.org/MPL/
22
 	
23
 	Software distributed under the License is distributed on an "AS IS"
24
 	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
25
 	License for the specific language governing rights and limitations
26
 	under the License.
27

  
28
The Debian packaging is (C) 2010,<editsupport@bgbm.org> and
29
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
30

  
31
# Please also look if there are files or directories which have a
32
# different copyright/license attached and list them here.
src/main/installer/win32/Launch4JavaCDMSERVER.xml
1
<launch4jConfig>
2
  <dontWrapJar>false</dontWrapJar>
3
  <headerType>console</headerType>
4
  <jar>C:\Dokumente und Einstellungen\f.revilla\Eigene Dateien\dev\cdm-server\target\cdm-server-2.5.jar</jar>
5
  <outfile>cdmserver\bin\cdmserver.exe</outfile>
6
  <errTitle></errTitle>
7
  <cmdLine></cmdLine>
8
  <chdir></chdir>
9
  <priority>normal</priority>
10
  <downloadUrl>http://java.com/download</downloadUrl>
11
  <supportUrl></supportUrl>
12
  <customProcName>false</customProcName>
13
  <stayAlive>false</stayAlive>
14
  <manifest></manifest>
15
  <icon></icon>
16
  <jre>
17
    <path></path>
18
    <minVersion>1.5.0</minVersion>
19
    <maxVersion></maxVersion>
20
    <jdkPreference>preferJre</jdkPreference>
21
    <opt>-Xmx1024M -jar &quot;%CD%..\\libs\\cdm-server-2.5.jar&quot; --httpPort=8080 --ajp13Port=-1 --logfile=%CD%..\\logs\\cdmserverLog.txt</opt>
22
  </jre>
23
</launch4jConfig>
src/main/installer/win32/cdmserver.nsi
1
; Script generated by the HM NIS Edit Script Wizard.
2

  
3
;Copy a file
4
!define FileCopy `!insertmacro FileCopy`
5
!macro FileCopy FilePath TargetDir
6
  CreateDirectory `${TargetDir}`
7
  CopyFiles `${FilePath}` `${TargetDir}`
8
!macroend
9

  
10
; HM NIS Edit Wizard helper defines
11
!define PRODUCT_NAME "cdmserver"
12
!define PRODUCT_VERSION "1.0"
13
!define PRODUCT_PUBLISHER "EDIT"
14
!define PRODUCT_WEB_SITE "http://wp5.e-taxonomy.eu/"
15
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
16
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
17

  
18
!define COPYRIGHT_FILE "..\templates\copyright.txt"
19
!define DATASOURCES_FILE "..\templates\.cdmLibrary\datasources.xml"
20
!define JAR_FILE "..\..\..\..\target\cdm-server-2.5.jar"
21

  
22
!define JAR_FILE_NAME "cdm-server-2.5.jar"
23
!define COPYRIGHT_FILE_NAME "copyright.txt"
24

  
25
; MUI 1.67 compatible ------
26
!include "MUI.nsh"
27

  
28
; MUI Settings
29
!define MUI_ABORTWARNING
30
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
31
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
32

  
33
; Language Selection Dialog Settings
34
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
35
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
36
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
37

  
38
; Welcome page
39
!insertmacro MUI_PAGE_WELCOME
40
; License page
41
!insertmacro MUI_PAGE_LICENSE ${COPYRIGHT_FILE}
42
; Directory page
43
!insertmacro MUI_PAGE_DIRECTORY
44
; Instfiles page
45
!insertmacro MUI_PAGE_INSTFILES
46
; Finish page
47
!insertmacro MUI_PAGE_FINISH
48

  
49
; Uninstaller pages
50
!insertmacro MUI_UNPAGE_INSTFILES
51

  
52
; Language files
53
!insertmacro MUI_LANGUAGE "English"
54
!insertmacro MUI_LANGUAGE "French"
55
!insertmacro MUI_LANGUAGE "German"
56
!insertmacro MUI_LANGUAGE "Spanish"
57

  
58
; MUI end ------
59

  
60
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
61
OutFile "Setup.exe"
62
InstallDir "$PROGRAMFILES\cdmserver"
63
ShowInstDetails show
64
ShowUnInstDetails show
65

  
66
Function .onInit
67
  !insertmacro MUI_LANGDLL_DISPLAY
68
FunctionEnd
69

  
70
Section "MainSection" SEC01
71
  SetOutPath "$INSTDIR\bin"
72
  SetOverwrite try
73
  File "cdmserver\bin\cdmserver.bat"
74
  File "cdmserver\bin\cdmserver.exe"
75
  SetOutPath "$INSTDIR\libs\.cdmLibrary"
76
  ;File "cdmserver\libs\.cdmLibrary\datasources.xml"
77
  File ${DATASOURCES_FILE}
78
  SetOutPath "$INSTDIR\libs"
79
  ;File "cdmserver\libs\cdmserver-standalone.jar"
80
  File ${JAR_FILE}
81
  SetOutPath "$INSTDIR\license"
82
  ;File "cdmserver\license\license.txt"
83
  File ${COPYRIGHT_FILE}
84
  SetOutPath "$INSTDIR\logs"
85
  ;File "cdmserver\logs\cdmserverLog.txt"
86
  ${FileCopy} `$INSTDIR\libs\.cdmLibrary\datasources.xml` `$PROFILE\.cdmLibrary`
87
SectionEnd
88

  
89
Section -AdditionalIcons
90
  SetOutPath $INSTDIR
91
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
92
  CreateDirectory "$SMPROGRAMS\cdmserver"
93
  CreateShortCut "$SMPROGRAMS\cdmserver\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
94
  CreateShortCut "$SMPROGRAMS\cdmserver\Uninstall.lnk" "$INSTDIR\uninst.exe"
95
  CreateShortCut "$SMPROGRAMS\cdmserver\cdmserver.lnk" "$INSTDIR\bin\cdmserver.exe"
96
SectionEnd
97

  
98
Section -Post
99
  WriteUninstaller "$INSTDIR\uninst.exe"
100
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
101
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
102
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
103
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
104
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
105
SectionEnd
106

  
107

  
108
Function un.onUninstSuccess
109
  HideWindow
110
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
111
FunctionEnd
112

  
113
Function un.onInit
114
!insertmacro MUI_UNGETLANGUAGE
115
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
116
  Abort
117
FunctionEnd
118

  
119
Section Uninstall
120
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
121
  Delete "$INSTDIR\uninst.exe"
122
  ;Delete "$INSTDIR\logs\cdmserverLog.txt"
123
  Delete "$INSTDIR\license\${COPYRIGHT_FILE_NAME}"
124
  Delete "$INSTDIR\libs\${JAR_FILE_NAME}"
125
  Delete "$INSTDIR\libs\.cdmLibrary\datasources.xml"
126
  Delete "$INSTDIR\bin\cdmserver.bat"
127
  Delete "$INSTDIR\bin\cdmserver.exe"
128

  
129
  Delete "$SMPROGRAMS\cdmserver\Uninstall.lnk"
130
  Delete "$SMPROGRAMS\cdmserver\Website.lnk"
131
  Delete "$SMPROGRAMS\cdmserver\cdmserver.lnk"
132

  
133
  RMDir "$SMPROGRAMS\cdmserver"
134
  RMDir "$INSTDIR\logs"
135
  RMDir "$INSTDIR\license"
136
  RMDir "$INSTDIR\libs\.cdmLibrary"
137
  RMDir "$INSTDIR\libs"
138
  RMDir "$INSTDIR\bin"
139
  
140
  Delete "$PROFILE\.cdmLibrary\datasources.xml"
141
  RMDir "$PROFILE\.cdmLibrary"
142

  
143
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
144
  SetAutoClose true
145
SectionEnd
src/main/installer/win32/cdmserver/bin/cdmserver.bat
1
cd ..
2
set HOME=%cd%
3
java -Xmx1024M -jar "%HOME%\libs\cdm-server-2.5.jar"
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java
1
// $Id$
2
/**
3
 * Copyright (C) 2009 EDIT
4
 * European Distributed Institute of Taxonomy 
5
 * http://www.e-taxonomy.eu
6
 * 
7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8
 * See LICENSE.TXT at the top of this package for the full license terms.
9
 */
10

  
11
package eu.etaxonomy.cdm.server;
12

  
13
import static eu.etaxonomy.cdm.server.CommandOptions.DATASOURCES_FILE;
14
import static eu.etaxonomy.cdm.server.CommandOptions.HELP;
15
import static eu.etaxonomy.cdm.server.CommandOptions.HTTP_PORT;
16
import static eu.etaxonomy.cdm.server.CommandOptions.JMX;
17
import static eu.etaxonomy.cdm.server.CommandOptions.WEBAPP;
18

  
19
import java.io.File;
20
import java.io.FileNotFoundException;
21
import java.io.FileOutputStream;
22
import java.io.IOException;
23
import java.io.InputStream;
24
import java.io.OutputStream;
25
import java.lang.management.ManagementFactory;
26
import java.lang.reflect.InvocationTargetException;
27
import java.net.URL;
28
import java.sql.Connection;
29
import java.sql.SQLException;
30
import java.util.Set;
31

  
32
import javax.naming.NamingException;
33
import javax.sql.DataSource;
34

  
35
import org.apache.commons.cli.CommandLine;
36
import org.apache.commons.cli.CommandLineParser;
37
import org.apache.commons.cli.GnuParser;
38
import org.apache.commons.cli.HelpFormatter;
39
import org.apache.commons.cli.ParseException;
40
import org.apache.commons.io.FileUtils;
41
import org.apache.log4j.Logger;
42
import org.apache.log4j.PatternLayout;
43
import org.apache.log4j.RollingFileAppender;
44
import org.eclipse.jetty.jmx.MBeanContainer;
45
import org.eclipse.jetty.server.Server;
46
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
47
import org.eclipse.jetty.util.component.LifeCycle;
48
import org.eclipse.jetty.util.log.Log;
49
import org.eclipse.jetty.webapp.WebAppClassLoader;
50
import org.eclipse.jetty.webapp.WebAppContext;
51

  
52
import eu.etaxonomy.cdm.server.CdmInstanceProperties.Status;
53

  
54

  
55
/**
56
 * A bootstrap class for starting Jetty Runner using an embedded war.
57
 * 
58
 * Recommended start options for the java virtual machine: 
59
 * <pre>
60
 * -Xmx1024M
61
 * 
62
 * -XX:PermSize=128m 
63
 * -XX:MaxPermSize=192m
64
 * 
65
 * -XX:+UseConcMarkSweepGC 
66
 * -XX:+CMSClassUnloadingEnabled
67
 * -XX:+CMSPermGenSweepingEnabled
68
 * </pre>
69
 * 
70
 * @version $Revision$
71
 */
72
public final class Bootloader {
73
	//private static final String DEFAULT_WARFILE = "target/";
74

  
75
	private static final Logger logger = Logger.getLogger(Bootloader.class);
76
	
77
	private static final String DATASOURCE_BEANDEF_FILE = "datasources.xml";
78
	private static final String USERHOME_CDM_LIBRARY_PATH = System.getProperty("user.home")+File.separator+".cdmLibrary"+File.separator;
79
	private static final String TMP_PATH = USERHOME_CDM_LIBRARY_PATH + "server" + File.separator;
80
	private static final String LOG_PATH = USERHOME_CDM_LIBRARY_PATH + "log" + File.separator;
81
	
82
	private static final String APPLICATION_NAME = "CDM Server";
83
    private static final String WAR_POSTFIX = ".war";
84
    
85
    private static final String CDM_WEBAPP_WAR_NAME = "cdmserver";
86
    private static final String DEFAULT_WEBAPP_WAR_NAME = "default-webapp";
87
    private static final File DEFAULT_WEBAPP_TEMP_FOLDER = new File(TMP_PATH + DEFAULT_WEBAPP_WAR_NAME);
88
    private static final File CDM_WEBAPP_TEMP_FOLDER = new File(TMP_PATH + CDM_WEBAPP_WAR_NAME);
89
    
90
    private static final String ATTRIBUTE_JDBC_JNDI_NAME = "cdm.jdbcJndiName";
91
    private static final String CDM_LOGFILE = "cdm.logfile";
92
    
93
    // memory requirements
94
    private static final long MB = 1024 * 1024;
95
    private static final long PERM_GEN_SPACE_PER_INSTANCE = 64 * MB;
96
    private static final long HEAP_PER_INSTANCE = 300 * MB;
97
    
98
    private static final int KB = 1024;
99
    
100
    private Set<CdmInstanceProperties> configAndStatus = null;
101
    
102
    public Set<CdmInstanceProperties> getConfigAndStatus() {
103
		return configAndStatus;
104
	}
105

  
106
	private File webappFile = null;
107
    private File defaultWebAppFile = null;
108
    
109
    private Server server = null;
110
    private ContextHandlerCollection contexts = new ContextHandlerCollection();
111
    
112
    private CommandLine cmdLine;
113
    
114
    /* thread save singleton implementation */
115

  
116
	private static Bootloader instance = new Bootloader();
117

  
118
    private Bootloader() {}
119
    
120
    public synchronized static Bootloader getBootloader(){
121
    	return instance;
122
    }
123
    
124
    /* end of singleton implementation */
125
    
126
    private Set<CdmInstanceProperties> loadDataSources(){
127
    	if(configAndStatus == null){
128
    		File datasourcesFile = new File(USERHOME_CDM_LIBRARY_PATH, DATASOURCE_BEANDEF_FILE); 
129
    		configAndStatus = DataSourcePropertyParser.parseDataSourceConfigs(datasourcesFile);
130
        	logger.info("cdm server instance names loaded: "+ configAndStatus.toString());
131
    	}
132
    	return configAndStatus;
133
    }
134

  
135
    public int writeStreamTo(final InputStream input, final OutputStream output, int bufferSize) throws IOException {
136
        int available = Math.min(input.available(), 256 * KB);
137
        byte[] buffer = new byte[Math.max(bufferSize, available)];
138
        int answer = 0;
139
        int count = input.read(buffer);
140
        while (count >= 0) {
141
            output.write(buffer, 0, count);
142
            answer += count;
143
            count = input.read(buffer);
144
        }
145
        return answer;
146
    }
147

  
148
	private boolean bindJndiDataSource(CdmInstanceProperties conf) {
149
		try {
150
			Class<DataSource> dsCass = (Class<DataSource>) Thread.currentThread().getContextClassLoader().loadClass("com.mchange.v2.c3p0.ComboPooledDataSource");
151
			DataSource datasource = dsCass.newInstance();
152
			dsCass.getMethod("setDriverClass", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getDriverClass()});
153
			dsCass.getMethod("setJdbcUrl", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getUrl()});
154
			dsCass.getMethod("setUser", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getUsername()});
155
			dsCass.getMethod("setPassword", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getPassword()});
156
			
157
			Connection connection = null;
158
			String sqlerror = null;
159
			try {
160
				connection = datasource.getConnection();
161
				connection.close();
162
			} catch (SQLException e) {
163
				sqlerror = e.getMessage() + "["+ e.getSQLState() + "]";
164
				conf.getProblems().add(sqlerror);
165
				if(connection !=  null){
166
					try {connection.close();} catch (SQLException e1) { /* IGNORE */ }
167
				}
168
				logger.error(conf.toString() + " has problem : "+ sqlerror );
169
			}
170
			
171
			if(!conf.hasProblems()){
172
				logger.info("binding jndi datasource at " + conf.getJdbcJndiName() + " with "+conf.getUsername() +"@"+ conf.getUrl());
173
				org.eclipse.jetty.plus.jndi.Resource jdbcResource = new org.eclipse.jetty.plus.jndi.Resource(conf.getJdbcJndiName(), datasource);
174
				return true;				
175
			}
176
			
177
		} catch (IllegalArgumentException e) {
178
			logger.error(e);
179
			e.printStackTrace();
180
		} catch (SecurityException e) {
181
			logger.error(e);
182
		} catch (ClassNotFoundException e) {
183
			logger.error(e);
184
		} catch (InstantiationException e) {
185
			logger.error(e);
186
		} catch (IllegalAccessException e) {
187
			logger.error(e);
188
		} catch (InvocationTargetException e) {
189
			logger.error(e);
190
		} catch (NoSuchMethodException e) {
191
			logger.error(e);
192
		} catch (NamingException e) {
193
			logger.error(e);
194
		}
195
		return false;
196
	}
197
	
198
	private void parseCommandOptions(String[] args) throws ParseException {
199
		CommandLineParser parser = new GnuParser();
200
		cmdLine = parser.parse( CommandOptions.getOptions(), args );
201
		
202
		 // print the help message
203
		 if(cmdLine.hasOption(HELP.getOpt())){
204
			 HelpFormatter formatter = new HelpFormatter();
205
			 formatter.printHelp( "java .. ", CommandOptions.getOptions() );
206
			 System.exit(0);
207
		 }
208
	}
209

  
210

  
211
	private File extractWar(String warName) throws IOException, FileNotFoundException {
212
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
213
		String warFileName = warName + WAR_POSTFIX;
214
    	URL resource = classLoader.getResource(warFileName);
215
    	if (resource == null) {
216
    		logger.error("Could not find the " + warFileName + " on classpath!");
217
    		System.exit(1);
218
    	}
219
    	
220
    	File warFile = new File(TMP_PATH, warName + "-" + WAR_POSTFIX);
221
    	logger.info("Extracting " + warFileName + " to " + warFile + " ...");
222
    	
223
    	writeStreamTo(resource.openStream(), new FileOutputStream(warFile), 8 * KB);
224
    	
225
    	logger.info("Extracted " + warFileName);
226
		return warFile;
227
	}
228
    
229
    
230
	/**
231
	 * MAIN METHOD
232
	 * 
233
	 * @param args
234
	 * @throws Exception
235
	 */
236
	public static void main(String[] args) throws Exception {
237
	
238
		Bootloader bootloader = Bootloader.getBootloader();
239
    	
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff