1 16 package org.jmanage.cmdui; 17 18 import org.jmanage.core.services.ServiceFactory; 19 import org.jmanage.core.services.ConfigurationService; 20 import org.jmanage.core.services.ServiceContext; 21 import org.jmanage.core.services.ServiceContextImpl; 22 import org.jmanage.core.auth.User; 23 import org.jmanage.core.data.ApplicationConfigData; 24 25 30 public class CommandInterface { 31 32 static{ 33 34 ServiceFactory.init(ServiceFactory.MODE_REMOTE); 35 } 36 37 public static void main(String [] args){ 38 ConfigurationService configService = 39 ServiceFactory.getConfigurationService(); 40 41 ApplicationConfigData configData = new ApplicationConfigData(); 42 configData.setHost("localhost"); 43 configData.setPort(new Integer (7001)); 44 configData.setName("testApp"); 45 configData.setType("weblogic"); 46 configData.setUsername("system"); 47 configData.setPassword("12345678"); 48 49 configData = configService.addApplication(getServiceContext(), 50 configData); 51 System.out.println("ApplicationId:" + configData.getApplicationId()); 52 System.out.println("Host:" + configData.getHost()); 53 System.out.println("Port:" + configData.getPort()); 54 System.out.println("Name:" + configData.getName()); 55 System.out.println("Type:" + configData.getType()); 56 System.out.println("Username:" + configData.getUsername()); 57 System.out.println("Password:" + configData.getPassword()); 58 } 59 60 private static ServiceContext getServiceContext(){ 61 ServiceContextImpl context = new ServiceContextImpl(); 62 User user = new User("admin", null, null, null, 0); 63 context.setUser(user); 64 return context; 65 } 66 } 67 | Popular Tags |