NoopActionManager.java
01 /*
02  * Copyright 2008-2014 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.codehaus.griffon.runtime.core.controller;
17 
18 import griffon.core.artifact.GriffonController;
19 import griffon.core.controller.Action;
20 import griffon.core.controller.ActionInterceptor;
21 import griffon.core.controller.ActionManager;
22 
23 import javax.annotation.Nonnull;
24 import javax.annotation.Nullable;
25 import java.util.Collections;
26 import java.util.Map;
27 
28 import static griffon.util.GriffonNameUtils.requireNonBlank;
29 import static griffon.util.GriffonNameUtils.uncapitalize;
30 
31 /**
32  @author Andres Almiray
33  @since 2.0.0
34  */
35 public class NoopActionManager implements ActionManager {
36     @Nonnull
37     @Override
38     public Map<String, Action> actionsFor(@Nonnull GriffonController controller) {
39         return Collections.emptyMap();
40     }
41 
42     @Nullable
43     @Override
44     public Action actionFor(@Nonnull GriffonController controller, @Nonnull String actionName) {
45         return null;
46     }
47 
48     @Override
49     public void createActions(@Nonnull GriffonController controller) {
50 
51     }
52 
53     @Nonnull
54     @Override
55     public String normalizeName(@Nonnull String actionName) {
56         requireNonBlank(actionName, "Argument 'actionName' must not be blank");
57         if (actionName.endsWith(ACTION)) {
58             actionName = actionName.substring(0, actionName.length() - ACTION.length());
59         }
60         return uncapitalize(actionName);
61     }
62 
63     @Override
64     public void invokeAction(@Nonnull GriffonController controller, @Nonnull String actionName, Object... args) {
65 
66     }
67 
68     @Override
69     public void addActionInterceptor(@Nonnull ActionInterceptor actionInterceptor) {
70 
71     }
72 }