use of com.alipay.sofa.ark.loader.ExplodedBizArchive in project sofa-ark by alipay.
the class BizFactoryServiceImpl method createBiz.
@Override
public Biz createBiz(BizArchive bizArchive) throws IOException {
AssertUtils.isTrue(isArkBiz(bizArchive), "Archive must be a ark biz!");
BizModel bizModel = new BizModel();
Attributes manifestMainAttributes = bizArchive.getManifest().getMainAttributes();
bizModel.setBizState(BizState.RESOLVED).setBizName(manifestMainAttributes.getValue(ARK_BIZ_NAME)).setBizVersion(manifestMainAttributes.getValue(ARK_BIZ_VERSION)).setMainClass(manifestMainAttributes.getValue(MAIN_CLASS_ATTRIBUTE)).setPriority(manifestMainAttributes.getValue(PRIORITY_ATTRIBUTE)).setWebContextPath(manifestMainAttributes.getValue(WEB_CONTEXT_PATH)).setDenyImportPackages(manifestMainAttributes.getValue(DENY_IMPORT_PACKAGES)).setDenyImportClasses(manifestMainAttributes.getValue(DENY_IMPORT_CLASSES)).setDenyImportResources(manifestMainAttributes.getValue(DENY_IMPORT_RESOURCES)).setInjectPluginDependencies(getInjectDependencies(manifestMainAttributes.getValue(INJECT_PLUGIN_DEPENDENCIES))).setInjectExportPackages(manifestMainAttributes.getValue(INJECT_EXPORT_PACKAGES)).setClassPath(bizArchive.getUrls()).setClassLoader(new BizClassLoader(bizModel.getIdentity(), getBizUcp(bizModel.getClassPath()), bizArchive instanceof ExplodedBizArchive));
return bizModel;
}
use of com.alipay.sofa.ark.loader.ExplodedBizArchive in project sofa-ark by alipay.
the class BizFactoryServiceImpl method createBiz.
@Override
public Biz createBiz(File file) throws IOException {
BizArchive bizArchive;
if (ArkConfigs.isEmbedEnable()) {
File unpackFile = new File(file.getAbsolutePath() + "-unpack");
if (!unpackFile.exists()) {
unpackFile = FileUtils.unzip(file, file.getAbsolutePath() + "-unpack");
}
if (file.exists()) {
file.delete();
}
file = unpackFile;
bizArchive = new ExplodedBizArchive(unpackFile);
} else {
JarFile bizFile = new JarFile(file);
JarFileArchive jarFileArchive = new JarFileArchive(bizFile);
bizArchive = new JarBizArchive(jarFileArchive);
}
BizModel biz = (BizModel) createBiz(bizArchive);
biz.setBizTempWorkDir(file);
return biz;
}
Aggregations