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


Java ContainerConfig.getContainer方法代码示例

本文整理汇总了Java中org.ofbiz.base.container.ContainerConfig.getContainer方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerConfig.getContainer方法的具体用法?Java ContainerConfig.getContainer怎么用?Java ContainerConfig.getContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ofbiz.base.container.ContainerConfig的用法示例。


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

示例1: init

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
public void init(String[] args, String name, String configFile) throws ContainerException {
    this.name = name;
    // initialize the LocalDispatcherFactory
    ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
    ContainerConfig.Container.Property dispatcherFactoryProperty = cfg.getProperty("dispatcher-factory");
    if (dispatcherFactoryProperty == null || UtilValidate.isEmpty(dispatcherFactoryProperty.value)) {
        throw new ContainerException("Unable to initialize container " + name + ": dispatcher-factory property is not set");
    }
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    try {
        Class<?> c = loader.loadClass(dispatcherFactoryProperty.value);
        dispatcherFactory = (LocalDispatcherFactory) c.newInstance();
    } catch (Exception e) {
        throw new ContainerException(e);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:ServiceContainer.java

示例2: init

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
public void init(String[] args, String name, String configFile) throws ContainerException {
    this.name = name;

    ContainerConfig.Container cc = ContainerConfig.getContainer(name, configFile);

    preloadedDelegatorNames = StringUtil.split(ContainerConfig.getPropertyValue(cc, "preloaded-delegators", "default"), ", ");
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:DelegatorContainer.java

示例3: start

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
/**
 * Start the container
 *
 * @return true if server started
 * @throws org.ofbiz.base.container.ContainerException
 *
 */
@Override
public boolean start() throws ContainerException {
    ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
    String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
    String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
    this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));

    this.delegator = DelegatorFactory.getDelegator(delegatorName);
    this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
    this.timerDelay = ContainerConfig.getPropertyValue(cfg, "poll-delay", 300000);
    this.maxSize = ContainerConfig.getPropertyValue(cfg, "maxSize", 1000000); // maximum size in bytes

    // load the userLogin object
    String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system");
    try {
        this.userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", runAsUser).queryOne();
    } catch (GenericEntityException e) {
        Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module);
        return false;
    }

    // load the MCA configuration
    ServiceMcaUtil.readConfig();

    // load the listeners
    List<ContainerConfig.Container.Property> configs = cfg.getPropertiesWithValue("store-listener");
    for (ContainerConfig.Container.Property prop: configs) {
        Session session = this.makeSession(prop);
        Store store = this.getStore(session);
        if (store != null) {
            stores.put(store, session);
            store.addStoreListener(new LoggingStoreListener());
        }
    }

    // start the polling timer
    if (UtilValidate.isNotEmpty(stores)) {
        pollTimer.scheduleAtFixedRate(new PollerTask(dispatcher, userLogin), timerDelay, timerDelay, TimeUnit.MILLISECONDS);
    } else {
        Debug.logWarning("No JavaMail Store(s) configured; poller disabled.", module);
    }

    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:52,代码来源:JavaMailContainer.java

示例4: start

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
/**
 * @see org.ofbiz.base.container.Container#start()
 */
@Override
public boolean start() throws ContainerException {
    if("all-tenants".equals(this.overrideDelegator)) {
        if (!EntityUtil.isMultiTenantEnabled()) {
            Debug.logWarning("Multitenant is disabled. Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
            return true;
        }
        ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
        ContainerConfig.Container.Property delegatorNameProp = cfg.getProperty("delegator-name");
        String delegatorName = null;
        if (delegatorNameProp == null || UtilValidate.isEmpty(delegatorNameProp.value)) {
            throw new ContainerException("Invalid delegator-name defined in container configuration");
        } else {
            delegatorName = delegatorNameProp.value;
        }
        Delegator delegator = DelegatorFactory.getDelegator(delegatorName);
        if (delegator == null) {
            throw new ContainerException("Invalid delegator name!");
        }
        List<EntityExpr> expr = new LinkedList<EntityExpr>();
        expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, "N"));
        expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, null));
        List<GenericValue> tenantList;
        try {
            tenantList = EntityQuery.use(delegator).from("Tenant").where(expr, EntityOperator.OR).queryList();
        } catch (GenericEntityException e) {
            throw new ContainerException(e.getMessage());
        }
        for (GenericValue tenant : tenantList) {
            this.overrideDelegator = delegator.getDelegatorName() + "#" + tenant.getString("tenantId");
            loadContainer();
        }
    } else {
        loadContainer();
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:41,代码来源:EntityDataLoadContainer.java

示例5: start

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
/**
 * Start the container
 *
 * @return true if server started
 * @throws org.ofbiz.base.container.ContainerException
 *
 */
public boolean start() throws ContainerException {
    ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
    String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
    String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
    this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));

    this.delegator = DelegatorFactory.getDelegator(delegatorName);
    this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
    this.timerDelay = ContainerConfig.getPropertyValue(cfg, "poll-delay", 300000);
    this.maxSize = ContainerConfig.getPropertyValue(cfg, "maxSize", 1000000); // maximum size in bytes

    // load the userLogin object
    String runAsUser = ContainerConfig.getPropertyValue(cfg, "run-as-user", "system");
    try {
        this.userLogin = delegator.findOne("UserLogin", false, "userLoginId", runAsUser);
    } catch (GenericEntityException e) {
        Debug.logError(e, "Unable to load run-as-user UserLogin; cannot start container", module);
        return false;
    }

    // load the MCA configuration
    ServiceMcaUtil.readConfig();

    // load the listeners
    List<ContainerConfig.Container.Property> configs = cfg.getPropertiesWithValue("store-listener");
    for (ContainerConfig.Container.Property prop: configs) {
        Session session = this.makeSession(prop);
        Store store = this.getStore(session);
        if (store != null) {
            stores.put(store, session);
            store.addStoreListener(new LoggingStoreListener());
        }
    }

    // start the polling timer
    if (UtilValidate.isNotEmpty(stores)) {
        pollTimer.scheduleAtFixedRate(new PollerTask(dispatcher, userLogin), timerDelay, timerDelay, TimeUnit.MILLISECONDS);
    } else {
        Debug.logWarning("No JavaMail Store(s) configured; poller disabled.", module);
    }

    return true;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:51,代码来源:JavaMailContainer.java

