Search in sources :

Example 1 with BizClassLoader

use of com.alipay.sofa.ark.container.service.classloader.BizClassLoader 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;
}
Also used : Attributes(java.util.jar.Attributes) ExplodedBizArchive(com.alipay.sofa.ark.loader.ExplodedBizArchive) BizModel(com.alipay.sofa.ark.container.model.BizModel) BizClassLoader(com.alipay.sofa.ark.container.service.classloader.BizClassLoader)

Example 2 with BizClassLoader

use of com.alipay.sofa.ark.container.service.classloader.BizClassLoader in project sofa-ark by alipay.

the class HandleArchiveStage method transformBizArchives.

private Biz transformBizArchives(BizArchive bizArchive) throws Exception {
    BizModel bizModel = new BizModel();
    Attributes manifestMainAttributes = bizArchive.getManifest().getMainAttributes();
    return bizModel.setBizName(manifestMainAttributes.getValue(ARK_BIZ_NAME)).setMainClass(manifestMainAttributes.getValue(MAIN_CLASS_ATTRIBUTE)).setPriority(manifestMainAttributes.getValue(PRIORITY_ATTRIBUTE)).setClassPath(bizArchive.getUrls()).setClassLoader(new BizClassLoader(bizModel.getBizName(), bizModel.getClassPath()));
}
Also used : Attributes(java.util.jar.Attributes) BizModel(com.alipay.sofa.ark.container.model.BizModel) BizClassLoader(com.alipay.sofa.ark.container.service.classloader.BizClassLoader)

Aggregations

BizModel (com.alipay.sofa.ark.container.model.BizModel)2 BizClassLoader (com.alipay.sofa.ark.container.service.classloader.BizClassLoader)2 Attributes (java.util.jar.Attributes)2 ExplodedBizArchive (com.alipay.sofa.ark.loader.ExplodedBizArchive)1