当前位置: 首页>>代码示例>>Java>>正文


Java ComponentConfig类代码示例

本文整理汇总了Java中org.ofbiz.base.component.ComponentConfig的典型用法代码示例。如果您正苦于以下问题:Java ComponentConfig类的具体用法?Java ComponentConfig怎么用?Java ComponentConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ComponentConfig类属于org.ofbiz.base.component包,在下文中一共展示了ComponentConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWebAppInfo

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
/**
 * Returns a map containing component information
 */
public static Map<String, Object> getWebAppInfo(ComponentConfig component, WebappInfo webApp) {
    Map<String, Object> componentMap = FastMap.newInstance();
    String webSiteId = null;
    try {
        webSiteId = WebAppUtil.getWebSiteId(webApp);
    } catch (Exception e) {
        ;
    }
    componentMap.put("compName", component.getComponentName());
    componentMap.put("rootLocation", component.getRootLocation());
    componentMap.put("enabled", component.enabled() == true ? "Y" : "N");
    componentMap.put("webAppInfo", webApp);
    componentMap.put("webAppName", webApp.getName());
    componentMap.put("contextRoot", webApp.getContextRoot()); // equals
                                                              // mount point
    componentMap.put("webSiteId", webSiteId != null ? webSiteId : "noWebSiteId");
    componentMap.put("location", webApp.getLocation());
    return componentMap;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:ComponentUtil.java

示例2: getSolrWebappInfo

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public static WebappInfo getSolrWebappInfo() {
    WebappInfo solrApp = null;
    try {
        ComponentConfig cc = ComponentConfig.getComponentConfig("solr");
        for(WebappInfo currApp : cc.getWebappInfos()) {
            if ("solr".equals(currApp.getName())) {
                solrApp = currApp;
                break;
            }
        }
    }
    catch(ComponentException e) {
        throw new IllegalStateException(e);
    }
    return solrApp;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:17,代码来源:SolrUtil.java

示例3: ModelReader

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
private ModelReader(String modelName) throws GenericEntityException {
    this.modelName = modelName;
    entityResourceHandlers = new LinkedList<ResourceHandler>();
    resourceHandlerEntities = new HashMap<ResourceHandler, Collection<String>>();
    entityResourceHandlerMap = new HashMap<String, ResourceHandler>();

    EntityModelReader entityModelReaderInfo = EntityConfig.getInstance().getEntityModelReader(modelName);

    if (entityModelReaderInfo == null) {
        throw new GenericEntityConfException("Cound not find an entity-model-reader with the name " + modelName);
    }

    // get all of the main resource model stuff, ie specified in the entityengine.xml file
    for (Resource resourceElement : entityModelReaderInfo.getResourceList()) {
        ResourceHandler handler = new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation());
        entityResourceHandlers.add(handler);
    }

    // get all of the component resource model stuff, ie specified in each ofbiz-component.xml file
    for (ComponentConfig.EntityResourceInfo componentResourceInfo: ComponentConfig.getAllEntityResourceInfos("model")) {
        if (modelName.equals(componentResourceInfo.readerName)) {
            entityResourceHandlers.add(componentResourceInfo.createResourceHandler());
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:26,代码来源:ModelReader.java

示例4: ModelGroupReader

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public ModelGroupReader(String modelName) throws GenericEntityConfException {
    this.modelName = modelName;
    EntityGroupReader entityGroupReaderInfo = EntityConfig.getInstance().getEntityGroupReader(modelName);

    if (entityGroupReaderInfo == null) {
        throw new GenericEntityConfException("Cound not find an entity-group-reader with the name " + modelName);
    }
    for (Resource resourceElement: entityGroupReaderInfo.getResourceList()) {
        this.entityGroupResourceHandlers.add(new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation()));
    }

    // get all of the component resource group stuff, ie specified in each ofbiz-component.xml file
    for (ComponentConfig.EntityResourceInfo componentResourceInfo: ComponentConfig.getAllEntityResourceInfos("group")) {
        if (modelName.equals(componentResourceInfo.readerName)) {
            this.entityGroupResourceHandlers.add(componentResourceInfo.createResourceHandler());
        }
    }

    // preload caches...
    getGroupCache();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:ModelGroupReader.java

示例5: getKeyManagers

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException {
    List<KeyManager> keyMgrs = new LinkedList<KeyManager>();
    for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) {
        if (ksi.isCertStore()) {
            KeyStore ks = ksi.getKeyStore();
            if (ks != null) {
                List<KeyManager> newKeyManagers = Arrays.asList(getKeyManagers(ks, ksi.getPassword(), alias));
                keyMgrs.addAll(newKeyManagers);
                if (Debug.verboseOn()) Debug.logVerbose("Loaded another cert store, adding [" + (newKeyManagers == null ? "0" : newKeyManagers.size()) + "] KeyManagers for alias [" + alias + "] and keystore: " + ksi.createResourceHandler().getFullLocation(), module);
            } else {
                throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation());
            }
        }
    }

    return keyMgrs.toArray(new KeyManager[keyMgrs.size()]);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:SSLUtil.java

示例6: getTrustManagers

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public static TrustManager[] getTrustManagers() throws IOException, GeneralSecurityException, GenericConfigException {
    MultiTrustManager tm = new MultiTrustManager();
    tm.add(KeyStoreUtil.getSystemTrustStore());
    if (tm.getNumberOfKeyStores() < 1) {
        Debug.logWarning("System truststore not found!", module);
    }

    for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) {
        if (ksi.isTrustStore()) {
            KeyStore ks = ksi.getKeyStore();
            if (ks != null) {
                tm.add(ks);
            } else {
                throw new IOException("Unable to load keystore: " + ksi.createResourceHandler().getFullLocation());
            }
        }
    }

    return new TrustManager[] { tm };
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:21,代码来源:SSLUtil.java

示例7: JunitSuiteWrapper

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public JunitSuiteWrapper(String componentName, String suiteName, String testCase) {
    for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(componentName)) {
        ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler();

        try {
            Document testSuiteDocument = testSuiteResource.getDocument();
            // TODO create TestSuite object based on this that will contain its TestCase objects

            Element documentElement = testSuiteDocument.getDocumentElement();
            ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement, testCase);

            // make sure there are test-cases configured for the suite
            if (suiteName != null && !modelTestSuite.getSuiteName().equals(suiteName)) {
                continue;
            }
            if (modelTestSuite.getTestList().size() > 0) {
                this.modelTestSuiteList.add(modelTestSuite);
            }
        } catch (GenericConfigException e) {
            String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]";
            Debug.logError(e, errMsg, module);
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:25,代码来源:JunitSuiteWrapper.java

示例8: hasBasePermission

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public static boolean hasBasePermission(GenericValue userLogin, HttpServletRequest request) {
    Security security = (Security) request.getAttribute("security");
    if (security != null) {
        ServletContext context = (ServletContext) request.getAttribute("servletContext");
        String serverId = (String) context.getAttribute("_serverId");
        // get a context path from the request, if it is empty then assume it is the root mount point
        String contextPath = request.getContextPath();
        if (UtilValidate.isEmpty(contextPath)) {
            contextPath = "/";
        }
        ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
        if (info != null) {
            return hasApplicationPermission(info, security, userLogin);
        } else {
            Debug.logInfo("No webapp configuration found for : " + serverId + " / " + contextPath, module);
        }
    } else {
        Debug.logWarning("Received a null Security object from HttpServletRequest", module);
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:LoginWorker.java

示例9: getWebappInfoFromWebsiteId

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
/**
 * Returns the <code>WebappInfo</code> instance associated to the specified web site ID.
 * Throws <code>IllegalArgumentException</code> if the web site ID was not found.
 * 
 * @param webSiteId
 * @throws IOException
 * @throws SAXException
 */
public static WebappInfo getWebappInfoFromWebsiteId(String webSiteId) throws IOException, SAXException {
    Assert.notNull("webSiteId", webSiteId);
    // SCIPIO: Go through cache first. No need to synchronize, doesn't matter.
    WebappInfo res = webappInfoWebSiteIdCache.get(webSiteId);
    if (res != null) {
        return res;
    }
    else {
        for (WebappInfo webAppInfo : ComponentConfig.getAllWebappResourceInfos()) {
            if (webSiteId.equals(WebAppUtil.getWebSiteId(webAppInfo))) {
                webappInfoWebSiteIdCache.put(webSiteId, webAppInfo); // SCIPIO: save in cache
                return webAppInfo;
            }
        }
    }
    // SCIPIO: much clearer message
    //throw new IllegalArgumentException("Web site ID '" + webSiteId + "' not found.");
    throw new IllegalArgumentException("Could not get webapp info for website ID '" + webSiteId 
            + "'; the website may not exist, or may not have a webapp (web.xml)"
            + ", or its webapp may be shadowed/overridden in the system (ofbiz_component.xml)");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:30,代码来源:WebAppUtil.java

示例10: getWebappInfoFromContextPath

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
/**
 * SCIPIO: Returns the <code>WebappInfo</code> instance that the given exact context path as mount-point
 * <p>
 * <strong>WARN:</strong> Webapp mounted on root (/*) will usually cause a catch-all here.
 * 
 * @param webSiteId
 * @throws IOException
 * @throws SAXException
 */
public static WebappInfo getWebappInfoFromContextPath(String contextPath) throws IOException, SAXException {
    Assert.notNull("contextPath", contextPath);
    
    // SCIPIO: Go through cache first. No need to synchronize, doesn't matter.
    WebappInfo res = webappInfoContextPathCache.get(contextPath);
    if (res != null) {
        return res;
    }
    else {
        for (WebappInfo webAppInfo : ComponentConfig.getAllWebappResourceInfos()) {
            if (contextPath.equals(webAppInfo.getContextRoot())) {
                webappInfoContextPathCache.put(contextPath, webAppInfo); // SCIPIO: save in cache
                return webAppInfo;
            }
        }
    }
    throw new IllegalArgumentException("Web app for context path '" + contextPath + "' not found.");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:WebAppUtil.java

示例11: readConfig

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public static void readConfig() {
    List<ServiceGroups> serviceGroupsList = null;
    try {
        serviceGroupsList = ServiceConfigUtil.getServiceEngine().getServiceGroups();
    } catch (GenericConfigException e) {
        // FIXME: Refactor API so exceptions can be thrown and caught.
        Debug.logError(e, module);
        throw new RuntimeException(e.getMessage());
    }
    for (ServiceGroups serviceGroup : serviceGroupsList) {
        ResourceHandler handler = new MainResourceHandler(ServiceConfigUtil.SERVICE_ENGINE_XML_FILENAME, serviceGroup.getLoader(), serviceGroup.getLocation());
        addGroupDefinitions(handler);
    }

    // get all of the component resource group stuff, ie specified in each ofbiz-component.xml file
    for (ComponentConfig.ServiceResourceInfo componentResourceInfo: ComponentConfig.getAllServiceResourceInfos("group")) {
        addGroupDefinitions(componentResourceInfo.createResourceHandler());
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:20,代码来源:ServiceGroupReader.java

示例12: prepareAll

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
public void prepareAll() throws GeneralException {
    Debug.logInfo("Loading artifact info objects...", module);
    List<Future<Void>> futures = new ArrayList<Future<Void>>();
    Set<String> entityNames = this.getEntityModelReader().getEntityNames();
    for (String entityName: entityNames) {
        this.getEntityArtifactInfo(entityName);
    }

    Set<String> serviceNames = this.getDispatchContext().getAllServiceNames();
    for (String serviceName: serviceNames) {
        futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(prepareTaskForServiceAnalysis(serviceName)));
    }
    // how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service

    Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents();
    ExecutionPool.getAllFutures(futures);
    futures = new ArrayList<Future<Void>>();
    for (ComponentConfig componentConfig: componentConfigs) {
        futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(prepareTaskForComponentAnalysis(componentConfig)));
    }
    ExecutionPool.getAllFutures(futures);
    Debug.logInfo("Artifact info objects loaded.", module);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:24,代码来源:ArtifactInfoFactory.java

示例13: loadLabelFiles

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
protected static void loadLabelFiles() throws IOException {
    filesFound = new TreeMap<String, LabelFile>();
    List<ClasspathInfo> cpInfos = ComponentConfig.getAllClasspathInfos();
    for (ClasspathInfo cpi : cpInfos) {
        if ("dir".equals(cpi.type)) {
            String configRoot = cpi.componentConfig.getRootLocation();
            configRoot = configRoot.replace('\\', '/');
            if (!configRoot.endsWith("/")) {
                configRoot = configRoot + "/";
            }
            String location = cpi.location.replace('\\', '/');
            if (location.startsWith("/")) {
                location = location.substring(1);
            }
            List<File> resourceFiles = FileUtil.findXmlFiles(configRoot + location, null, "resource", null);
            for (File resourceFile : resourceFiles) {
                filesFound.put(resourceFile.getName(), new LabelFile(resourceFile, cpi.componentConfig.getComponentName()));
            }
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:22,代码来源:LabelManagerFactory.java

示例14: startFileListener

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
/**
 * A service used to capture file changes on the system. Automatically implements file listeners for all components recursively.
 * 
 * @param dctx The DispatchContext that this service is operating in
 * @param context Map containing the input parameters
 * @return Map with the result of the service, the output parameters
 */
public static Map<String, Object> startFileListener(DispatchContext dctx, Map<String, ?> context) {
    //Delegator delegator = dctx.getDelegator();
    //LocalDispatcher dispatcher = dctx.getDispatcher();
    try {
        Collection<ComponentConfig> allComponents = ComponentConfig.getAllComponents();
        for (ComponentConfig config : allComponents) {
            String name = "component-"+config.getComponentName();
            String location = config.getRootLocation();
            FileListener.startFileListener(name,location); 
        }
        return ServiceUtil.returnSuccess("File event registered.");
    }
    catch(Exception e) {
        final String errorMsg = "Exception triggering File Event";
        Debug.logError(e, errorMsg, module);
        return ServiceUtil.returnError(errorMsg + ": " + e.getMessage());
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:26,代码来源:CommonServices.java

示例15: ModelReader

import org.ofbiz.base.component.ComponentConfig; //导入依赖的package包/类
private ModelReader(String modelName) throws GenericEntityException {
    this.modelName = modelName;
    entityResourceHandlers = new LinkedList<ResourceHandler>();
    resourceHandlerEntities = new HashMap<ResourceHandler, Collection<String>>();
    entityResourceHandlerMap = new HashMap<String, ResourceHandler>();

    EntityModelReader entityModelReaderInfo = EntityConfigUtil.getEntityModelReader(modelName);

    if (entityModelReaderInfo == null) {
        throw new GenericEntityConfException("Cound not find an entity-model-reader with the name " + modelName);
    }

    // get all of the main resource model stuff, ie specified in the entityengine.xml file
    for (Resource resourceElement : entityModelReaderInfo.getResourceList()) {
        ResourceHandler handler = new MainResourceHandler(EntityConfigUtil.ENTITY_ENGINE_XML_FILENAME, resourceElement.getLoader(), resourceElement.getLocation());
        entityResourceHandlers.add(handler);
    }

    // get all of the component resource model stuff, ie specified in each ofbiz-component.xml file
    for (ComponentConfig.EntityResourceInfo componentResourceInfo: ComponentConfig.getAllEntityResourceInfos("model")) {
        if (modelName.equals(componentResourceInfo.readerName)) {
            entityResourceHandlers.add(componentResourceInfo.createResourceHandler());
        }
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:26,代码来源:ModelReader.java


注:本文中的org.ofbiz.base.component.ComponentConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。