use of org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider in project sling by apache.
the class RepositoryTestHelper method createOakRepository.
public static Repository createOakRepository(NodeStore nodeStore) {
DefaultWhiteboard whiteboard = new DefaultWhiteboard();
final Oak oak = new Oak(nodeStore).with(new InitialContent()).with(JcrConflictHandler.createJcrConflictHandler()).with(new EditorHook(new VersionEditorProvider())).with(new OpenSecurityProvider()).with(new NamespaceEditorProvider()).with(new TypeEditorProvider()).with(new ConflictValidatorProvider()).with(//getDefaultWorkspace())
"default").with(whiteboard);
// if (commitRateLimiter != null) {
// oak.with(commitRateLimiter);
// }
final ContentRepository contentRepository = oak.createContentRepository();
return new RepositoryImpl(contentRepository, whiteboard, new OpenSecurityProvider(), 1000, null);
}
use of org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider in project sling by apache.
the class OakSlingRepositoryManager method acquireRepository.
@Override
protected Repository acquireRepository() {
final BundleContext bundleContext = componentContext.getBundleContext();
final Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
this.indexProvider.start(whiteboard);
this.indexEditorProvider.start(whiteboard);
this.oakExecutorServiceReference = bundleContext.registerService(Executor.class.getName(), new Executor() {
@Override
public void execute(Runnable command) {
threadPool.execute(command);
}
}, new Hashtable<String, Object>());
final Oak oak = new Oak(nodeStore).withAsyncIndexing("async", 5);
final Jcr jcr = new Jcr(oak, false).with(new InitialContent()).with(new ExtraSlingContent()).with(JcrConflictHandler.createJcrConflictHandler()).with(new VersionHook()).with(securityProvider).with(new NameValidatorProvider()).with(new NamespaceEditorProvider()).with(new TypeEditorProvider()).with(new ConflictValidatorProvider()).with(indexProvider).with(indexEditorProvider).with(getDefaultWorkspace()).with(whiteboard).withFastQueryResultSize(true).withObservationQueueLength(configuration.oak_observation_queue_length());
if (commitRateLimiter != null) {
jcr.with(commitRateLimiter);
}
jcr.createContentRepository();
return new TcclWrappingJackrabbitRepository((JackrabbitRepository) jcr.createRepository());
}
use of org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider in project jackrabbit-oak by apache.
the class InitialContent method initialize.
@Override
public void initialize(@Nonnull NodeBuilder builder) {
builder.setProperty(JCR_PRIMARYTYPE, NT_REP_ROOT, Type.NAME);
if (!builder.hasChildNode(JCR_SYSTEM)) {
NodeBuilder system = builder.child(JCR_SYSTEM);
system.setProperty(JCR_PRIMARYTYPE, NT_REP_SYSTEM, Type.NAME);
system.child(JCR_VERSIONSTORAGE).setProperty(JCR_PRIMARYTYPE, REP_VERSIONSTORAGE, Type.NAME);
system.child(JCR_NODE_TYPES).setProperty(JCR_PRIMARYTYPE, NT_REP_NODE_TYPES, Type.NAME);
system.child(VersionConstants.JCR_ACTIVITIES).setProperty(JCR_PRIMARYTYPE, VersionConstants.REP_ACTIVITIES, Type.NAME);
Namespaces.setupNamespaces(system);
}
NodeBuilder versionStorage = builder.child(JCR_SYSTEM).child(JCR_VERSIONSTORAGE);
if (prePopulateVS && !isInitialized(versionStorage)) {
createIntermediateNodes(versionStorage);
}
if (!builder.hasChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)) {
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder);
NodeBuilder uuid = IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.<String>of(JCR_UUID), null);
uuid.setProperty("info", "Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable').");
NodeBuilder nodetype = IndexUtils.createIndexDefinition(index, "nodetype", true, false, ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null);
nodetype.setProperty("info", "Oak index for queries with node type, and possibly path restrictions, " + "for example \"/jcr:root/content//element(*, mix:language)\".");
IndexUtils.createReferenceIndex(index);
index.child("counter").setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME).setProperty(TYPE_PROPERTY_NAME, NodeCounterEditorProvider.TYPE).setProperty(IndexConstants.ASYNC_PROPERTY_NAME, IndexConstants.ASYNC_PROPERTY_NAME).setProperty("info", "Oak index that allows to estimate " + "how many nodes are stored below a given path, " + "to decide whether traversing or using an index is faster.");
}
// squeeze node state before it is passed to store (OAK-2411)
NodeState base = squeeze(builder.getNodeState());
NodeStore store = new MemoryNodeStore(base);
registerBuiltIn(RootFactory.createSystemRoot(store, new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null));
NodeState target = store.getRoot();
target.compareAgainstBaseState(base, new ApplyDiff(builder));
}
use of org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider in project jackrabbit-oak by apache.
the class TestUtil method registerNodeType.
public static void registerNodeType(NodeBuilder builder, String nodeTypeDefn) {
// Taken from org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
NodeState base = ModifiedNodeState.squeeze(builder.getNodeState());
NodeStore store = new MemoryNodeStore(base);
Root root = RootFactory.createSystemRoot(store, new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null);
NodeTypeRegistry.register(root, IOUtils.toInputStream(nodeTypeDefn), "test node types");
NodeState target = store.getRoot();
target.compareAgainstBaseState(base, new ApplyDiff(builder));
}
use of org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider in project jackrabbit-oak by apache.
the class LuceneIndexAggregation2Test method createRepository.
@Override
protected ContentRepository createRepository() {
LuceneIndexProvider provider = new LuceneIndexProvider();
return new Oak().with(new InitialContent() {
@Override
public void initialize(@Nonnull NodeBuilder builder) {
super.initialize(builder);
// registering additional node types for wider testing
InputStream stream = null;
try {
stream = LuceneIndexAggregation2Test.class.getResourceAsStream("test_nodetypes.cnd");
NodeState base = builder.getNodeState();
NodeStore store = new MemoryNodeStore(base);
Root root = RootFactory.createSystemRoot(store, new EditorHook(new CompositeEditorProvider(new NamespaceEditorProvider(), new TypeEditorProvider())), null, null, null);
NodeTypeRegistry.register(root, stream, "testing node types");
NodeState target = store.getRoot();
target.compareAgainstBaseState(base, new ApplyDiff(builder));
} catch (Exception e) {
LOG.error("Error while registering required node types. Failing here", e);
fail("Error while registering required node types");
} finally {
printNodeTypes(builder);
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
LOG.debug("Ignoring exception on stream closing.", e);
}
}
}
}
}).with(new OpenSecurityProvider()).with(((QueryIndexProvider) provider.with(getNodeAggregator()))).with((Observer) provider).with(new LuceneIndexEditorProvider()).createContentRepository();
}
Aggregations