KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > actions > ejb > UnDeployEjbActionDelegate


1 package com.bull.eclipse.jonas.actions.ejb;
2
3 /*
4  * (c) Copyright Bull SA 2003.
5  * All Rights Reserved.
6  */

7
8 import java.io.File JavaDoc;
9 import java.util.Vector JavaDoc;
10
11 import org.eclipse.jdt.core.IPackageFragment;
12
13 import com.bull.eclipse.jonas.JonasLauncherPlugin;
14 import com.bull.eclipse.jonas.JonasProject;
15 import com.bull.eclipse.jonas.actions.JonasPackageAbstractActionDelegate;
16
17 public class UnDeployEjbActionDelegate extends JonasPackageAbstractActionDelegate {
18
19     public boolean doActionOn(IPackageFragment pack) throws Exception JavaDoc {
20         String JavaDoc packName = pack.getPath().removeFirstSegments(2).toOSString();
21         JonasLauncherPlugin.log("PackName = " + packName);
22         String JavaDoc jarName = null;
23         JonasProject prj = JonasProject.create(pack.getJavaProject());
24         Vector JavaDoc vec = prj.getPackageProjectFolder();
25         if (vec != null)
26             for (int i = 0; i < vec.size(); i++) {
27                 JonasLauncherPlugin.log("Element = " + vec.elementAt(i));
28                 if (vec.elementAt(i).toString().equals(packName)) {
29                     JonasLauncherPlugin.log("Element = " + vec.elementAt(i));
30                     jarName = prj.getJarEjbName().elementAt(i).toString();
31                     continue;
32                 }
33             }
34         if (jarName == null) {
35             jarName = packName.replace(File.separatorChar,'_');
36         }
37         
38 // if (jarName == null)
39
// throw new Exception("The EJB does not exist");
40

41         JonasLauncherPlugin.log("ejbFile = " + jarName + ".jar");
42         String JavaDoc[] options = {"-r", jarName + ".jar"};
43         JonasLauncherPlugin.getDefault().getJonasBootstrap().admin(options);
44         
45         return false;
46     }
47
48 }
49
50
Popular Tags