mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged DEV to HEAD
52217: MT code cleanup before continuing ALF-19172 - @Override - deprecated TenantAdminService.getAllTenants - Add TenantAdminService.getTenants(enabledOnly) ... TODO: not implemented fully, yet - Remove unused methods - Make internal service methods private - Line endings git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@52287 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,51 +31,33 @@ public interface TenantAdminDAO
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create tenant - note: tenant domain must be unique
|
* Create tenant - note: tenant domain must be unique
|
||||||
*
|
|
||||||
* @param tenantEntity
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
TenantEntity createTenant(TenantEntity tenantEntity);
|
TenantEntity createTenant(TenantEntity tenantEntity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get tenant
|
* Get tenant
|
||||||
*
|
|
||||||
* @param tenantEntity
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
TenantEntity getTenant(String tenantDomain);
|
TenantEntity getTenant(String tenantDomain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List tenants
|
* List tenants
|
||||||
*
|
|
||||||
* TODO add filter(s)
|
|
||||||
*
|
|
||||||
* @param tenantEntity
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
List<TenantEntity> listTenants();
|
List<TenantEntity> listTenants();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get tenant for update
|
* Get tenant for update
|
||||||
*
|
|
||||||
* @param tenantEntity
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
TenantUpdateEntity getTenantForUpdate(String tenantDomain);
|
TenantUpdateEntity getTenantForUpdate(String tenantDomain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update tenant
|
* Update tenant
|
||||||
*
|
* <p/>
|
||||||
* Note: tenant domain cannot be changed
|
* Note: tenant domain cannot be changed
|
||||||
*
|
|
||||||
* @param tenantUpdateEntity
|
|
||||||
*/
|
*/
|
||||||
void updateTenant(TenantUpdateEntity tenantUpdateEntity);
|
void updateTenant(TenantUpdateEntity tenantUpdateEntity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete tenant
|
* Delete tenant
|
||||||
*
|
|
||||||
* @param tenantEntity
|
|
||||||
*/
|
*/
|
||||||
void deleteTenant(String tenantDomain);
|
void deleteTenant(String tenantDomain);
|
||||||
}
|
}
|
||||||
|
@@ -243,6 +243,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
|
|
||||||
private static final String WARN_MSG = "system.mt.warn.upgrade_mt_admin_context";
|
private static final String WARN_MSG = "system.mt.warn.upgrade_mt_admin_context";
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
// for upgrade/backwards compatibility with 3.0.x (mt-admin-context.xml)
|
// for upgrade/backwards compatibility with 3.0.x (mt-admin-context.xml)
|
||||||
@@ -264,11 +265,13 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
PropertyCheck.mandatory(this, "moduleService", moduleService);
|
PropertyCheck.mandatory(this, "moduleService", moduleService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||||
{
|
{
|
||||||
this.ctx = applicationContext;
|
this.ctx = applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void startTenants()
|
public void startTenants()
|
||||||
{
|
{
|
||||||
AuthenticationUtil.setMtEnabled(true);
|
AuthenticationUtil.setMtEnabled(true);
|
||||||
@@ -361,6 +364,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stopTenants()
|
public void stopTenants()
|
||||||
{
|
{
|
||||||
tenantDeployers.clear();
|
tenantDeployers.clear();
|
||||||
@@ -368,25 +372,19 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
AuthenticationUtil.setMtEnabled(false);
|
AuthenticationUtil.setMtEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see TenantAdminService.createTenant()
|
|
||||||
*/
|
|
||||||
public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword)
|
public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword)
|
||||||
{
|
{
|
||||||
createTenant(tenantDomain, tenantAdminRawPassword, null);
|
createTenant(tenantDomain, tenantAdminRawPassword, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see TenantAdminService.createTenant()
|
|
||||||
*/
|
|
||||||
public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword, String contentRoot)
|
public void createTenant(final String tenantDomain, final char[] tenantAdminRawPassword, String contentRoot)
|
||||||
{
|
{
|
||||||
createTenant(tenantDomain, tenantAdminRawPassword, contentRoot, null);
|
createTenant(tenantDomain, tenantAdminRawPassword, contentRoot, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see TenantAdminService.createTenant()
|
|
||||||
*/
|
|
||||||
public void createTenant(final String tenantDomainIn, final char[] tenantAdminRawPassword, String contentRootPath, final String dbUrl)
|
public void createTenant(final String tenantDomainIn, final char[] tenantAdminRawPassword, String contentRootPath, final String dbUrl)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("tenantAdminRawPassword", tenantAdminRawPassword);
|
ParameterCheck.mandatory("tenantAdminRawPassword", tenantAdminRawPassword);
|
||||||
@@ -520,6 +518,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
/**
|
/**
|
||||||
* Export tenant - equivalent to the tenant admin running a 'complete repo' export from the Web Client Admin
|
* Export tenant - equivalent to the tenant admin running a 'complete repo' export from the Web Client Admin
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void exportTenant(String tenantDomainIn, final File directoryDestination)
|
public void exportTenant(String tenantDomainIn, final File directoryDestination)
|
||||||
{
|
{
|
||||||
final String tenantDomain = getTenantDomain(tenantDomainIn);
|
final String tenantDomain = getTenantDomain(tenantDomainIn);
|
||||||
@@ -542,6 +541,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
/**
|
/**
|
||||||
* Create tenant by restoring from a complete repository export. This is equivalent to a bootstrap import using restore-context.xml.
|
* Create tenant by restoring from a complete repository export. This is equivalent to a bootstrap import using restore-context.xml.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void importTenant(final String tenantDomainIn, final File directorySource, String contentRoot)
|
public void importTenant(final String tenantDomainIn, final File directorySource, String contentRoot)
|
||||||
{
|
{
|
||||||
final String tenantDomain = getTenantDomain(tenantDomainIn);
|
final String tenantDomain = getTenantDomain(tenantDomainIn);
|
||||||
@@ -602,6 +602,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean existsTenant(String tenantDomain)
|
public boolean existsTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
// Check that all the passed values are not null
|
// Check that all the passed values are not null
|
||||||
@@ -626,6 +627,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void enableTenant(String tenantDomain)
|
public void enableTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
@@ -647,7 +649,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
notifyAfterEnableTenant(tenantDomain);
|
notifyAfterEnableTenant(tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void notifyAfterEnableTenant(String tenantDomain)
|
private void notifyAfterEnableTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
// Check that all the passed values are not null
|
// Check that all the passed values are not null
|
||||||
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
||||||
@@ -671,6 +673,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void disableTenant(String tenantDomain)
|
public void disableTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
@@ -693,7 +696,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
tenantAdminDAO.updateTenant(tenantUpdateEntity);
|
tenantAdminDAO.updateTenant(tenantUpdateEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void notifyBeforeDisableTenant(String tenantDomain)
|
private void notifyBeforeDisableTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
|
|
||||||
@@ -716,6 +719,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEnabledTenant(String tenantDomain)
|
public boolean isEnabledTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
// Check that all the passed values are not null
|
// Check that all the passed values are not null
|
||||||
@@ -732,20 +736,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getRootContentStoreDir(String tenantDomain)
|
@Override
|
||||||
{
|
|
||||||
// Check that all the passed values are not null
|
|
||||||
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
|
||||||
|
|
||||||
Tenant tenant = getTenantAttributes(tenantDomain);
|
|
||||||
if (tenant != null)
|
|
||||||
{
|
|
||||||
return tenant.getRootContentStoreDir();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tenant getTenant(String tenantDomain)
|
public Tenant getTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
@@ -757,9 +748,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
return getTenantAttributes(tenantDomain);
|
return getTenantAttributes(tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see TenantAdminService.deleteTenant()
|
|
||||||
*/
|
|
||||||
public void deleteTenant(String tenantDomain)
|
public void deleteTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
@@ -850,10 +839,16 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see TenantAdminService.getAllTenants()
|
@Deprecated
|
||||||
*/
|
|
||||||
public List<Tenant> getAllTenants()
|
public List<Tenant> getAllTenants()
|
||||||
|
{
|
||||||
|
return getTenants(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public List<Tenant> getTenants(boolean enabledOnly)
|
||||||
{
|
{
|
||||||
List<TenantEntity> tenantEntities = tenantAdminDAO.listTenants();
|
List<TenantEntity> tenantEntities = tenantAdminDAO.listTenants();
|
||||||
List<Tenant> tenants = new ArrayList<Tenant>(tenantEntities.size());
|
List<Tenant> tenants = new ArrayList<Tenant>(tenantEntities.size());
|
||||||
@@ -880,7 +875,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
bootstrapSystemTenantStore(systemImporterBootstrap, tenantDomain);
|
bootstrapSystemTenantStore(systemImporterBootstrap, tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bootstrapSystemTenantStore(ImporterBootstrap systemImporterBootstrap, String tenantDomain)
|
private void bootstrapSystemTenantStore(ImporterBootstrap systemImporterBootstrap, String tenantDomain)
|
||||||
{
|
{
|
||||||
// Bootstrap Tenant-Specific System Store
|
// Bootstrap Tenant-Specific System Store
|
||||||
StoreRef bootstrapStoreRef = systemImporterBootstrap.getStoreRef();
|
StoreRef bootstrapStoreRef = systemImporterBootstrap.getStoreRef();
|
||||||
@@ -919,7 +914,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
bootstrapUserTenantStore(userImporterBootstrap, tenantDomain, null);
|
bootstrapUserTenantStore(userImporterBootstrap, tenantDomain, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bootstrapUserTenantStore(ImporterBootstrap userImporterBootstrap, String tenantDomain, char[] tenantAdminRawPassword)
|
private void bootstrapUserTenantStore(ImporterBootstrap userImporterBootstrap, String tenantDomain, char[] tenantAdminRawPassword)
|
||||||
{
|
{
|
||||||
// Bootstrap Tenant-Specific User Store
|
// Bootstrap Tenant-Specific User Store
|
||||||
StoreRef bootstrapStoreRef = userImporterBootstrap.getStoreRef();
|
StoreRef bootstrapStoreRef = userImporterBootstrap.getStoreRef();
|
||||||
@@ -960,7 +955,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
bootstrapVersionTenantStore(versionImporterBootstrap, tenantDomain);
|
bootstrapVersionTenantStore(versionImporterBootstrap, tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bootstrapVersionTenantStore(ImporterBootstrap versionImporterBootstrap, String tenantDomain)
|
private void bootstrapVersionTenantStore(ImporterBootstrap versionImporterBootstrap, String tenantDomain)
|
||||||
{
|
{
|
||||||
// Bootstrap Tenant-Specific Version Store
|
// Bootstrap Tenant-Specific Version Store
|
||||||
StoreRef bootstrapStoreRef = versionImporterBootstrap.getStoreRef();
|
StoreRef bootstrapStoreRef = versionImporterBootstrap.getStoreRef();
|
||||||
@@ -991,7 +986,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
bootstrapSpacesArchiveTenantStore(spacesArchiveImporterBootstrap, tenantDomain);
|
bootstrapSpacesArchiveTenantStore(spacesArchiveImporterBootstrap, tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bootstrapSpacesArchiveTenantStore(ImporterBootstrap spacesArchiveImporterBootstrap, String tenantDomain)
|
private void bootstrapSpacesArchiveTenantStore(ImporterBootstrap spacesArchiveImporterBootstrap, String tenantDomain)
|
||||||
{
|
{
|
||||||
// Bootstrap Tenant-Specific Spaces Archive Store
|
// Bootstrap Tenant-Specific Spaces Archive Store
|
||||||
StoreRef bootstrapStoreRef = spacesArchiveImporterBootstrap.getStoreRef();
|
StoreRef bootstrapStoreRef = spacesArchiveImporterBootstrap.getStoreRef();
|
||||||
@@ -1046,7 +1041,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
bootstrapSpacesTenantStore(spacesImporterBootstrap, tenantDomain);
|
bootstrapSpacesTenantStore(spacesImporterBootstrap, tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bootstrapSpacesTenantStore(ImporterBootstrap spacesImporterBootstrap, String tenantDomain)
|
private void bootstrapSpacesTenantStore(ImporterBootstrap spacesImporterBootstrap, String tenantDomain)
|
||||||
{
|
{
|
||||||
// Bootstrap Tenant-Specific Spaces Store
|
// Bootstrap Tenant-Specific Spaces Store
|
||||||
StoreRef bootstrapStoreRef = spacesImporterBootstrap.getStoreRef();
|
StoreRef bootstrapStoreRef = spacesImporterBootstrap.getStoreRef();
|
||||||
@@ -1072,6 +1067,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deployTenants(final TenantDeployer deployer, Log logger)
|
public void deployTenants(final TenantDeployer deployer, Log logger)
|
||||||
{
|
{
|
||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
@@ -1139,6 +1135,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void undeployTenants(final TenantDeployer deployer, Log logger)
|
public void undeployTenants(final TenantDeployer deployer, Log logger)
|
||||||
{
|
{
|
||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
@@ -1210,12 +1207,13 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void register(TenantDeployer deployer)
|
public void register(TenantDeployer deployer)
|
||||||
{
|
{
|
||||||
register(deployer, -1);
|
register(deployer, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void register(TenantDeployer deployer, int position)
|
private void register(TenantDeployer deployer, int position)
|
||||||
{
|
{
|
||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
{
|
{
|
||||||
@@ -1235,6 +1233,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void unregister(TenantDeployer deployer)
|
public void unregister(TenantDeployer deployer)
|
||||||
{
|
{
|
||||||
if (deployer == null)
|
if (deployer == null)
|
||||||
@@ -1248,6 +1247,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void register(WorkflowDeployer workflowDeployer)
|
public void register(WorkflowDeployer workflowDeployer)
|
||||||
{
|
{
|
||||||
if (workflowDeployer == null)
|
if (workflowDeployer == null)
|
||||||
@@ -1261,7 +1261,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initTenant(String tenantDomain, String contentRoot, String dbUrl)
|
private void initTenant(String tenantDomain, String contentRoot, String dbUrl)
|
||||||
{
|
{
|
||||||
validateTenantName(tenantDomain);
|
validateTenantName(tenantDomain);
|
||||||
|
|
||||||
@@ -1298,7 +1298,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
tenantAdminDAO.createTenant(tenantEntity);
|
tenantAdminDAO.createTenant(tenantEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void validateTenantName(String tenantDomain)
|
private void validateTenantName(String tenantDomain)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
||||||
|
|
||||||
@@ -1334,41 +1334,40 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
|
|
||||||
// tenant deployer/user services delegated to tenant service
|
// tenant deployer/user services delegated to tenant service
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
{
|
{
|
||||||
return tenantService.isEnabled();
|
return tenantService.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCurrentUserDomain()
|
public String getCurrentUserDomain()
|
||||||
{
|
{
|
||||||
return tenantService.getCurrentUserDomain();
|
return tenantService.getCurrentUserDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getUserDomain(String username)
|
public String getUserDomain(String username)
|
||||||
{
|
{
|
||||||
return tenantService.getUserDomain(username);
|
return tenantService.getUserDomain(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getBaseNameUser(String username)
|
public String getBaseNameUser(String username)
|
||||||
{
|
{
|
||||||
return tenantService.getBaseNameUser(username);
|
return tenantService.getBaseNameUser(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getDomainUser(String baseUsername, String tenantDomain)
|
public String getDomainUser(String baseUsername, String tenantDomain)
|
||||||
{
|
{
|
||||||
tenantDomain = getTenantDomain(tenantDomain);
|
tenantDomain = getTenantDomain(tenantDomain);
|
||||||
return tenantService.getDomainUser(baseUsername, tenantDomain);
|
return tenantService.getDomainUser(baseUsername, tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDomain(String name)
|
|
||||||
{
|
|
||||||
name = getTenantDomain(name);
|
|
||||||
return tenantService.getDomain(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// local helpers
|
// local helpers
|
||||||
|
|
||||||
public String getBaseAdminUser()
|
private String getBaseAdminUser()
|
||||||
{
|
{
|
||||||
// default for backwards compatibility only - eg. upgrade of existing MT instance (mt-admin-context.xml.sample)
|
// default for backwards compatibility only - eg. upgrade of existing MT instance (mt-admin-context.xml.sample)
|
||||||
if (baseAdminUsername != null)
|
if (baseAdminUsername != null)
|
||||||
@@ -1378,7 +1377,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
return getBaseNameUser(AuthenticationUtil.getAdminUserName());
|
return getBaseNameUser(AuthenticationUtil.getAdminUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSystemUser(String tenantDomain)
|
private String getSystemUser(String tenantDomain)
|
||||||
{
|
{
|
||||||
return tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain);
|
return tenantService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain);
|
||||||
}
|
}
|
||||||
@@ -1394,7 +1393,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
|
|||||||
return authenticationContext.getGuestUserName(tenantDomain);
|
return authenticationContext.getGuestUserName(tenantDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTenantDomain(String tenantDomain)
|
private String getTenantDomain(String tenantDomain)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
||||||
return tenantDomain.toLowerCase(I18NUtil.getLocale());
|
return tenantDomain.toLowerCase(I18NUtil.getLocale());
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -14,217 +14,240 @@
|
|||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.tenant;
|
package org.alfresco.repo.tenant;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.workflow.WorkflowDeployer;
|
import org.alfresco.repo.workflow.WorkflowDeployer;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty Tenant Deployer Service implementation (for Single-Tenant / Single-Instance)
|
* Empty Tenant Deployer Service implementation (for Single-Tenant / Single-Instance)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SingleTAdminServiceImpl implements TenantAdminService
|
public class SingleTAdminServiceImpl implements TenantAdminService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* NO-OP
|
* NO-OP
|
||||||
*/
|
*/
|
||||||
public void startTenants()
|
@Override
|
||||||
{
|
public void startTenants()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
/**
|
|
||||||
* NO-OP
|
/**
|
||||||
*/
|
* NO-OP
|
||||||
public void stopTenants()
|
*/
|
||||||
{
|
@Override
|
||||||
}
|
public void stopTenants()
|
||||||
|
{
|
||||||
/**
|
}
|
||||||
* @return Returns <tt>false</tt> always
|
|
||||||
*/
|
/**
|
||||||
public boolean isEnabled()
|
* @return Returns <tt>false</tt> always
|
||||||
{
|
*/
|
||||||
return false;
|
@Override
|
||||||
}
|
public boolean isEnabled()
|
||||||
|
{
|
||||||
/**
|
return false;
|
||||||
* NO-OP
|
}
|
||||||
*/
|
|
||||||
public void initialiseTenants()
|
/**
|
||||||
{
|
* NO-OP
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
/**
|
public void deployTenants(final TenantDeployer deployer, Log logger)
|
||||||
* NO-OP
|
{
|
||||||
*/
|
}
|
||||||
public void deployTenants(final TenantDeployer deployer, Log logger)
|
|
||||||
{
|
/**
|
||||||
}
|
* NO-OP
|
||||||
|
*/
|
||||||
/**
|
@Override
|
||||||
* NO-OP
|
public void undeployTenants(final TenantDeployer deployer, Log logger)
|
||||||
*/
|
{
|
||||||
public void undeployTenants(final TenantDeployer deployer, Log logger)
|
}
|
||||||
{
|
|
||||||
}
|
/**
|
||||||
|
* NO-OP
|
||||||
/**
|
*/
|
||||||
* NO-OP
|
@Override
|
||||||
*/
|
public void register(TenantDeployer tenantDeployer)
|
||||||
public void register(TenantDeployer tenantDeployer)
|
{
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* NO-OP
|
||||||
* NO-OP
|
*/
|
||||||
*/
|
@Override
|
||||||
public void unregister(TenantDeployer tenantDeployer)
|
public void unregister(TenantDeployer tenantDeployer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NO-OP
|
* NO-OP
|
||||||
*/
|
*/
|
||||||
public void register(WorkflowDeployer workflowDeployer)
|
@Override
|
||||||
{
|
public void register(WorkflowDeployer workflowDeployer)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @return Returns an empty list always
|
/**
|
||||||
*/
|
* NO-OP
|
||||||
public List<Tenant> getAllTenants()
|
*/
|
||||||
{
|
@Override
|
||||||
return Collections.emptyList();
|
@Deprecated
|
||||||
}
|
public List<Tenant> getAllTenants()
|
||||||
|
{
|
||||||
/**
|
return getTenants(false);
|
||||||
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
|
}
|
||||||
*/
|
|
||||||
public String getCurrentUserDomain()
|
/**
|
||||||
{
|
* NO-OP
|
||||||
return TenantService.DEFAULT_DOMAIN;
|
*/
|
||||||
}
|
@Override
|
||||||
|
@Deprecated
|
||||||
/**
|
public List<Tenant> getTenants(boolean enabledOnly)
|
||||||
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
|
{
|
||||||
*/
|
return Collections.emptyList();
|
||||||
public String getUserDomain(String username)
|
}
|
||||||
{
|
|
||||||
return TenantService.DEFAULT_DOMAIN;
|
/**
|
||||||
}
|
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
|
||||||
|
*/
|
||||||
/**
|
@Override
|
||||||
* @return Returns the given <tt>username</tt> always
|
public String getCurrentUserDomain()
|
||||||
*/
|
{
|
||||||
public String getBaseNameUser(String username)
|
return TenantService.DEFAULT_DOMAIN;
|
||||||
{
|
}
|
||||||
return username;
|
|
||||||
}
|
/**
|
||||||
|
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
|
||||||
/**
|
*/
|
||||||
* @return Returns the given <tt>baseUserName</tt> always
|
@Override
|
||||||
*/
|
public String getUserDomain(String username)
|
||||||
public String getDomainUser(String baseUsername, String tenantDomain)
|
{
|
||||||
{
|
return TenantService.DEFAULT_DOMAIN;
|
||||||
return baseUsername;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @return Returns the given <tt>username</tt> always
|
||||||
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
|
*/
|
||||||
*/
|
@Override
|
||||||
public String getDomain(String name)
|
public String getBaseNameUser(String username)
|
||||||
{
|
{
|
||||||
return TenantService.DEFAULT_DOMAIN;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws UnsupportedOperationException always
|
* @return Returns the given <tt>baseUserName</tt> always
|
||||||
*/
|
*/
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot)
|
@Override
|
||||||
{
|
public String getDomainUser(String baseUsername, String tenantDomain)
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
{
|
||||||
}
|
return baseUsername;
|
||||||
|
}
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot, String dbUrl)
|
|
||||||
{
|
/**
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
* @throws UnsupportedOperationException always
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
/**
|
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot)
|
||||||
* @throws UnsupportedOperationException always
|
{
|
||||||
*/
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword)
|
}
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
/**
|
||||||
}
|
* @throws UnsupportedOperationException always
|
||||||
|
*/
|
||||||
/**
|
@Override
|
||||||
* @throws UnsupportedOperationException always
|
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot, String dbUrl)
|
||||||
*/
|
{
|
||||||
public void deleteTenant(String tenantDomain)
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
{
|
}
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
|
||||||
}
|
/**
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
/**
|
*/
|
||||||
* @throws UnsupportedOperationException always
|
@Override
|
||||||
*/
|
public void createTenant(String tenantDomain, char[] adminRawPassword)
|
||||||
public void disableTenant(String tenantDomain)
|
{
|
||||||
{
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @throws UnsupportedOperationException always
|
||||||
* @throws UnsupportedOperationException always
|
*/
|
||||||
*/
|
@Override
|
||||||
public void enableTenant(String tenantDomain)
|
public void deleteTenant(String tenantDomain)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws UnsupportedOperationException always
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
public boolean existsTenant(String tenantDomain)
|
@Override
|
||||||
{
|
public void disableTenant(String tenantDomain)
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
{
|
||||||
}
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @throws UnsupportedOperationException always
|
/**
|
||||||
*/
|
* @throws UnsupportedOperationException always
|
||||||
public void exportTenant(String tenantDomain, File directoryDestination)
|
*/
|
||||||
{
|
@Override
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
public void enableTenant(String tenantDomain)
|
||||||
}
|
{
|
||||||
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
/**
|
}
|
||||||
* @throws UnsupportedOperationException always
|
|
||||||
*/
|
/**
|
||||||
public Tenant getTenant(String tenantDomain)
|
* @throws UnsupportedOperationException always
|
||||||
{
|
*/
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
@Override
|
||||||
}
|
public boolean existsTenant(String tenantDomain)
|
||||||
|
{
|
||||||
/**
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
* @throws UnsupportedOperationException always
|
}
|
||||||
*/
|
|
||||||
public void importTenant(String tenantDomain, File directorySource, String rootContentStoreDir)
|
/**
|
||||||
{
|
* @throws UnsupportedOperationException always
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
*/
|
||||||
}
|
@Override
|
||||||
|
public void exportTenant(String tenantDomain, File directoryDestination)
|
||||||
/**
|
{
|
||||||
* @throws UnsupportedOperationException always
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
*/
|
}
|
||||||
public boolean isEnabledTenant(String tenantDomain)
|
|
||||||
{
|
/**
|
||||||
throw new UnsupportedOperationException("Single tenant mode is active.");
|
* @throws UnsupportedOperationException always
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
|
public Tenant getTenant(String tenantDomain)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void importTenant(String tenantDomain, File directorySource, String rootContentStoreDir)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isEnabledTenant(String tenantDomain)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Single tenant mode is active.");
|
||||||
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -14,74 +14,92 @@
|
|||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.tenant;
|
package org.alfresco.repo.tenant;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.workflow.WorkflowDeployer;
|
import org.alfresco.repo.workflow.WorkflowDeployer;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tenant Admin Service interface.
|
* Tenant Admin Service interface.
|
||||||
* <p>
|
* <p>
|
||||||
* This interface provides administrative methods to provision and administer tenants.
|
* This interface provides administrative methods to provision and administer tenants.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface TenantAdminService extends TenantUserService
|
public interface TenantAdminService extends TenantUserService
|
||||||
{
|
{
|
||||||
public void startTenants();
|
public void startTenants();
|
||||||
|
|
||||||
public void stopTenants();
|
public void stopTenants();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tenant Deployer methods
|
* Tenant Deployer methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void deployTenants(final TenantDeployer deployer, Log logger);
|
public void deployTenants(final TenantDeployer deployer, Log logger);
|
||||||
|
|
||||||
public void undeployTenants(final TenantDeployer deployer, Log logger);
|
public void undeployTenants(final TenantDeployer deployer, Log logger);
|
||||||
|
|
||||||
public void register(TenantDeployer tenantDeployer);
|
public void register(TenantDeployer tenantDeployer);
|
||||||
|
|
||||||
public void unregister(TenantDeployer tenantDeployer);
|
public void unregister(TenantDeployer tenantDeployer);
|
||||||
|
|
||||||
public List<Tenant> getAllTenants();
|
/**
|
||||||
|
* @return a list of <b>all</b> tenants regardless of state
|
||||||
/*
|
*
|
||||||
* Workflow Deployer methods
|
* @deprecated Deprecated in <b>4.2</b>. This method does not scale.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void register(WorkflowDeployer workflowDeployer);
|
public List<Tenant> getAllTenants();
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Admin methods
|
* Retrieve all tenants
|
||||||
*/
|
*
|
||||||
|
* @param enabledOnly <tt>true</tt> to retrieve only active tenants
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword);
|
* @return tenants, either active or all
|
||||||
|
*
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot);
|
* @since 4.2
|
||||||
|
* @deprecated method does not scale.
|
||||||
// experimental (unsupported)
|
*/
|
||||||
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot, String dbUrl);
|
@Deprecated
|
||||||
|
public List<Tenant> getTenants(boolean enabledOnly);
|
||||||
public void exportTenant(String tenantDomain, File directoryDestination);
|
|
||||||
|
/*
|
||||||
public void importTenant(String tenantDomain, File directorySource, String contentRoot);
|
* Workflow Deployer methods
|
||||||
|
*/
|
||||||
public boolean existsTenant(String tenantDomain);
|
|
||||||
|
public void register(WorkflowDeployer workflowDeployer);
|
||||||
public void deleteTenant(String tenantDomain);
|
|
||||||
|
/*
|
||||||
public void enableTenant(String tenantDomain);
|
* Admin methods
|
||||||
|
*/
|
||||||
public void disableTenant(String tenantDomain);
|
|
||||||
|
public void createTenant(String tenantDomain, char[] adminRawPassword);
|
||||||
public Tenant getTenant(String tenantDomain);
|
|
||||||
|
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot);
|
||||||
public boolean isEnabledTenant(String tenantDomain);
|
|
||||||
}
|
// experimental (unsupported)
|
||||||
|
public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot, String dbUrl);
|
||||||
|
|
||||||
|
public void exportTenant(String tenantDomain, File directoryDestination);
|
||||||
|
|
||||||
|
public void importTenant(String tenantDomain, File directorySource, String contentRoot);
|
||||||
|
|
||||||
|
public boolean existsTenant(String tenantDomain);
|
||||||
|
|
||||||
|
public void deleteTenant(String tenantDomain);
|
||||||
|
|
||||||
|
public void enableTenant(String tenantDomain);
|
||||||
|
|
||||||
|
public void disableTenant(String tenantDomain);
|
||||||
|
|
||||||
|
public Tenant getTenant(String tenantDomain);
|
||||||
|
|
||||||
|
public boolean isEnabledTenant(String tenantDomain);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user