1 /* 2 * ModeShape (http://www.modeshape.org) 3 * See the COPYRIGHT.txt file distributed with this work for information 4 * regarding copyright ownership. Some portions may be licensed 5 * to Red Hat, Inc. under one or more contributor license agreements. 6 * See the AUTHORS.txt file in the distribution for a full listing of 7 * individual contributors. 8 * 9 * Unless otherwise indicated, all code in ModeShape is licensed 10 * to you under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation; either version 2.1 of 12 * the License, or (at your option) any later version. 13 * 14 * ModeShape is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this software; if not, write to the Free 21 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 22 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 23 */ 24 package org.modeshape.graph.io; 25 26 import java.util.List; 27 import net.jcip.annotations.NotThreadSafe; 28 import org.modeshape.graph.ExecutionContext; 29 import org.modeshape.graph.property.Path; 30 import org.modeshape.graph.property.Property; 31 32 /** 33 * Interface used internally as the destination for the requests. This is used to abstract whether the requests should be 34 * submitted immediately or in a single batch. 35 */ 36 @NotThreadSafe 37 public interface Destination { 38 39 /** 40 * Obtain the execution context of the destination. 41 * 42 * @return the destination's execution context 43 */ 44 public ExecutionContext getExecutionContext(); 45 46 /** 47 * Create a node at the supplied path and with the supplied attributes. The path will be absolute. 48 * 49 * @param path the absolute path of the node 50 * @param properties the properties for the node; never null, but may be empty if there are no properties 51 */ 52 public void create( Path path, 53 List<Property> properties ); 54 55 /** 56 * Create a node at the supplied path and with the supplied attributes. The path will be absolute. 57 * 58 * @param path the absolute path of the node 59 * @param firstProperty the first property 60 * @param additionalProperties the remaining properties for the node 61 */ 62 public void create( Path path, 63 Property firstProperty, 64 Property... additionalProperties ); 65 66 /** 67 * Sets the given properties on the node at the supplied path. The path will be absolute. 68 * 69 * @param path the absolute path of the node 70 * @param properties the remaining properties for the node 71 */ 72 public void setProperties( Path path, 73 Property... properties ); 74 75 /** 76 * Signal to this destination that any enqueued create requests should be submitted. Usually this happens at the end of the 77 * document parsing, but an implementer must allow for it to be called multiple times and anytime during parsing. 78 */ 79 public void submit(); 80 }