Ejemplo n.º 1
0
 /** Constructor */
 public HttpsListener(Map args, ObjectPool objectPool, HostGroup hostGroup) throws IOException {
   super(args, objectPool, hostGroup);
   this.keystore =
       WebAppConfiguration.stringArg(args, getConnectorName() + "KeyStore", "winstone.ks");
   this.password =
       WebAppConfiguration.stringArg(args, getConnectorName() + "KeyStorePassword", null);
   this.keyManagerType =
       WebAppConfiguration.stringArg(args, getConnectorName() + "KeyManagerType", "SunX509");
 }
  /**
   * Factory method - this parses the web.xml nodes and builds the correct subclass for handling
   * that auth type.
   */
  protected BaseAuthenticationHandler(
      Node loginConfigNode, List constraintNodes, Set rolesAllowed, AuthenticationRealm realm) {
    this.realm = realm;

    for (int m = 0; m < loginConfigNode.getChildNodes().getLength(); m++) {
      Node loginElm = loginConfigNode.getChildNodes().item(m);
      if (loginElm.getNodeType() != Node.ELEMENT_NODE) continue;
      else if (loginElm.getNodeName().equals(ELEM_REALM_NAME))
        realmName = WebAppConfiguration.getTextFromNode(loginElm);
    }

    // Build security constraints
    this.constraints = new SecurityConstraint[constraintNodes.size()];
    for (int n = 0; n < constraints.length; n++)
      this.constraints[n] = new SecurityConstraint((Node) constraintNodes.get(n), rolesAllowed, n);
  }
Ejemplo n.º 3
0
  /** Main constructor. Basically just calls the init method */
  public WinstoneDataSource(String name, Map args, ClassLoader loader) {
    this.name = name;

    this.usedWrappers = new ArrayList();
    this.usedRealConnections = new ArrayList();
    this.unusedRealConnections = new ArrayList();
    this.connectProps = new Properties();

    // Extract pool management properties
    this.keepAliveSQL = WebAppConfiguration.stringArg(args, "keepAliveSQL", "");
    this.keepAlivePeriod = WebAppConfiguration.intArg(args, "keepAlivePeriod", -1);
    this.checkBeforeGet =
        WebAppConfiguration.booleanArg(args, "checkBeforeGet", !this.keepAliveSQL.equals(""));
    this.killInactivePeriod = WebAppConfiguration.intArg(args, "killInactivePeriod", -1);

    this.url = WebAppConfiguration.stringArg(args, "url", null);
    String driverClassName = WebAppConfiguration.stringArg(args, "driverClassName", "");
    if (args.get("username") != null) this.connectProps.put("user", args.get("username"));
    if (args.get("password") != null) this.connectProps.put("password", args.get("password"));

    this.maxHeldCount = WebAppConfiguration.intArg(args, "maxConnections", 20);
    this.maxIdleCount = WebAppConfiguration.intArg(args, "maxIdle", 10);
    int startCount = WebAppConfiguration.intArg(args, "startConnections", 1);

    this.retryCount = WebAppConfiguration.intArg(args, "retryCount", 1);
    this.retryPeriod = WebAppConfiguration.intArg(args, "retryPeriod", 1000);

    log(Logger.FULL_DEBUG, "WinstoneDataSource.Init", this.url, null);

    try {
      synchronized (this.unusedRealConnections) {
        if (!driverClassName.equals("")) {
          Class driverClass = Class.forName(driverClassName.trim(), true, loader);
          this.driver = (Driver) driverClass.newInstance();

          for (int n = 0; n < startCount; n++) {
            makeNewRealConnection(this.unusedRealConnections);
          }
        }
      }
    } catch (Throwable err) {
      log(Logger.ERROR, "WinstoneDataSource.ErrorInCreate", this.name, err);
    }

    // Start management thread
    this.managementThread = new Thread(this, "DBConnectionPool management thread");
    this.managementThread.start();
  }