Multi-Tenant node interceptor

- Actually less happening here than it would first appear
 - Some MT bean and interface consolidation
 - The unit test has no meat to it, yet... coming soon!


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-09-05 13:04:46 +00:00
parent f074588b0c
commit 77eb167c2b
35 changed files with 961 additions and 344 deletions

View File

@@ -32,7 +32,7 @@ import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.module.ModuleService;
import org.alfresco.util.EqualsHelper;
@@ -59,7 +59,7 @@ public abstract class AbstractModuleComponent implements ModuleComponent, BeanNa
protected ServiceRegistry serviceRegistry;
protected AuthenticationComponent authenticationComponent;
protected ModuleService moduleService;
private TenantDeployerService tenantDeployerService;
private TenantAdminService tenantAdminService;
private String moduleId;
private String name;
@@ -158,9 +158,9 @@ public abstract class AbstractModuleComponent implements ModuleComponent, BeanNa
this.serviceRegistry = serviceRegistry;
}
public void setTenantDeployerService(TenantDeployerService tenantDeployerService)
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.tenantDeployerService = tenantDeployerService;
this.tenantAdminService = tenantAdminService;
}
/**
@@ -341,7 +341,7 @@ public abstract class AbstractModuleComponent implements ModuleComponent, BeanNa
public final synchronized void execute()
{
// ensure that this has not been executed already
String tenantDomain = tenantDeployerService.getCurrentUserDomain();
String tenantDomain = tenantAdminService.getCurrentUserDomain();
if (! executed.containsKey(tenantDomain))
{
executed.put(tenantDomain, false);

View File

@@ -41,7 +41,7 @@ import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.Tenant;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.ServiceRegistry;
@@ -92,7 +92,7 @@ public class ModuleComponentHelper
private AuthenticationComponent authenticationComponent;
private RegistryService registryService;
private ModuleService moduleService;
private TenantDeployerService tenantDeployerService;
private TenantAdminService tenantAdminService;
private Map<String, Map<String, ModuleComponent>> componentsByNameByModule;
/** Default constructor */
@@ -141,9 +141,9 @@ public class ModuleComponentHelper
this.moduleService = moduleService;
}
public void setTenantDeployerService(TenantDeployerService tenantDeployerService)
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.tenantDeployerService = tenantDeployerService;
this.tenantAdminService = tenantAdminService;
}
/**
@@ -206,7 +206,7 @@ public class ModuleComponentHelper
PropertyCheck.mandatory(this, "authenticationComponent", authenticationComponent);
PropertyCheck.mandatory(this, "registryService", registryService);
PropertyCheck.mandatory(this, "moduleService", moduleService);
PropertyCheck.mandatory(this, "tenantDeployerService", tenantDeployerService);
PropertyCheck.mandatory(this, "tenantAdminService", tenantAdminService);
/*
* Ensure transactionality and the correct authentication
*/
@@ -227,15 +227,15 @@ public class ModuleComponentHelper
final Map<String, Set<String>> mapStartedModules = new HashMap<String, Set<String>>(1);
// Note: for system bootstrap this will be the default domain, else tenant domain for tenant create/import
final String tenantDomainCtx = tenantDeployerService.getCurrentUserDomain();
final String tenantDomainCtx = tenantAdminService.getCurrentUserDomain();
mapExecutedComponents.put(tenantDomainCtx, new HashSet<ModuleComponent>(10));
mapStartedModules.put(tenantDomainCtx, new HashSet<String>(2));
final List<Tenant> tenants;
if (tenantDeployerService.isEnabled() && (tenantDomainCtx.equals(TenantService.DEFAULT_DOMAIN)))
if (tenantAdminService.isEnabled() && (tenantDomainCtx.equals(TenantService.DEFAULT_DOMAIN)))
{
tenants = tenantDeployerService.getAllTenants();
tenants = tenantAdminService.getAllTenants();
for (Tenant tenant : tenants)
{
mapExecutedComponents.put(tenant.getTenantDomain(), new HashSet<ModuleComponent>(10));
@@ -267,7 +267,7 @@ public class ModuleComponentHelper
startModule(module, mapStartedModules.get(tenantDomain), mapExecutedComponents.get(tenantDomain));
return null;
}
}, tenantDeployerService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
}
}
@@ -291,7 +291,7 @@ public class ModuleComponentHelper
checkForMissingModules();
return null;
}
}, tenantDeployerService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenant.getTenantDomain()));
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenant.getTenantDomain()));
}
}
@@ -310,7 +310,7 @@ public class ModuleComponentHelper
checkForOrphanComponents(mapExecutedComponents.get(tenantDomain));
return null;
}
}, tenantDeployerService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantDomain));
}
}
}

View File

@@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map;
import org.alfresco.repo.admin.registry.RegistryService;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.service.cmr.module.ModuleDetails;
import org.alfresco.service.cmr.module.ModuleService;
import org.alfresco.service.descriptor.DescriptorService;
@@ -85,7 +85,7 @@ public class ModuleComponentHelperTest extends BaseAlfrescoTestCase
};
private RegistryService registryService;
private TenantDeployerService tenantDeployerService;
private TenantAdminService tenantDeployerService;
private DescriptorService descriptorService;
private DummyModuleService moduleService;
private ModuleComponentHelper helper;
@@ -97,7 +97,7 @@ public class ModuleComponentHelperTest extends BaseAlfrescoTestCase
super.setUp();
registryService = (RegistryService) ctx.getBean("RegistryService");
tenantDeployerService = (TenantDeployerService) ctx.getBean("tenantAdminService");
tenantDeployerService = (TenantAdminService) ctx.getBean("tenantAdminService");
descriptorService = serviceRegistry.getDescriptorService();
@@ -108,7 +108,7 @@ public class ModuleComponentHelperTest extends BaseAlfrescoTestCase
helper.setRegistryService(registryService);
helper.setServiceRegistry(serviceRegistry);
helper.setDescriptorService(descriptorService);
helper.setTenantDeployerService(tenantDeployerService);
helper.setTenantAdminService(tenantDeployerService);
// Register the components
components = new DummyModuleComponent[3][3]; // i,j
@@ -124,7 +124,7 @@ public class ModuleComponentHelperTest extends BaseAlfrescoTestCase
component.setServiceRegistry(serviceRegistry);
component.setAuthenticationComponent(authenticationComponent);
component.setModuleService(moduleService);
component.setTenantDeployerService(tenantDeployerService);
component.setTenantAdminService(tenantDeployerService);
// Don't initialize the component as that will do the registration. We do it manually.
helper.registerComponent(component);
// Add to array
@@ -266,7 +266,7 @@ public class ModuleComponentHelperTest extends BaseAlfrescoTestCase
super.setServiceRegistry(serviceRegistry);
super.setAuthenticationComponent(authenticationComponent);
super.setModuleService(moduleService);
super.setTenantDeployerService(tenantDeployerService);
super.setTenantAdminService(tenantDeployerService);
super.setModuleId(moduleId);
super.setName(name);

View File

@@ -37,7 +37,7 @@ import java.util.Properties;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.admin.registry.RegistryService;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.tenant.TenantDeployerService;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.module.ModuleDetails;
import org.alfresco.service.cmr.module.ModuleService;
@@ -115,9 +115,9 @@ public class ModuleServiceImpl implements ModuleService
this.moduleComponentHelper.setRegistryService(registryService);
}
public void setTenantDeployerService(TenantDeployerService tenantDeployerService)
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.moduleComponentHelper.setTenantDeployerService(tenantDeployerService);
this.moduleComponentHelper.setTenantAdminService(tenantAdminService);
}
/**