KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > projector > processor > access > Remove


1 /*
2  * $Header: /home/cvs/jakarta-slide/projector/src/java/org/apache/slide/projector/processor/access/Remove.java,v 1.3 2004/07/28 09:48:17 ib Exp $
3  * $Revision: 1.3 $
4  * $Date: 2004/07/28 09:48:17 $
5  *
6  * ====================================================================
7  *
8  * Copyright 2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.projector.processor.access;
25
26 import java.util.Map JavaDoc;
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 /**
41  * The Event class
42  *
43  */

44 public class Remove implements Processor {
45     public final static String JavaDoc STORE = "store";
46     public final static String JavaDoc 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 JavaDoc parameter, Context context) throws Exception JavaDoc {
55         String JavaDoc storeName = parameter.get(STORE).toString();
56         String JavaDoc 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