You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Darren Hartford <dh...@ghsinc.com> on 2006/12/29 18:02:02 UTC

Custom nodeType, WebDAV

Hey all,
I'm trying to get custom nodeTypes to work, and be able to inject for
and search on those nodetypes through WebDAV.

I've made a custom nodetype in
/repository/nodetypes/faxtest_nodetypes.xml
===================================
<nodeTypes xmlns:FAX="http://customfaxnamespace.nowhere"
           xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
  <nodeType name="FAX:masternode"
            isMixin="true" hasOrderableChildNodes="false"
primaryItemName="">
        <supertypes>
            <supertype>nt:base</supertype>
        </supertypes>

    <propertyDefinition name="FAX:category"
                 requiredType="String" autoCreated="true"
mandatory="false"
                 onParentVersion="IGNORE" protected="false"
multiple="true">
      <valueConstraints>
      </valueConstraints>
      <defaultValues>
                <defaultValue>NONE</defaultValue>
      </defaultValues>
    </propertyDefinition>
  </nodeType>
</nodeTypes>
===============================

?Is the above nodetype definition correct if the expectation is to
populate FAX:category?




Second issue is how to inject this custom property through WebDAV.  It
looks like you are required to use the namespace, but could someone
confirm this please.  Looking at the results in the XMLRepository, they
all store the namespace.

=================
//webdav propertyname
PropertyName pfax = new
PropertyName("http://customfaxnamespace.nowhere","category");
=================
//results in the XMLRepo /data
<?xml version="1.0" encoding="UTF-8"?>
<property name="{http://customfaxnamespace.nowhere}category"
parentUUID="2682945c-ed31-419a-b944-90bd13aaa1de" multiValued="false"
definitionId="806470580" modCount="3" type="String">
	<values>
		<value>TESTCATEGORY1</value>
	</values>
</property>
===================

?When using WebDAV to populate properties, do you need to explicitly
enter the namespace as defined in the nodetype.xml?





Third issue - how do you search using the SQL this new custom nodeType?
========
String query = "SELECT * from nt:base where contains(FAX:category,
'TESTCATEGORY1')";
========
This throws a Bad Request exception
<dcr:class>javax.jcr.query.InvalidQueryException</dcr:class><dcr:message
>FAX</dcr:message>.  If I replace FAX with the FQN namespace, it again
throughs an exception on the 'http:' piece.  Since I recently learned
you can not wrap the <searchrequest> header that usually defines the
xlms:<namespace> around the query, I'm a little lost.  As for searching,
not sure if I need to explicitly define indexing somewhere or not for
this new nodeType.


I have already read through
http://jackrabbit.apache.org/doc/nodetype/index.html, and have been
looking at the source, but am confused why this is not working.  Please
forgive my ignorance and rather long e-mail - want to make sure I'm not
missing anything.

-D