NoopActionManager.java
001 /*
002  * SPDX-License-Identifier: Apache-2.0
003  *
004  * Copyright 2008-2017 the original author or authors.
005  *
006  * Licensed under the Apache License, Version 2.0 (the "License");
007  * you may not use this file except in compliance with the License.
008  * You may obtain a copy of the License at
009  *
010  *     http://www.apache.org/licenses/LICENSE-2.0
011  *
012  * Unless required by applicable law or agreed to in writing, software
013  * distributed under the License is distributed on an "AS IS" BASIS,
014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015  * See the License for the specific language governing permissions and
016  * limitations under the License.
017  */
018 package org.codehaus.griffon.runtime.core.controller;
019 
020 import griffon.core.artifact.GriffonController;
021 import griffon.core.controller.Action;
022 import griffon.core.controller.ActionHandler;
023 import griffon.core.controller.ActionInterceptor;
024 import griffon.core.controller.ActionManager;
025 
026 import javax.annotation.Nonnull;
027 import javax.annotation.Nullable;
028 import java.util.Collections;
029 import java.util.Map;
030 
031 import static griffon.util.GriffonNameUtils.requireNonBlank;
032 import static griffon.util.GriffonNameUtils.uncapitalize;
033 
034 /**
035  @author Andres Almiray
036  @since 2.0.0
037  */
038 public class NoopActionManager implements ActionManager {
039     @Nonnull
040     @Override
041     public Map<String, Action> actionsFor(@Nonnull GriffonController controller) {
042         return Collections.emptyMap();
043     }
044 
045     @Nullable
046     @Override
047     public Action actionFor(@Nonnull GriffonController controller, @Nonnull String actionName) {
048         return null;
049     }
050 
051     @Override
052     public void createActions(@Nonnull GriffonController controller) {
053 
054     }
055 
056     @Nonnull
057     @Override
058     public String normalizeName(@Nonnull String actionName) {
059         requireNonBlank(actionName, "Argument 'actionName' must not be blank");
060         if (actionName.endsWith(ACTION)) {
061             actionName = actionName.substring(0, actionName.length() - ACTION.length());
062         }
063         return uncapitalize(actionName);
064     }
065 
066     @Override
067     public void updateActions() {
068 
069     }
070 
071     @Override
072     public void updateActions(@Nonnull GriffonController controller) {
073 
074     }
075 
076     @Override
077     public void updateAction(@Nonnull Action action) {
078 
079     }
080 
081     @Override
082     public void updateAction(@Nonnull GriffonController controller, @Nonnull String actionName) {
083 
084     }
085 
086     @Override
087     public void invokeAction(@Nonnull GriffonController controller, @Nonnull String actionName, Object... args) {
088 
089     }
090 
091     @Override
092     public void invokeAction(@Nonnull Action action, @Nonnull Object... args) {
093 
094     }
095 
096     @Override
097     public void addActionHandler(@Nonnull ActionHandler actionHandler) {
098 
099     }
100 
101     @Deprecated
102     @Override
103     public void addActionInterceptor(@Nonnull ActionInterceptor actionInterceptor) {
104 
105     }
106 }