Search in sources :

Example 1 with IdentityImpl

use of org.jboss.as.patching.metadata.impl.IdentityImpl in project wildfly-core by wildfly.

the class IdentityPatchContext method createRollbackPatch.

/**
 * Create a rollback patch based on the recorded actions.
 *
 * @param patchId   the new patch id, depending on release or one-off
 * @param patchType the current patch identity
 * @return the rollback patch
 */
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) {
    // Process elements
    final List<PatchElement> elements = new ArrayList<PatchElement>();
    // Process layers
    for (final PatchEntry entry : getLayers()) {
        final PatchElement element = createRollbackElement(entry);
        elements.add(element);
    }
    // Process add-ons
    for (final PatchEntry entry : getAddOns()) {
        final PatchElement element = createRollbackElement(entry);
        elements.add(element);
    }
    final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState();
    final String name = installedIdentity.getIdentity().getName();
    final IdentityImpl identity = new IdentityImpl(name, modification.getVersion());
    if (patchType == Patch.PatchType.CUMULATIVE) {
        identity.setPatchType(Patch.PatchType.CUMULATIVE);
        identity.setResultingVersion(installedIdentity.getIdentity().getVersion());
    } else if (patchType == Patch.PatchType.ONE_OFF) {
        identity.setPatchType(Patch.PatchType.ONE_OFF);
    }
    final List<ContentModification> modifications = identityEntry.rollbackActions;
    final Patch delegate = new PatchImpl(patchId, "rollback patch", identity, elements, modifications);
    return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity);
}
Also used : InstalledIdentity(org.jboss.as.patching.installation.InstalledIdentity) ArrayList(java.util.ArrayList) IdentityImpl(org.jboss.as.patching.metadata.impl.IdentityImpl) PatchElement(org.jboss.as.patching.metadata.PatchElement) PatchImpl(org.jboss.as.patching.metadata.PatchImpl) ContentModification(org.jboss.as.patching.metadata.ContentModification) Patch(org.jboss.as.patching.metadata.Patch) RollbackPatch(org.jboss.as.patching.metadata.RollbackPatch)

Example 2 with IdentityImpl

use of org.jboss.as.patching.metadata.impl.IdentityImpl in project wildfly-core by wildfly.

the class PatchBuilder method upgradeIdentity.

public PatchIdentityBuilder upgradeIdentity(final String name, final String version, final String resultingVersion) {
    final PatchIdentityBuilder builder = new PatchIdentityBuilder(name, version, PatchType.CUMULATIVE, this);
    final IdentityImpl identity = builder.getIdentity();
    identity.setResultingVersion(resultingVersion);
    this.identity = identity;
    this.patchType = PatchType.CUMULATIVE;
    return builder;
}
Also used : IdentityImpl(org.jboss.as.patching.metadata.impl.IdentityImpl)

Example 3 with IdentityImpl

use of org.jboss.as.patching.metadata.impl.IdentityImpl in project wildfly-core by wildfly.

the class PatchBuilder method oneOffPatchIdentity.

public PatchIdentityBuilder oneOffPatchIdentity(final String name, final String version) {
    final PatchIdentityBuilder builder = new PatchIdentityBuilder(name, version, PatchType.ONE_OFF, this);
    final IdentityImpl identity = builder.getIdentity();
    this.identity = identity;
    this.patchType = PatchType.ONE_OFF;
    return builder;
}
Also used : IdentityImpl(org.jboss.as.patching.metadata.impl.IdentityImpl)

Aggregations

IdentityImpl (org.jboss.as.patching.metadata.impl.IdentityImpl)3 ArrayList (java.util.ArrayList)1 InstalledIdentity (org.jboss.as.patching.installation.InstalledIdentity)1 ContentModification (org.jboss.as.patching.metadata.ContentModification)1 Patch (org.jboss.as.patching.metadata.Patch)1 PatchElement (org.jboss.as.patching.metadata.PatchElement)1 PatchImpl (org.jboss.as.patching.metadata.PatchImpl)1 RollbackPatch (org.jboss.as.patching.metadata.RollbackPatch)1