本文整理汇总了Java中org.ofbiz.base.component.ComponentConfig.enabled方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentConfig.enabled方法的具体用法?Java ComponentConfig.enabled怎么用?Java ComponentConfig.enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.component.ComponentConfig
的用法示例。
在下文中一共展示了ComponentConfig.enabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadComponent
import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
private void loadComponent(ComponentConfig config) {
// make sure the component is enabled
if (!config.enabled()) {
Debug.logInfo("Not Loaded component : [" + config.getComponentName() + "] (disabled)", module);
return;
}
Debug.logInfo("Loaded component : [" + config.getComponentName() + "]", module);
}
示例2: loadComponent
import org.ofbiz.base.component.ComponentConfig; //导入方法依赖的package包/类
private void loadComponent(ComponentConfig config) {
// make sure the component is enabled
if (!config.enabled()) {
Debug.logInfo("Not Loading component : [" + config.getComponentName() + "] (disabled)", module);
return;
}
Debug.logInfo("Loading component : [" + config.getComponentName() + "]", module);
List<ComponentConfig.ClasspathInfo> classpathInfos = config.getClasspathInfos();
String configRoot = config.getRootLocation();
configRoot = configRoot.replace('\\', '/');
// set the root to have a trailing slash
if (!configRoot.endsWith("/")) {
configRoot = configRoot + "/";
}
if (classpathInfos != null) {
String nativeLibExt = System.mapLibraryName("someLib").replace("someLib", "").toLowerCase();
for (ComponentConfig.ClasspathInfo cp: classpathInfos) {
String location = cp.location.replace('\\', '/');
// set the location to not have a leading slash
if (location.startsWith("/")) {
location = location.substring(1);
}
if (!"jar".equals(cp.type) && !"dir".equals(cp.type)) {
Debug.logError("Classpath type '" + cp.type + "' is not supported; '" + location + "' not loaded", module);
continue;
}
String dirLoc = location;
if (dirLoc.endsWith("/*")) {
// strip off the slash splat
dirLoc = location.substring(0, location.length() - 2);
}
File path = FileUtil.getFile(configRoot + dirLoc);
if (path.exists()) {
if (path.isDirectory()) {
if ("dir".equals(cp.type)) {
classPath.addComponent(configRoot + location);
}
// load all .jar, .zip files and native libs in this directory
boolean containsNativeLibs = false;
for (File file: path.listFiles()) {
String fileName = file.getName().toLowerCase();
if (fileName.endsWith(".jar") || fileName.endsWith(".zip")) {
classPath.addComponent(file);
} else if (fileName.endsWith(nativeLibExt)) {
containsNativeLibs = true;
}
}
if (containsNativeLibs) {
libraryPath.addComponent(path);
}
} else {
// add a single file
classPath.addComponent(configRoot + location);
}
} else {
Debug.logWarning("Location '" + configRoot + dirLoc + "' does not exist", module);
}
}
}
}