Add undeploy rule
[remote/remote-ws.git] / Makefile
blob81ff5071122b0fc2fdf5a4d5ee32cbf7e2dd0005
1 ################################################################################
2 # Configuration section
3 ################################################################################
5 ## Location of the server class files
7 # The host and path specifying where the web service application
8 # infrastructure classes should be deployed. Note, that scp is used for
9 # this, so the DEPLOYLOCATION variable should hold a valid scp location.
11 DEPLOYHOST = remote-server
12 DEPLOYPATH = /opt/apache-tomcat-5.5.12/webapps/axis/WEB-INF/classes/
14 DEPLOYLOCATION = $(DEPLOYHOST):$(DEPLOYPATH)
16 ## Webservice address information
18 # Information about the location of the webservice.
20 SERVICEHOST = amigos30.diku.dk
21 SERVICEPORT = 8080
22 SERVICEPATH = axis/services
24 SERVICELOCATION = http://$(SERVICEHOST):$(SERVICEPORT)/$(SERVICEPATH)
26 ## Webservice admin service information
28 # Information about the location and credentials for accessing the
29 # webservice framework with the AdminClient. Test the information using
30 # the deploy-test rule.
32 # To use default values, set them to the empty string.
34 ADMINHOST = amigos30.diku.dk
35 ADMINPORT = 8080
36 ADMINUSER =
37 ADMINPASS =
39 ################################################################################
40 # Build section
41 ################################################################################
43 JAVAC = javac
44 JAVA = java
45 JAR = jar
46 SCP = scp
48 LIBDIR = lib
49 WSDDDIR = wsdd
50 BUILDDIR = build
51 SERVERSRCDIR = src
52 CLIENTSRCDIR = $(BUILDDIR)/src
53 SERVERBINDIR = $(BUILDDIR)/server
54 CLIENTBINDIR = $(BUILDDIR)/client
55 WSDLDIR = $(BUILDDIR)/wsdl
57 CLASSPATH = $(shell find $(PWD)/$(LIBDIR) -name "*.jar" | tr '\n' ':')$(PWD)/$(SERVERJAR)
59 COMPILE = $(JAVAC)
60 JAVA2WSDL = $(JAVA) org.apache.axis.wsdl.Java2WSDL
61 WSDL2JAVA = $(JAVA) org.apache.axis.wsdl.WSDL2Java
62 ADMINCLIENT = $(JAVA) org.apache.axis.client.AdminClient
64 SERVERSRC = $(shell find $(SERVERSRCDIR) -name "*.java")
65 SERVERJAR = $(LIBDIR)/remote-ws-server.jar
67 WSDDFILES = $(shell find $(WSDDDIR) -name "*.wsdd")
68 SERVICES = $(patsubst $(WSDDDIR)/%.wsdd,%,$(WSDDFILES))
70 WSDLFILES = $(patsubst %,$(WSDLDIR)/%.wsdl,$(SERVICES))
71 CLIENTSRC = $(patsubst %,$(CLIENTSRCDIR)/%-stamp,$(SERVICES))
72 CLIENTJAR = $(LIBDIR)/remote-ws-client.jar
74 export CLASSPATH
76 all: client
78 clean:
79 $(RM) -r $(BUILDDIR) $(SERVERJAR) $(CLIENTJAR)
81 ## Rules for building the server and client class files
83 # This requires the immediate step of building WSDL files from the
84 # server Java classes. The client Java classes is then generated from
85 # the WSDL files.
87 wsdl: $(WSDLFILES)
88 client-src: $(CLIENTSRC)
89 client: $(CLIENTJAR)
90 server: $(SERVERJAR)
92 $(SERVERJAR): $(SERVERSRC)
93 @$(RM) -r $(SERVERBINDIR)
94 @mkdir -p $(SERVERBINDIR)
95 $(COMPILE) -d $(SERVERBINDIR) $(SERVERSRC)
96 $(JAR) cf $@ -C $(SERVERBINDIR) .
98 $(CLIENTJAR): $(CLIENTSRC)
99 @$(RM) -r $(CLIENTBINDIR)
100 @mkdir -p $(CLIENTBINDIR)
101 $(COMPILE) -d $(CLIENTBINDIR) $(shell find $(CLIENTSRCDIR) -name "*.java")
102 $(JAR) cf $@ -C $(CLIENTBINDIR) .
104 $(CLIENTSRCDIR)/%-stamp: $(WSDLDIR)/%.wsdl
105 $(WSDL2JAVA) -o $(CLIENTSRCDIR) -pdiku.distlab.remote.$(*F) $<
106 touch $@
108 $(WSDLDIR)/%.wsdl: $(WSDDDIR)/%.wsdd $(SERVERJAR)
109 @mkdir -p $(WSDLDIR)
110 $(JAVA2WSDL) -l $(SERVICELOCATION)/$(*F) -o $(WSDLDIR)/$(*F).wsdl \
111 -p"$(*F)=$(*F).remote.distlab.diku" \
112 "$(*F).$$(sed -n 's/.*className.*value="[^.]*\.\(.*\)".*/\1/p' < $<)"
114 $(BUILDDIR)/undeploy.wsdd:
115 @mkdir -p $(CLIENTBINDIR)
116 { echo '<undeployment xmlns="http://xml.apache.org/axis/wsdd/">'; \
117 for i in $(SERVICES); do echo "<service name=\"$$i\"/>"; done; \
118 echo '</undeployment>'; } > $@
120 ## Deployment rules
122 # Rules for deploying the Re-Mote webservices and for testing the setup.
124 RUNADMINCLIENT = $(ADMINCLIENT) \
125 $(if $(ADMINHOST),-h $(ADMINHOST)) \
126 $(if $(ADMINPORT),-p $(ADMINPORT)) \
127 $(if $(ADMINUSER),-u $(ADMINUSER)) \
128 $(if $(ADMINPASS),-w $(ADMINPASS))
130 deploy-test:
131 $(RUNADMINCLIENT) list
133 deploy-wsdd: $(SERVERJAR)
134 $(RUNADMINCLIENT) $(WSDDFILES)
136 deploy-classes: $(SERVERJAR)
137 $(SCP) -r $(SERVERBINDIR)/* $(WSDDDIR) $(DEPLOYLOCATION)
139 deploy: deploy-classes deploy-wsdd
141 undeploy: $(BUILDDIR)/undeploy.wsdd
142 $(RUNADMINCLIENT) $<