示例6: start

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
/**
 * @see org.ofbiz.base.container.Container#start()
 */
public boolean start() throws ContainerException {
    if("all-tenants".equals(this.overrideDelegator)) {
        if ("N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
            Debug.logWarning("Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
            return true;
        }
        ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
        ContainerConfig.Container.Property delegatorNameProp = cfg.getProperty("delegator-name");
        String delegatorName = null;
        if (delegatorNameProp == null || UtilValidate.isEmpty(delegatorNameProp.value)) {
            throw new ContainerException("Invalid delegator-name defined in container configuration");
        } else {
            delegatorName = delegatorNameProp.value;
        }
        Delegator delegator = DelegatorFactory.getDelegator(delegatorName);
        if (delegator == null) {
            throw new ContainerException("Invalid delegator name!");
        }
        List<EntityExpr> expr = FastList.newInstance();
        expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, "N"));
        expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, null));
        List<GenericValue> tenantList;
        try {
            tenantList = delegator.findList("Tenant", EntityCondition.makeCondition(expr, EntityOperator.OR), null, null, null, false);
        } catch (GenericEntityException e) {
            throw new ContainerException(e.getMessage());
        }
        for (GenericValue tenant : tenantList) {
            this.overrideDelegator = delegator.getDelegatorName() + "#" + tenant.getString("tenantId");
            loadContainer();
        }
    } else {
        loadContainer();
    }
    return true;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:40,代码来源:EntityDataLoadContainer.java

示例7: readContainerConfig

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
private ContainerConfig.Container readContainerConfig(String configFile) throws ContainerException {
    ContainerConfig.Container cc = ContainerConfig.getContainer(CONTAINER_NAME, configFile);
    if (cc == null) {
        throw new ContainerException(CONTAINER_NAME + " configuration not found in container config!");
    }
    return cc;
}
 
开发者ID:jamesyong,项目名称:o3erp,代码行数:8,代码来源:CamelContainer.java

