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