ConfigHelper is replace by a facade pattern

This commit is contained in:
Hugo Trippaers 2014-11-03 09:39:23 +01:00 committed by wilderrodrigues
parent 4cfe2a32c0
commit 0a95c44c51
2 changed files with 9 additions and 40 deletions

View File

@ -1,39 +0,0 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
package com.cloud.agent.resource.virtualnetwork;
import java.util.List;
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.resource.virtualnetwork.facade.AbstractConfigItemFacade;
public class ConfigHelper {
public static List<ConfigItem> generateCommandCfg(final NetworkElementCommand cmd) {
/*
* [TODO] Still have to migrate LoadBalancerConfigCommand and BumpUpPriorityCommand
* [FIXME] Have a look at SetSourceNatConfigItem
*/
final AbstractConfigItemFacade configItemFacade = AbstractConfigItemFacade.getInstance(cmd.getClass());
return configItemFacade.generateConfig(cmd);
}
}

View File

@ -49,6 +49,7 @@ import com.cloud.agent.api.routing.AggregationControlCommand.Action;
import com.cloud.agent.api.routing.GetRouterAlertsCommand;
import com.cloud.agent.api.routing.GroupAnswer;
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.resource.virtualnetwork.facade.AbstractConfigItemFacade;
import com.cloud.utils.ExecutionResult;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.exception.CloudRuntimeException;
@ -325,7 +326,14 @@ public class VirtualRoutingResource {
}
private List<ConfigItem> generateCommandCfg(NetworkElementCommand cmd) {
return ConfigHelper.generateCommandCfg(cmd);
/*
* [TODO] Still have to migrate LoadBalancerConfigCommand and BumpUpPriorityCommand
* [FIXME] Have a look at SetSourceNatConfigItem
*/
final AbstractConfigItemFacade configItemFacade = AbstractConfigItemFacade.getInstance(cmd.getClass());
return configItemFacade.generateConfig(cmd);
}
private Answer execute(AggregationControlCommand cmd) {