Package com.dbxml.db.common.adapters

Examples of com.dbxml.db.common.adapters.XMLSerializableAdapter


   }

   public void removeUser(User user) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getUsersCollection();
      String userID = user.getId();

         col.remove(tx, userID);
         userCache.remove(userID);
      }
      catch ( DBException e ) {
         tx.cancel();
         throw e;
View Full Code Here


   }

   void storeGroup(Group group) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getGroupsCollection();
         col.setObject(tx, group.getName(), group);
      }
      catch ( DBException e ) {
         tx.cancel();
         throw e;
      }
View Full Code Here

   }

   public String[] listRoles() throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getRolesCollection();
      Key[] keys = col.listKeys(tx);
      String[] result = new String[keys.length];
      for ( int i = 0; i < keys.length; i++ )
        result[i] = keys[i].toString();
         return result;
      }
View Full Code Here

   }

   Group getGroup(String group, boolean create) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getGroupsCollection();
         Group g = (Group)col.getObject(tx, group);
         if ( g == null && create ) {
            g = new Group(group);
            storeGroup(g);
         }
         return g;
View Full Code Here

   }

   public String[] listUsersForRole(String roleID) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getUsersCollection();
         String queryString = "/user[role[.='"+roleID+"']]/@id";
         ResultSet rs = col.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, queryString, null);
         Set roles = new TreeSet();
         while ( rs.next() ) {
            try {
               String userID = DTSMHelper.tableToText(rs.getResult());
               roles.add(userID);
View Full Code Here

   }

   public Role readRole(String roleID) throws InvalidRoleException {
      Transaction tx = new Transaction();
      try {
      XMLSerializableAdapter col = getRolesCollection();
         Role role = (Role)roleCache.get(roleID);
      if ( role != null ) {
        // Perform access check for cached items
        checkAccess(col, Access.READ);
      }
      else {
            role = (Role)col.getObject(tx, roleID);
        if ( role != null )
              roleCache.put(roleID, role);
        else
             throw new InvalidUserException("Role '"+roleID+"' doesn't exist");
         }
View Full Code Here

   }

   void storeContent(Content content) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getContentCollection();
         col.setObject(tx, content.getPath(), content);
      }
      catch ( DBException e ) {
         tx.cancel();
         throw e;
      }
View Full Code Here

   }

   public void storeRole(Role role) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getRolesCollection();
         String roleID = role.getId();
         col.setObject(tx, roleID, role);
         roleCache.put(roleID, role);
      }
      catch ( DBException e ) {
         tx.cancel();
         throw e;
View Full Code Here

   }

   Content getContent(String path, boolean create) throws DBException {
      Transaction tx = new Transaction();
      try {
         XMLSerializableAdapter col = getContentCollection();
         Content c = (Content)col.getObject(tx, path);
         if ( c == null && create ) {
            c = new Content(path);
            storeContent(c);
         }
         return c;
View Full Code Here

   public void removeRole(Role role) throws DBException {
      Transaction tx = new Transaction();
      try {
      String roleID = role.getId();

         XMLSerializableAdapter col = getRolesCollection();
         col.remove(tx, roleID);
         roleCache.remove(roleID);

         col = getUsersCollection();
         String queryString = "/user[role[.='"+roleID+"']]/@id";
         ResultSet rs = col.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, queryString, null);
         while ( rs.next() ) {
            try {
               String userID = DTSMHelper.tableToText(rs.getResult());
               User user = readUser(userID);
               user.removeRole(role);
               storeUser(user);
            }
            catch ( DTSMException e ) {
               // Should never happen
            }
         }

         col = getAccessCollection();
         queryString = "/access[role[.='"+roleID+"']]/path/text()";
         rs = col.queryCollection(tx, XPathQueryResolver.STYLE_XPATH, queryString, null);
         while ( rs.next() ) {
            try {
               String path = DTSMHelper.tableToText(rs.getResult());
               Access access = readAccess(path);
               access.removePermissions(role);
View Full Code Here

TOP

Related Classes of com.dbxml.db.common.adapters.XMLSerializableAdapter

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.