use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class AbstractJournal method init.
/**
* {@inheritDoc}
*/
public void init(String id, NamespaceResolver resolver) throws JournalException {
this.id = id;
this.resolver = resolver;
this.npResolver = new DefaultNamePathResolver(resolver, true);
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class TestAll method getDefaultValue.
/**
* Returns the string value of the identified property default value.
*
* @param def property definition
* @param index default value index
* @return default value
*/
private String getDefaultValue(QPropertyDefinition def, int index) {
try {
QValue[] values = def.getDefaultValues();
NamespaceResolver nsResolver = new AdditionalNamespaceResolver(registry);
NamePathResolver resolver = new DefaultNamePathResolver(nsResolver);
ValueFactoryQImpl factory = new ValueFactoryQImpl(InternalValueFactory.getInstance(), resolver);
return factory.createValue(values[index]).getString();
} catch (RepositoryException e) {
throw new AssertionFailedError(e.getMessage());
}
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit-oak by apache.
the class RepositoryUpgrade method createPropertyDefinitionTemplate.
private PropertyDefinitionTemplate createPropertyDefinitionTemplate(ValueFactory valueFactory, NodeTypeManager ntMgr, QPropertyDefinition def) throws RepositoryException {
PropertyDefinitionTemplate tmpl = ntMgr.createPropertyDefinitionTemplate();
Name name = def.getName();
if (name != null) {
tmpl.setName(getOakName(name));
}
tmpl.setAutoCreated(def.isAutoCreated());
tmpl.setMandatory(def.isMandatory());
tmpl.setOnParentVersion(def.getOnParentVersion());
tmpl.setProtected(def.isProtected());
tmpl.setRequiredType(def.getRequiredType());
tmpl.setMultiple(def.isMultiple());
tmpl.setAvailableQueryOperators(def.getAvailableQueryOperators());
tmpl.setFullTextSearchable(def.isFullTextSearchable());
tmpl.setQueryOrderable(def.isQueryOrderable());
QValueConstraint[] qConstraints = def.getValueConstraints();
if (qConstraints != null && qConstraints.length > 0) {
String[] constraints = new String[qConstraints.length];
for (int i = 0; i < qConstraints.length; i++) {
constraints[i] = qConstraints[i].getString();
}
tmpl.setValueConstraints(constraints);
}
QValue[] qValues = def.getDefaultValues();
if (qValues != null) {
NamePathResolver npResolver = new DefaultNamePathResolver(source.getNamespaceRegistry());
Value[] vs = new Value[qValues.length];
for (int i = 0; i < qValues.length; i++) {
vs[i] = ValueFormat.getJCRValue(qValues[i], npResolver, valueFactory);
}
tmpl.setDefaultValues(vs);
}
return tmpl;
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class SessionImpl method setNamespacePrefix.
/**
* @see javax.jcr.Session#setNamespacePrefix(String, String)
*/
@Override
public void setNamespacePrefix(String prefix, String uri) throws RepositoryException {
super.setNamespacePrefix(prefix, uri);
// Reset name and path caches
npResolver = new DefaultNamePathResolver(this, true);
}
use of org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver in project jackrabbit by apache.
the class AccessControlListImplTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
resolver = new DefaultNamePathResolver(superuser);
vFactory = QValueFactoryImpl.getInstance();
unknownPrincipal = getHelper().getUnknownPrincipal(superuser);
knownPrincipal = new Principal() {
@Override
public String getName() {
return "everyone";
}
};
}
Aggregations