알프레스코

MT(multi-tenancy) 환경에서의 bootstrap 문제.

naucika 2015. 1. 12. 15:29

MT 환경이 아닌경우, 아래와 같이 bootstrap 을 만들어서 사용자 기본 경로나, 카테고리등을 생성하고 있었으나, MT환경으로 전화되면서 추가 태넌트가 생길때 아래와 같은 bootstrap 이 작동되지 않는 문제가 생겼다. 

<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


<bean id="${project.artifactId}.bootstrap" parent="spacesStoreImporter" depends-on="com.uwisoene.edms.dictionaryBootstrap">


<property name="useExistingStore">

<!-- If false the content will not be imported if the store exists -->

<value>true</value>

</property>


<property name="uuidBinding">

<!-- <value>REPLACE_EXISTING</value> -->

<!--<value>UPDATE_EXISTING</value>-->

<!-- <value>CREATE_NEW_WITH_UUID</value> -->

<value>REMOVE_EXISTING</value>

<!-- <value>CREATE_NEW</value> -->

</property>


<property name="bootstrapViews">

<list>

<props>

<prop key="path">/${spaces.company_home.childname}</prop>

<prop key="location">alfresco/module/${project.artifactId}/bootstrap/companys_initilize.xml</prop>

</props>

<props>

<prop key="path">/cm:categoryRoot/cm:generalclassifiable</prop>

<prop key="location">alfresco/module/${project.artifactId}/bootstrap/wocategory_initilize.xml</prop>

</props>

</list>

</property>

</bean>


</beans>


MT환경에서의 bootstrap 이 어떻게 작동하나 찾아보았더니, 결국 태넌트 생성시에 MTadmin 서비스에서 필요한 bootstrap 등을 생성하도록 되어 있다. 시스템 시작시엔 extension 의 bootstrap 들을 아래와 같이 수행시켜준다.


alfresco 의 bootstrap-context.xml 은 아래와 같이 각 모듈별 extension 의 bootstrap 설정파일을 읽어드린다. 

<!-- Bootstrap any extensions -->   

<import resource="classpath*:alfresco/extension/bootstrap/*-context.xml" />


그러나 태넌트 생성시 돌아가는 MTAdminService 는 아래와 같이 일부 확장된 bootstrap 만을 고정시켜 돌려주고 있다.

 RetryingTransactionCallback<Object> doImportCallback = new RetryingTransactionCallback<Object>()

                    {

                        public Object execute() throws Throwable

                        {

                            // create tenant-specific stores

                            ImporterBootstrap userImporterBootstrap = (ImporterBootstrap)ctx.getBean("userBootstrap-mt");

                            bootstrapUserTenantStore(userImporterBootstrap, tenantDomain, tenantAdminRawPassword);

                            

                            ImporterBootstrap systemImporterBootstrap = (ImporterBootstrap)ctx.getBean("systemBootstrap-mt");

                            bootstrapSystemTenantStore(systemImporterBootstrap, tenantDomain);

                            

                            // deprecated

                            ImporterBootstrap versionImporterBootstrap = (ImporterBootstrap)ctx.getBean("versionBootstrap-mt");

                            bootstrapVersionTenantStore(versionImporterBootstrap, tenantDomain);

                            

                            ImporterBootstrap version2ImporterBootstrap = (ImporterBootstrap)ctx.getBean("version2Bootstrap-mt");

                            bootstrapVersionTenantStore(version2ImporterBootstrap, tenantDomain);

                            

                            ImporterBootstrap spacesArchiveImporterBootstrap = (ImporterBootstrap)ctx.getBean("spacesArchiveBootstrap-mt");

                            bootstrapSpacesArchiveTenantStore(spacesArchiveImporterBootstrap, tenantDomain);

                            

                            ImporterBootstrap spacesImporterBootstrap = (ImporterBootstrap)ctx.getBean("spacesBootstrap-mt");

                            bootstrapSpacesTenantStore(spacesImporterBootstrap, tenantDomain);


                            thumbnailRegistry.initThumbnailDefinitions();

                    

                            // TODO janv - resolve this conflict later

                            /* Note: assume for now that all tenant deployers can lazily init

                            

                            // notify listeners that tenant has been created & hence enabled

                            for (TenantDeployer tenantDeployer : tenantDeployers)

                            {

                                tenantDeployer.onEnableTenant();

                            }

                            */

                            

                            // bootstrap workflows

                            for (WorkflowDeployer workflowDeployer : workflowDeployers)

                            {

                                workflowDeployer.init();

                            }                            

                            

                            // bootstrap modules (if any)

                            moduleService.startModules();

                            

                            return null;

                        }

                    };

요는, 시스템 시작시 bootstrap custom 은 MT에선 동작하지 않는것 같다. 

1) spacesBootstrap-mt 를 재정의한다. ?

2) MTAdminServiceImple 을 건드려 버린다. ?


ㅜ.ㅜ