1 19 20 package com.sslexplorer.applications; 21 22 import java.util.Iterator ; 23 import java.util.Map ; 24 25 import com.sslexplorer.core.CoreAttributeConstants; 26 import com.sslexplorer.extensions.ApplicationParameterDefinition; 27 import com.sslexplorer.extensions.ExtensionDescriptor; 28 import com.sslexplorer.extensions.store.ExtensionStore; 29 import com.sslexplorer.policyframework.ResourceChangeEvent; 30 import com.sslexplorer.security.SessionInfo; 31 32 33 39 public class ApplicationShortcutChangeEvent extends ResourceChangeEvent { 40 41 49 public ApplicationShortcutChangeEvent(Object source, int id, SessionInfo session, Throwable exception) { 50 super(source, id, session, exception); 51 } 52 53 62 public ApplicationShortcutChangeEvent(Object source, int id, ApplicationShortcut shortcut, SessionInfo session, int state) { 63 super(source, id, shortcut, session, state); 64 if(shortcut != null) { 65 addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, shortcut.getApplication()); 66 try { 67 ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication()); 68 if(des != null) { 69 addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, des.getName()); 70 for (Iterator i = des.getParametersAndDefaults().entrySet().iterator(); i.hasNext();) { 71 Map.Entry entry = (Map.Entry ) i.next(); 72 String val = (String )shortcut.getParameters().get(entry.getKey()); 73 ApplicationParameterDefinition def = (ApplicationParameterDefinition) entry.getValue(); 74 addAttribute(def.getName(), def.getType() == ApplicationParameterDefinition.TYPE_PASSWORD ? "******" : ( val == null ? "" : val ) ); 75 } 76 } 77 } 78 catch(Exception e) { 79 } 80 } 81 } 82 83 89 public ApplicationShortcut getClientConfiguration() { 90 return ((ApplicationShortcut)getResource()); 91 } 92 93 } 94 | Popular Tags |