-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from spyrkob/api
Create API for manifest ops
- Loading branch information
Showing
7 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/org/wildfly/prospero/extras/ProsperoExtras.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.wildfly.prospero.extras; | ||
|
||
import org.wildfly.prospero.extras.manifest.ManifestOperations; | ||
import org.wildfly.prospero.extras.manifest.ManifestOperationsFactory; | ||
|
||
public class ProsperoExtras { | ||
|
||
public static ManifestOperations manifestOperations() { | ||
return ManifestOperationsFactory.getNewInstance(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/org/wildfly/prospero/extras/manifest/ManifestOperations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.wildfly.prospero.extras.manifest; | ||
|
||
import org.wildfly.channel.ChannelManifest; | ||
import org.wildfly.installationmanager.ArtifactChange; | ||
import org.wildfly.prospero.extras.manifest.merge.VersionMergeStrategy; | ||
|
||
import java.util.List; | ||
|
||
public interface ManifestOperations { | ||
|
||
/** | ||
* Merges streams from two manifests. | ||
* | ||
* Creates a manifest containing streams from both input manifests. If the same stream is available in both input | ||
* manifests, the conflict is resolved using a merge strategy. | ||
* <ul> | ||
* <li>The LATEST merge strategy compares the versions and picks the latest stream.</li> | ||
* <li>The FIRST merge strategy chooses the stream from {@code manifestOne}.</li> | ||
* </ul> | ||
* @param manifestOne - first manifest to merge | ||
* @param manifestTwo - second manifest to merge | ||
* @param mergeStrategy - merging strategy used if the stream is found in both manifests | ||
* @param mergedManifestName - optional name of the generated manifest | ||
* @param mergedManifestId - optional id of the generated manifest | ||
* @return - merged manifest | ||
*/ | ||
ChannelManifest merge(ChannelManifest manifestOne, ChannelManifest manifestTwo, | ||
VersionMergeStrategy.Strategies mergeStrategy, | ||
String mergedManifestName, String mergedManifestId); | ||
|
||
/** | ||
* Performs a diff of {@code manifestOne} and {@code manifestTwo}. | ||
* | ||
* @param manifestOne - first manifest to diff | ||
* @param manifestTwo - second manifest to diff | ||
* @return - list of changed streams representes as {@link ArtifactChange}s | ||
*/ | ||
List<ArtifactChange> diff(ChannelManifest manifestOne, ChannelManifest manifestTwo); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/wildfly/prospero/extras/manifest/ManifestOperationsFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.wildfly.prospero.extras.manifest; | ||
|
||
public abstract class ManifestOperationsFactory { | ||
|
||
public static ManifestOperations getNewInstance() { | ||
return new ManifestOperationsImpl(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/org/wildfly/prospero/extras/manifest/ManifestOperationsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.wildfly.prospero.extras.manifest; | ||
|
||
import org.wildfly.channel.ChannelManifest; | ||
import org.wildfly.installationmanager.ArtifactChange; | ||
import org.wildfly.prospero.extras.manifest.diff.ManifestsDiffCommand; | ||
import org.wildfly.prospero.extras.manifest.merge.ManifestMergeCommand; | ||
import org.wildfly.prospero.extras.manifest.merge.VersionMergeStrategy; | ||
|
||
import java.util.List; | ||
|
||
class ManifestOperationsImpl implements ManifestOperations { | ||
|
||
@Override | ||
public ChannelManifest merge(ChannelManifest manifestOne, ChannelManifest manifestTwo, | ||
VersionMergeStrategy.Strategies mergeStrategy, | ||
String mergedManifestName, String mergedManifestId) { | ||
return ManifestMergeCommand.merge(manifestOne, manifestTwo, mergeStrategy, mergedManifestName, mergedManifestId); | ||
} | ||
|
||
@Override | ||
public List<ArtifactChange> diff(ChannelManifest manifestOne, ChannelManifest manifestTwo) { | ||
return ManifestsDiffCommand.manifestDiff(manifestOne, manifestTwo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters