001    package railo.runtime.spooler.remote;
002    
003    import railo.runtime.config.RemoteClient;
004    import railo.runtime.spooler.ExecutionPlan;
005    import railo.runtime.spooler.SpoolerTaskWS;
006    import railo.runtime.type.Collection;
007    import railo.runtime.type.KeyImpl;
008    import railo.runtime.type.Struct;
009    import railo.runtime.type.StructImpl;
010    import railo.runtime.type.util.KeyConstants;
011    
012    public class RemoteClientTask extends SpoolerTaskWS {
013            
014            public static final Collection.Key PASSWORD = KeyImpl.intern("password");
015            public static final Collection.Key ATTRIBUTE_COLLECTION = KeyImpl.intern("attributeCollection");
016            public static final Collection.Key CALLER_ID = KeyImpl.intern("callerId");
017            private StructImpl args;
018            private String action;
019            private String type;
020        
021            public RemoteClientTask(ExecutionPlan[] plans,RemoteClient client, Struct attrColl,String callerId, String type) {
022                    super(plans,client);
023                    this.type=type;
024                    action=(String) attrColl.get(KeyConstants._action,null);
025                    args = new StructImpl();
026                    args.setEL(KeyConstants._type, client.getType());
027                    args.setEL(PASSWORD, client.getAdminPasswordEncrypted());
028                    args.setEL(ATTRIBUTE_COLLECTION, attrColl);
029                    args.setEL(CALLER_ID, callerId);
030            }
031    
032            @Override
033            public String getType() {
034                    return type;
035            }
036    
037            @Override
038            public String subject() {
039                    return action+" ("+super.subject()+")";
040            }
041            @Override
042            public Struct detail() {
043                    Struct sct=super.detail();
044                    sct.setEL("action", action);
045                    return sct;
046            }
047            
048    
049            @Override
050            protected String getMethodName() {
051                    return "invoke";
052            }
053            
054            @Override
055            protected Struct getArguments() {
056                    return args;
057            }
058    }