CodeUpgraderFactoryImpl.java 1.7 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.jcr.Session
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Property
 *  org.apache.felix.scr.annotations.Service
 *  org.osgi.service.component.ComponentContext
 */
package com.day.cq.compat.codeupgrade.impl;

import com.day.cq.compat.codeupgrade.impl.CodeUpgraderImpl;
import com.day.cq.compat.codeupgrade.impl.NodeBackupImpl;
import com.day.cq.compat.codeupgrade.internal.api.CodeUpgrader;
import com.day.cq.compat.codeupgrade.internal.api.CodeUpgraderFactory;
import com.day.cq.compat.codeupgrade.internal.api.NodeBackup;
import java.util.Dictionary;
import javax.jcr.Session;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.service.component.ComponentContext;

@Component(metatype=1, label="%CodeUpgraderFactoryImpl.name", description="%CodeUpgraderFactoryImpl.description")
@Service
public class CodeUpgraderFactoryImpl
implements CodeUpgraderFactory {
    private String backupRootPath;
    @Property(value={"/var/upgrade/backup/5.3"})
    public static final String PROP_BACKUP_ROOT_PATH = "backup.root.path";

    @Override
    public CodeUpgrader createUpgrader(Session s, String configPath) throws Exception {
        return new CodeUpgraderImpl(s, configPath);
    }

    @Override
    public NodeBackup createNodeBackup() {
        return new NodeBackupImpl(this.backupRootPath);
    }

    public void activate(ComponentContext ctx) throws Exception {
        Dictionary properties = ctx.getProperties();
        this.backupRootPath = (String)properties.get("backup.root.path");
    }
}