Examples of PooledConnection


Examples of anvil.database.PooledConnection

  public Synapse[] find(String type, String name) throws OperationFailedException
  {
    if (type == null && name == null) {
      return new Synapse[0];
    }
    PooledConnection impl = null;
    Connection conn = null;
    try {
      impl = getConnection();
      conn = (Connection)impl.getConnection();
      PreparedStatement stmt;
      if (type != null && name != null) {
        stmt = conn.prepareStatement("select id, type, name from synapse where type=? and name=?");
        stmt.setString(1, type);
        stmt.setString(2, name);
View Full Code Here

Examples of anvil.database.PooledConnection

  private static long _id = -1;
 
  public synchronized long getNextSequence() throws SQLException
  {
    if (_id == -1) {
      PooledConnection impl = null;
      Connection conn = null;
      try {
        impl = getConnection();
        conn = (Connection)impl.getConnection();
        Statement stmt = conn.createStatement();
        ResultSet result = stmt.executeQuery("select max(id) from synapse");
        if (result.next()) {
          _id = result.getLong(1);
        }
View Full Code Here

Examples of anvil.database.PooledConnection

  }


  protected SynapseImpl load(long id) throws OperationFailedException, SQLException
  {
    PooledConnection impl = null;
    Connection conn = null;
    SynapseImpl synapse = null;
    try {
      impl = getConnection();
      conn = (Connection)impl.getConnection();

      Statement stmt = conn.createStatement();
      ResultSet result = stmt.executeQuery("select type, name from synapse where id="+id);
      if (result.next()) {
        String type = result.getString(1);
View Full Code Here

Examples of anvil.database.PooledConnection

 
 
  void remove(long id) throws SQLException
  {
    _cache.remove(new Long(id));
    PooledConnection impl = null;
    Connection conn = null;
    try {
      impl = getConnection();
      conn = (Connection)impl.getConnection();
      Statement stmt = conn.createStatement();
      stmt.execute("delete from synapse where id="+id);
      stmt.execute("delete from data where id="+id);
      stmt.execute("delete from dimension where source="+id+" or target="+id);
      stmt.close();
View Full Code Here

Examples of anvil.database.PooledConnection



  void save(SynapseImpl synapse) throws SQLException
  {
    PooledConnection impl = null;
    Connection conn = null;
    try {
      impl = getConnection();
      conn = (Connection)impl.getConnection();
      save(conn, synapse);
      //conn.commit();
     
    } catch (SQLException e) {
      cleanup(conn);
View Full Code Here

Examples of anvil.database.PooledConnection

  }
 
 
  void save(Dimension dimension) throws SQLException
  {
    PooledConnection impl = null;
    Connection conn = null;
    try {
      impl = getConnection();
      conn = (Connection)impl.getConnection();
      save(conn, dimension.getSynapseImpl(), dimension);
      //conn.commit();
     
    } catch (SQLException e) {
      cleanup(conn);
View Full Code Here

Examples of anvil.database.PooledConnection

    this.username = username;
    this.dn = "uid="+username+",ou=users";
    this.fullDN = realm.createUserDN(username);
 
    //get password and id
    PooledConnection connImpl = null;
    DirContext ctx = null;
    boolean citizenFound = false;
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      //todo: use ctx.getAttributes()
      NamingEnumeration enu = ctx.search("ou=users", "(uid="+username+")", new SearchControls());
 
      if (enu.hasMore()) {
View Full Code Here

Examples of anvil.database.PooledConnection

    }
  }

 
  public void remove() throws OperationFailedException {
    PooledConnection connImpl = null;
    DirContext ctx = null;
 
    try {
      connImpl = realm.getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      ctx.unbind(dn);
      realm.removeCitizen(username);
      //this citizen no longer exists!
 
View Full Code Here

Examples of anvil.database.PooledConnection

    if (variable == null || !LDAPCitizen.ATTRMAP_C.containsKey(variable)) {
      _zone.log().error("LDAPRealm doesn't support search for: "+variable);
      return null;
    }
   
    PooledConnection connImpl = null;
    DirContext ctx = null;
    ArrayList result = new ArrayList();
 
    try {
      connImpl = getConnection();
      ctx = (DirContext)connImpl.getConnection();
 
      String search = "("+LDAPCitizen.ATTRMAP_C.get(variable)+"="+value+")";
      SearchControls sc = new SearchControls();
      sc.setReturningAttributes(new String[] { "uid" });
      NamingEnumeration enu = ctx.search("ou=users", search, sc);
View Full Code Here

Examples of anvil.database.PooledConnection

  }


  Tribe[] getMemberGroups(String dn)
  {
    PooledConnection connImpl = null;
    DirContext ctx = null;
    List groups = new ArrayList();
 
    try {
      connImpl = _manager.acquire(_contextPool);
      ctx = (DirContext)connImpl.getConnection();
     
      NamingEnumeration enu = null;
      SearchControls sc = new SearchControls();
      sc.setReturningAttributes(new String[] {"cn"});
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.