public ConsistencyCheckerImpl(AbstractBundlePersistenceManager pm, ConsistencyCheckListener listener, String lostNFoundId, final UpdateEventChannel eventChannel) { this.pm = pm; this.listener = listener; if (lostNFoundId != null) { this.lostNFoundId = new NodeId(lostNFoundId); } if (eventChannel != null) { this.eventChannel = eventChannel; } }
public ConsistencyCheckerImpl(AbstractBundlePersistenceManager pm, ConsistencyCheckListener listener, String lostNFoundId, final UpdateEventChannel eventChannel) { this.pm = pm; this.listener = listener; if (lostNFoundId != null) { this.lostNFoundId = new NodeId(lostNFoundId); } if (eventChannel != null) { this.eventChannel = eventChannel; } }
/** * Creates a new AddNode action. * * @param transactionId the id of the transaction that executes this action. * @param doc the document to add. */ AddNode(long transactionId, Document doc) { this(transactionId, new NodeId(doc.get(FieldNames.UUID))); this.doc = doc; }
/** * @param uuids the uuids of the referenced nodes. * @throws IllegalArgumentException if one of the uuids is malformed. */ MultiUUIDDocId(String[] uuids) { this.docIds = new UUIDDocId[uuids.length]; for (int i = 0; i < uuids.length; i++) { docIds[i] = new UUIDDocId(new NodeId(uuids[i])); } }
/** * @param uuids the uuids of the referenced nodes. * @throws IllegalArgumentException if one of the uuids is malformed. */ MultiUUIDDocId(String[] uuids) { this.docIds = new UUIDDocId[uuids.length]; for (int i = 0; i < uuids.length; i++) { docIds[i] = new UUIDDocId(new NodeId(uuids[i])); } }
/** * Creates a UUID from the given <code>id</code> String that is converted * to lower case before. * * @param id The user/group id that needs to be converted to a valid NodeId. * @return a new <code>NodeId</code>. */ private NodeId buildNodeId(String id) { UUID uuid = UUID.nameUUIDFromBytes(id.toLowerCase().getBytes(StandardCharsets.UTF_8)); return new NodeId(uuid); }
/** * Creates a UUID from the given <code>id</code> String that is converted * to lower case before. * * @param id The user/group id that needs to be converted to a valid NodeId. * @return a new <code>NodeId</code>. */ private NodeId buildNodeId(String id) { UUID uuid = UUID.nameUUIDFromBytes(id.toLowerCase().getBytes(StandardCharsets.UTF_8)); return new NodeId(uuid); }
/** * Creates a <code>DocId</code> based on a UUID. * * @param uuid the UUID * @return a <code>DocId</code> based on the UUID. * @throws IllegalArgumentException if the <code>uuid</code> is malformed. */ static DocId create(String uuid) { return create(new NodeId(uuid)); }
/** * Creates a random node identifier using a secure random number generator. */ public static NodeId randomId() { Random random = SeededSecureRandom.getInstance(); return new NodeId( // Most significant 64 bits, with version field set to 4 random.nextLong() & 0xFfffFfffFfff0fffL | 0x0000000000004000L, // Least significant 64 bits, with variant field set to IETF random.nextLong() & 0x3fffFfffFfffFfffL | 0x8000000000000000L ); }
/** * Creates a <code>DocId</code> based on a UUID. * * @param uuid the UUID * @return a <code>DocId</code> based on the UUID. * @throws IllegalArgumentException if the <code>uuid</code> is malformed. */ static DocId create(String uuid) { return create(new NodeId(uuid)); }
/** * Return the next available node id. Simply increments the last UUID * returned by <code>1</code>. * * @return next UUID */ private NodeId nextNodeId() { return new NodeId(0, lsbGenerator++); }
public NodeId newNodeId() throws RepositoryException { if (createRandom) { return NodeId.randomId(); } long lsb = nextLsb++; if (lsb >= storedLsb) { store(lsb + cacheSize); } return new NodeId(msb, lsb); }
public boolean collect(Term term, TermDocs tDocs) throws IOException { NodeId id = new NodeId(term.text()); while (tDocs.next()) { int doc = tDocs.doc(); if (parents.containsKey(id)) { parents.put(id, doc); } } return true; } });
public NodeId newNodeId() throws RepositoryException { if (createRandom) { return NodeId.randomId(); } long lsb = nextLsb++; if (lsb >= storedLsb) { store(lsb + cacheSize); } return new NodeId(msb, lsb); }
public boolean collect(Term term, TermDocs tDocs) throws IOException { NodeId id = new NodeId(term.text()); while (tDocs.next()) { int doc = tDocs.doc(); if (parents.containsKey(id)) { parents.put(id, doc); } } return true; } });
private static NodeId randomNodeId(Random r) { if (r.nextInt(100) == 0) { return null; } return new NodeId(r.nextLong(), r.nextLong()); }
public void testToString() { for (NodeId id : ids) { assertEquals(id, new NodeId(id.toString())); } }
public void testGetMostAndLeastSignificantBits() { for (NodeId id : ids) { long msb = id.getMostSignificantBits(); long lsb = id.getLeastSignificantBits(); assertEquals(id, new NodeId(msb, lsb)); } }
@Override protected void setUp() throws Exception { super.setUp(); n = testRootNode.addNode(nodeName1, ntUnstructured); n.addMixin(mixReferenceable); n.addMixin(mixTitle); session.save(); nState = (NodeState) getSearchIndex().getContext().getItemStateManager().getItemState( new NodeId(n.getIdentifier())); }
public void testEmptyBundle() throws Exception { NodePropBundle bundle = new NodePropBundle(NodeId.randomId()); bundle.setParentId(new NodeId(1, 2)); bundle.setNodeTypeName(NameConstants.NT_UNSTRUCTURED); bundle.setMixinTypeNames(Collections.<Name>emptySet()); bundle.setSharedSet(Collections.<NodeId>emptySet()); assertBundleRoundtrip(bundle); assertBundleSerialization(bundle, new byte[] { 2, 0, 0, 1, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0 }); }