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


Java Ini.fromResourcePath方法代码示例

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


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

示例1: doParse

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Override
public Ini doParse(String raw) throws IllegalArgumentException {
  Ini ini;
  try {
    ini = Ini.fromResourcePath(raw);
  } catch (ConfigurationException e) {
    throw new ShiroConfigurationException(e);
  }

  Set<String> presentSections = ImmutableSortedSet.copyOf(ini.getSectionNames());
  if (presentSections.isEmpty()) {
    throw new MissingSectionsException();
  }

  Set<String> extraSections = Sets.difference(presentSections, ALLOWED_SECTION_NAMES);
  if (!extraSections.isEmpty()) {
    throw new ExtraSectionsException(extraSections);
  }

  return ini;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:22,代码来源:ShiroIniParser.java

示例2: setup

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Override
protected void setup() {

    String configFile = getSettings().getString("shiro.configurationFile", "classpath:conf/shiro.ini");
    Ini ini = Ini.fromResourcePath(configFile);

    IniWebEnvironment webEnvironment = new IniWebEnvironment();
    webEnvironment.setIni(ini);
    webEnvironment.setServletContext(getServletContext());
    webEnvironment.init();

    bind(WebEnvironment.class).toInstance(webEnvironment);
    bind(SecurityManager.class).toInstance(webEnvironment.getSecurityManager());
    bind(WebSecurityManager.class).toInstance(webEnvironment.getWebSecurityManager());

    String basePath = Strings.nullToEmpty(getSettings().getString(RestServlet.SETTING_URL, null)).trim();
    filter(basePath + "/*").through(ShiroFilter.class);

    install(new AopModule());
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:21,代码来源:ShiroModule.java

示例3: start

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Override
public synchronized void start() throws IOException {
    switch (state) {
    case NONE:
        throw new IllegalStateException("not initialized");
    case STARTED:
        throw new IllegalStateException("started already");
    case DESTROYED:
        throw new IllegalStateException("can't start after destruction");
    default:
        break;
    }

    final File configFile = findConfigFile(this.configFile, DEFAULT_CONFIG_FILE);
    final File securityConfigFile = findConfigFile(this.securityConfigFile, DEFAULT_SECURITY_CONFIG_FILE);
    final Ini securityConfig =
            securityConfigFile != null ? Ini.fromResourcePath(securityConfigFile.getPath()) : null;

    final CentralDogma dogma;
    if (configFile == null) {
        dogma = new CentralDogmaBuilder(DEFAULT_DATA_DIR).build();
    } else {
        dogma = CentralDogma.forConfig(configFile, securityConfig);
    }

    dogma.start();

    this.dogma = dogma;
    state = State.STARTED;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:31,代码来源:Main.java

示例4: loadShiroIni

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Provides
@Singleton
   Ini loadShiroIni() {
	logger.entry();
	Ini result = Ini.fromResourcePath("classpath:shiro.ini");
	logger.exit(result);
       return result;
   }
 
开发者ID:pabiagioli,项目名称:shiro-guice-async-webapp,代码行数:9,代码来源:BootstrapShiroModule.java

示例5: onInit

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Override
protected void onInit() {
    super.onInit();

    // This is an in-memory realm only - no need for an additional cache when we're already
    // as memory-efficient as we can be.
    
    Ini ini = getIni();
    String resourcePath = getResourcePath();
            
    if (!CollectionUtils.isEmpty(this.users) || !CollectionUtils.isEmpty(this.roles)) {
        if (!CollectionUtils.isEmpty(ini)) {
            log.warn("Users or Roles are already populated.  Configured Ini instance will be ignored.");
        }
        if (StringUtils.hasText(resourcePath)) {
            log.warn("Users or Roles are already populated.  resourcePath '{}' will be ignored.", resourcePath);
        }
        
        log.debug("Instance is already populated with users or roles.  No additional user/role population " +
                "will be performed.");
        return;
    }
    
    if (CollectionUtils.isEmpty(ini)) {
        log.debug("No INI instance configuration present.  Checking resourcePath...");
        
        if (StringUtils.hasText(resourcePath)) {
            log.debug("Resource path {} defined.  Creating INI instance.", resourcePath);
            ini = Ini.fromResourcePath(resourcePath);
            if (!CollectionUtils.isEmpty(ini)) {
                setIni(ini);
            }
        }
    }
    
    if (CollectionUtils.isEmpty(ini)) {
        String msg = "Ini instance and/or resourcePath resulted in null or empty Ini configuration.  Cannot " +
                "load account data.";
        throw new IllegalStateException(msg);
    }

    processDefinitions(ini);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:44,代码来源:IniRealm.java

示例6: loadDefaultShiroIni

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
Ini loadDefaultShiroIni() {
    logger.entry();
    Ini result = Ini.fromResourcePath(DEFAULT_SHIRO_INI_REALM_RESOURCE);
    logger.exit(result);
    return result;
}
 
开发者ID:pabiagioli,项目名称:webshooters,代码行数:7,代码来源:BaseShiroModule.java

示例7: loadShiroIni

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
@Provides
@Singleton
   Ini loadShiroIni() {
	Ini result = Ini.fromResourcePath("classpath:shiro.ini"); 
       return result;
   }
 
开发者ID:pabiagioli,项目名称:secure-rest-webapp-archetype,代码行数:7,代码来源:BootstrapShiroModule.java

示例8: IniRealm

import org.apache.shiro.config.Ini; //导入方法依赖的package包/类
/**
 * This constructor will immediately process the definitions in the {@code Ini} resolved from the specified
 * {@code resourcePath}.  If you need to perform additional configuration before processing (e.g. setting a
 * permissionResolver, etc), do not call this constructor.  Instead, do the following:
 * <ol>
 * <li>Call the default no-arg constructor</li>
 * <li>Set the Ini instance you wish to use via {@code #setIni}</li>
 * <li>Set any other configuration properties</li>
 * <li>Call {@link #init()}</li>
 * </ol>
 *
 * @param resourcePath the resource path of the Ini config which will be inspected to create accounts, groups and
 *                     permissions for this realm.
 */
public IniRealm(String resourcePath) {
    this();
    Ini ini = Ini.fromResourcePath(resourcePath);
    this.ini = ini;
    this.resourcePath = resourcePath;
    processDefinitions(ini);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:22,代码来源:IniRealm.java


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