use of org.craftercms.studio.api.v2.dal.ClusterMember in project studio by craftercms.
the class SiteServiceImpl method setPublishedRepoCreated.
@Override
public void setPublishedRepoCreated(String siteId) {
siteFeedMapper.setPublishedRepoCreated(siteId);
try {
ClusterMember clusterMember = clusterDao.getMemberByLocalAddress(studioClusterUtils.getClusterNodeLocalAddress());
if (Objects.nonNull(clusterMember)) {
SiteFeed siteFeed = getSite(siteId);
clusterDao.setPublishedRepoCreated(clusterMember.getId(), siteFeed.getId());
}
} catch (SiteNotFoundException e) {
logger.error("Site not found " + siteId);
}
}
use of org.craftercms.studio.api.v2.dal.ClusterMember in project studio by craftercms.
the class DbEncryptionUpgradeOperation method upgradeClusterMembers.
protected void upgradeClusterMembers(NamedParameterJdbcTemplate jdbcTemplate) throws CryptoException {
logger.debug("Looking for cluster members to upgrade");
List<ClusterMember> members = jdbcTemplate.query(CLUSTER_MEMBERS_QUERY, new BeanPropertyRowMapper<>(ClusterMember.class));
logger.debug("Found {0} cluster members", members.size());
if (isEmpty(members)) {
return;
}
for (ClusterMember member : members) {
logger.debug("Upgrading cluster member with id: {0}", member.getId());
switch(member.getGitAuthType()) {
case RemoteRepository.AuthenticationType.BASIC:
member.setGitPassword(upgradeValue(member.getGitPassword()));
break;
case RemoteRepository.AuthenticationType.TOKEN:
member.setGitToken(upgradeValue(member.getGitToken()));
break;
case RemoteRepository.AuthenticationType.PRIVATE_KEY:
member.setGitPrivateKey(upgradeValue(member.getGitPrivateKey()));
break;
default:
logger.warn("Unknown authentication type {0} for cluster member with id {1}", member.getGitAuthType(), member.getId());
}
}
jdbcTemplate.batchUpdate(CLUSTER_MEMBERS_UPDATE, members.stream().map(BeanPropertySqlParameterSource::new).toArray(BeanPropertySqlParameterSource[]::new));
}
Aggregations