mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
PluggableService: Refactor method to return map of key value pairs
- Makes plugins self contained so they decide their properties file format - PluggableService creates the contract that implementing entity will return a properties map which is apiname:rolemask (both are strings) Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
a56f355ceb
commit
c4e890c55d
@ -17,16 +17,16 @@
|
||||
package com.cloud.server;
|
||||
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ManagementServerSimulatorImpl extends ManagementServerExtImpl {
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
String[] apis = super.getPropertiesFiles();
|
||||
String[] newapis = new String[apis.length + 1];
|
||||
for (int i = 0; i < apis.length; i++) {
|
||||
newapis[i] = apis[i];
|
||||
}
|
||||
|
||||
newapis[apis.length] = "commands-simulator.properties";
|
||||
return newapis;
|
||||
public Map<String, String> getProperties() {
|
||||
Map<String, String> apiNameRoleMaskMapping = super.getProperties();
|
||||
apiNameRoleMaskMapping.putAll(PropertiesUtil.processConfigFile(new String[]
|
||||
{"commands-simulator.properties"}));
|
||||
return apiNameRoleMaskMapping;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
@ -24,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
|
||||
@ -237,7 +239,8 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "cisconexusvsm_commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "cisconexusvsm_commands.properties" });
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -24,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -260,8 +262,9 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "f5bigip_commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "f5bigip_commands.properties" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.network.element;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -24,6 +25,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -402,8 +404,9 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "junipersrx_commands.properties"};
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "junipersrx_commands.properties"});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -26,6 +26,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -464,8 +465,9 @@ StaticNatServiceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "netscalerloadbalancer_commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "netscalerloadbalancer_commands.properties" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -27,6 +27,7 @@ import java.util.UUID;
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -540,8 +541,9 @@ public class NiciraNvpElement extends AdapterBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "nicira-nvp_commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "nicira-nvp_commands.properties" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -24,6 +24,7 @@ import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -680,8 +681,9 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "virtualrouter_commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "virtualrouter_commands.properties" });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -29,6 +29,7 @@ import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import org.apache.cloudstack.api.response.UsageTypeResponse;
|
||||
import com.cloud.usage.UsageJobVO;
|
||||
import com.cloud.usage.UsageTypes;
|
||||
@ -206,8 +207,9 @@ public class ManagementServerExtImpl extends ManagementServerImpl implements Man
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "commands.properties", "commands-ext.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "commands.properties", "commands-ext.properties" });
|
||||
}
|
||||
|
||||
private Date computeAdjustedTime(Date initialDate, TimeZone targetTZ, boolean adjustToDayStart) {
|
||||
|
||||
@ -2297,8 +2297,9 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPropertiesFiles() {
|
||||
return new String[] { "commands.properties" };
|
||||
public Map<String, String> getProperties() {
|
||||
return PropertiesUtil.processConfigFile(new String[]
|
||||
{ "commands.properties" });
|
||||
}
|
||||
|
||||
protected class EventPurgeTask implements Runnable {
|
||||
|
||||
@ -16,9 +16,11 @@
|
||||
// under the License.
|
||||
package com.cloud.utils.component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
// This interface defines methods for pluggable code within the Cloud Stack.
|
||||
public interface PluggableService {
|
||||
// The config command properties filenames that lists allowed API commands
|
||||
// and role masks supported by this pluggable service
|
||||
String[] getPropertiesFiles();
|
||||
Map<String, String> getProperties();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user