Package org.jboss.logging

Examples of org.jboss.logging.Logger


*/
public class JBossLoggerFactory extends InternalLoggerFactory {

    @Override
    public InternalLogger newInstance(String name) {
        final Logger logger =
            Logger.getLogger(name);
        return new JBossLogger(logger);
    }
View Full Code Here


         char[] password = decode(raf);
         return password;
      }
      catch(Exception e)
      {
         Logger log = Logger.getLogger(FilePassword.class);
         log.error("Failed to decode password file: "+passwordFile, e);
         throw new IOException(e.getMessage());
      }
   }
View Full Code Here

    * @return Group[] containing the sets of roles
    */
   static Group[] getRoleSets(String targetUser, Properties roles,
      char roleGroupSeperator, AbstractServerLoginModule aslm)
   {
      Logger log = aslm.log;     
      boolean trace = log.isTraceEnabled();
      Enumeration<?> users = roles.propertyNames();
      SimpleGroup rolesGroup = new SimpleGroup("Roles");
      ArrayList<Group> groups = new ArrayList<Group>();
      groups.add(rolesGroup);
      while (users.hasMoreElements() && targetUser != null)
      {
         String user = (String) users.nextElement();
         String value = roles.getProperty(user);
         if( trace )
            log.trace("Checking user: "+user+", roles string: "+value);
         // See if this entry is of the form targetUser[.GroupName]=roles
         //JBAS-3742 - skip potential '.' in targetUser
         int index = user.indexOf(roleGroupSeperator, targetUser.length());
         boolean isRoleGroup = false;
         boolean userMatch = false;
         if (index > 0 && targetUser.regionMatches(0, user, 0, index) == true)
            isRoleGroup = true;
         else
            userMatch = targetUser.equals(user);

         // Check for username.RoleGroup pattern
         if (isRoleGroup == true)
         {
            String groupName = user.substring(index + 1);
            if (groupName.equals("Roles"))
            {
               if( trace )
                  log.trace("Adding to Roles: "+value);
               parseGroupMembers(rolesGroup, value, aslm);
            }
            else
            {
               if( trace )
                  log.trace("Adding to "+groupName+": "+value);
               SimpleGroup group = new SimpleGroup(groupName);
               parseGroupMembers(group, value, aslm);
               groups.add(group);
            }
         }
         else if (userMatch == true)
         {
            if( trace )
               log.trace("Adding to Roles: "+value);
            // Place these roles into the Default "Roles" group
            parseGroupMembers(rolesGroup, value, aslm);
         }
      }
      Group[] roleSets = new Group[groups.size()];
View Full Code Here

    */
   static Group[] getRoleSets(String username, String dsJndiName,
      String rolesQuery, AbstractServerLoginModule aslm, boolean suspendResume)
      throws LoginException
   {
      Logger log = aslm.log;
      boolean trace = log.isTraceEnabled();
      Connection conn = null;
      HashMap<String,Group> setsMap = new HashMap<String,Group>();
      PreparedStatement ps = null;
      ResultSet rs = null;
     
      TransactionManager tm = null;
     
      if(suspendResume)
      {
         TransactionManagerLocator tml = new TransactionManagerLocator();
         try
         {
            tm = tml.getTM("java:/TransactionManager");
         }
         catch (NamingException e1)
         {
            throw new RuntimeException(e1);
         }
         if(tm == null)
            throw new IllegalStateException("Transaction Manager is null");
      }     
      Transaction tx = null;
      if (suspendResume)
      {
        // tx = TransactionDemarcationSupport.suspendAnyTransaction();
         try
         {
            tx = tm.suspend();
         }
         catch (SystemException e)
         {
            throw new RuntimeException(e);
         }
         if( trace )
            log.trace("suspendAnyTransaction");
      }

      try
      {
         InitialContext ctx = new InitialContext();
         DataSource ds = (DataSource) ctx.lookup(dsJndiName);
         conn = ds.getConnection();
         // Get the user role names
         if (trace)
            log.trace("Excuting query: "+rolesQuery+", with username: "+username);
         ps = conn.prepareStatement(rolesQuery);
         try
         {
            ps.setString(1, username);
         }
         catch(ArrayIndexOutOfBoundsException ignore)
         {
            // The query may not have any parameters so just try it
         }
         rs = ps.executeQuery();
         if( rs.next() == false )
         {
            if( trace )
               log.trace("No roles found");
            if( aslm.getUnauthenticatedIdentity() == null )
               throw new FailedLoginException("No matching username found in Roles");
            /* We are running with an unauthenticatedIdentity so create an
               empty Roles set and return.
            */
            Group[] roleSets = { new SimpleGroup("Roles") };
            return roleSets;
         }

         do
         {
            String name = rs.getString(1);
            String groupName = rs.getString(2);
            if( groupName == null || groupName.length() == 0 )
               groupName = "Roles";
            Group group = (Group) setsMap.get(groupName);
            if( group == null )
            {
               group = new SimpleGroup(groupName);
               setsMap.put(groupName, group);
            }

            try
            {
               Principal p = aslm.createIdentity(name);
               if( trace )
                  log.trace("Assign user to role " + name);
               group.addMember(p);
            }
            catch(Exception e)
            {
               log.debug("Failed to create principal: "+name, e);
            }
         } while( rs.next() );
      }
      catch(NamingException ex)
      {
         LoginException le = new LoginException("Error looking up DataSource from: "+dsJndiName);
         le.initCause(ex);
         throw le;
      }
      catch(SQLException ex)
      {
         LoginException le = new LoginException("Query failed");
         le.initCause(ex);
         throw le;
      }
      finally
      {
         if( rs != null )
         {
            try
            {
               rs.close();
            }
            catch(SQLException e)
            {}
         }
         if( ps != null )
         {
            try
            {
               ps.close();
            }
            catch(SQLException e)
            {}
         }
         if( conn != null )
         {
            try
            {
               conn.close();
            }
            catch (Exception ex)
            {}
         }
         if (suspendResume)
         {
            //TransactionDemarcationSupport.resumeAnyTransaction(tx);
            try
            {
               tm.resume(tx);
            }
            catch (Exception e)
            {
               throw new RuntimeException(e);
            }
            if( trace )
               log.trace("resumeAnyTransaction");
         }
      }
     
      Group[] roleSets = new Group[setsMap.size()];
      setsMap.values().toArray(roleSets);
View Full Code Here

            order.addAll(jarsSet);
            jarsSet.clear();
            warMetaData.setNoOrder(true);
        }

        Logger log = Logger.getLogger("org.jboss.web");
        if (log.isDebugEnabled()) {
            StringBuilder builder = new StringBuilder();
            builder.append("Resolved order: [ ");
            for (String jar : order) {
                builder.append(jar).append(' ');
            }
            builder.append(']');
            log.debug(builder.toString());
        }

        warMetaData.setOrder(order);
        warMetaData.setOverlays(overlays);
        warMetaData.setScis(scis);
View Full Code Here

        done(container, elapsedTime, started, failed, map, missingDepsSet);
    }

    protected void done(ServiceContainer container, long elapsedTime, int started, int failed, EnumMap<ServiceController.Mode, AtomicInteger> map, Set<ServiceName> missingDepsSet) {
        futureContainer.done(container);
        final Logger log = Logger.getLogger("org.jboss.as");
        final int active = map.get(ServiceController.Mode.ACTIVE).get();
        final int passive = map.get(ServiceController.Mode.PASSIVE).get();
        final int onDemand = map.get(ServiceController.Mode.ON_DEMAND).get();
        final int never = map.get(ServiceController.Mode.NEVER).get();
        if (failed == 0) {
            log.infof("JBoss AS %s \"%s\" started in %dms - Started %d of %d services (%d services are passive or on-demand)", Version.AS_VERSION, Version.AS_RELEASE_CODENAME, Long.valueOf(elapsedTime), Integer.valueOf(started), Integer.valueOf(active + passive + onDemand + never), Integer.valueOf(onDemand + passive));
            try {
                configuration.getConfigurationPersister().successfulBoot();
            } catch (ConfigurationPersistenceException e) {
                log.error(e);
            }
        } else {
            log.errorf("JBoss AS %s \"%s\" started (with errors) in %dms - Started %d of %d services (%d services failed or missing dependencies, %d services are passive or on-demand)", Version.AS_VERSION, Version.AS_RELEASE_CODENAME, Long.valueOf(elapsedTime), Integer.valueOf(started), Integer.valueOf(active + passive + onDemand + never), Integer.valueOf(failed), Integer.valueOf(onDemand + passive));
        }
    }
