001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.spooler.remote; 020 021import lucee.runtime.config.RemoteClient; 022import lucee.runtime.spooler.ExecutionPlan; 023import lucee.runtime.spooler.SpoolerTaskWS; 024import lucee.runtime.type.Collection; 025import lucee.runtime.type.KeyImpl; 026import lucee.runtime.type.Struct; 027import lucee.runtime.type.StructImpl; 028import lucee.runtime.type.util.KeyConstants; 029 030public class RemoteClientTask extends SpoolerTaskWS { 031 032 public static final Collection.Key PASSWORD = KeyImpl.intern("password"); 033 public static final Collection.Key ATTRIBUTE_COLLECTION = KeyImpl.intern("attributeCollection"); 034 public static final Collection.Key CALLER_ID = KeyImpl.intern("callerId"); 035 private StructImpl args; 036 private String action; 037 private String type; 038 039 public RemoteClientTask(ExecutionPlan[] plans,RemoteClient client, Struct attrColl,String callerId, String type) { 040 super(plans,client); 041 this.type=type; 042 action=(String) attrColl.get(KeyConstants._action,null); 043 args = new StructImpl(); 044 args.setEL(KeyConstants._type, client.getType()); 045 args.setEL(PASSWORD, client.getAdminPasswordEncrypted()); 046 args.setEL(ATTRIBUTE_COLLECTION, attrColl); 047 args.setEL(CALLER_ID, callerId); 048 } 049 050 @Override 051 public String getType() { 052 return type; 053 } 054 055 @Override 056 public String subject() { 057 return action+" ("+super.subject()+")"; 058 } 059 @Override 060 public Struct detail() { 061 Struct sct=super.detail(); 062 sct.setEL("action", action); 063 return sct; 064 } 065 066 067 @Override 068 protected String getMethodName() { 069 return "invoke"; 070 } 071 072 @Override 073 protected Struct getArguments() { 074 return args; 075 } 076}