示例8: start

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
   public boolean start() throws ContainerException {
	
       // get the container config
       ContainerConfig.Container cfg = ContainerConfig.getContainer(containerName, configFileLocation);
       String pluginPath = ContainerConfig.getPropertyValue(cfg, "plugin-path", System.getProperty("ofbiz.home")+"/framework/plugin/plugins");

       Debug.logInfo("Plugin Path: "+pluginPath, module);
       
       pluginManager = new DefaultPluginManager(new File(pluginPath));
       pluginManager.loadPlugins();
       pluginManager.startPlugins();
       return false;
}
 
开发者ID:jamesyong,项目名称:o3erp,代码行数:15,代码来源:PluginContainer.java

示例9: init

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
public void init(String[] args, String name, String configFile) throws ContainerException {
    this.name = name;
    // get the container config
    ContainerConfig.Container cc = ContainerConfig.getContainer(name, configFile);
    if (cc == null) {
        throw new ContainerException("No catalina-container configuration found in container config!");
    }

    // embedded properties
    boolean useNaming = ContainerConfig.getPropertyValue(cc, "use-naming", false);
    //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);

    // grab some global context settings
    this.contextReloadable = ContainerConfig.getPropertyValue(cc, "apps-context-reloadable", false);
    this.crossContext = ContainerConfig.getPropertyValue(cc, "apps-cross-context", true);
    this.distribute = ContainerConfig.getPropertyValue(cc, "apps-distributable", true);

    this.catalinaRuntimeHome = ContainerConfig.getPropertyValue(cc, "catalina-runtime-home", "runtime/catalina");

    // set catalina_home
    System.setProperty(Globals.CATALINA_HOME_PROP, System.getProperty("ofbiz.home") + "/" + this.catalinaRuntimeHome);
    System.setProperty(Globals.CATALINA_BASE_PROP, System.getProperty(Globals.CATALINA_HOME_PROP));

    // create the instance of embedded Tomcat
    System.setProperty("catalina.useNaming", String.valueOf(useNaming));
    tomcat = new Tomcat();
    tomcat.setBaseDir(System.getProperty("ofbiz.home"));

    // configure JNDI in the StandardServer
    StandardServer server = (StandardServer) tomcat.getServer();
    if (useNaming) {
        tomcat.enableNaming();
    }
    try {
        server.setGlobalNamingContext(new InitialContext());
    } catch (NamingException e) {
        throw new ContainerException(e);
    }

    // create the engine
    List<ContainerConfig.Container.Property> engineProps = cc.getPropertiesWithValue("engine");
    if (UtilValidate.isEmpty(engineProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no engines defined.");
    }
    if (engineProps.size() > 1) {
        throw new ContainerException("Cannot load CatalinaContainer; more than one engine configuration found; only one is supported.");
    }
    createEngine(engineProps.get(0));

    // create the connectors
    List<ContainerConfig.Container.Property> connectorProps = cc.getPropertiesWithValue("connector");
    if (UtilValidate.isEmpty(connectorProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no connectors defined!");
    }
    for (ContainerConfig.Container.Property connectorProp: connectorProps) {
        createConnector(connectorProp);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:60,代码来源:CatalinaContainer.java

示例10: init

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
public void init(String[] args, String name, String configFile) throws ContainerException {
    this.name = name;
    // get the container config
    ContainerConfig.Container cc = ContainerConfig.getContainer(name, configFile);
    if (cc == null) {
        throw new ContainerException("No catalina-container configuration found in container config!");
    }

    // embedded properties
    boolean useNaming = ContainerConfig.getPropertyValue(cc, "use-naming", false);
    //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);

    // grab some global context settings
    this.delegator = DelegatorFactory.getDelegator(ContainerConfig.getPropertyValue(cc, "delegator-name", "default"));
    this.contextReloadable = ContainerConfig.getPropertyValue(cc, "apps-context-reloadable", false);
    this.crossContext = ContainerConfig.getPropertyValue(cc, "apps-cross-context", true);
    this.distribute = ContainerConfig.getPropertyValue(cc, "apps-distributable", true);

    this.catalinaRuntimeHome = ContainerConfig.getPropertyValue(cc, "catalina-runtime-home", "runtime/catalina");

    // set catalina_home
    System.setProperty(Globals.CATALINA_HOME_PROP, System.getProperty("ofbiz.home") + "/" + this.catalinaRuntimeHome);
    System.setProperty(Globals.CATALINA_BASE_PROP, System.getProperty(Globals.CATALINA_HOME_PROP));

    // create the instance of embedded Tomcat
    System.setProperty("catalina.useNaming", String.valueOf(useNaming));
    tomcat = new Tomcat();
    tomcat.setBaseDir(System.getProperty("ofbiz.home"));
    if (useNaming) {
        tomcat.enableNaming();
    }

    // configure JNDI in the StandardServer
    StandardServer server = (StandardServer) tomcat.getServer();
    try {
        server.setGlobalNamingContext(new InitialContext());
    } catch (NamingException e) {
        throw new ContainerException(e);
    }

    // create the engines
    List<ContainerConfig.Container.Property> engineProps = cc.getPropertiesWithValue("engine");
    if (UtilValidate.isEmpty(engineProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no engines defined!");
    }
    for (ContainerConfig.Container.Property engineProp: engineProps) {
        createEngine(engineProp);
    }

    // create the connectors
    List<ContainerConfig.Container.Property> connectorProps = cc.getPropertiesWithValue("connector");
    if (UtilValidate.isEmpty(connectorProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no connectors defined!");
    }
    for (ContainerConfig.Container.Property connectorProp: connectorProps) {
        createConnector(connectorProp);
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:60,代码来源:CatalinaContainer.java

示例11: init

import org.ofbiz.base.container.ContainerConfig; //导入方法依赖的package包/类
@Override
public void init(String[] args, String name, String configFile) throws ContainerException {
    this.name = name;
    // get the container config
    ContainerConfig.Container cc = ContainerConfig.getContainer(name, configFile);
    if (cc == null) {
        throw new ContainerException("No catalina-container configuration found in container config!");
    }

    // embedded properties
    boolean useNaming = ContainerConfig.getPropertyValue(cc, "use-naming", false);
    //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);

    // grab some global context settings
    this.delegator = DelegatorFactory.getDelegator(ContainerConfig.getPropertyValue(cc, "delegator-name", "default"));
    this.contextReloadable = ContainerConfig.getPropertyValue(cc, "apps-context-reloadable", false);
    this.crossContext = ContainerConfig.getPropertyValue(cc, "apps-cross-context", true);
    this.distribute = ContainerConfig.getPropertyValue(cc, "apps-distributable", true);

    this.catalinaRuntimeHome = ContainerConfig.getPropertyValue(cc, "catalina-runtime-home", System.getProperty("runtime.home")+"/catalina");

    // set catalina_home
    System.setProperty(Globals.CATALINA_HOME_PROP, this.catalinaRuntimeHome );
    System.setProperty(Globals.CATALINA_BASE_PROP, System.getProperty(Globals.CATALINA_HOME_PROP));

    // create the instance of embedded Tomcat
    System.setProperty("catalina.useNaming", String.valueOf(useNaming));
    tomcat = new Tomcat();
    tomcat.setBaseDir(System.getProperty("ofbiz.home"));
    if (useNaming) {
        tomcat.enableNaming();
    }

    // configure JNDI in the StandardServer
    StandardServer server = (StandardServer) tomcat.getServer();
    try {
        server.setGlobalNamingContext(new InitialContext());
    } catch (NamingException e) {
        throw new ContainerException(e);
    }

    // create the engines
    List<ContainerConfig.Container.Property> engineProps = cc.getPropertiesWithValue("engine");
    if (UtilValidate.isEmpty(engineProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no engines defined!");
    }
    for (ContainerConfig.Container.Property engineProp: engineProps) {
        createEngine(engineProp);
    }

    // create the connectors
    List<ContainerConfig.Container.Property> connectorProps = cc.getPropertiesWithValue("connector");
    if (UtilValidate.isEmpty(connectorProps)) {
        throw new ContainerException("Cannot load CatalinaContainer; no connectors defined!");
    }
    for (ContainerConfig.Container.Property connectorProp: connectorProps) {
        createConnector(connectorProp);
    }
}
 
开发者ID:jamesyong,项目名称:o3erp,代码行数:60,代码来源:CatalinaContainer.java


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