View Full Code Here

   */
  static Group[] getRoleSets(String username, String dsJndiName,
     String rolesQuery, AbstractServerLoginModule aslm, boolean suspendResume)
     throws LoginException
  {
     Logger log = aslm.log;
     boolean trace = log.isTraceEnabled();
     Connection conn = null;
     HashMap<String,Group> setsMap = new HashMap<String,Group>();
     PreparedStatement ps = null;
     ResultSet rs = null;
    
     TransactionManager tm = null;
    
     if(suspendResume)
     {
        TransactionManagerLocator tml = new TransactionManagerLocator();
        try
        {
           tm = tml.getTM("java:/TransactionManager");
        }
        catch (NamingException e1)
        {
           throw new RuntimeException(e1);
        }
        if(tm == null)
           throw new IllegalStateException("Transaction Manager is null");
     }     
     Transaction tx = null;
     if (suspendResume)
     {
       // tx = TransactionDemarcationSupport.suspendAnyTransaction();
        try
        {
           tx = tm.suspend();
        }
        catch (SystemException e)
        {
           throw new RuntimeException(e);
        }
        if( trace )
           log.trace("suspendAnyTransaction");
     }

     try
     {
        InitialContext ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup(dsJndiName);
        conn = ds.getConnection();
        // Get the user role names
        if (trace)
           log.trace("Excuting query: "+rolesQuery+", with username: "+username);
        ps = conn.prepareStatement(rolesQuery);
        try
        {
           ps.setString(1, username);
        }
        catch(ArrayIndexOutOfBoundsException ignore)
        {
           // The query may not have any parameters so just try it
        }
        rs = ps.executeQuery();
        if( rs.next() == false )
        {
           if( trace )
              log.trace("No roles found");
           if( aslm.getUnauthenticatedIdentity() == null )
              throw new FailedLoginException("No matching username found in Roles");
           /* We are running with an unauthenticatedIdentity so create an
              empty Roles set and return.
           */
           Group[] roleSets = { new SimpleGroup("Roles") };
           return roleSets;
        }

        do
        {
           String name = rs.getString(1);
           String groupName = rs.getString(2);
           if( groupName == null || groupName.length() == 0 )
              groupName = "Roles";
           Group group = (Group) setsMap.get(groupName);
           if( group == null )
           {
              group = new SimpleGroup(groupName);
              setsMap.put(groupName, group);
           }

           try
           {
              Principal p = aslm.createIdentity(name);
              if( trace )
                 log.trace("Assign user to role " + name);
              group.addMember(p);
           }
           catch(Exception e)
           {
              log.debug("Failed to create principal: "+name, e);
           }
        } while( rs.next() );
     }
     catch(NamingException ex)
     {
        LoginException le = new LoginException("Error looking up DataSource from: "+dsJndiName);
        le.initCause(ex);
        throw le;
     }
     catch(SQLException ex)
     {
        LoginException le = new LoginException("Query failed");
        le.initCause(ex);
        throw le;
     }
     finally
     {
        if( rs != null )
        {
           try
           {
              rs.close();
           }
           catch(SQLException e)
           {}
        }
        if( ps != null )
        {
           try
           {
              ps.close();
           }
           catch(SQLException e)
           {}
        }
        if( conn != null )
        {
           try
           {
              conn.close();
           }
           catch (Exception ex)
           {}
        }
        if (suspendResume)
        {
           //TransactionDemarcationSupport.resumeAnyTransaction(tx);
           try
           {
              tm.resume(tx);
           }
           catch (Exception e)
           {
              throw new RuntimeException(e);
           }
           if( trace )
              log.trace("resumeAnyTransaction");
        }
     }
    
     Group[] roleSets = new Group[setsMap.size()];
     setsMap.values().toArray(roleSets);
View Full Code Here

    * @return Group[] containing the sets of roles
    */
   static Group[] getRoleSets(String targetUser, Properties roles,
      char roleGroupSeperator, AbstractServerLoginModule aslm)
   {
      Logger log = aslm.log;     
      boolean trace = log.isTraceEnabled();
      Enumeration<?> users = roles.propertyNames();
      SimpleGroup rolesGroup = new SimpleGroup("Roles");
      ArrayList<Group> groups = new ArrayList<Group>();
      groups.add(rolesGroup);
      while (users.hasMoreElements() && targetUser != null)
      {
         String user = (String) users.nextElement();
         String value = roles.getProperty(user);
         if( trace )
            log.trace("Checking user: "+user+", roles string: "+value);
         // See if this entry is of the form targetUser[.GroupName]=roles
         //JBAS-3742 - skip potential '.' in targetUser
         int index = user.indexOf(roleGroupSeperator, targetUser.length());
         boolean isRoleGroup = false;
         boolean userMatch = false;
         if (index > 0 && targetUser.regionMatches(0, user, 0, index) == true)
            isRoleGroup = true;
         else
            userMatch = targetUser.equals(user);

         // Check for username.RoleGroup pattern
         if (isRoleGroup == true)
         {
            String groupName = user.substring(index + 1);
            if (groupName.equals("Roles"))
            {
               if( trace )
                  log.trace("Adding to Roles: "+value);
               parseGroupMembers(rolesGroup, value, aslm);
            }
            else
            {
               if( trace )
                  log.trace("Adding to "+groupName+": "+value);
               SimpleGroup group = new SimpleGroup(groupName);
               parseGroupMembers(group, value, aslm);
               groups.add(group);
            }
         }
         else if (userMatch == true)
         {
            if( trace )
               log.trace("Adding to Roles: "+value);
            // Place these roles into the Default "Roles" group
            parseGroupMembers(rolesGroup, value, aslm);
         }
      }
      Group[] roleSets = new Group[groups.size()];
View Full Code Here

         char[] password = decode(raf);
         return password;
      }
      catch(Exception e)
      {
         Logger log = Logger.getLogger(FilePassword.class);
         log.error("Failed to decode password file: "+passwordFile, e);
         throw new IOException(e.getMessage());
      }
   }
View Full Code Here

      poolingStrategy.setConnectionListenerFactory(this);

      // Give it somewhere to tell people things
      String categoryName = poolingStrategy.getManagedConnectionFactory().getClass().getName() + "." + jndiName;
      Logger log = Logger.getLogger(categoryName);
      PrintWriter logWriter = new LoggerPluginWriter(log.getLoggerPlugin());
      try
      {
         poolingStrategy.getManagedConnectionFactory().setLogWriter(logWriter);
      }
      catch (ResourceException re)
      {
         log.warn("Unable to set log writer '" + logWriter + "' on " + "managed connection factory", re);
         log.warn("Linked exception:", re.getLinkedException());
      }
     
      if (poolingStrategy instanceof PreFillPoolSupport)
      {
         PreFillPoolSupport prefill = (PreFillPoolSupport) poolingStrategy;
View Full Code Here

TOP

Related Classes of org.jboss.logging.Logger

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.