Package org.jboss.forge.shell.exceptions

Examples of org.jboss.forge.shell.exceptions.CommandExecutionException


               }
               else
               {
                  name = "at index [" + option.getIndex() + "]";
               }
               throw new CommandExecutionException(command, "command option '"
                        + name
                        + "' must be of type '" + parmTypes[i].getSimpleName() + "'", e);
            }
         }

         Plugin plugin;
         if (bean != null)
         {
            CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
                     .createCreationalContext(bean);
            if (context != null)
            {
               plugin = (Plugin) manager.getReference(bean, pluginType, context);

               Status status = Status.FAILURE;
               ClassLoader current = Thread.currentThread().getContextClassLoader();
               boolean vetoed = false;
               try
               {
                  Thread.currentThread().setContextClassLoader(plugin.getClass().getClassLoader());
                  PreCommandExecution event = new PreCommandExecution(command, originalStatement, parameterArray);
                  manager.fireEvent(event, new Annotation[0]);
                  vetoed = event.isVetoed();
                  if (!vetoed)
                  {
                     command.getMethod().invoke(plugin, paramStaging);
                     status = Status.SUCCESS;
                  }
               }
               catch (Exception e)
               {
                  throw new CommandExecutionException(command, e);
               }
               finally
               {
                  Thread.currentThread().setContextClassLoader(current);
                  if (!vetoed)
View Full Code Here


            if (!command.isSetup())
               enforcer.verifyAvailable(shell.getCurrentProject(), command.getParent());
         }
         catch (ConstraintException e)
         {
            throw new CommandExecutionException(command, e);
         }
      }
   }
View Full Code Here

         {
            enforcer.verifyAvailable(shell.getCurrentProject(), command.getPluginMetadata());
         }
         catch (ConstraintException e)
         {
            throw new CommandExecutionException(command, e);
         }
      }
   }
View Full Code Here

               }
               else
               {
                  name = "at index [" + option.getIndex() + "]";
               }
               throw new CommandExecutionException(command, "command option '"
                        + name
                        + "' must be of type '" + parmTypes[i].getSimpleName() + "'", e);
            }
         }

         Plugin plugin;
         if (bean != null)
         {
            CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
                     .createCreationalContext(bean);
            if (context != null)
            {
               plugin = (Plugin) manager.getReference(bean, pluginType, context);

               boolean success = false;
               try
               {
                  command.getMethod().invoke(plugin, paramStaging);
                  success = true;
               }
               catch (Exception e)
               {
                  throw new CommandExecutionException(command, e);
               }
               finally
               {
                  if (success)
                     manager.fireEvent(new CommandExecuted(Status.SUCCESS), new Annotation[] {});
View Full Code Here

            if (!command.isSetup())
               enforcer.verifyAvailable(shell.getCurrentProject(), command.getParent());
         }
         catch (ConstraintException e)
         {
            throw new CommandExecutionException(command, e);
         }
      }
   }
View Full Code Here

               }
               else
               {
                  name = "at index [" + option.getIndex() + "]";
               }
               throw new CommandExecutionException(command, "command option '"
                        + name
                        + "' must be of type '" + parmTypes[i].getSimpleName() + "'", e);
            }
         }

         Plugin plugin;
         if (bean != null)
         {
            CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
                     .createCreationalContext(bean);
            if (context != null)
            {
               plugin = (Plugin) manager.getReference(bean, pluginType, context);

               Status status = Status.FAILURE;
               ClassLoader current = Thread.currentThread().getContextClassLoader();
               try
               {
                  Thread.currentThread().setContextClassLoader(plugin.getClass().getClassLoader());
                  command.getMethod().invoke(plugin, paramStaging);
               }
               catch (Exception e)
               {
                  throw new CommandExecutionException(command, e);
               }
               finally
               {
                  Thread.currentThread().setContextClassLoader(current);
                  manager.fireEvent(new CommandExecuted(status, command, parameterArray), new Annotation[] {});
View Full Code Here

            if (!command.isSetup())
               enforcer.verifyAvailable(shell.getCurrentProject(), command.getParent());
         }
         catch (ConstraintException e)
         {
            throw new CommandExecutionException(command, e);
         }
      }
   }
View Full Code Here

               }
               else
               {
                  name = "at index [" + option.getIndex() + "]";
               }
               throw new CommandExecutionException(command, "command option '"
                        + name
                        + "' must be of type '" + parmTypes[i].getSimpleName() + "'", e);
            }
         }

         Plugin plugin;
         if (bean != null)
         {
            CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
                     .createCreationalContext(bean);
            if (context != null)
            {
               plugin = (Plugin) manager.getReference(bean, pluginType, context);

               boolean success = false;
               try
               {
                  command.getMethod().invoke(plugin, paramStaging);
                  success = true;
               }
               catch (Exception e)
               {
                  throw new CommandExecutionException(command, e);
               }
               finally
               {
                  if (success)
                     manager.fireEvent(new CommandExecuted(Status.SUCCESS, command), new Annotation[] {});
View Full Code Here

            if (!command.isSetup())
               enforcer.verifyAvailable(shell.getCurrentProject(), command.getParent());
         }
         catch (ConstraintException e)
         {
            throw new CommandExecutionException(command, e);
         }
      }
   }
View Full Code Here

               }
               else
               {
                  name = "at index [" + option.getIndex() + "]";
               }
               throw new CommandExecutionException(command, "command option '"
                        + name
                        + "' must be of type '" + parmTypes[i].getSimpleName() + "'", e);
            }
         }

         Plugin plugin;
         if (bean != null)
         {
            CreationalContext<? extends Plugin> context = (CreationalContext<? extends Plugin>) manager
                     .createCreationalContext(bean);
            if (context != null)
            {
               plugin = (Plugin) manager.getReference(bean, pluginType, context);

               Status status = Status.FAILURE;
               ClassLoader current = Thread.currentThread().getContextClassLoader();
               try
               {
                  Thread.currentThread().setContextClassLoader(plugin.getClass().getClassLoader());
                  command.getMethod().invoke(plugin, paramStaging);
                  status = Status.SUCCESS;
               }
               catch (Exception e)
               {
                  throw new CommandExecutionException(command, e);
               }
               finally
               {
                  Thread.currentThread().setContextClassLoader(current);
                  manager.fireEvent(new CommandExecuted(status, command, originalStatement, parameterArray),
View Full Code Here

TOP

Related Classes of org.jboss.forge.shell.exceptions.CommandExecutionException

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.