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.request;
25
26 import org.modeshape.graph.Location;
27 import org.modeshape.graph.property.Path;
28
29 /**
30 * A Request to make changes in a graph.
31 */
32 public abstract class ChangeRequest extends Request implements Cloneable {
33
34 private static final long serialVersionUID = 1L;
35
36 protected ChangeRequest() {
37 }
38
39 /**
40 * Determine if this request changes the branch at the given path.
41 *
42 * @param workspace the name of the workspace; may not be null
43 * @param path the path; may not be null
44 * @return true if this request changes a node under the given path
45 */
46 public abstract boolean changes( String workspace,
47 Path path );
48
49 /**
50 * Get the location of the top-most node that is to be changed by this request. If this request has been completed, this
51 * location will always have a {@link Location#getPath() path}.
52 *
53 * @return the location changed by this request
54 */
55 public abstract Location changedLocation();
56
57 /**
58 * Get the name of the workspace that was changed by this request.
59 *
60 * @return the name of the workspace changed by this request
61 */
62 public abstract String changedWorkspace();
63
64 /**
65 * {@inheritDoc}
66 * <p>
67 * This method does not clone the results.
68 * </p>
69 *
70 * @see java.lang.Object#clone()
71 */
72 @Override
73 public abstract ChangeRequest clone();
74 }