DocumentBasedWaveletThreadState( DocumentEventRouter<? super E, E, ?> router, E container) { this.router = router; this.container = container; threadStates = DocumentBasedBasicMap.create(router, container, Serializer.STRING, threadStateSerializer, WaveletBasedSupplement.THREAD_TAG, WaveletBasedSupplement.ID_ATTR, WaveletBasedSupplement.STATE_ATTR); }
DocumentBasedGadgetState(DocumentEventRouter<? super E, E, ?> router, E container) { this.router = router; this.container = container; state = DocumentBasedBasicMap.create(router, container, Serializer.STRING, Serializer.STRING, WaveletBasedSupplement.STATE_TAG, WaveletBasedSupplement.NAME_ATTR, WaveletBasedSupplement.VALUE_ATTR); }
/** * Private constructor. Use the factory method ({@link #create}) instead. * * @param document the document to wrap */ // VisibleForTesting AttachmentDocumentWrapper(ObservableMutableDocument<N, E, T> document) { internalDocument = document; dataMap = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(document), document.getDocumentElement(), new KeyNameSerializer(), Serializer.STRING, "node", "key", "value"); }
/** * Creates a target map on a substrate. */ private <N, E extends N> void createTargetOn(ValueContext<N, E> context) { DocumentBasedBasicMap<E, String, Integer> target = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(context.doc), context.container, Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); // Eventually, the target map and the substrate should be sufficient state for all tests. // However, in order to simulate document events, the two need to be wrapped together in a // FungeStack so that Java knows that the element type-parameters match. stack = new FungeStack<N, E, String, Integer>( context, target, Serializer.STRING, Serializer.INTEGER); }
/** * Creates a target map on a substrate. */ private <N, E extends N> void createTargetOn(ValueContext<N, E> context) { DocumentBasedBasicMap<E, String, Integer> target = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(context.doc), context.container, Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); // Eventually, the target map and the substrate should be sufficient state for all tests. // However, in order to simulate document events, the two need to be wrapped together in a // FungeStack so that Java knows that the element type-parameters match. stack = new FungeStack<N, E, String, Integer>( context, target, Serializer.STRING, Serializer.INTEGER); }
/** * Creates a Permissions view on top of the document. */ public static DocumentBasedIndexability create(final DocEventRouter doc) { DocumentBasedBasicMap<Doc.E, ParticipantId, IndexDecision> map = DocumentBasedBasicMap.create(doc, doc.getDocument().getDocumentElement(), ParticipantIdSerializer.INSTANCE, new Serializer.EnumSerializer<IndexDecision>(IndexDecision.class), INDEX_TAG, ADDRESS_ATTR, VALUE_ATTR); DocumentBasedIndexability indexability = new DocumentBasedIndexability(map); map.addListener(indexability); return indexability; }
@Override protected void createMap() { ObservablePluggableMutableDocument doc = BasicFactories.observableDocumentProvider().create( "data", Collections.<String, String> emptyMap()); map = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(doc), doc.getDocumentElement(), Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); } }
@Override protected void createMap() { ObservablePluggableMutableDocument doc = BasicFactories.observableDocumentProvider().create( "data", Collections.<String, String> emptyMap()); map = DocumentBasedBasicMap.create(DefaultDocumentEventRouter.create(doc), doc.getDocumentElement(), Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); } }