cancel
Showing results for 
Search instead for 
Did you mean: 

Extending the bootstrap process - follow on from post: 1516

lnagra
Champ in-the-making
Champ in-the-making
Follow on from: http://forums.alfresco.com/viewtopic.php?t=1516

Hi,

I would be interested to know if either felipe or thaneshk got this to work successfully.

I am trying to create spaces and categories at bootstrap in Alfresco ECMS 1.4. We had this working successfully by modifying /alfresco/bootstrap/categories.xml and /alfresco/bootstrap/spaces.xml in Alfresco 1.2.

However, this approach doesn't work very well for upgrading at a later date and it would be nice to try keeping our code seperate from Alfresco's.

I have created a JAR that contains:

alfresco.extension.custom-bootstrap-context.xml
alfresco.extension.bootstrap.custom-categories.xml
alfresco.extension.bootstrap.custom-spaces.xml
alfresco.extension.messages.custom-bootstrap-spaces

The idea is to have the -context.xml read automatically and refer to the custom-categories.xml and custom-spaces.xml

e.g.

alfresco.extension.custom-bootstrap-context.xml



<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <bean id="spacesBootstrap" parent="spacesStoreImporter">
               <property name="bootstrapViews">
                   <list>
                       <props>
                           <prop key="path">/</prop>
                           <prop key="location">alfresco/extension/bootstrap/custom-spaces.xml</prop>
                           <prop key="messages">alfresco/extension/messages/custom-bootstrap-spaces</prop>
                       </props>
                       <props>
                           <prop key="path">/</prop>
                           <prop key="location">alfresco/extension/bootstrap/custom-categories.xml</prop>
                       </props>
                   </list>
               </property>
   </bean>
  
</beans>

e.g.

alfresco.extension.bootstrap.custom-spaces.xml




<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
           xmlns:cm="http://www.alfresco.org/model/content/1.0"
           xmlns:app="http://www.alfresco.org/model/application/1.0">

    <!– NOTE: all replaced properties referenced from repository.properties file must also be
              mapped in the bootstrap-context.xml spacesBootstrap/configuration section –>
   <cm:folder view:childName="${spaces.company_home.childname}">
        <view:acl view:inherit="false">
            <view:ace view:access="ALLOWED">
                <view:authority>GROUP_EVERYONE</view:authority>
                <view:permission>Consumer</view:permission>
            </view:ace>
        </view:acl>
      <app:uifacets />
      <cm:name>${spaces.company_home.name}</cm:name>
      <app:icon>space-icon-default</app:icon>
      <cm:title>${spaces.company_home.name}</cm:title>
      <cm:description>${spaces.company_home.description}</cm:description>
      <cm:contains>
           <cm:folder view:childName="${spaces.published.name}">
                <view:acl view:inherit="false">
                    <view:ace view:access="ALLOWED">
                        <view:authority>guest</view:authority>
                        <view:permission>Consumer</view:permission>
                    </view:ace>
                    <view:ace view:access="ALLOWED">
                        <view:authority>GROUP_EVERYONE</view:authority>
                        <view:permission>Consumer</view:permission>
                    </view:ace>
                </view:acl>
                <app:uifacets />
            <cm:name>${spaces.published.name}</cm:name>
            <app:icon>space-icon-default</app:icon>
            <cm:title>${spaces.published.name}</cm:title>
            <cm:description>${spaces.published.description}</cm:description>
            </cm:folder>
      </cm:contains>
   </cm:folder>

</view:view>

I've dropped the packaged JAR into a clean Alfresco exploded tomcat install in WEB-INF/lib

They don't appear to show. Is this because the bootstrap has already happened?

Is this approach the recommended method for seperating bootstrap configuration from Alfresco code?

Is there a way to force the bootstrap to occur?

Many thanks,

Lakhdip
1 REPLY 1

lnagra
Champ in-the-making
Champ in-the-making
This now seems to get past the bootstrap process and use my extension.
However, Alfresco presents the login screen and upon submitting valid login credentials I get the following error:

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:86)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
… 23 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: Required people system path not found: /sys:system/sys:people
at org.alfresco.repo.security.person.PersonServiceImpl.getPeopleContainer(PersonServiceImpl.java:275)
at org.alfresco.repo.security.person.PersonServiceImpl.createPerson(PersonServiceImpl.java:264)
at org.alfresco.repo.security.person.PersonServiceImpl.createMissingPerson(PersonServiceImpl.java:244)
at org.alfresco.repo.security.person.PersonServiceImpl.getPerson(PersonServiceImpl.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:41)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:210)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:156)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy45.getPerson(Unknown Source)
at org.alfresco.web.bean.LoginBean.login(LoginBean.java:297)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
… 24 more

Any pointers or help would be much appreciated.

Thanks,