Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.QValueFactory


    }

    protected Map<String, QValue[]> getDescriptors() throws RepositoryException {
        Map<String, QValue[]> descriptorKeys = new HashMap<String, QValue[]>();

        QValueFactory qvf = QValueFactoryImpl.getInstance();

        descriptorKeys.put(Repository.REP_NAME_DESC, new QValue[] {qvf.create("Mock Repository", PropertyType.STRING)});
        descriptorKeys.put(Repository.REP_VENDOR_DESC, new QValue[] {qvf.create("Apache Software Foundation", PropertyType.STRING)});
        descriptorKeys.put(Repository.REP_VENDOR_URL_DESC, new QValue[] {qvf.create("http://www.apache.org/", PropertyType.STRING)});
        descriptorKeys.put(Repository.REP_VERSION_DESC, new QValue[] {qvf.create("2.0", PropertyType.STRING)});
        descriptorKeys.put(Repository.SPEC_NAME_DESC, new QValue[] {qvf.create("Content Repository API for Java(TM) Technology Specification", PropertyType.STRING)});
        descriptorKeys.put(Repository.SPEC_VERSION_DESC, new QValue[] {qvf.create("2.0", PropertyType.STRING)});

        return descriptorKeys;
    }
View Full Code Here


        PropertyState ps = property.getPropertyState(sn, context);
        if (ps == null) {
            return EMPTY;
        } else {
            ValueFactoryImpl vf = (ValueFactoryImpl) context.getSession().getValueFactory();
            QValueFactory qvf = vf.getQValueFactory();
            InternalValue[] values = ps.getValues();
            Value[] lengths = new Value[values.length];
            for (int i = 0; i < lengths.length; i++) {
                long len;
                int type = values[i].getType();
                if (type == PropertyType.NAME) {
                    len = vf.createValue(qvf.create(values[i].getName())).getString().length();
                } else if (type == PropertyType.PATH) {
                    len = vf.createValue(qvf.create(values[i].getPath())).getString().length();
                } else {
                    len = Util.getLength(values[i]);
                }
                lengths[i] = vf.createValue(len);
            }
View Full Code Here

                : create(result, logWriterProvider);
        }

        @Override
        public QValueFactory getQValueFactory() throws RepositoryException {
            QValueFactory result = super.getQValueFactory();
            return result == null
                ? null
                : create(result, logWriterProvider);
        }
View Full Code Here

        this.excerptProvider = exProvider;
        this.spellSuggestion = spellSuggestion;
        if (valueFactory instanceof ValueFactoryQImpl) {
            this.valueFactory = (ValueFactoryQImpl) valueFactory;
        } else {
            QValueFactory qvf = QValueFactoryImpl.getInstance();
            this.valueFactory = new ValueFactoryQImpl(qvf, resolver);
        }
    }
View Full Code Here

        this.excerptProvider = exProvider;
        this.spellSuggestion = spellSuggestion;
        if (valueFactory instanceof ValueFactoryQImpl) {
            this.valueFactory = (ValueFactoryQImpl) valueFactory;
        } else {
            QValueFactory qvf = QValueFactoryImpl.getInstance();
            this.valueFactory = new ValueFactoryQImpl(qvf, resolver);
        }
    }
View Full Code Here

    protected RepositoryService createService(String uri) throws RepositoryException {
        IdFactory idFactory = IdFactoryImpl.getInstance();
        NameFactory nFactory = NameFactoryImpl.getInstance();
        PathFactory pFactory = PathFactoryImpl.getInstance();
        QValueFactory vFactory = QValueFactoryImpl.getInstance();
        return new RepositoryServiceImpl(uri, idFactory, nFactory, pFactory, vFactory);
    }
View Full Code Here

    }

    public void testSetStringValue() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Name propName = resolver.getQName("stringProp");
        QValueFactory vf = rs.getQValueFactory();

        List<String> l = new ArrayList<String>();
        l.add("String value containing \"double quotes\" and \'single\' and \"undeterminated quote.");
        l.add("String value \ncontaining \n\rline \r\nseparators and \t tab.");
        l.add("String value containing \r\n\r\r\n\r\n multiple \r\n\r\n line separators in sequence.");
        l.add("String value containing >diff -char +act ^ters.");
        l.add("String value containing \n>line sep \r+and \r\n-diff\n\r^chars.");
        l.add("String value containing \u0633\u0634 unicode chars.");

        for (String val : l) {
            QValue v = vf.create(val, PropertyType.STRING);
            Batch b = rs.createBatch(si, nid);
            b.addProperty(nid, propName, v);
            rs.submit(b);

            PropertyInfo pi = getPropertyInfo(nid, propName);
View Full Code Here

            pathFactory = (PathFactory) param;
        } else {
            pathFactory = PathFactoryImpl.getInstance();
        }

        QValueFactory vFactory;
        param = parameters.get(PARAM_QVALUE_FACTORY);
        if (param != null && param instanceof QValueFactory) {
            vFactory = (QValueFactory) param;
        } else {
            vFactory = QValueFactoryImpl.getInstance();
View Full Code Here

        if (service == null) {
            String uri = getProperty(PROP_REPOSITORY_URI);
            IdFactory idFactory = IdFactoryImpl.getInstance();
            NameFactory nFactory = NameFactoryImpl.getInstance();
            PathFactory pFactory = PathFactoryImpl.getInstance();
            QValueFactory vFactory = QValueFactoryImpl.getInstance();
            service = new RepositoryServiceImpl(uri, idFactory, nFactory, pFactory, vFactory);
        }
        return service;
    }
View Full Code Here

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            QValueFactory qvf = rs.getQValueFactory();
            b.addProperty(getNodeId("/test"), resolver.getQName("prop"), qvf.create("value", PropertyType.STRING));
            b.addProperty(getNodeId("/test"), resolver.getQName("propMV"), new QValue[] {qvf.create(1), qvf.create(2)});
            rs.submit(b);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.QValueFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.