Package org.jboss.util

Examples of org.jboss.util.JBossStringBuilder


      return buffer.toString();
   }

   protected String formatError(String context, TransformerException e)
   {
      JBossStringBuilder buffer = new JBossStringBuilder();
      buffer.append("File ").append(fileName);
      buffer.append(" process ").append(context);
      buffer.append(". Location: ").append(e.getLocationAsString());
      buffer.append(". Error message: ").append(e.getMessage());
      return buffer.toString();
   }
View Full Code Here


      }
   }
  
   public String dump()
   {
      JBossStringBuilder buffer = new JBossStringBuilder();
      buffer.append("TOP=");
      if (top == null)
         buffer.append("null");
      else
         buffer.append(top.time);
      buffer.append(" size=").append(size()).append('\n');
      for (int i = 0; i < queues.length; ++i)
      {
         buffer.append(i).append("=");
         for (int j = 1; j <= queues[i].size; ++j)
            buffer.append(queues[i].queue[j].time).append(',');
         buffer.append('\n');
      }
      return buffer.toString();
   }
View Full Code Here

   }

   public String showPreparedTransactionsAsHTML()
   {
      List txs = txRepository.getPreparedTransactions();
      JBossStringBuilder buffer = new JBossStringBuilder();
      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
      buffer.append("<tr><th>Xid</th></tr>");
      for (Iterator i = txs.iterator(); i.hasNext();)
      {
         Xid xid = (Xid)i.next();
         if (xid != null)
         {
            buffer.append("<tr><td>");
            buffer.append(xid);
            buffer.append("</td></tr>");
         }
      }
      buffer.append("</table>");
      return buffer.toString();
   }
View Full Code Here

   }

   public String showPreparedTransactionsAsHTML()
   {
      List txs = txRepository.getPreparedTransactions();
      JBossStringBuilder buffer = new JBossStringBuilder();
      buffer.append("<table width=\"100%\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\">");
      buffer.append("<tr><th>Xid</th></tr>");
      for (Iterator i = txs.iterator(); i.hasNext();)
      {
         Xid xid = (Xid)i.next();
         if (xid != null)
         {
            buffer.append("<tr><td>");
            buffer.append(xid);
            buffer.append("</td></tr>");
         }
      }
      buffer.append("</table>");
      return buffer.toString();
   }
View Full Code Here

      {
         if (Character.isUpperCase(name.charAt(1)))
            return name;
      }

      JBossStringBuilder buffer = new JBossStringBuilder(name.length());
      buffer.append(Character.toLowerCase(name.charAt(0)));
      if (name.length() > 1)
         buffer.append(name.substring(1));
      return buffer.toString();
   }
View Full Code Here

   protected String convertName(CtClass clazz)
   {
      CtClass temp = clazz;
      if (temp.isArray())
      {
         JBossStringBuilder buffer = new JBossStringBuilder();
         try
         {
            while (temp.isArray())
            {
               buffer.append('[');
               temp = temp.getComponentType();
            }
            if (temp.isPrimitive())
            {
               CtPrimitiveType primitive = (CtPrimitiveType) temp;
               buffer.append(Character.toString(primitive.getDescriptor()));
            }
            else
            {
               buffer.append('L');
               buffer.append(temp.getName());
               buffer.append(';');
            }
            return buffer.toString();
         }
         catch (NotFoundException e)
         {
            throw raiseClassNotFound(clazz.getName(), e);
         }
View Full Code Here

     
   }

   private String stream2String(InputSource input) throws Exception
   {
      final JBossStringBuilder back = new JBossStringBuilder();
      byte[] tmp = new byte[255];
      InputStream rd = input.getByteStream();

      while (rd.read(tmp) != -1)
      {
         back.append(new String(tmp));
      }

      return back.toString();

   }
View Full Code Here

      {
         if (Character.isUpperCase(name.charAt(1)))
            return name;
      }

      JBossStringBuilder buffer = new JBossStringBuilder(name.length());
      buffer.append(Character.toLowerCase(name.charAt(0)));
      if (name.length() > 1)
         buffer.append(name.substring(1));
      return buffer.toString();
   }
View Full Code Here

        
         ApplicationScope app = md.getMetaData(ApplicationScope.class);
         DeploymentScope dep = md.getMetaData(DeploymentScope.class);
         if (app != null && dep != null)
         {
            JBossStringBuilder fqn = new JBossStringBuilder("/");
            AspectManager sub = null;
            if (app != null)
            {
               String name="APPLICATION=" + app.value();
               fqn.append(name);
               fqn.append("/");
               sub = manager.findManagerByName(fqn.toString());
               if (sub == null)
               {
                  sub = createNewDomain(manager, name);
               }
            }
           
            if (dep != null)
            {
               String name="DEPLOYMENT=" + dep.value();
               fqn.append(name);
               fqn.append("/");
               AspectManager parent = sub;
               sub = manager.findManagerByName(fqn.toString());
               if (sub == null)
               {
                  sub = createNewDomain(parent, name);
               }
            }
View Full Code Here

               if (ctx.getState().equals(ControllerState.ERROR))
                  errors.add(ctx);
               else
                  incomplete.add(ctx);
            }
            JBossStringBuilder buffer = new JBossStringBuilder();
            buffer.append("Incompletely deployed:\n");
            if (errors.size() != 0)
            {
               buffer.append("\nDEPLOYMENTS IN ERROR:\n");
               for (ControllerContext ctx : errors)
               {
                  buffer.append(String.format("  Deployment \"%s\" is in error due to: %s\n", ctx.getName(), ctx.getError()));
               }
            }
            if (incomplete.size() != 0)
            {
               buffer.append("\nDEPLOYMENTS MISSING DEPENDENCIES:\n");
               for (ControllerContext ctx : incomplete)
               {
                  Object name = ctx.getName();
                  buffer.append(String.format("  Deployment \"%s\" is missing the following dependencies:\n", name));
                  DependencyInfo dependsInfo = ctx.getDependencyInfo();
                  Set<DependencyItem> depends = dependsInfo.getIDependOn(null);
                  for (DependencyItem item : depends)
                  {
                     ControllerState dependentState = item.getDependentState();
                     if (dependentState == null)
                        dependentState = ControllerState.INSTALLED;
                    
                     ControllerState otherState = null;
                     ControllerContext other = null;
                     Object iDependOn = item.getIDependOn();

                     if (name.equals(iDependOn) == false)
                     {
                        if (iDependOn != null)
                        {
                           other = controller.getContext(iDependOn, null);
                           if (other != null)
                              otherState = other.getState();
                        }

                        boolean print = true;
                        if (otherState != null && otherState.equals(ControllerState.ERROR) == false)
                        {
                           ControllerStateModel states = controller.getStates();
                           if (states.isBeforeState(otherState, dependentState) == false)
                              print = false;
                        }

                        if (print)
                        {
                           buffer.append(String.format("    Dependency \"%s\" (should be in state \"%s\", but is actually %s)\n",
                                   iDependOn,
                                   dependentState.getStateString(),
                                   iDependOn == null ?
                                           String.format("unresolved (%s)",
                                           item.toHumanReadableString()) :
                                           other == null ?
                                                   "not found" :
                                                   String.format("in state \"%s\"", otherState.getStateString())));
                        }
                     }
                  }
               }
            }
            throw new IllegalStateException(buffer.toString());
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.util.JBossStringBuilder

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.