From riftsaw-commits at lists.jboss.org Wed Dec 1 09:14:37 2010 Content-Type: multipart/mixed; boundary="===============2796800342116039053==" MIME-Version: 1.0 From: riftsaw-commits at lists.jboss.org To: riftsaw-commits at lists.jboss.org Subject: [riftsaw-commits] riftsaw SVN: r1174 - in dsp/trunk/samples/deployer/src/main: webapp and 1 other directories. Date: Wed, 01 Dec 2010 09:14:37 -0500 Message-ID: <201012011414.oB1EEbhv013039@svn01.web.mwc.hst.phx2.redhat.com> --===============2796800342116039053== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: objectiser Date: 2010-12-01 09:14:35 -0500 (Wed, 01 Dec 2010) New Revision: 1174 Added: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPEx= ampleForm.java dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Deplo= yStore.java dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Undep= loyServlet.java dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Welco= meServlet.java Removed: dsp/trunk/samples/deployer/src/main/webapp/upload.html Modified: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Deplo= yServlet.java dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/web.xml Log: Add undeploy support. Added: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/D= SPExampleForm.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPE= xampleForm.java (rev 0) +++ dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/DSPE= xampleForm.java 2010-12-01 14:14:35 UTC (rev 1174) @@ -0,0 +1,59 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, Red Hat Middleware LLC, and others contributors as indi= cated + * by the @authors tag. All rights reserved. + * See the copyright.txt in the distribution for a + * full listing of individual contributors. + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License, v. 2.1. + * This program is distributed in the hope that it will be useful, but WIT= HOUT A + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE= SS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more= details. + * You should have received a copy of the GNU Lesser General Public Licens= e, + * v.2.1 along with this distribution; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ +package org.jboss.soa.dsp.example; + +import java.io.IOException; +import java.io.PrintWriter; + +public class DSPExampleForm { + + public static void buildForm(PrintWriter out) throws IOException { + = + out.println("

Deploy Web Service

"); + out.println("
"); + out.println("\t
"); + out.println("\t
"); + out.println("
"); + = + java.util.Set keys=3DDeployStore.keys(); + = + if (keys.size() > 0) { + = + out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
"); + out.println("

Undeploy Web Service

"); + = + out.println("
"); + out.println(""); + out.println(""); + = + out.println(""); + out.println(""); + } + = + out.println(""); + = + out.println(""); + out.println(""); + out.println("
"); + out.println("
"); + } + } +} Modified: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/exampl= e/DeployServlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Depl= oyServlet.java 2010-12-01 10:08:22 UTC (rev 1173) +++ dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Depl= oyServlet.java 2010-12-01 14:14:35 UTC (rev 1174) @@ -62,7 +62,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse res= ponse) throws ServletException, IOException { PrintWriter out =3D response.getWriter(); response.setContentType("text/html"); - out.println("

Dynamic Service Provider Example - Deployer

"); + out.println("

Dynamic Service Provider Example

"); out.println(); = DiskFileItemFactory fileItemFactory =3D new DiskFileItemFactory (); @@ -110,10 +110,13 @@ // Invoke dynamic service deployment mechanism WSDeployer deployer=3Dnew WSDeployer(); = - deployer.deploy(file, wsdlFile); - = + DeployStore.add(deployer.deploy(file, wsdlFile)); } + = + // Display undeployment options + DSPExampleForm.buildForm(out); } + = out.close(); } }catch(FileUploadException ex) { @@ -123,7 +126,7 @@ } = } - = + = protected java.io.File unzip(PrintWriter out, ZipInputStream zis, String = path) throws IOException { ZipEntry ze=3Dnull; java.io.File wsdlFile=3Dnull; @@ -145,7 +148,7 @@ } } = - out.println("Closing zip.
"); + out.println("Zip unpacked.

"); zis.close(); = return(wsdlFile); Added: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/D= eployStore.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Depl= oyStore.java (rev 0) +++ dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Depl= oyStore.java 2010-12-01 14:14:35 UTC (rev 1174) @@ -0,0 +1,42 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, Red Hat Middleware LLC, and others contributors as indi= cated + * by the @authors tag. All rights reserved. + * See the copyright.txt in the distribution for a + * full listing of individual contributors. + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License, v. 2.1. + * This program is distributed in the hope that it will be useful, but WIT= HOUT A + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE= SS FOR A + * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more= details. + * You should have received a copy of the GNU Lesser General Public Licens= e, + * v.2.1 along with this distribution; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ +package org.jboss.soa.dsp.example; + +import org.jboss.soa.dsp.ServiceEndpointReference; + +public class DeployStore { + + private static java.util.Map m_serviceEn= dpointRefs=3D + new java.util.HashMap(); + = + public static void add(ServiceEndpointReference ser) { + m_serviceEndpointRefs.put(ser.getDeploymentName(), ser); + } + = + public static void remove(ServiceEndpointReference ser) { + m_serviceEndpointRefs.remove(ser.getDeploymentName()); + } + = + public static java.util.Set keys() { + return(m_serviceEndpointRefs.keySet()); + } + = + public static ServiceEndpointReference get(String key) { + return(m_serviceEndpointRefs.get(key)); + } +} Added: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/U= ndeployServlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Unde= ployServlet.java (rev 0) +++ dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Unde= ployServlet.java 2010-12-01 14:14:35 UTC (rev 1174) @@ -0,0 +1,62 @@ +/* + * Copyright 2010 Red Hat, Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.jboss.soa.dsp.example; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.jboss.soa.dsp.ServiceEndpointReference; + = +public class UndeployServlet extends HttpServlet { + private static final long serialVersionUID =3D 1L; + + protected void doPost(HttpServletRequest request, HttpServletResponse res= ponse) throws ServletException, IOException { + PrintWriter out =3D response.getWriter(); + response.setContentType("text/html"); + out.println("

Dynamic Service Provider Example

"); + out.println(); + = + ServiceEndpointReference ser=3DDeployStore.get((String)request.getPar= ameter("seref")); + = + if (ser =3D=3D null) { + out.println("ERROR: Unable to find service endpoint reference with k= ey '"+ + request.getAttribute("seref")+"'
"); + } else { + WSDeployer deployer=3Dnew WSDeployer(); + = + try { + deployer.undeploy(ser); + = + DeployStore.remove(ser); + + } catch(Exception e) { + out.println("ERROR: Unable to undeploy service endpoint reference w= ith key '"+ + request.getAttribute("seref")+"'
"); + e.printStackTrace(); + } + } + = + DSPExampleForm.buildForm(out); + = + out.close(); + } +} \ No newline at end of file Added: dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/W= elcomeServlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Welc= omeServlet.java (rev 0) +++ dsp/trunk/samples/deployer/src/main/java/org/jboss/soa/dsp/example/Welc= omeServlet.java 2010-12-01 14:14:35 UTC (rev 1174) @@ -0,0 +1,40 @@ +/* + * Copyright 2010 Red Hat, Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.jboss.soa.dsp.example; + +import java.io.IOException; +import java.io.PrintWriter; + = +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + = +public class WelcomeServlet extends HttpServlet { + private static final long serialVersionUID =3D 1L; + + protected void doGet(HttpServletRequest request, HttpServletResponse resp= onse) throws ServletException, IOException { + PrintWriter out =3D response.getWriter(); + response.setContentType("text/html"); + out.println("

Dynamic Service Provider Example

"); + out.println(); + = + DSPExampleForm.buildForm(out); + = + out.close(); + } +} \ No newline at end of file Modified: dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/web.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/web.xml 2010-12-01 1= 0:08:22 UTC (rev 1173) +++ dsp/trunk/samples/deployer/src/main/webapp/WEB-INF/web.xml 2010-12-01 1= 4:14:35 UTC (rev 1174) @@ -2,16 +2,36 @@ DSPExample - /upload.html + WelcomeServlet + WelcomeServlet + WelcomeServlet + org.jboss.soa.dsp.example.WelcomeServlet + + + DeployServlet DeployServlet org.jboss.soa.dsp.example.DeployServlet + + + UndeployServlet + UndeployServlet + org.jboss.soa.dsp.example.UndeployServlet + + WelcomeServlet + /WelcomeServlet + + DeployServlet /DeployServlet + + UndeployServlet + /UndeployServlet + \ No newline at end of file Deleted: dsp/trunk/samples/deployer/src/main/webapp/upload.html =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- dsp/trunk/samples/deployer/src/main/webapp/upload.html 2010-12-01 10:08= :22 UTC (rev 1173) +++ dsp/trunk/samples/deployer/src/main/webapp/upload.html 2010-12-01 14:14= :35 UTC (rev 1174) @@ -1,10 +0,0 @@ - - - -

Commons File Upload Example

-
-
-
-
- - \ No newline at end of file --===============2796800342116039053==--