Skip to content

[URMF] VersionManager

Jinyoung Jang edited this page Oct 17, 2016 · 5 revisions

VersionManager

Class Members

[VersionManager.java] *- [Version.java]

λ²„μ „μ˜ ꡬ성은 major number 와 minor number 둜 κ΅¬μ„±λ˜κ³ , 각기 majorVersionUp() λ©”μ„œλ“œμ™€ minorVersionUp() λ©”μ„œλ“œμ— μ˜ν•˜μ—¬ 1μ”© μ¦κ°€ν•œλ‹€.

major.minor

versionUp() method 그리고 majorVersionUp(), minorVersionUp()

private void versionUp(Version lastVersion) throws Exception {
    //copy dev to new version.
    IContainer dev = new ContainerResource();
    dev.setPath(rootPath);

    IContainer newVersion = new ContainerResource();
    newVersion.setPath(versionDirectoryOf(lastVersion)); // μƒˆ λ²„μ „μ˜ 디렉토리 μœ„μΉ˜

    resourceManager.getStorage().copy(dev, newVersion.getPath());

    if(isMakeThisVersionAsProduction()){
        MetaworksRemoteService.autowire(lastVersion);
        lastVersion.makeAsProduction(this);
    }

    MetaworksRemoteService.wrapReturn(new Label("<div class='alert alert-success' role='alert'>Version has been set as " + lastVersion.getMajor() + "." + lastVersion.getMinor() + "</div>"));
}

버전별 μ €μž₯ μœ„μΉ˜

resourceManager.getStorage().copy(dev, newVersion.getPath()) 에 μ˜ν•˜μ—¬ ν˜„μž¬ μˆ˜μ •μ€‘μΈ ν΄λ”μ˜ 볡사본을 λ§Œλ“€μ–΄ μƒˆ λ²„μ „μ˜ ν΄λ”λ‘œ λ³΅μ œν•œλ‹€. μƒˆ λ²„μ „μ˜ 폴더 μœ„μΉ˜λŠ” versionDirectoryOf(lastVersion) λ©”μ„œλ“œμ— μ˜ν•˜μ—¬ ꡬ해지며 μ•„λž˜μ™€ 같이 κ΅¬μ„±λœλ‹€:

protected String versionDirectoryOf(Version version) {
    return appName + β€œ_versions/" + version.getMajor() + "." + version.getMinor();
}

uEngine BPMμ—μ„œ appName 은 β€œcodi” 이닀. λ”°λΌμ„œ, μ•„λž˜μ™€ 같이 ν˜„μž¬ ν΄λ”μ—μ„œμ˜ μ •μ˜ 파일의 μœ„μΉ˜μ™€ νŠΉμ • λ²„μ „μ˜ νŒŒμΌμœ„μΉ˜κ°€ λŒ€μ‘λœλ‹€:

codi/package/Model.process   <β€” ν˜„μž¬ νŽΈμ§‘μ€‘μΈ μœ„μΉ˜
codi_versions/1.1/package/Model.process   <β€” 1.1 λ²„μ „μ˜ μœ„μΉ˜

ν”„λ‘œλ•μ…˜ λ²„μ „μ˜ 정보

버전은 versionUp λ©”μ„œλ“œκ°€ ν˜ΈμΆœλ λ•Œλ§ˆλ‹€ (VersionManager UI μ—μ„œ major version up, minor version up λ²„νŠΌμ„ ν΄λ¦­ν• λ•Œλ§ˆλ‹€) μƒμ„±λœλ‹€. μƒμ„±λœ 버전 μ€‘μ—μ„œ μ–΄λ–€ 버전을 ν”„λ‘œλ•μ…˜ λ²„μ „μœΌλ‘œ 지정할 κ²ƒμΈκ°€λŠ” ν”„λ‘œλ•μ…˜ μ„ΈνŒ…μ— μ˜ν•΄μ„œ μ§€μ •λœλ‹€.

ν”„λ‘œλ•μ…˜ 버전 정보 파일 - version.info.xml

ν”„λ‘œλ•μ…˜ 버전에 λŒ€ν•œ μ •λ³΄λŠ” Version.java λ₯Ό serialize ν•œ xml을 ν•΄λ‹Ή appFolder (uEngine BPM 의 κ²½μš°λŠ” β€œcodi”) μ΄ν•˜μ— μ €μž₯ν•œλ‹€. 이 νŒŒμΌμ„ 읽어듀이면 ν”„λ‘œλ•μ…˜ 정보λ₯Ό μ–»μ–΄λ‚Ό 수 μžˆλ‹€.

protected DefaultResource getProductionVersionInfo() {
    DefaultResource productionInfoXML = new DefaultResource();
    productionInfoXML.setPath(getRootPath() + ".version.info.xml");

    return productionInfoXML;
}

ν”„λ‘œλ•μ…˜ 처리 - Version.makeAsProduction

@ServiceMethod(callByContent = true, target = ServiceMethod.TARGET_SELF)
public void makeAsProduction(@AutowiredFromClient VersionManager versionManager) throws Exception {

    DefaultResource productionInfoXML = versionManager.getProductionVersionInfo();

    ResourceManager resourceManager = MetaworksRemoteService.getComponent(ResourceManager.class);

    resourceManager.getStorage().save(productionInfoXML, this);
    setProduction(true);
}

package 별 version 관리 κΈ°λŠ₯

package λ³„λ‘œ 별도 version 을 관리해야 ν•˜λŠ” 경우 λ‹€μŒκ³Ό 같은 ꡬ쑰λ₯Ό 생각할 수 μžˆλ‹€.

codi/package/Model.process   <β€” ν˜„μž¬ νŽΈμ§‘μ€‘μΈ μœ„μΉ˜
codi_versions/package/1.1/Model.process   <β€” package 의 1.1 λ²„μ „μ˜ μœ„μΉ˜

μš”μ²­λ˜λŠ” resource path 에 λŒ€ν•œ 버전별 μ‹€μ œ μœ„μΉ˜λ₯Ό λ¦¬ν„΄ν•˜λŠ” λ‘œμ§μ€ μ•„λž˜μ™€ 같이 λ³€ν˜•λ˜λ©΄ λœλ‹€.

package org.uengine.modeling.resource;

public class PackageVersionManager extends VersionManager{

    @Override
    protected String versionDirectoryOf() {

        String[] pathElements = getRootPath().split("/");

        String appName = pathElements[0];
        String packageName = pathElements[1];

        String versionPath = appName + VERSION_DIR + "/" + packageName;

        return versionPath;
    }


}

Clone this wiki locally