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

View File

@@ -50,6 +50,16 @@
</property>
</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 -->
<bean id="systemInfoBootstrap" parent="systemInfoImporter">

View File

@@ -31,7 +31,7 @@
</bean>
<bean id="sessionFactoryBase" abstract="true">
<property name="schemaUpdate">
<value>true</value>
<value>false</value>
</property>
<property name="mappingResources">
<list>

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.
*/
public void init()
public void initialize()
{
class TxnWork implements TransactionUtil.TransactionWork<Long>
{