07-23-2010 12:36 PM
ExportJcrToAlfresco
– src
–> com.test.exportJCR
–> XmlToJcrImporter.java
– mds-model-context.xml
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:mds-model-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
SimpleCredentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
session = repository.login(credentials);
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'extension.dictionaryBootstrap' defined in class path resource [mds-model-context.xml]: Could not resolve parent bean definition 'dictionaryModelBootstrap'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1110)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1055)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:537)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.test.exportJCR.XmlToJcrImporter.connectToRepository(XmlToJcrImporter.java:75)
at com.test.exportJCR.XmlToJcrImporter.importXMLToRepository(XmlToJcrImporter.java:52)
at com.test.exportJCR.ImportJCR.main(ImportJCR.java:16)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dictionaryModelBootstrap' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:827)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1096)
… 10 more
<?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="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/mdsModel.xml</value>
</list>
</property>
</bean>
</beans>
07-26-2010 08:51 AM
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'custom.dictionaryBootstrap' defined in class path resource [com/test/exportJCR/custom-model-context.xml]: Invocation of init method failed; nested exception is org.alfresco.service.cmr.dictionary.DictionaryException: 06260001 Could not import bootstrap model com/test/exportJCR/myCustomModel.xml
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.test.exportJCR.XmlToJcrImporter.connectToRepository(XmlToJcrImporter.java:75)
at com.test.exportJCR.XmlToJcrImporter.importXMLToRepository(XmlToJcrImporter.java:52)
at com.test.exportJCR.ImportJCR.main(ImportJCR.java:16)
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 06260001 Could not import bootstrap model com/test/exportJCR/myCustomModel.xml
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:157)
at org.alfresco.repo.dictionary.DictionaryBootstrap.bootstrap(DictionaryBootstrap.java:104)
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:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1529)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1468)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
… 14 more
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 06260000 Failed to compile model custom:contentmodel
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:106)
at org.alfresco.repo.dictionary.M2Model.compile(M2Model.java:128)
at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModel(DictionaryDAOImpl.java:277)
at org.alfresco.repo.dictionary.DictionaryBootstrap.onDictionaryInit(DictionaryBootstrap.java:153)
… 22 more
Caused by: org.alfresco.service.namespace.NamespaceException: URI http://www.alfresco.org/model/content/1.0 cannot be imported as it is not defined (with prefix cm
at org.alfresco.repo.dictionary.CompiledModel.createLocalPrefixResolver(CompiledModel.java:203)
at org.alfresco.repo.dictionary.CompiledModel.constructDefinitions(CompiledModel.java:128)
at org.alfresco.repo.dictionary.CompiledModel.<init>(CompiledModel.java:88)
… 25 more
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new model –>
<model name="custom:contentmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Custom Document Content Model</description>
<author>My Company</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.jcp.org/jcr/nt/1.0" prefix="nt"/>
</imports>
<!– Introduction of new namespaces defined by this model –>
<namespaces>
<namespace uri="http://www.mycompany.com/model/content/1.0" prefix="mnt"/>
</namespaces>
<types>
<type name="mnt:resource">
<title>Document</title>
<parent>nt:resource</parent>
<properties>
<property name="jcr:name">
<title>Filename</title>
<description>name of the document</description>
<type>d:text</type>
</property>
<property name="jcr:createdDate">
<title>Created</title>
<description>date of creation</description>
<type>d:date</type>
</property>
<property name="jcr:lastModifiedDate">
<title>Last Modified</title>
<description>last time a modification has been made</description>
<type>d:date</type>
</property>
<property name="jcr:type">
<title>Type</title>
<description>type of the document</description>
<type>d:text</type>
</property>
<property name="jcr:extension">
<title>Extension</title>
<description>extension of the document</description>
<type>d:text</type>
</property>
<property name="jcr:owner">
<title>Owner</title>
<description>owner of the document</description>
<type>d:text</type>
</property>
<property name="jcr:ownerMail">
<title>Owner E-mail</title>
<description>e-mail of the owner of the document</description>
<type>d:text</type>
</property>
<property name="jcr:title">
<title>Title</title>
<description>title of the document</description>
<type>d:text</type>
</property>
<property name="jcr:from">
<title>From</title>
<description>sender of the document</description>
<type>d:text</type>
</property>
<property name="jcr:fromMail">
<title>From</title>
<description>e-mail of the sender of the document</description>
<type>d:text</type>
</property>
<property name="jcr:to">
<title>To</title>
<description>recipient of the document</description>
<type>d:text</type>
</property>
<property name="jcr:toMail">
<title>To</title>
<description>e-mail of the recipient of the document</description>
<type>d:text</type>
</property>
<property name="jcr:text">
<title>Text</title>
<description>content of the document</description>
<type>d:text</type>
</property>
<property name="jcr:xPath">
<title>Xpath</title>
<description>xpath of the document</description>
<type>d:text</type>
</property>
<property name="jcr:timeStamp">
<title>Timestamp</title>
<description>JCR-managed timestamp of the document</description>
<type>d:text</type>
</property>
<property name="jcr:flag">
<title>Flag</title>
<description>JCR-managed flag of the document</description>
<type>d:text</type>
</property>
<property name="jcr:path">
<title>Location</title>
<description>Absolute path of the document</description>
<type>d:text</type>
</property>
<property name="jcr:indexable">
<title>Indexable</title>
<description>specify if the content can be indexed</description>
<type>d:text</type>
</property>
<property name="jcr:documentation">
<title>Documentation</title>
<description>the content of the documentation file</description>
<type>d:any</type>
</property>
<property name="jcr:thar">
<title>Thar file</title>
<description>the content of the thar file</description>
<type>d:any</type>
</property>
</properties>
</type>
<type name="mnt:file">
<title>File</title>
<parent>nt:file</parent>
<associations>
<child-association name="cm:containsFiles">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>nt:file</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>true</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsAttachment">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:fileP</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
<type name="mnt:folder">
<title>Folder</title>
<parent>nt:folder</parent>
<associations>
<child-association name="cm:containsCustomFiles">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:file</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsAttachment">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:fileP</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsResources">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:resource</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
<type name="mnt:folderExchange">
<title>Folder</title>
<parent>nt:folder</parent>
<associations>
<child-association name="cm:containsMntFiles">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:file</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsAttachment">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:fileP</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsResources">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:resource</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
<type name="mnt:folderDirectory">
<title>Folder</title>
<parent>nt:folder</parent>
<associations>
<child-association name="cm:containsMntFiles">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:file</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsAttachment">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:fileP</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsResources">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:resource</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsFolderExchange">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:folderExchange</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsCustomFolders">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:folder</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
<type name="mnt:fileP">
<title>Attachment</title>
<parent>nt:file</parent>
<associations>
<child-association name="cm:containsFiles">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>nt:file</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>true</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
<child-association name="cm:containsAttachment">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>mnt:fileP</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
</type>
</types>
</model>
07-28-2010 05:17 AM
07-29-2010 02:23 PM
07-30-2010 05:24 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.