public class SiteServiceImpl extends Object implements SiteService
Constructor and Description |
---|
SiteServiceImpl(StudioClusterUtils studioClusterUtils) |
Modifier and Type | Method and Description |
---|---|
boolean |
addRemote(String siteId,
String remoteName,
String remoteUrl,
String authenticationType,
String remoteUsername,
String remotePassword,
String remoteToken,
String remotePrivateKey)
Add remote repository for site content repository
|
int |
countSites() |
void |
createSiteFromBlueprint(String blueprintId,
String siteName,
String siteId,
String sandboxBranch,
String desc,
Map<String,String> params,
boolean createAsOrphan)
Create a new site based on an existing blueprint
|
protected boolean |
createSiteFromBlueprintGit(String blueprintLocation,
String siteName,
String siteId,
String sandboxBranch,
String desc,
Map<String,String> params,
String creator) |
void |
createSiteWithRemoteOption(String siteId,
String sandboxBranch,
String description,
String blueprintName,
String remoteName,
String remoteUrl,
String remoteBranch,
boolean singleBranch,
String authenticationType,
String remoteUsername,
String remotePassword,
String remoteToken,
String remotePrivateKey,
String createOption,
Map<String,String> params,
boolean createAsOrphan)
Create a new site with remote option (clone from remote or push to remote repository)
|
boolean |
deleteSite(String siteId)
remove a site from the system
|
boolean |
enablePublishing(String siteId,
boolean enabled)
Enable/Disable publishing for given site
|
boolean |
exists(String site)
Check if site already exists
|
boolean |
existsById(String siteId)
Check if site already exists
|
boolean |
existsByName(String siteName)
Check if site already exists
|
Set<String> |
getAllAvailableSites() |
List<String> |
getAllCreatedSites()
Get list of all sites with state = CREATED
|
AuditServiceInternal |
getAuditServiceInternal() |
SiteBlueprintTO[] |
getAvailableBlueprints()
get a list of available blueprints
|
ClusterDAO |
getClusterDao() |
Map<String,Object> |
getConfiguration(String path)
get configuraiton content as XML string at the given path
|
Map<String,Object> |
getConfiguration(String site,
String path,
boolean applyEnv)
get configuraiton content as XML string at the given path
|
ConfigurationService |
getConfigurationService() |
ContentRepository |
getContenetRepository() |
ContentRepository |
getContentRepositoryV2() |
ContentService |
getContentService() |
ContentTypeService |
getContentTypeService() |
List<String> |
getDefaultGroups() |
List<SiteFeed> |
getDeletedSites()
Get deleted sites
|
DependencyService |
getDependencyService() |
DependencyServiceInternal |
getDependencyServiceInternal() |
Deployer |
getDeployer() |
DeploymentService |
getDeploymentService() |
DmPageNavigationOrderService |
getDmPageNavigationOrderService() |
String |
getEnvironment() |
EventService |
getEventService() |
GeneralLockService |
getGeneralLockService() |
String |
getGlobalConfigRoot() |
GroupServiceInternal |
getGroupServiceInternal() |
ImportService |
getImportService() |
String |
getLastCommitId(String siteId)
get last commit id for site
|
String |
getLastSyncedGitlogCommitId(String siteId)
get last audited git log commit id for site
|
String |
getLastVerifiedGitlogCommitId(String siteId)
get last verified git log commit id for site
|
ObjectMetadataManager |
getObjectMetadataManager() |
ObjectStateService |
getObjectStateService() |
RebuildRepositoryMetadata |
getRebuildRepositoryMetadata() |
RetryingOperationFacade |
getRetryingOperationFacade() |
SecurityService |
getSecurityService() |
ServicesConfig |
getServicesConfig() |
SiteFeed |
getSite(String siteId)
Get site details
|
org.dom4j.Document |
getSiteConfiguration(String site)
given a site ID return the configuration as a document
This method allows extensions to add additional properties to the configuration that
are not made available through the site configuration object
|
String |
getSitesConfigPath() |
SiteServiceDAL |
getSiteService()
getter site service dal
|
List<SiteFeed> |
getSitesPerUser(int start,
int number)
Get sites that user is allowed access to for current user
|
List<SiteFeed> |
getSitesPerUser(String username,
int start,
int number)
Get sites that user is allowed access to for given username
|
int |
getSitesPerUserTotal()
Get total number of sites that user is allowed access to for current user
|
int |
getSitesPerUserTotal(String username)
Get total number of sites that user is allowed access to for given username
|
SitesServiceInternal |
getSitesServiceInternal() |
String |
getSiteState(String siteId) |
StudioConfiguration |
getStudioConfiguration() |
StudioDBScriptRunnerFactory |
getStudioDBScriptRunner() |
SyncDatabaseWithRepository |
getSyncDatabaseWithRepository() |
UserServiceInternal |
getUserServiceInternal() |
boolean |
isPublishedRepoCreated(String siteId) |
boolean |
isPublishingEnabled(String siteId)
Check if publishing is enabled for given site
|
List<RemoteRepositoryInfoTO> |
listRemote(String siteId)
List remote repositories for given site
|
void |
rebuildDatabase(String site)
Rebuild database for site
|
void |
reloadGlobalConfiguration() |
void |
reloadSiteConfiguration(String site) |
void |
reloadSiteConfiguration(String site,
boolean triggerEvent) |
void |
reloadSiteConfigurations() |
boolean |
removeRemote(String siteId,
String remoteName)
Remove remote with given name for site
|
protected void |
replaceFileContentGit(String site,
String path,
String find,
String replace) |
void |
setAuditServiceInternal(AuditServiceInternal auditServiceInternal) |
void |
setClusterDao(ClusterDAO clusterDao) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setContentRepository(ContentRepository repo) |
void |
setContentRepositoryV2(ContentRepository contentRepositoryV2) |
void |
setContentService(ContentService contentService) |
void |
setContentTypeService(ContentTypeService contentTypeService) |
void |
setDependencyService(DependencyService dependencyService) |
void |
setDependencyServiceInternal(DependencyServiceInternal dependencyServiceInternal) |
void |
setDeployer(Deployer deployer) |
void |
setDeploymentService(DeploymentService deploymentService) |
void |
setDmPageNavigationOrderService(DmPageNavigationOrderService dmPageNavigationOrderService) |
void |
setEntitlementValidator(org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator) |
void |
setEventService(EventService eventService) |
void |
setGeneralLockService(GeneralLockService generalLockService) |
void |
setGroupServiceInternal(GroupServiceInternal groupServiceInternal) |
void |
setImportService(ImportService importService) |
void |
setNotificationService(NotificationService notificationService) |
void |
setObjectMetadataManager(ObjectMetadataManager objectMetadataManager) |
void |
setObjectStateService(ObjectStateService objectStateService) |
void |
setPublishedRepoCreated(String siteId) |
void |
setRebuildRepositoryMetadata(RebuildRepositoryMetadata rebuildRepositoryMetadata) |
void |
setRetryingOperationFacade(RetryingOperationFacade retryingOperationFacade) |
void |
setSecurityService(SecurityService securityService) |
void |
setServicesConfig(ServicesConfig servicesConfig) |
void |
setSiteServiceDAL(SiteServiceDAL service)
setter site service dal
|
void |
setSitesServiceInternal(SitesServiceInternal sitesServiceInternal) |
void |
setSiteState(String siteId,
String state) |
void |
setStudioConfiguration(StudioConfiguration studioConfiguration) |
void |
setStudioDBScriptRunner(StudioDBScriptRunnerFactory studioDBScriptRunnerFactory) |
void |
setSyncDatabaseWithRepository(SyncDatabaseWithRepository syncDatabaseWithRepository) |
void |
setUpgradeManager(UpgradeManager upgradeManager) |
void |
setUserServiceInternal(UserServiceInternal userServiceInternal) |
boolean |
syncDatabaseWithRepo(String site,
String fromCommitId)
Synchronize our internal database with the underlying repository.
|
boolean |
syncDatabaseWithRepo(String site,
String fromCommitId,
boolean generateAuditLog)
Synchronize our internal database with the underlying repository.
|
void |
syncRepository(String site)
Synchronize Database with repository
|
boolean |
tryLockPublishingForSite(String siteId,
String lockOwnerId,
int ttl)
Lock publishing for site
|
boolean |
unlockPublishingForSite(String siteId,
String lockOwnerId)
Unlock publishing for site
|
void |
updateLastCommitId(String site,
String commitId) |
void |
updateLastSyncedGitlogCommitId(String site,
String commitId)
Update last audited gitlog commit id
|
void |
updateLastVerifiedGitlogCommitId(String site,
String commitId) |
void |
updatePublishingLockHeartbeatForSite(String siteId)
update publishing lock heartbeat for site
|
boolean |
updatePublishingStatusMessage(String siteId,
String status,
String message)
Update publishing status message for given site
|
boolean |
writeConfiguration(String path,
InputStream content)
write configuraiton content at the given path
(can be any kind of content)
|
boolean |
writeConfiguration(String site,
String path,
InputStream content)
write configuraiton content at the given path
(can be any kind of content)
|
protected Deployer deployer
protected SiteServiceDAL _siteServiceDAL
protected ServicesConfig servicesConfig
protected ContentService contentService
protected ContentRepository contentRepository
protected ContentRepository contentRepositoryV2
protected ObjectStateService objectStateService
protected DependencyService dependencyService
protected SecurityService securityService
protected DeploymentService deploymentService
protected ObjectMetadataManager objectMetadataManager
protected DmPageNavigationOrderService dmPageNavigationOrderService
protected ContentTypeService contentTypeService
protected ImportService importService
protected NotificationService notificationService
protected GeneralLockService generalLockService
protected RebuildRepositoryMetadata rebuildRepositoryMetadata
protected SyncDatabaseWithRepository syncDatabaseWithRepository
protected EventService eventService
protected GroupServiceInternal groupServiceInternal
protected UserServiceInternal userServiceInternal
protected UpgradeManager upgradeManager
protected StudioConfiguration studioConfiguration
protected SitesServiceInternal sitesServiceInternal
protected AuditServiceInternal auditServiceInternal
protected ConfigurationService configurationService
protected StudioClusterUtils studioClusterUtils
protected ClusterDAO clusterDao
@Autowired protected SiteFeedMapper siteFeedMapper
protected org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator
protected StudioDBScriptRunnerFactory studioDBScriptRunnerFactory
protected DependencyServiceInternal dependencyServiceInternal
protected RetryingOperationFacade retryingOperationFacade
public SiteServiceImpl(StudioClusterUtils studioClusterUtils)
public boolean writeConfiguration(String site, String path, InputStream content) throws ServiceLayerException
SiteService
writeConfiguration
in interface SiteService
ServiceLayerException
public boolean writeConfiguration(String path, InputStream content) throws ServiceLayerException
SiteService
writeConfiguration
in interface SiteService
ServiceLayerException
public Map<String,Object> getConfiguration(String path)
SiteService
getConfiguration
in interface SiteService
path
- find from the environment overrides location?public org.dom4j.Document getSiteConfiguration(String site) throws SiteConfigNotFoundException
getSiteConfiguration
in interface SiteService
site
- the name of the siteSiteConfigNotFoundException
public Map<String,Object> getConfiguration(String site, String path, boolean applyEnv)
SiteService
getConfiguration
in interface SiteService
applyEnv
- find from the environment overrides location?public Set<String> getAllAvailableSites()
getAllAvailableSites
in interface SiteService
public int countSites()
countSites
in interface SiteService
public void createSiteFromBlueprint(String blueprintId, String siteName, String siteId, String sandboxBranch, String desc, Map<String,String> params, boolean createAsOrphan) throws SiteAlreadyExistsException, SiteCreationException, DeployerTargetException, BlueprintNotFoundException, MissingPluginParameterException
SiteService
createSiteFromBlueprint
in interface SiteService
blueprintId
- blueprint name to create sitesiteName
- site namesiteId
- site identifierdesc
- descriptionparams
- site parameterscreateAsOrphan
- create the site from a remote repository as orphan (no git history)SiteAlreadyExistsException
SiteCreationException
DeployerTargetException
BlueprintNotFoundException
MissingPluginParameterException
protected boolean createSiteFromBlueprintGit(String blueprintLocation, String siteName, String siteId, String sandboxBranch, String desc, Map<String,String> params, String creator) throws Exception
Exception
protected void replaceFileContentGit(String site, String path, String find, String replace) throws Exception
Exception
public void createSiteWithRemoteOption(String siteId, String sandboxBranch, String description, String blueprintName, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey, String createOption, Map<String,String> params, boolean createAsOrphan) throws ServiceLayerException, InvalidRemoteRepositoryException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException, RemoteRepositoryNotBareException, InvalidRemoteUrlException
SiteService
createSiteWithRemoteOption
in interface SiteService
siteId
- site identifiersandboxBranch
- sandbox branch namedescription
- descriptionblueprintName
- name of the blueprint to create siteremoteName
- remote repository nameremoteUrl
- remote repository urlremoteBranch
- remote repository branch to create site fromsingleBranch
- clone single branch if true, otherwise clone whole repoauthenticationType
- remote repository authentication typeremoteUsername
- remote repository username to use for authenticationremotePassword
- remote repository username to use for authenticationremoteToken
- remote repository username to use for authenticationremotePrivateKey
- remote repository username to use for authenticationcreateOption
- remote repository username to use for authenticationparams
- site parameterscreateAsOrphan
- create the site from a remote repository as orphan (no git history)ServiceLayerException
InvalidRemoteRepositoryException
InvalidRemoteRepositoryCredentialsException
RemoteRepositoryNotFoundException
RemoteRepositoryNotBareException
InvalidRemoteUrlException
public boolean deleteSite(String siteId)
SiteService
deleteSite
in interface SiteService
public SiteBlueprintTO[] getAvailableBlueprints()
SiteService
getAvailableBlueprints
in interface SiteService
public void reloadSiteConfigurations()
reloadSiteConfigurations
in interface SiteService
public void reloadSiteConfiguration(String site)
reloadSiteConfiguration
in interface SiteService
public void reloadSiteConfiguration(String site, boolean triggerEvent)
reloadSiteConfiguration
in interface SiteService
public void reloadGlobalConfiguration()
reloadGlobalConfiguration
in interface SiteService
public void syncRepository(String site) throws SiteNotFoundException
SiteService
syncRepository
in interface SiteService
site
- site idSiteNotFoundException
public void rebuildDatabase(String site)
SiteService
rebuildDatabase
in interface SiteService
site
- site idpublic void updateLastCommitId(String site, String commitId)
updateLastCommitId
in interface SiteService
public void updateLastVerifiedGitlogCommitId(String site, String commitId)
updateLastVerifiedGitlogCommitId
in interface SiteService
public void updateLastSyncedGitlogCommitId(String site, String commitId)
SiteService
updateLastSyncedGitlogCommitId
in interface SiteService
site
- site identifiercommitId
- commit IDpublic boolean syncDatabaseWithRepo(String site, String fromCommitId) throws SiteNotFoundException
SiteService
syncDatabaseWithRepo
in interface SiteService
site
- site to syncfromCommitId
- commit ID to start at and sync up until current commitSiteNotFoundException
public boolean syncDatabaseWithRepo(String site, String fromCommitId, boolean generateAuditLog) throws SiteNotFoundException
SiteService
syncDatabaseWithRepo
in interface SiteService
site
- site to syncfromCommitId
- commit ID to start at and sync up until current commitgenerateAuditLog
- if true add operations to audit logSiteNotFoundException
public boolean exists(String site)
SiteService
exists
in interface SiteService
site
- site IDpublic boolean existsById(String siteId)
SiteService
existsById
in interface SiteService
siteId
- site ID in DBpublic boolean existsByName(String siteName)
SiteService
existsByName
in interface SiteService
siteName
- site name in DBpublic int getSitesPerUserTotal() throws UserNotFoundException, ServiceLayerException
SiteService
getSitesPerUserTotal
in interface SiteService
UserNotFoundException
ServiceLayerException
public int getSitesPerUserTotal(String username) throws UserNotFoundException, ServiceLayerException
SiteService
getSitesPerUserTotal
in interface SiteService
username
- usernameUserNotFoundException
ServiceLayerException
public List<SiteFeed> getSitesPerUser(int start, int number) throws UserNotFoundException, ServiceLayerException
SiteService
getSitesPerUser
in interface SiteService
start
- start position for paginationnumber
- number of sites per pageUserNotFoundException
ServiceLayerException
public List<SiteFeed> getSitesPerUser(String username, int start, int number) throws UserNotFoundException, ServiceLayerException
SiteService
getSitesPerUser
in interface SiteService
username
- usernamestart
- start position for paginationnumber
- number of sites per pageUserNotFoundException
ServiceLayerException
public SiteFeed getSite(String siteId) throws SiteNotFoundException
SiteService
getSite
in interface SiteService
siteId
- site idSiteNotFoundException
public boolean isPublishingEnabled(String siteId)
SiteService
isPublishingEnabled
in interface SiteService
siteId
- site idpublic boolean enablePublishing(String siteId, boolean enabled) throws SiteNotFoundException
SiteService
enablePublishing
in interface SiteService
siteId
- site idenabled
- true to enable publishing, false to disable publishingSiteNotFoundException
public boolean updatePublishingStatusMessage(String siteId, String status, String message) throws SiteNotFoundException
SiteService
updatePublishingStatusMessage
in interface SiteService
siteId
- site idstatus
- statusmessage
- new publishing status messageSiteNotFoundException
public boolean addRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey) throws InvalidRemoteUrlException, ServiceLayerException
SiteService
addRemote
in interface SiteService
siteId
- site identifierremoteName
- remote nameremoteUrl
- remote urlauthenticationType
- authentication typeremoteUsername
- remote usernameremotePassword
- remote passwordremoteToken
- remote tokenremotePrivateKey
- remote private keyInvalidRemoteUrlException
ServiceLayerException
public boolean removeRemote(String siteId, String remoteName) throws SiteNotFoundException
SiteService
removeRemote
in interface SiteService
siteId
- site identifierremoteName
- remote nameSiteNotFoundException
public List<RemoteRepositoryInfoTO> listRemote(String siteId) throws ServiceLayerException, org.craftercms.commons.crypto.CryptoException
SiteService
listRemote
in interface SiteService
siteId
- site identifierSiteNotFoundException
ServiceLayerException
org.craftercms.commons.crypto.CryptoException
public List<SiteFeed> getDeletedSites()
SiteService
getDeletedSites
in interface SiteService
public boolean tryLockPublishingForSite(String siteId, String lockOwnerId, int ttl)
SiteService
tryLockPublishingForSite
in interface SiteService
siteId
- site identifierlockOwnerId
- lock owner identifierttl
- TTL for lockpublic boolean unlockPublishingForSite(String siteId, String lockOwnerId)
SiteService
unlockPublishingForSite
in interface SiteService
siteId
- site identifierpublic void updatePublishingLockHeartbeatForSite(String siteId)
SiteService
updatePublishingLockHeartbeatForSite
in interface SiteService
siteId
- site identifierpublic String getLastCommitId(String siteId)
SiteService
getLastCommitId
in interface SiteService
siteId
- site identifierpublic String getLastVerifiedGitlogCommitId(String siteId)
SiteService
getLastVerifiedGitlogCommitId
in interface SiteService
siteId
- site identifierpublic List<String> getAllCreatedSites()
SiteService
getAllCreatedSites
in interface SiteService
public void setSiteState(String siteId, String state)
setSiteState
in interface SiteService
public String getSiteState(String siteId)
getSiteState
in interface SiteService
public boolean isPublishedRepoCreated(String siteId)
isPublishedRepoCreated
in interface SiteService
public void setPublishedRepoCreated(String siteId)
setPublishedRepoCreated
in interface SiteService
public String getLastSyncedGitlogCommitId(String siteId)
SiteService
getLastSyncedGitlogCommitId
in interface SiteService
siteId
- site identifierpublic String getGlobalConfigRoot()
public String getSitesConfigPath()
public String getEnvironment()
public SiteServiceDAL getSiteService()
public void setSiteServiceDAL(SiteServiceDAL service)
public ServicesConfig getServicesConfig()
public void setServicesConfig(ServicesConfig servicesConfig)
public ContentService getContentService()
public void setContentService(ContentService contentService)
public ContentRepository getContenetRepository()
public void setContentRepository(ContentRepository repo)
public ObjectStateService getObjectStateService()
public void setObjectStateService(ObjectStateService objectStateService)
public DependencyService getDependencyService()
public void setDependencyService(DependencyService dependencyService)
public SecurityService getSecurityService()
public void setSecurityService(SecurityService securityService)
public DeploymentService getDeploymentService()
public void setDeploymentService(DeploymentService deploymentService)
public ObjectMetadataManager getObjectMetadataManager()
public void setObjectMetadataManager(ObjectMetadataManager objectMetadataManager)
public DmPageNavigationOrderService getDmPageNavigationOrderService()
public void setDmPageNavigationOrderService(DmPageNavigationOrderService dmPageNavigationOrderService)
public ContentTypeService getContentTypeService()
public void setContentTypeService(ContentTypeService contentTypeService)
public ImportService getImportService()
public void setImportService(ImportService importService)
public void setNotificationService(NotificationService notificationService)
public GeneralLockService getGeneralLockService()
public void setGeneralLockService(GeneralLockService generalLockService)
public RebuildRepositoryMetadata getRebuildRepositoryMetadata()
public void setRebuildRepositoryMetadata(RebuildRepositoryMetadata rebuildRepositoryMetadata)
public SyncDatabaseWithRepository getSyncDatabaseWithRepository()
public void setSyncDatabaseWithRepository(SyncDatabaseWithRepository syncDatabaseWithRepository)
public StudioConfiguration getStudioConfiguration()
public void setStudioConfiguration(StudioConfiguration studioConfiguration)
public EventService getEventService()
public void setEventService(EventService eventService)
public Deployer getDeployer()
public void setDeployer(Deployer deployer)
public void setEntitlementValidator(org.craftercms.commons.entitlements.validator.EntitlementValidator entitlementValidator)
public GroupServiceInternal getGroupServiceInternal()
public void setGroupServiceInternal(GroupServiceInternal groupServiceInternal)
public UserServiceInternal getUserServiceInternal()
public void setUserServiceInternal(UserServiceInternal userServiceInternal)
public void setUpgradeManager(UpgradeManager upgradeManager)
public SitesServiceInternal getSitesServiceInternal()
public void setSitesServiceInternal(SitesServiceInternal sitesServiceInternal)
public AuditServiceInternal getAuditServiceInternal()
public void setAuditServiceInternal(AuditServiceInternal auditServiceInternal)
public ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
public ContentRepository getContentRepositoryV2()
public void setContentRepositoryV2(ContentRepository contentRepositoryV2)
public ClusterDAO getClusterDao()
public void setClusterDao(ClusterDAO clusterDao)
public StudioDBScriptRunnerFactory getStudioDBScriptRunner()
public void setStudioDBScriptRunner(StudioDBScriptRunnerFactory studioDBScriptRunnerFactory)
public DependencyServiceInternal getDependencyServiceInternal()
public void setDependencyServiceInternal(DependencyServiceInternal dependencyServiceInternal)
public RetryingOperationFacade getRetryingOperationFacade()
public void setRetryingOperationFacade(RetryingOperationFacade retryingOperationFacade)
Copyright © 2023 CrafterCMS. All rights reserved.