Skip to contentPackage: ScmWorkingDirectory
ScmWorkingDirectory
Coverage
1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
7: * %%
8: * Copyright (C) 2011 - 2023 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.frontend.filesystem.scm.spi;
28:
29: import javax.annotation.Nonnull;
30: import java.util.List;
31: import java.util.Optional;
32: import java.io.IOException;
33: import java.nio.file.Path;
34: import java.net.URI;
35:
36: /***********************************************************************************************************************
37: *
38: * This interface defines the operations required for accessing a working directory of a repository.
39: *
40: * @author Fabrizio Giudici
41: *
42: **********************************************************************************************************************/
43: public interface ScmWorkingDirectory
44: {
45: /*******************************************************************************************************************
46: *
47: * Clones the contents from a given repository.
48: *
49: * @param url the URL of the source repo
50: * @throws InterruptedException if the operation has been interrupted
51: * @throws IOException if something fails
52: *
53: ******************************************************************************************************************/
54: public void cloneFrom (@Nonnull URI url)
55: throws InterruptedException, IOException;
56:
57: /*******************************************************************************************************************
58: *
59: * Fetches changesets from the remote repository.
60: *
61: * @throws InterruptedException if the operation has been interrupted
62: * @throws IOException if something fails
63: *
64: ******************************************************************************************************************/
65: public void fetchChangesets()
66: throws InterruptedException, IOException;
67:
68: /*******************************************************************************************************************
69: *
70: * Returns the current tag of this repository, if present.
71: *
72: * @return the current tag
73: * @throws InterruptedException if the operation has been interrupted
74: * @throws IOException if something fails
75: *
76: ******************************************************************************************************************/
77: @Nonnull
78: public Optional<Tag> getCurrentTag()
79: throws InterruptedException, IOException;
80:
81: /*******************************************************************************************************************
82: *
83: * Checks out the given tag.
84: *
85: * @param tag the tag
86: * @throws InterruptedException if the operation has been interrupted
87: * @throws IOException if something fails
88: *
89: ******************************************************************************************************************/
90: public void checkOut (@Nonnull Tag tag)
91: throws InterruptedException, IOException;
92:
93: /*******************************************************************************************************************
94: *
95: * Returns all the tags in this repository.
96: *
97: * @return the tags
98: * @throws InterruptedException if the operation has been interrupted
99: * @throws IOException if something fails
100: *
101: ******************************************************************************************************************/
102: @Nonnull
103: public List<Tag> getTags()
104: throws InterruptedException, IOException;
105:
106: /*******************************************************************************************************************
107: *
108: * Returns the latest tag in this repository matching the given regular expression, if present.
109: *
110: * @param regexp the regular expression
111: * @return the tag
112: * @throws InterruptedException if the operation has been interrupted
113: * @throws IOException if something fails
114: *
115: ******************************************************************************************************************/
116: @Nonnull
117: public Optional<Tag> getLatestTagMatching (@Nonnull String regexp)
118: throws InterruptedException, IOException;
119:
120: /*******************************************************************************************************************
121: *
122: * Returns the path of the working area.
123: *
124: * @return the path to the working area
125: *
126: ******************************************************************************************************************/
127: @Nonnull
128: public Path getFolder();
129:
130: /*******************************************************************************************************************
131: *
132: * Returns whether the repository is empty.
133: *
134: * @return whether the repository is empty
135: *
136: ******************************************************************************************************************/
137: public boolean isEmpty();
138:
139: /*******************************************************************************************************************
140: *
141: * Returns the name of the configuration folder (e.g. {@code .git} or {@code .hg}.
142: *
143: * @return the name of the configuration folder
144: *
145: ******************************************************************************************************************/
146: @Nonnull
147: public String getConfigFolderName();
148: }