03-07-2006 10:49 AM
03-13-2006 04:22 AM
<context-param>
<description>Spring config file locations</description>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:alfresco/web-client-application-context.xml
classpath:alfresco/jcr-context.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.alfresco.web.app.ContextListener</listener-class>
</listener>
<?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="repository-properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
<property name="locations">
<list>
<value>classpath:alfresco/repository.properties</value>
<value>classpath:alfresco/version.properties</value>
<value>classpath:alfresco/domain/transaction.properties</value>
<!– override default core properties –>
<value>classpath:alfresco/extension/custom.properties</value>
</list>
</property>
</bean>
<bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:alfresco/domain/hibernate-cfg.properties</value>
<!– override default hibernate properties –>
<value>classpath:alfresco/extension/custom.properties</value>
</list>
</property>
</bean>
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
</bean>
</beans>
Alfresco looks for any *-context.xml files within the alfresco.extension package.
# Folder where Alfresco stores lucene indexes and some store metadata
dir.root=C:/Alfresco_datastore
#DB settings
db.driver=com.mysql.jdbc.Driver
db.name=alfresco
db.url=jdbc:mysql://localhost:3306/${db.name}
db.username=alfresco
db.password=alfresco
# hibernate settings
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=false
<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository. So, all custom –>
<!– types and aspects added here will automatically be registered –>
<model name="cust:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Custom Model</description>
<author></author>
<version>1.0</version>
<imports>
<!– Import Alfresco Dictionary Definitions –>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!– Import Alfresco Content Domain Model Definitions –>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!– Introduction of new namespaces defined by this model –>
<!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
<namespaces>
<namespace uri="custom.model" prefix="cust"/>
</namespaces>
</model>
public class AlfrescoUtils
{
private static ServletContext context=null;
private static WebApplicationContext webAppCtx = null;
public static ServiceRegistry getServiceRegistry()
{
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return (ServiceRegistry) webAppCtx.getBean(ServiceRegistry.SERVICE_REGISTRY);
}
public static Repository getJCRRepository()
{
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return (Repository) webAppCtx.getBean(RepositoryFactory.REPOSITORY_BEAN);
}
/**
* @return Returns the context.
*/
public static ServletContext getServletContext() {
return context;
}
/**
* @param context The context to set.
*/
public static void setServletContext(ServletContext context) {
AlfrescoUtils.context = context;
webAppCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
}
public static Object getAlfrescoBean(String beanName) {
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return webAppCtx.getBean(beanName);
}
}
03-13-2006 04:23 AM
<context-param>
<description>Spring config file locations</description>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:alfresco/web-client-application-context.xml
classpath:alfresco/jcr-context.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.alfresco.web.app.ContextListener</listener-class>
</listener>
<?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="repository-properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders">
<value>true</value>
</property>
<property name="locations">
<list>
<value>classpath:alfresco/repository.properties</value>
<value>classpath:alfresco/version.properties</value>
<value>classpath:alfresco/domain/transaction.properties</value>
<!– override default core properties –>
<value>classpath:alfresco/extension/custom.properties</value>
</list>
</property>
</bean>
<bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:alfresco/domain/hibernate-cfg.properties</value>
<!– override default hibernate properties –>
<value>classpath:alfresco/extension/custom.properties</value>
</list>
</property>
</bean>
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/customModel.xml</value>
</list>
</property>
</bean>
</beans>
Alfresco looks for any *-context.xml files within the alfresco.extension package.
# Folder where Alfresco stores lucene indexes and some store metadata
dir.root=C:/Alfresco_datastore
#DB settings
db.driver=com.mysql.jdbc.Driver
db.name=alfresco
db.url=jdbc:mysql://localhost:3306/${db.name}
db.username=alfresco
db.password=alfresco
# hibernate settings
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=false
<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository. So, all custom –>
<!– types and aspects added here will automatically be registered –>
<model name="cust:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Custom Model</description>
<author></author>
<version>1.0</version>
<imports>
<!– Import Alfresco Dictionary Definitions –>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!– Import Alfresco Content Domain Model Definitions –>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<!– Introduction of new namespaces defined by this model –>
<!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
<namespaces>
<namespace uri="custom.model" prefix="cust"/>
</namespaces>
</model>
public class AlfrescoUtils
{
private static ServletContext context=null;
private static WebApplicationContext webAppCtx = null;
public static ServiceRegistry getServiceRegistry()
{
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return (ServiceRegistry) webAppCtx.getBean(ServiceRegistry.SERVICE_REGISTRY);
}
public static Repository getJCRRepository()
{
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return (Repository) webAppCtx.getBean(RepositoryFactory.REPOSITORY_BEAN);
}
/**
* @return Returns the context.
*/
public static ServletContext getServletContext() {
return context;
}
/**
* @param context The context to set.
*/
public static void setServletContext(ServletContext context) {
AlfrescoUtils.context = context;
webAppCtx = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
}
public static Object getAlfrescoBean(String beanName) {
assert (getServletContext()!=null) : "The ServletContext is not available in Utils. Please set this during Application startup.";
return webAppCtx.getBean(beanName);
}
}
03-13-2006 04:31 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.