1 23 24 package org.apache.slide.projector.processor.access; 25 26 import java.util.Map ; 27 28 import org.apache.slide.projector.Context; 29 import org.apache.slide.projector.Processor; 30 import org.apache.slide.projector.Result; 31 import org.apache.slide.projector.Store; 32 import org.apache.slide.projector.descriptor.ParameterDescriptor; 33 import org.apache.slide.projector.descriptor.ResultDescriptor; 34 import org.apache.slide.projector.descriptor.StateDescriptor; 35 import org.apache.slide.projector.descriptor.StringValueDescriptor; 36 import org.apache.slide.projector.i18n.ParameterMessage; 37 import org.apache.slide.projector.util.StoreHelper; 38 import org.apache.slide.projector.value.StringValue; 39 40 44 public class Remove implements Processor { 45 public final static String STORE = "store"; 46 public final static String KEY = "key"; 47 48 private final static ParameterDescriptor[] parameterDescriptors = new ParameterDescriptor[] { 49 new ParameterDescriptor(STORE, new ParameterMessage("put/parameter/store"), new StringValueDescriptor(Store.stores), new StringValue(Store.stores[Store.REPOSITORY])), 50 new ParameterDescriptor(KEY, new ParameterMessage("put/parameter/key"), new StringValueDescriptor()), 51 }; 52 private final static ResultDescriptor resultDescriptor = new ResultDescriptor(new StateDescriptor[] { StateDescriptor.OK_DESCRIPTOR }); 53 54 public Result process(Map parameter, Context context) throws Exception { 55 String storeName = parameter.get(STORE).toString(); 56 String key = parameter.get(KEY).toString(); 57 Store store = context.getStore(StoreHelper.getStoreByName(storeName)); 58 store.dispose(key); 59 return Result.OK; 60 } 61 62 public ParameterDescriptor[] getParameterDescriptors() { 63 return parameterDescriptors; 64 } 65 66 public ResultDescriptor getResultDescriptor() { 67 return resultDescriptor; 68 } 69 } | Popular Tags |