mirror of https://github.com/apache/cloudstack.git
cloudian: refactor public api
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
02907dac6d
commit
23b2b34670
|
|
@ -62,14 +62,17 @@ public interface CloudianConnector extends PluggableService {
|
|||
ConfigKey<String> CloudianSsoKey = new ConfigKey<>("Advanced", String.class, "cloudian.sso.key", "ss0sh5r3dk3y",
|
||||
"The shared single sign-on key as configured in Cloudian CMC.", true);
|
||||
|
||||
String getAdminUrl();
|
||||
/**
|
||||
* Returns the base Cloudian Management Console URL
|
||||
* @return returns the url string
|
||||
*/
|
||||
String getCmcUrl();
|
||||
|
||||
/**
|
||||
* Checks if the Cloudian Connector is disabled
|
||||
* @return returns true is connector is disabled
|
||||
* Checks if the Cloudian Connector is enabled
|
||||
* @return returns true is connector is enabled
|
||||
*/
|
||||
boolean isConnectorDisabled();
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Generates single-sign on URL for logged in user
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
}
|
||||
|
||||
private boolean addOrUpdateGroup(final Domain domain) {
|
||||
if (domain == null || isConnectorDisabled()) {
|
||||
if (domain == null || !isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
final CloudianClient client = getClient();
|
||||
|
|
@ -107,7 +107,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
}
|
||||
|
||||
private boolean removeGroup(final Domain domain) {
|
||||
if (domain == null || isConnectorDisabled()) {
|
||||
if (domain == null || !isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
final CloudianClient client = getClient();
|
||||
|
|
@ -121,7 +121,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
}
|
||||
|
||||
private boolean addOrUpdateUserAccount(final Account account, final Domain domain) {
|
||||
if (account == null || domain == null || isConnectorDisabled()) {
|
||||
if (account == null || domain == null || !isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
final User accountUser = userDao.listByAccount(account.getId()).get(0);
|
||||
|
|
@ -151,7 +151,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
}
|
||||
|
||||
private boolean removeUserAccount(final Account account) {
|
||||
if (account == null || isConnectorDisabled()) {
|
||||
if (account == null || !isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
final CloudianClient client = getClient();
|
||||
|
|
@ -164,12 +164,6 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
//////////////// Plugin APIs /////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getAdminUrl() {
|
||||
return String.format("%s://%s:%s", CloudianAdminProtocol.value(),
|
||||
CloudianAdminHost.value(), CloudianAdminPort.value());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCmcUrl() {
|
||||
return String.format("%s://%s:%s/Cloudian/", CloudianCmcProtocol.value(),
|
||||
|
|
@ -177,8 +171,8 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectorDisabled() {
|
||||
return !CloudianConnectorEnabled.value();
|
||||
public boolean isEnabled() {
|
||||
return CloudianConnectorEnabled.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -208,7 +202,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
|
||||
if (isConnectorDisabled()) {
|
||||
if (!isEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +273,7 @@ public class CloudianConnectorImpl extends ComponentLifecycleBase implements Clo
|
|||
public List<Class<?>> getCommands() {
|
||||
final List<Class<?>> cmdList = new ArrayList<Class<?>>();
|
||||
cmdList.add(CloudianIsEnabledCmd.class);
|
||||
if (isConnectorDisabled()) {
|
||||
if (!isEnabled()) {
|
||||
return cmdList;
|
||||
}
|
||||
cmdList.add(CloudianSsoLoginCmd.class);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class CloudianIsEnabledCmd extends BaseCmd {
|
|||
@Override
|
||||
public void execute() {
|
||||
final CloudianEnabledResponse response = new CloudianEnabledResponse();
|
||||
response.setEnabled(!connector.isConnectorDisabled());
|
||||
response.setEnabled(connector.isEnabled());
|
||||
response.setCmcUrl(connector.getCmcUrl());
|
||||
response.setObjectName(APINAME.toLowerCase());
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue