1 package com.bull.eclipse.jonas.actions.ejb; 2 3 7 8 import java.io.File ; 9 import java.util.Vector ; 10 11 import org.eclipse.core.runtime.CoreException; 12 import org.eclipse.jdt.core.IPackageFragment; 13 14 import com.bull.eclipse.jonas.JonasLauncherPlugin; 15 import com.bull.eclipse.jonas.JonasProject; 16 import com.bull.eclipse.jonas.actions.JonasPackageAbstractActionDelegate; 17 18 public class DeployEjbActionDelegate extends JonasPackageAbstractActionDelegate { 19 20 public boolean doActionOn(IPackageFragment pack) throws Exception { 21 String packName = pack.getPath().removeFirstSegments(2).toOSString(); 22 JonasLauncherPlugin.log("PackName = " + packName); 23 String jarName = null; 24 JonasProject prj = JonasProject.create(pack.getJavaProject()); 25 Vector vec = prj.getPackageProjectFolder(); 26 if (vec != null) 27 for (int i = 0; i < vec.size(); i++) { 28 JonasLauncherPlugin.log("Element = " + vec.elementAt(i)); 29 if (vec.elementAt(i).toString().equals(packName)) { 30 JonasLauncherPlugin.log("Element = " + vec.elementAt(i)); 31 jarName = prj.getJarEjbName().elementAt(i).toString(); 32 continue; 33 } 34 } 35 if (jarName == null) { 36 jarName = packName.replace(File.separatorChar,'_'); 37 } 38 40 deploy(jarName + ".jar"); 41 return false; 42 } 43 44 static public void deploy(String jarName) throws CoreException { 45 JonasLauncherPlugin.log("ejbFile = " + jarName); 46 String [] options = {"-a",jarName}; 47 JonasLauncherPlugin.getDefault().getJonasBootstrap().admin(options); 48 } 49 50 } 51 52 | Popular Tags |