private Name createNodeName() { int n = (int) System.currentTimeMillis() + new Random().nextInt(); final String localName = Integer.toHexString(n); final NameFactory nameFactory = NameFactoryImpl.getInstance(); return nameFactory.create("{}" + localName); }
/** * Utility method that returns the given string as a name in the default * namespace. * * @param name string name * @return A <code>Name</code> object. */ protected static Name getName(String name) { return NameFactoryImpl.getInstance().create(Name.NS_DEFAULT_URI, name); }
private Name createNodeName() { int n = (int) System.currentTimeMillis() + new Random().nextInt(); final String localName = Integer.toHexString(n); final NameFactory nameFactory = NameFactoryImpl.getInstance(); return nameFactory.create("{}" + localName); }
@Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { final Name name = NameFactoryImpl.getInstance().create(uri, localName); if (name.equals(SV_NODE)) { if (skip()) { depth--; } else { path.pop(); } } }
public Object visit(ASTExcerptFunction node, Object data) { root.addSelectProperty(NameFactoryImpl.getInstance().create(Name.NS_REP_URI, "excerpt(.)")); return data; } }, root);
private Name getHandleName(final RepositoryImpl repository) { if (handleNodeName == null) { try { final String hippoUri = repository.getNamespaceRegistry().getURI("hippo"); handleNodeName = NameFactoryImpl.getInstance().create(hippoUri, "handle"); } catch (NamespaceException e) { log.warn("hippo prefix not yet available"); } } return handleNodeName; }
private Name getDocumentName(final RepositoryImpl repository) { if (documentNodeName == null) { try { final String hippoUri = repository.getNamespaceRegistry().getURI("hippo"); documentNodeName = NameFactoryImpl.getInstance().create(hippoUri, "document"); } catch (NamespaceException e) { log.warn("hippo prefix not yet available"); } } return documentNodeName; }
/** * Utility method, converting a string into a name. * * @param s string * @return name */ private static Name toName(String s) { return NameFactoryImpl.getInstance().create("", s); } }
private static void fillSupportedPrivilegeMap(List<SupportedPrivilege> sps, Map<Name, SupportedPrivilege> spMap, NameFactory nameFactory) throws NamespaceException, IllegalNameException { for (SupportedPrivilege sp : sps) { Privilege p = sp.getPrivilege(); Name privName = nameFactory.create(p.getNamespace().getURI(), p.getName()); spMap.put(privName, sp); List<SupportedPrivilege> agg = Arrays.asList(sp.getSupportedPrivileges()); if (!agg.isEmpty()) { fillSupportedPrivilegeMap(agg, spMap, nameFactory); } } }
private static Name decode(Name name) { String decodedLN = ISO9075.decode(name.getLocalName()); if (decodedLN.equals(name.getLocalName())) { return name; } else { return NAME_FACTORY.create(name.getNamespaceURI(), decodedLN); } } }
private static Name encode(Name name) { String encoded = ISO9075.encode(name.getLocalName()); if (encoded.equals(name.getLocalName())) { return name; } else { return NameFactoryImpl.getInstance().create(name.getNamespaceURI(), encoded); } } }
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { NameFactory factory = NameFactoryImpl.getInstance(); try { return new SimpleFieldComparator(nsMappings.translateName(factory.create(fieldname)), FieldNames.PROPERTY_LENGTHS, numHits); } catch (IllegalNameException e) { throw Util.createIOException(e); } }
private Name toName(String name) throws IllegalNameException, NamespaceException { Name n = resolver.getQName(name); String decodedLocalName = ISO9075.decode(n.getLocalName()); return NAME_FACTORY.create(n.getNamespaceURI(), decodedLocalName); }
private Name toName(String name) throws IllegalNameException, NamespaceException { Name n = resolver.getQName(name); String decodedLocalName = ISO9075.decode(n.getLocalName()); return NAME_FACTORY.create(n.getNamespaceURI(), decodedLocalName); }
private static Name randomName(Random r) { if (r.nextInt(100) == 0) { return null; } return factory.create(randomString(r), randomString(r)); }
public void testFindNodeEscape() throws RepositoryException { Name n = NameFactoryImpl.getInstance().create("", "someone" + "@apache.org"); nodeResolver.findNode(n, UserConstants.NT_REP_USER); } }
protected void setUp() throws Exception { factory = InternalValueFactory.getInstance(); rootPath = PathFactoryImpl.getInstance().getRootPath(); testName = NameFactoryImpl.getInstance().create(Name.NS_JCR_URI, "data"); reference = NodeId.randomId().toString(); }
protected void setUp() throws Exception { super.setUp(); RepositoryService service = helper.getRepositoryService(); factory = service.getQValueFactory(); rootPath = service.getPathFactory().getRootPath(); testName = service.getNameFactory().create(Name.NS_JCR_URI, "data"); reference = getProperty("reference"); }
/** Test for node type item definitions. */ public void testItemNodeType() { QNodeTypeDefinition def = getNodeType("itemNodeType"); assertEquals("itemNodeType primaryItemName", FACTORY.create(TEST_NAMESPACE, "emptyItem"), def.getPrimaryItemName()); assertEquals("itemNodeType propertyDefs", 10, def.getPropertyDefs().length); QPropertyDefinition pdef = getPropDef("itemNodeType", null); assertTrue("itemNodeType wildcard property", pdef.definesResidual()); }