1 23 24 package com.sun.enterprise.deployapi.actions; 25 26 import java.io.*; 27 28 import javax.enterprise.deploy.spi.exceptions.ClientExecuteException ; 29 import javax.enterprise.deploy.spi.status.ClientConfiguration ; 30 import javax.enterprise.deploy.spi.TargetModuleID ; 31 32 import com.sun.enterprise.deployapi.SunTarget; 33 import com.sun.enterprise.deployapi.SunTargetModuleID; 34 import com.sun.enterprise.util.LocalStringManagerImpl; 35 36 37 43 public class ClientConfigurationImpl implements ClientConfiguration { 44 45 SunTargetModuleID targetModuleID; 46 String originalArchivePath; 47 48 private static LocalStringManagerImpl localStrings = 49 new LocalStringManagerImpl(ClientConfigurationImpl.class); 50 51 52 public ClientConfigurationImpl(SunTargetModuleID targetModuleID) { 53 this.targetModuleID = targetModuleID; 54 } 55 56 62 public void execute() throws ClientExecuteException { 63 if (targetModuleID==null) { 64 throw new ClientExecuteException (localStrings.getLocalString( 65 "enterprise.deployapi.actions.clientconfigurationimpl.nomoduleid", 66 "No moduleID for deployed application found")); 67 } 68 SunTarget target = (SunTarget) targetModuleID.getTarget(); 69 String moduleID; 70 if (targetModuleID.getParentTargetModuleID()!=null) { 71 moduleID = targetModuleID.getParentTargetModuleID().getModuleID(); 72 } else { 73 moduleID = targetModuleID.getModuleID(); 74 } 75 76 77 try { 78 String location = target.exportClientStubs(moduleID, 0, System.getProperty("java.io.tmpdir")); 80 81 String id = targetModuleID.getModuleID(); 83 if (id.indexOf('#')!=-1) { 84 id = id.substring(id.indexOf('#')+1); 85 } 86 87 String j2eeHome = System.getProperty("com.sun.aas.installRoot"); 89 String appClientBinary = j2eeHome + File.separatorChar + "bin" + File.separatorChar + "appclient"; 90 String command = appClientBinary + " -client " + location; 91 92 Process p = Runtime.getRuntime().exec(command); 93 InputStream is = p.getInputStream(); 94 95 } catch(Exception e) { 96 e.printStackTrace(); 97 throw new ClientExecuteException (localStrings.getLocalString( 98 "enterprise.deployapi.actions.clientconfigurationimpl.exception", 99 "Exception while invoking application client : \n {0}", new Object [] { e.getMessage() })); 100 } 101 } 102 } 103 | Popular Tags |