this.defaultTypeName = PropertyType.STRING.getName().toUpperCase(); Map<PropertyType, TypeFactory<?>> factories = new HashMap<PropertyType, TypeFactory<?>>(); this.stringValueFactory = valueFactories.getStringFactory(); this.stringFactory = new Factory<String>(stringValueFactory) { this.booleanFactory = new Factory<Boolean>(valueFactories.getBooleanFactory()); this.longFactory = new Factory<Long>(valueFactories.getLongFactory()); this.doubleFactory = new Factory<Double>(valueFactories.getDoubleFactory()); this.decimalFactory = new Factory<BigDecimal>(valueFactories.getDecimalFactory()); this.dateFactory = new Factory<DateTime>(valueFactories.getDateFactory()) { this.pathFactory = new Factory<Path>(valueFactories.getPathFactory()); this.referenceFactory = new Factory<Reference>(valueFactories.getReferenceFactory()); this.binaryFactory = new Factory<Binary>(valueFactories.getBinaryFactory()) { factories.put(PropertyType.BOOLEAN, this.booleanFactory); factories.put(PropertyType.DATE, this.dateFactory); factories.put(PropertyType.DECIMAL, new Factory<BigDecimal>(valueFactories.getDecimalFactory())); factories.put(PropertyType.DOUBLE, this.doubleFactory); factories.put(PropertyType.LONG, this.longFactory); factories.put(PropertyType.NAME, new Factory<Name>(valueFactories.getNameFactory())); factories.put(PropertyType.OBJECT, new Factory<Object>(valueFactories.getObjectFactory())); factories.put(PropertyType.PATH, this.pathFactory); factories.put(PropertyType.REFERENCE, new Factory<Reference>(valueFactories.getReferenceFactory())); factories.put(PropertyType.WEAKREFERENCE, new Factory<Reference>(valueFactories.getWeakReferenceFactory())); factories.put(PropertyType.URI, new Factory<URI>(valueFactories.getUriFactory())); factories.put(PropertyType.UUID, new Factory<UUID>(valueFactories.getUuidFactory())); factories.put(PropertyType.BINARY, this.binaryFactory); this.typeFactoriesByPropertyType = Collections.unmodifiableMap(factories);
@Before public void beforeEach() { rule = RewriteAsRangeCriteria.INSTANCE; rules = new LinkedList<OptimizerRule>(); rules.add(rule); ExecutionContext execContext = new ExecutionContext(); context = new QueryContext(execContext, mock(Schemata.class), execContext.getValueFactories().getTypeSystem()); print = false; }
protected BaseTransaction( ExecutionContext context, Repository<NodeType, WorkspaceType> repository, UUID rootNodeUuid ) { this.rootNodeUuid = rootNodeUuid; this.context = context; this.propertyFactory = context.getPropertyFactory(); this.valueFactories = context.getValueFactories(); this.pathFactory = valueFactories.getPathFactory(); this.nameFactory = valueFactories.getNameFactory(); this.repository = repository; this.rootLocation = Location.create(pathFactory.createRootPath(), rootNodeUuid); }
private String[] stringValuesOf( Node node, Name propertyName ) { Property property = node.getProperty(propertyName); if (property == null) { // Check whether the property exists with no namespace ... property = node.getProperty(context.getValueFactories().getNameFactory().create(propertyName.getLocalName())); if (property == null) return null; } return context.getValueFactories().getStringFactory().create(property.getValuesAsArray()); }
public PathRequestProcessor( ExecutionContext context, PathRepository repository, Observer observer, boolean updatesAllowed, PathRepositoryTransaction txn ) { super(repository.getSourceName(), context, observer); this.repository = repository; pathFactory = context.getValueFactories().getPathFactory(); this.updatesAllowed = updatesAllowed; this.txn = txn; }
@Override public ThisType setProperty( String propertyName, Object[] values ) { return setProperty(context.getValueFactories().getNameFactory().create(propertyName), values); }
private DateTimeFactory dateFactoryFor( StreamSequencerContext context ) { return context.getValueFactories().getDateFactory(); }
if (value instanceof String) { append(SINGLE_QUOTE); String str = factories.getStringFactory().create(value); append(str); append(SINGLE_QUOTE); append(factories.getPathFactory().create(value)); append(" AS ").append(PropertyType.PATH.getName().toUpperCase()).append(')'); return; append(factories.getNameFactory().create(value)); append(" AS ").append(PropertyType.NAME.getName().toUpperCase()).append(')'); return; String str = factories.getStringFactory().create(value); append("CAST('").append(str).append("' AS ").append(typeName.toUpperCase()).append(')');
protected String readUriFor( String prefix ) { // Read the store ... try { PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory(); Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix); Property uri = store.getProperty(uriPropertyName).on(pathToNamespaceNode); // Get the URI property value ... ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); return stringFactory.create(uri.getFirstValue()); } catch (PathNotFoundException e) { // Nothing to read return null; } }
public On<Conjunction<Graph>> to( InputStream stream, long approximateLength ) { Binary value = getContext().getValueFactories().getBinaryFactory().create(stream, approximateLength); return toValue(value); }
ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); ValueFactory<Boolean> booleanFactory = store.getContext().getValueFactories().getBooleanFactory(); Set<String> generatedPrefixes = null; for (Location nsLocation : nsGraph.getRoot().getChildren()) { PathFactory pathFactory = store.getContext().getValueFactories().getPathFactory(); String prefix = generatePrefix(generatedPrefixes); Path pathToNamespaceNode = pathFactory.create(parentOfNamespaceNodes, prefix);
@Test public void shouldSerializeAndDeserializeMixtureOfSmallAndLargeProperties() throws Exception { Property prop1 = createProperty("p1", "v1"); String value = "v234567890123456789012345678901234567890"; Property prop2 = createProperty("p2", value); Property prop3 = createProperty("p3", "v2"); Property prop4 = createProperty("p4", new String(value)); // make sure it's a different String object Property prop5 = createProperty("p5", valueFactories.getBinaryFactory().create("something")); String binaryValue = "really really long string that will be converted to a binary value and tested like that"; Property prop6 = createProperty("p6", valueFactories.getBinaryFactory().create(binaryValue)); UUID uuid7 = UUID.randomUUID(); Reference ref7 = valueFactories.getReferenceFactory().create(uuid7); Property prop7 = createProperty("p7", ref7); UUID uuid8 = UUID.randomUUID(); Reference ref8 = valueFactories.getReferenceFactory().create(uuid8); Property prop8 = createProperty("p8", ref8); assertSerializableAndDeserializable(serializer, prop1, prop2, prop3, prop4, prop5, prop6, prop7, prop8); assertThat(largeValues.getCount(), is(2)); }
protected String readable( Object obj ) { return valueFactories.getStringFactory().create(obj); }
try { intervalInSeconds = context.getValueFactories().getLongFactory().create(intervalProp.getFirstValue()); } catch (RuntimeException e) { String actualValue = context.getValueFactories().getStringFactory().create(intervalProp.getFirstValue()); problems.addError(RepositoryI18n.unableToUseGarbageCollectionIntervalValue, actualValue);
UuidFactory uuidFactory = context.getValueFactories().getUuidFactory(); ValueFactory<Reference> referenceFactory = context.getValueFactories().getReferenceFactory(); for (Map.Entry<UUID, UUID> oldToNew : oldToNewUuids.entrySet()) { MapNode oldNode = this.getNode(oldToNew.getKey());
ProjectionParser projectionParser, Node node ) { ValueFactory<String> strings = context.getValueFactories().getStringFactory(); Property readOnlyProperty = node.getProperty(ModeShapeLexicon.READ_ONLY); if (readOnlyProperty != null && !readOnlyProperty.isEmpty()) { readOnly = context.getValueFactories().getBooleanFactory().create(readOnlyProperty.getFirstValue());
@Test public void shouldCompareLongAndStringValues() { String strValue = "3"; Long longValue = factories.getLongFactory().create(strValue); assertThat(ValueComparators.OBJECT_COMPARATOR.compare(strValue, longValue), is(0)); assertThat(ValueComparators.OBJECT_COMPARATOR.compare(longValue, strValue), is(0)); }
@Test public void shouldSerializeAndDeserializeReferenceProperty() throws Exception { UUID uuid = UUID.randomUUID(); Property prop = createProperty("p1", valueFactories.getReferenceFactory().create(uuid.toString())); assertSerializableAndDeserializable(serializer, prop); assertThat(largeValues.getCount(), is(0)); }
@Test public void shouldSerializeAndDeserializeBigDecimalProperty() throws Exception { Property prop = createProperty("p1", valueFactories.getDecimalFactory().create("1.0123455243284347375478525485466895512")); assertSerializableAndDeserializable(serializer, prop); assertThat(largeValues.getCount(), is(0)); }
public MapRequestProcessor( ExecutionContext context, MapRepository repository, Observer observer, boolean updatesAllowed ) { super(repository.getSourceName(), context, observer); this.repository = repository; pathFactory = context.getValueFactories().getPathFactory(); propertyFactory = context.getPropertyFactory(); this.updatesAllowed = updatesAllowed; }