Fix AR-1208

- Issuers were using Spring init to load data.  The Hibernate database auto-update was switch on and this bypassed the SchemaBootstrap.
 - Added an AvmBootstrap bean for initializing AVM components that require DB interaction


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5042 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-05 17:23:09 +00:00
parent 34b12db95e
commit b37ec12379
5 changed files with 87 additions and 7 deletions

View File

@@ -6,8 +6,7 @@
<!-- ID Issuers. --> <!-- ID Issuers. -->
<bean id="nodeIssuer" class="org.alfresco.repo.avm.Issuer" <bean id="nodeIssuer" class="org.alfresco.repo.avm.Issuer" depends-on="avmDAOs" >
depends-on="avmDAOs" init-method="init">
<property name="name"> <property name="name">
<value>node</value> <value>node</value>
</property> </property>
@@ -16,8 +15,7 @@
</property> </property>
</bean> </bean>
<bean id="layerIssuer" class="org.alfresco.repo.avm.Issuer" <bean id="layerIssuer" class="org.alfresco.repo.avm.Issuer" depends-on="avmDAOs" >
depends-on="avmDAOs" init-method="init">
<property name="name"> <property name="name">
<value>layer</value> <value>layer</value>
</property> </property>

View File

@@ -49,6 +49,16 @@
</list> </list>
</property> </property>
</bean> </bean>
<!-- Bootstrap the AVM -->
<bean id="avmBootstrap" class="org.alfresco.repo.avm.AvmBootstrap" >
<property name="issuers">
<list>
<ref bean="nodeIssuer" />
<ref bean="layerIssuer" />
</list>
</property>
</bean>
<!-- Bootstrap Files --> <!-- Bootstrap Files -->

View File

@@ -31,7 +31,7 @@
</bean> </bean>
<bean id="sessionFactoryBase" abstract="true"> <bean id="sessionFactoryBase" abstract="true">
<property name="schemaUpdate"> <property name="schemaUpdate">
<value>true</value> <value>false</value>
</property> </property>
<property name="mappingResources"> <property name="mappingResources">
<list> <list>
@@ -58,7 +58,7 @@
<!-- from elsewhere --> <!-- from elsewhere -->
<!-- --> <!-- -->
<value>org/jbpm/graph/action/Script.hbm.xml</value> <value>org/jbpm/graph/action/Script.hbm.xml</value>
<value>org/jbpm/db/hibernate.queries.hbm.xml</value> <value>org/jbpm/db/hibernate.queries.hbm.xml</value>
<value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value> <value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value>
<value>org/jbpm/graph/def/Node.hbm.xml</value> <value>org/jbpm/graph/def/Node.hbm.xml</value>
<value>org/jbpm/graph/def/Transition.hbm.xml</value> <value>org/jbpm/graph/def/Transition.hbm.xml</value>

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2006 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.repo.avm;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.util.AbstractLifecycleBean;
import org.springframework.context.ApplicationEvent;
/**
* This component ensures that the AVM system is properly bootstrapped
* and that this is done in the correct order relative to other
* bootstrap components.
*
* @see #setIssuers(List)
* @see org.alfresco.repo.avm.Issuer
*
* @author Derek Hulley
*/
public class AvmBootstrap extends AbstractLifecycleBean
{
private List<Issuer> issuers;
public AvmBootstrap()
{
issuers = new ArrayList<Issuer>(0);
}
/**
* Provide a list of {@link Issuer issuers} to bootstrap on context initialization.
*
* @see #onBootstrap(ApplicationEvent)
*/
public void setIssuers(List<Issuer> issuers)
{
this.issuers = issuers;
}
/**
* Initialize the issuers.
*/
@Override
protected void onBootstrap(ApplicationEvent event)
{
for (Issuer issuer : issuers)
{
issuer.initialize();
}
}
/** NO-OP */
@Override
protected void onShutdown(ApplicationEvent event)
{
// Nothing
}
}

View File

@@ -65,7 +65,7 @@ public class Issuer
/** /**
* After the database is up, get our value. * After the database is up, get our value.
*/ */
public void init() public void initialize()
{ {
class TxnWork implements TransactionUtil.TransactionWork<Long> class TxnWork implements TransactionUtil.TransactionWork<Long>
{ {