/** * @see IdentifierResolver#checkFormat(String) */ public void checkFormat(String identifier) throws MalformedPathException { try { NodeId.valueOf(identifier); } catch (IllegalArgumentException e) { throw new MalformedPathException("Invalid identifier: " + identifier); } }
/** * @see IdentifierResolver#checkFormat(String) */ public void checkFormat(String identifier) throws MalformedPathException { try { NodeId.valueOf(identifier); } catch (IllegalArgumentException e) { throw new MalformedPathException("Invalid identifier: " + identifier); } }
/** * Parse a lock token string representation and return the lock * holder node id. * * @param token string representation of lock token * @return lock holder node id * @throws IllegalArgumentException if some field is illegal */ public static NodeId parseLockToken(String token) throws IllegalArgumentException { int sep = token.lastIndexOf('-'); if (sep == -1 || sep == token.length() - 1) { throw new IllegalArgumentException("Separator not found. Token [" + token + "]"); } String uuid = token.substring(0, sep); if (getLockTokenCheckDigit(uuid) != token.charAt(token.length() - 1)) { throw new IllegalArgumentException("Bad check digit. Token [" + token + "]"); } return NodeId.valueOf(uuid); }
/** * Parse a lock token string representation and return the lock * holder node id. * * @param token string representation of lock token * @return lock holder node id * @throws IllegalArgumentException if some field is illegal */ public static NodeId parseLockToken(String token) throws IllegalArgumentException { int sep = token.lastIndexOf('-'); if (sep == -1 || sep == token.length() - 1) { throw new IllegalArgumentException("Separator not found. Token [" + token + "]"); } String uuid = token.substring(0, sep); if (getLockTokenCheckDigit(uuid) != token.charAt(token.length() - 1)) { throw new IllegalArgumentException("Bad check digit. Token [" + token + "]"); } return NodeId.valueOf(uuid); }
/** * @see javax.jcr.Session#getNodeByIdentifier(String) * @since JCR 2.0 */ public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException { NodeId nodeId; try { nodeId = NodeId.valueOf(id); } catch (IllegalArgumentException iae) { throw new RepositoryException("invalid identifier: " + id,iae); } return getNodeById(nodeId); }
/** * @see javax.jcr.Session#getNodeByIdentifier(String) * @since JCR 2.0 */ public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException { NodeId nodeId; try { nodeId = NodeId.valueOf(id); } catch (IllegalArgumentException iae) { throw new RepositoryException("invalid identifier: " + id,iae); } return getNodeById(nodeId); }
/** * Returns a property identifier instance holding the value of the * specified string. The string must be in the format returned by the * {@link #toString() toString()} method of this class. * * @param s a <code>String</code> containing the <code>PropertyId</code> * representation to be parsed. * @return the <code>PropertyId</code> represented by the argument * @throws IllegalArgumentException if the specified string can not be parsed * as a <code>PropertyId</code>. * @see #toString() */ public static PropertyId valueOf(String s) throws IllegalArgumentException { if (s == null) { throw new IllegalArgumentException("invalid PropertyId literal"); } int i = s.indexOf('/'); if (i == -1) { throw new IllegalArgumentException("invalid PropertyId literal"); } String uuid = s.substring(0, i); Name name = NameFactoryImpl.getInstance().create(s.substring(i + 1)); return new PropertyId(NodeId.valueOf(uuid), name); }
/** * Returns a property identifier instance holding the value of the * specified string. The string must be in the format returned by the * {@link #toString() toString()} method of this class. * * @param s a <code>String</code> containing the <code>PropertyId</code> * representation to be parsed. * @return the <code>PropertyId</code> represented by the argument * @throws IllegalArgumentException if the specified string can not be parsed * as a <code>PropertyId</code>. * @see #toString() */ public static PropertyId valueOf(String s) throws IllegalArgumentException { if (s == null) { throw new IllegalArgumentException("invalid PropertyId literal"); } int i = s.indexOf('/'); if (i == -1) { throw new IllegalArgumentException("invalid PropertyId literal"); } String uuid = s.substring(0, i); Name name = NameFactoryImpl.getInstance().create(s.substring(i + 1)); return new PropertyId(NodeId.valueOf(uuid), name); }
private void setUuid() throws SAXException { if(!values.isEmpty()) { String strUuid = null; try { strUuid = values.get(0).text.retrieve(); node.uuid = NodeId.valueOf(strUuid); } catch (IOException e) { throw new SAXException("error while retrieving value", e); } catch (IllegalArgumentException e) { throw new SAXException(new InvalidSerializedDataException("illegal uuid: " + strUuid, e)); } } else { throw new SAXException(new InvalidSerializedDataException("missing value for property jcr:uuid")); } }
/** * {@inheritDoc} */ @Override public boolean itemExists(String absPath) throws RepositoryException { if (absPath != null && absPath.startsWith("[") && absPath.endsWith("]")) { // an identifier segment has been specified (JCR-3014) try { NodeId id = NodeId.valueOf(absPath.substring(1, absPath.length() - 1)); return getItemManager().itemExists(id); } catch (IllegalArgumentException e) { throw new MalformedPathException(absPath); } } return perform(SessionItemOperation.itemExists(absPath)); }
/** * {@inheritDoc} */ @Override public boolean itemExists(String absPath) throws RepositoryException { if (absPath != null && absPath.startsWith("[") && absPath.endsWith("]")) { // an identifier segment has been specified (JCR-3014) try { NodeId id = NodeId.valueOf(absPath.substring(1, absPath.length() - 1)); return getItemManager().itemExists(id); } catch (IllegalArgumentException e) { throw new MalformedPathException(absPath); } } return perform(SessionItemOperation.itemExists(absPath)); }
/** * @see javax.jcr.Session#nodeExists(String) * @since JCR 2.0 */ @Override public boolean nodeExists(String absPath) throws RepositoryException { if (absPath != null && absPath.startsWith("[") && absPath.endsWith("]")) { // an identifier segment has been specified (JCR-3014) try { NodeId id = NodeId.valueOf(absPath.substring(1, absPath.length() - 1)); return getItemManager().itemExists(id); } catch (IllegalArgumentException e) { throw new MalformedPathException(absPath); } } return perform(SessionItemOperation.nodeExists(absPath)); }
/** * @see javax.jcr.Session#nodeExists(String) * @since JCR 2.0 */ @Override public boolean nodeExists(String absPath) throws RepositoryException { if (absPath != null && absPath.startsWith("[") && absPath.endsWith("]")) { // an identifier segment has been specified (JCR-3014) try { NodeId id = NodeId.valueOf(absPath.substring(1, absPath.length() - 1)); return getItemManager().itemExists(id); } catch (IllegalArgumentException e) { throw new MalformedPathException(absPath); } } return perform(SessionItemOperation.nodeExists(absPath)); }
/** * @see IdentifierResolver#getPath(String) */ public Path getPath(String identifier) throws MalformedPathException { try { return context.getHierarchyManager().getPath(NodeId.valueOf(identifier)); } catch (RepositoryException e) { throw new MalformedPathException("Identifier '" + identifier + "' cannot be resolved."); } }
/** * @see IdentifierResolver#getPath(String) */ public Path getPath(String identifier) throws MalformedPathException { try { return context.getHierarchyManager().getPath(NodeId.valueOf(identifier)); } catch (RepositoryException e) { throw new MalformedPathException("Identifier '" + identifier + "' cannot be resolved."); } }
id = NodeId.valueOf(state.uuid);
id = NodeId.valueOf(state.uuid);
Field uuidField = d.getField(FieldNames.UUID); if (uuidField != null) { nodeIdHits.add(NodeId.valueOf(uuidField.stringValue()));
private void readState(DOMWalker walker, NodeReferences refs) throws ItemStateException { // first do some paranoid sanity checks if (!walker.getName().equals(NODEREFERENCES_ELEMENT)) { String msg = "invalid serialization format (unexpected element: " + walker.getName() + ")"; log.debug(msg); throw new ItemStateException(msg); } // check targetId if (!refs.getTargetId().equals(NodeId.valueOf(walker.getAttribute(TARGETID_ATTRIBUTE)))) { String msg = "invalid serialized state: targetId mismatch"; log.debug(msg); throw new ItemStateException(msg); } // now we're ready to read the references data // property id's refs.clearAllReferences(); while (walker.iterateElements(NODEREFERENCE_ELEMENT)) { refs.addReference(PropertyId.valueOf(walker.getAttribute(PROPERTYID_ATTRIBUTE))); } }
private void readState(DOMWalker walker, NodeReferences refs) throws ItemStateException { // first do some paranoid sanity checks if (!walker.getName().equals(NODEREFERENCES_ELEMENT)) { String msg = "invalid serialization format (unexpected element: " + walker.getName() + ")"; log.debug(msg); throw new ItemStateException(msg); } // check targetId if (!refs.getTargetId().equals(NodeId.valueOf(walker.getAttribute(TARGETID_ATTRIBUTE)))) { String msg = "invalid serialized state: targetId mismatch"; log.debug(msg); throw new ItemStateException(msg); } // now we're ready to read the references data // property id's refs.clearAllReferences(); while (walker.iterateElements(NODEREFERENCE_ELEMENT)) { refs.addReference(PropertyId.valueOf(walker.getAttribute(PROPERTYID_ATTRIBUTE))); } }