ServiceAssemblyEnvironment env = new ServiceAssemblyEnvironment();
env.setRootDir(rootDir);
env.setInstallDir(new File(rootDir, "install"));
env.setSusDir(new File(rootDir, "sus"));
env.setStateFile(new File(rootDir, "state.xml"));
ServiceAssemblyLifeCycle salc = container.getRegistry().registerServiceAssembly(assembly.getDescriptor().getServiceAssembly(), env);
if (env.getStateFile().isFile()) {
salc.restore();
} else {
salc.start();
}
}