jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kooper <sergeysach...@list.ru>
Subject Re: propertyDefinition fails to import
Date Wed, 01 Apr 2009 12:34:42 GMT



Stefan Guggisberg wrote:
> 
> On Mon, Mar 30, 2009 at 6:54 PM, Kooper <sergeysachkov@list.ru> wrote:
>>
>> Hi,
>> I have an issue with import/export node types in JackRabbit. I have
>> method
>> for import nodetypes:
>>
>> public static void importNodeType(Session session, String fileName)
>>                        throws InvalidNodeTypeDefException,
>> RepositoryException,
>>                        ParseException, IOException {
>>                Workspace ws = session.getWorkspace();
>>                NodeTypeManagerImpl ntTypeMgr = (NodeTypeManagerImpl) ws
>>                                .getNodeTypeManager();
>>                NodeTypeRegistry ntr = ntTypeMgr.getNodeTypeRegistry();
>>                InputStream inputStream = new FileInputStream(fileName);
>>                NodeTypeDef[] defs = NodeTypeReader.read(inputStream);
>>                Set coll = new HashSet();
>>                for (int i = 0; i < defs.length; i++) {
>>                        coll.add(defs[i]);
>>                }
>>
>>                ntr.registerNodeTypes(coll);
>>
>>        }
>>
>> and xml file with node types:
>> <nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
>> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
>> xmlns:jcr="http://www.jcp.org/jcr/1.0" >
>> <nodeType name="Value Test" isMixin="true" hasOrderableChildNodes="false"
>> primaryItemName="" >
>> <supertypes>
>> <supertype>nt:base</supertype>
>> </supertypes>
>> <propertyDefinitions>
>> <propertyDefinition name="Animals" requiredType="String"
>> autoCreated="false"
>> mandatory="false" onParentVersion="COPY" protected="false"
>> multiple="false"
>>>
>> <valueConstraints>
>> <valueConstraint>Dog</valueConstraint>
>> <valueConstraint>Cat</valueConstraint>
>> <valueConstraint>Bird</valueConstraint>
>> <valueConstraint>Bear</valueConstraint>
>> <valueConstraint>Spider</valueConstraint>
>> <valueConstraint>Snake</valueConstraint>
>> </valueConstraints>
>> </propertyDefinition>
>> <propertyDefinition name="Country" requiredType="String"
>> autoCreated="false"
>> mandatory="false" onParentVersion="COPY" protected="false"
>> multiple="false"
>>>
>> <valueConstraints>
>> <valueConstraint>Ukraine</valueConstraint>
>> <valueConstraint>USA</valueConstraint>
>> </valueConstraints>
>> </propertyDefinition>
>> <propertyDefinition name="Conference" requiredType="String"
>> autoCreated="false" mandatory="false" onParentVersion="COPY"
>> protected="false" multiple="false" >
>> <valueConstraints>
>> <valueConstraint>Big10</valueConstraint>
>> <valueConstraint>Big12</valueConstraint>
>> <valueConstraint>SEC</valueConstraint>
>> <valueConstraint>PAC10</valueConstraint>
>> </valueConstraints>
>> </propertyDefinition>
>> </propertyDefinitions>
>> </nodeType>
>> </nodeTypes>
>>
>> import completes successfullty no exception thrown but custom_node.xml
>> seems
>> to miss all propertyDefinitions in it.
>> e.g:
>> <nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
>> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
>> xmlns:jcr="http://www.jcp.org/jcr/1.0" >
>> <nodeType name="Value Test" isMixin="true" hasOrderableChildNodes="false"
>> primaryItemName="" >
>> <supertypes>
>> <supertype>nt:base</supertype>
>> </supertypes>
>> </nodeType>
>> </nodeTypes>
>>
>>  Does anyone meet the issue and could help me with it?
> 
> the format is incorrect. omit the <propertyDefinitions/> element and
> everything should be working as expected. see [1] for a DTD for the
> (internal) node type serialization format.
> 
> cheers
> stefan
> 
> [1]
> http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml?view=markup
> 
>> Thank you in advance
>> --
>> View this message in context:
>> http://www.nabble.com/propertyDefinition-fails-to-import-tp22787679p22787679.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

Thank you very much for reply. It helped a lot.
-- 
View this message in context: http://www.nabble.com/propertyDefinition-fails-to-import-tp22787679p22825481.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message