@Override
public boolean activateServerTLSAuth() {
- if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null &&
- jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
+ if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null
+ && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
return jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).getAsBoolean();
} else {
return false;
/**
* Clds Identity database DataSource configuration.
*
- * @return
+ * @return encoded password data source
*/
@Bean(name = "cldsDataSource")
@ConfigurationProperties(prefix = "spring.datasource.cldsdb")
@Autowired
protected CsarInstaller csarInstaller;
+ /**
+ * Loads SDC controllers configuration.
+ */
@PostConstruct
public void loadSdcControllers() {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
});
}
+ /**
+ * Checks whether all SDC controllers defined are up and running.
+ */
@Scheduled(fixedRate = 120000)
public void checkAllSdcControllers() {
logger.info("Checking that all SDC Controllers defined are up and running");
logger.info("SDC Controllers check completed");
}
+ /**
+ * Closes all SDC Controller and the SDC Client.
+ */
@PreDestroy
public void killSdcControllers() {
sdcControllersList.forEach(e -> {
@Autowired
protected CsarInstaller csarInstaller;
+ /**
+ * Loads SDC controller configuration.
+ */
@PostConstruct
public void loadSdcControllers() {
SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
});
}
+ /**
+ * Checks whether all SDC controllers defined are up and running.
+ */
@Scheduled(fixedRate = 120000)
public void checkAllSdcControllers() {
logger.info("Checking that all SDC Controllers defined are up and running");
logger.info("SDC Controllers check completed");
}
+ /**
+ * Closes all SDC Controller and the SDC Client.
+ */
@PreDestroy
public void killSdcControllers() {
sdcControllersList.forEach(e -> {
public class BadRequestException extends RuntimeException {
/**
- *
- */
- private static final long serialVersionUID = -5738167530541646123L;
+ * The serial version ID.
+ */
+ private static final long serialVersionUID = -5738167530541646123L;
- /**
+ /**
* This constructor can be used to create a new CldsConfigException.
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public BadRequestException(String message, Throwable e) {
- super(message, e);
+ public BadRequestException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class CldsConfigException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 5958873136187918505L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public CldsConfigException(String message, Throwable e) {
- super(message, e);
+ public CldsConfigException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class CldsUsersException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 933535057227505342L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public CldsUsersException(String message, Throwable e) {
- super(message, e);
+ public CldsUsersException(String message, Throwable ex) {
+ super(message, ex);
}
/**
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public ModelBpmnException(String message, Throwable e) {
- super(message, e);
+ public ModelBpmnException(String message, Throwable ex) {
+ super(message, ex);
}
/**
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public ModelPropertiesException(String message, Throwable e) {
- super(message, e);
+ public ModelPropertiesException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class NotAuthorizedException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = -5738167530541646123L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public NotAuthorizedException(String message, Throwable e) {
- super(message, e);
+ public NotAuthorizedException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class TcaRequestFormatterException extends RuntimeException {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = 169875373143236667L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public TcaRequestFormatterException(String message, Throwable e) {
- super(message, e);
+ public TcaRequestFormatterException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class DcaeDeploymentException extends RuntimeException {
/**
- * Generated ID
+ * Generated ID.
*/
private static final long serialVersionUID = 8452294782552680243L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public DcaeDeploymentException(String message, Throwable e) {
- super(message, e);
+ public DcaeDeploymentException(String message, Throwable ex) {
+ super(message, ex);
}
/**
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public PolicyClientException(String message, Throwable e) {
- super(message, e);
+ public PolicyClientException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class SdcCommunicationException extends RuntimeException {
/**
- * Generated ID
+ * Generated ID.
*/
private static final long serialVersionUID = 8452294782552680243L;
*
* @param message
* A string message detailing the problem
- * @param e
+ * @param ex
* The exception sent by the code
*/
- public SdcCommunicationException(String message, Throwable e) {
- super(message, e);
+ public SdcCommunicationException(String message, Throwable ex) {
+ super(message, ex);
}
/**
public class CsarHandlerException extends Exception {
/**
- *
+ * The serial version ID.
*/
private static final long serialVersionUID = -7628640776124409155L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new CsarHandlerException.
+ *
+ * @param message The message to dump
*/
public CsarHandlerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new CsarHandlerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public CsarHandlerException(final String message, final Throwable cause) {
super(message, cause);
private static final long serialVersionUID = 4095937499475915021L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcArtifactInstallerException.
+ *
+ * @param message The message to dump
*/
public SdcArtifactInstallerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcArtifactInstallerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcArtifactInstallerException(final String message, final Throwable cause) {
super(message, cause);
private static final long serialVersionUID = -4236006447255525130L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcControllerException.
+ *
+ * @param message The message to dump
*/
public SdcControllerException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcControllerException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcControllerException(final String message, final Throwable cause) {
super(message, cause);
private static final long serialVersionUID = -5276848693231134901L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
*/
public SdcDownloadException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcDownloadException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcDownloadException(final String message, final Throwable cause) {
super(message, cause);
private static final long serialVersionUID = 8425657297510362736L;
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcParametersException.
+ *
+ * @param message The message to dump
*/
public SdcParametersException(final String message) {
super(message);
}
/**
- * @param message
- * The message to dump
- * @param cause
- * The Throwable cause object
+ * This constructor can be used to create a new SdcParametersException.
+ *
+ * @param message The message to dump
+ * @param cause The Throwable cause object
*/
public SdcParametersException(final String message, final Throwable cause) {
super(message, cause);
import org.springframework.stereotype.Component;
/**
- * REST services to manage dictionary and dictionary items for Tosca Model
+ * REST services to manage dictionary and dictionary items for Tosca Model.
*/
@Component
public class CldsDictionaryService extends SecureServiceBase {
}
/**
- * REST Service that creates or Updates a Dictionary
+ * REST Service that creates or Updates a Dictionary.
*
- * @param dictionaryName
- * @param cldsDictionary
+ * @param dictionaryName dictionary name
+ * @param cldsDictionary clds dictionary
* @return CldsDictionary that was created in DB.
*/
public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
/**
* REST Service that creates or Updates a Dictionary Elements for dictionary
- * in DB
+ * in DB.
*
- * @param dictionaryName
- * @param dictionaryItem
+ * @param dictionaryName dictionary name
+ * @param dictionaryItem dictionary item
* @return CldsDictionaryItem A dictionary items that was created or updated
* in DB
*/
}
/**
- * Rest Service that retrieves all CLDS dictionary in DB
+ * Rest Service that retrieves all CLDS dictionary in DB.
*
* @return CldsDictionary List List of CldsDictionary available in DB
*/
/**
* Rest Service that retrieves all CLDS dictionary items in DB for a give
- * dictionary name
+ * dictionary name.
*
- * @param dictionaryName
+ * @param dictionaryName dictionary name
* @return CldsDictionaryItem list List of CLDS Dictionary items for a given
* dictionary name
*/
* The constant LIST_OF_SDC_SERVICE_INFO_TYPE.
*/
public static final Type LIST_OF_SDC_SERVICE_INFO_TYPE = new TypeToken<List<SdcServiceInfo>>() {
- }.getType();
+ }.getType();
@Produce(uri = "direct:processSubmit")
private CamelProxy camelProxy;
/**
* UUID. If not authorized, then NotAuthorizedException is thrown.
*
* @param model The clds model
- * @return
+ * @return boolean or throws NotAuthorizedException
*/
private boolean isAuthorizedForVf(CldsModel model) {
String vf = ModelProperties.getVf(model);
private SecureServicePermission permissionReadTemplate;
private SecureServicePermission permissionUpdateTemplate;
@Autowired
- private HttpServletRequest request;
+ private HttpServletRequest request;
@PostConstruct
private final void afterConstruction() {
* database. This is subset of the json getModel. This is only expected to
* be used for testing purposes, not by the UI.
*
- * @param templateName
+ * @param templateName template name
* @return bpmn xml text - content of bpmn given name
*/
public String getBpmnTemplate(String templateName) {
- util.entering(request, "CldsTemplateService: GET template bpmn");
+ util.entering(request, "CldsTemplateService: GET template bpmn");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET bpmnText for templateName=" + templateName);
* database. This is subset of the json getModel. This is only expected to
* be used for testing purposes, not by the UI.
*
- * @param templateName
+ * @param templateName template name
* @return image xml text - content of image given name
*/
public String getImageXml(String templateName) {
- util.entering(request, "CldsTemplateService: GET template image");
+ util.entering(request, "CldsTemplateService: GET template image");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET imageText for templateName=" + templateName);
/**
* REST service that retrieves a CLDS template by name from the database.
*
- * @param templateName
+ * @param templateName template name
* @return clds template - clds template for the given template name
*/
public CldsTemplate getTemplate(String templateName) {
- util.entering(request, "CldsTemplateService: GET template");
+ util.entering(request, "CldsTemplateService: GET template");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET model for templateName=" + templateName);
/**
* REST service that saves a CLDS template by name in the database.
*
- * @param templateName
- * @param cldsTemplate
+ * @param templateName template name
+ * @param cldsTemplate clds template
* @return The CldsTemplate modified and saved in DB
*/
public CldsTemplate putTemplate(String templateName, CldsTemplate cldsTemplate) {
- util.entering(request, "CldsTemplateService: PUT template");
+ util.entering(request, "CldsTemplateService: PUT template");
Date startTime = new Date();
isAuthorized(permissionUpdateTemplate);
logger.info("PUT Template for templateName=" + templateName);
* @return template names in JSON
*/
public List<ValueItem> getTemplateNames() {
- util.entering(request, "CldsTemplateService: GET template names");
+ util.entering(request, "CldsTemplateService: GET template names");
Date startTime = new Date();
isAuthorized(permissionReadTemplate);
logger.info("GET list of template names");
}
// Created for the integration test
- public void setLoggingUtil (LoggingUtils utilP) {
+ public void setLoggingUtil(LoggingUtils utilP) {
util = utilP;
}
}
import org.springframework.stereotype.Component;
/**
- * REST services to manage Tosca Model
+ * REST services to manage Tosca Model.
*/
@Component
public class CldsToscaService extends SecureServiceBase {
/**
* Get the userId from AAF/CSP.
*
- * @return
+ * @return user ID
*/
public String getUserId() {
return getUserName();
/**
* Get the Full name.
*
- * @return
+ * @return user name
*/
public String getUserName() {
String name = userNameHandler.retrieveUserName(securityContext);
/**
* Get the principal name.
*
- * @return
+ * @return the principal name
*/
public String getPrincipalName() {
String principal = ((UserDetails)securityContext.getAuthentication().getPrincipal()).getUsername();
// the rest of these don't seem to be required - isUserInRole method
// appears to take * as a wildcard
} else if (hasRole(inPermission.getKeyAllInstance())) {
- securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllInstanceAction())) {
- securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else if (hasRole(inPermission.getKeyAllAction())) {
- securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey());
+ securityLogger.info("{} authorized because user has permission with * for action: {}",
+ getPrincipalName(), inPermission.getKey());
authorized = true;
} else {
throw new NotAuthorizedException("");
}
for (GrantedAuthority auth : authentication.getAuthorities()) {
- if (role.equals(auth.getAuthority()))
+ if (role.equals(auth.getAuthority())) {
return true;
+ }
}
return false;
/**
* Factory method to create permission given type, instance, and action.
*
- * @param type
- * @param instance
- * @param action
- * @return
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @param action action of the permission
+ * @return instance of SecureServicePermission with type, instance and action
*/
public static SecureServicePermission create(String type, String instance, String action) {
return new SecureServicePermission(type, instance, action);
* Factory method to create permission given type and instance. Default
* action to ALL/*.
*
- * @param type
- * @param instance
- * @return
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @return instance of SecureServicePermission with type, instance and default action
*/
public static SecureServicePermission create(String type, String instance) {
return new SecureServicePermission(type, instance, ALL);
* Factory method to create permission given type. Default instance and
* action to ALL/*.
*
- * @param type
- * @return
+ * @param type type of the permission
+ * @return instance of SecureServicePermission with type and default instance and action
*/
public static SecureServicePermission create(String type) {
return new SecureServicePermission(type, ALL, ALL);
/**
* Instantiate permission given type, instance, and action.
*
- * @param type
- * @param instance
- * @param action
+ * @param type type of the permission
+ * @param instance instance of the permission
+ * @param action action of the permission
*/
public SecureServicePermission(String type, String instance, String action) {
this.type = type;
}
/**
- * Override toString - return permission in key format
+ * Override toString - return permission in key format.
*/
@Override
public String toString() {
* Return Permission in Key format = type, instance, and action separate by
* pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKey() {
return type + "|" + instance + "|" + action;
* Return Permission in Key format = type, all instance, and action separate
* by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllInstance() {
return type + "|" + ALL + "|" + action;
* Return Permission in Key format = type, all instance, and all action
* separate by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllInstanceAction() {
return type + "|" + ALL + "|" + ALL;
* Return Permission in Key format = type, instance, and all action separate
* by pipe character.
*
- * @return
+ * @return permission in key format
*/
public String getKeyAllAction() {
return type + "|" + instance + "|" + ALL;
}
/**
+ * Returns the permission type.
+ *
* @return the type
*/
public String getType() {
}
/**
- * @param type
- * the type to set
+ * Sets the type of permission.
+ *
+ * @param type the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
+ * Returns the instance of permission.
+ *
* @return the instance
*/
public String getInstance() {
}
/**
- * @param instance
- * the instance to set
+ * Sets the instance of permission.
+ *
+ * @param instance the instance to set
*/
public void setInstance(String instance) {
this.instance = instance;
}
/**
+ * Returns the action of permission.
+ *
* @return the action
*/
public String getAction() {
}
/**
- * @param action
- * the action to set
+ * Sets the action of permission.
+ *
+ * @param action the action to set
*/
public void setAction(String action) {
this.action = action;
@Controller
public class UserService {
- private SecurityContext securityContext= SecurityContextHolder.getContext();
+ private SecurityContext securityContext = SecurityContextHolder.getContext();
/**
* REST service that returns the username.
*
- * @param userName
* @return the user name
*/
public String getUser() {