Examples of ContainerException


Examples of org.jboss.forge.furnace.exception.ContainerException

   public Object invoke(final Object obj, final Method thisMethod, final Method proceed, final Object[] args)
            throws Throwable
   {
      if (Thread.currentThread().isInterrupted())
      {
         throw new ContainerException("Thread.interrupt() requested.");
      }

      Object result = ClassLoaders.executeIn(delegateLoader, new Callable<Object>()
      {
         @Override
         public Object call() throws Exception
         {
            try
            {
               if (thisMethod.getDeclaringClass().getName().equals(ForgeProxy.class.getName()))
               {
                  if (thisMethod.getName().equals("getDelegate"))
                     return ClassLoaderAdapterCallback.this.getDelegate();
                  if (thisMethod.getName().equals("getHandler"))
                     return ClassLoaderAdapterCallback.this.getHandler();
               }
            }
            catch (final Exception e)
            {
            }

            final Method delegateMethod = getDelegateMethod(thisMethod);

            final List<Object> parameterValues = enhanceParameterValues(args, delegateMethod);

            AccessibleObject.setAccessible(new AccessibleObject[] { delegateMethod }, true);
            try
            {
               final Object[] parameterValueArray = parameterValues.toArray();
               final Object result = delegateMethod.invoke(delegate, parameterValueArray);
               return enhanceResult(thisMethod, result);
            }
            catch (final InvocationTargetException e)
            {
               if (e.getCause() instanceof Exception)
                  throw enhanceException(delegateMethod, (Exception) e.getCause());
               throw enhanceException(delegateMethod, e);
            }

         }

         private Method getDelegateMethod(final Method proxy) throws ClassNotFoundException, NoSuchMethodException
         {

            Method delegateMethod = null;
            try
            {
               final List<Class<?>> parameterTypes = translateParameterTypes(proxy);
               delegateMethod = delegate.getClass().getMethod(proxy.getName(),
                        parameterTypes.toArray(new Class<?>[parameterTypes.size()]));
            }
            catch (final ClassNotFoundException e)
            {
               method: for (final Method m : delegate.getClass().getMethods())
               {
                  final String methodName = proxy.getName();
                  final String delegateMethodName = m.getName();
                  if (methodName.equals(delegateMethodName))
                  {
                     final Class<?>[] methodParameterTypes = proxy.getParameterTypes();
                     final Class<?>[] delegateParameterTypes = m.getParameterTypes();

                     if (methodParameterTypes.length == delegateParameterTypes.length)
                     {
                        for (int i = 0; i < methodParameterTypes.length; i++)
                        {
                           final Class<?> methodType = methodParameterTypes[i];
                           final Class<?> delegateType = delegateParameterTypes[i];

                           if (!methodType.getName().equals(delegateType.getName()))
                           {
                              continue method;
                           }
                        }

                        delegateMethod = m;
                        break;
                     }
                  }
               }
               if (delegateMethod == null)
                  throw e;
            }

            return delegateMethod;
         }
      });

      if (Thread.currentThread().isInterrupted())
      {
         throw new ContainerException("Thread.interrupt() requested.");
      }

      return result;
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

         final Class<Enum> callingType = (Class<Enum>) loader.loadClass(instance.getClass().getName());
         return Enum.valueOf(callingType, ((Enum) instance).name());
      }
      catch (final ClassNotFoundException e)
      {
         throw new ContainerException(
                  "Could not enhance instance [" + instance + "] of type [" + instance.getClass() + "]", e);
      }
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

         });
      }
      catch (final Exception e)
      {
         throw new ContainerException("Failed to create proxy for type [" + delegateType + "]", e);
      }
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

                        );
            }
         }
         catch (IOException e)
         {
            throw new ContainerException("Could not load resources from [" + file.getAbsolutePath() + "]", e);
         }
      }
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

                     dependency.isOptional()));
         }
      }

      if (!dependency.isOptional() && (addonId == null || moduleId == null))
         throw new ContainerException("Dependency [" + dependency + "] could not be loaded for addon [" + found
                  + "]");
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

         method.setAccessible(true);
         method.invoke(null);
      }
      catch (Exception e)
      {
         throw new ContainerException("Could not install Modules MBean server", e);
      }
   }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

                                       .getPosition()];
                           }
                        }
                        else
                        {
                           throw new ContainerException(
                                    "Cannot handle producer for non-Field and non-Method member type: " + member);
                        }

                        return ExportedInstanceLazyLoader.create(
                                 BeanManagerUtils.getContextualInstance(manager, AddonRegistry.class),
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

               }
            });
         }
         catch (Exception e)
         {
            throw new ContainerException("Could not get service of type [" + clazz + "] from addon [" + addon
                     + "]", e);
         }

      }
      return result;
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

                     }
                  }));
               }
               catch (Exception e)
               {
                  throw new ContainerException("Could not get services of type [" + clazz + "] from addon ["
                           + addon
                           + "]", e);
               }

            }
View Full Code Here

Examples of org.jboss.forge.furnace.exception.ContainerException

                     }
                  }
               }
               catch (Exception e)
               {
                  throw new ContainerException("Problems encountered during propagation of event [" + event
                           + "] with qualifiers [" + qualifiers + "]", e);
               }
         }
         else if (event instanceof InboundEvent)
         {
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.