Add PushResult class
[egit/zawir.git] / org.spearce.jgit / src / org / spearce / jgit / transport / PushResult.java
blobf7fbd586c59998fb35ba9837c585458f76285b8f
1 /*
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or
7 * without modification, are permitted provided that the following
8 * conditions are met:
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * - Neither the name of the Git Development Community nor the
19 * names of its contributors may be used to endorse or promote
20 * products derived from this software without specific prior
21 * written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 package org.spearce.jgit.transport;
40 import java.util.Collection;
41 import java.util.Collections;
42 import java.util.Map;
44 /**
45 * Result of push operation to the remote repository. Holding information of
46 * {@link OperationResult} and remote refs updates status.
48 * @see Transport#push(org.spearce.jgit.lib.ProgressMonitor, Collection)
50 public class PushResult extends OperationResult {
51 private Map<String, RemoteRefUpdate> remoteUpdates = Collections.emptyMap();
53 /**
54 * Get status of remote refs updates. Together with
55 * {@link #getAdvertisedRefs()} it provides full description/status of each
56 * ref update.
57 * <p>
58 * Returned collection is not sorted in any order.
59 * </p>
61 * @return collection of remote refs updates
63 public Collection<RemoteRefUpdate> getRemoteUpdates() {
64 return Collections.unmodifiableCollection(remoteUpdates.values());
67 /**
68 * Get status of specific remote ref update by remote ref name. Together
69 * with {@link #getAdvertisedRef(String)} it provide full description/status
70 * of this ref update.
72 * @param refName
73 * remote ref name
74 * @return status of remote ref update
76 public RemoteRefUpdate getRemoteUpdate(final String refName) {
77 return remoteUpdates.get(refName);
80 protected void setRemoteUpdates(
81 final Map<String, RemoteRefUpdate> remoteUpdates) {
82 this.remoteUpdates = remoteUpdates;