1 13 14 package org.ejbca.ui.cli; 15 16 import javax.naming.InitialContext ; 17 18 import org.ejbca.core.ejb.ra.raadmin.IRaAdminSessionHome; 19 import org.ejbca.core.ejb.ra.raadmin.IRaAdminSessionRemote; 20 import org.ejbca.core.model.log.Admin; 21 22 27 public class SetupSetBaseURLCommand extends BaseAdminCommand { 28 33 public SetupSetBaseURLCommand(String [] args) { 34 super(args, Admin.TYPE_CACOMMANDLINE_USER, "cli"); 35 } 36 37 43 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 44 if (args.length < 3) { 45 throw new IllegalAdminCommandException("Usage: SETUP setdefaultbaseurl <computername> <applicationname>\n" + 46 "Example: setup setbaseurl localhost ejbca \n\n"); 47 } 48 try { 49 InitialContext jndicontext = getInitialContext(); 51 52 String computername = args[1]; 53 String applicationpath = args[2]; 54 IRaAdminSessionHome raadminsessionhome = (IRaAdminSessionHome) javax.rmi.PortableRemoteObject.narrow(jndicontext.lookup("RaAdminSession"), 55 IRaAdminSessionHome.class); 56 57 IRaAdminSessionRemote raadminsession = raadminsessionhome.create(); 58 59 raadminsession.initGlobalConfigurationBaseURL(new Admin(Admin.TYPE_CACOMMANDLINE_USER), computername, applicationpath); 60 61 62 } catch (Exception e) { 63 throw new ErrorAdminCommandException(e); 64 } 65 } 66 67 } 69 | Popular Tags |