Package org.apache.wicket.security.hive

Examples of org.apache.wicket.security.hive.BasicHive


     *
     * @see org.apache.wicket.security.hive.config.HiveFactory#createHive()
     */
    public Hive createHive()
    {
      BasicHive hive;
      if (cache)
        hive = new SimpleCachingHive();
      else
        hive = new BasicHive();
      Principal principal = new SimplePrincipal("speed");
      SwarmAction action = (SwarmAction) actionFactory.getAction("access, render");
      hive.addPermission(principal, new ComponentPermission(
        "org.apache.wicket.security.pages.SpeedPage", action));
      for (int i = 0; i < ROWS; i++)
      {
        for (int j = 0; j < COLS / denialFactor; j++)
        {
          // not granting a permission for each component will add
          // linear time to check, the more permissions the more time
          // will be added
          hive.addPermission(principal, new ComponentPermission(
            "org.apache.wicket.security.pages.SpeedPage:rows:" + i + ":cols:" + j
              + ":label", action));
        }
      }
      return hive;
View Full Code Here


   */
  protected BasicHive constructHive()
  {
    if (isUsingHiveCache())
      return new SimpleCachingHive();
    return new BasicHive();
  }
View Full Code Here

   *
   * @see org.apache.wicket.security.hive.config.HiveFactory#createHive()
   */
  public final Hive createHive()
  {
    BasicHive hive = constructHive();
    boolean readAnything = false;
    for (URL file : policyFiles)
    {
      readAnything = true;
      try
      {
        readPolicyFile(file, hive);
      }
      catch (IOException e)
      {
        log.error("Could not read from " + file, e);
      }
    }
    for (InputStream stream : inputStreams)
    {
      readAnything = true;
      try
      {
        readInputStream(stream, hive);
      }
      catch (IOException e)
      {
        log.error("Could not read from stream", e);
      }
    }
    inputStreams.clear();
    for (Reader stream : inputReaders)
    {
      readAnything = true;
      try
      {
        readInputReader(stream, hive);
      }
      catch (IOException e)
      {
        log.error("Could not read from reader", e);
      }
    }
    inputReaders.clear();
    if (!readAnything)
      log.warn("No policyFiles or inputstreams were added to the factory!");
    hive.lock();
    return hive;
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.security.hive.BasicHive

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.