Package com.khs.sherpa.exception

Examples of com.khs.sherpa.exception.SherpaRuntimeException


 
  protected Object createInstance() {
    try {
      return type.newInstance();
    } catch (Exception e) {
      throw new SherpaRuntimeException("Unable to create Managed Bean [" + type + "]");
    }
   
  }
View Full Code Here


      if(newMethod == null) {
        continue;
      }
     
      if(method != null) {
        throw new SherpaRuntimeException("To many methods found for method ["+method.getName()+"]");
      }
     
      method = newMethod;
    }
    return method;
View Full Code Here

    if(springApplicationContextClass != null) {
      try {
        applicationContext = (ApplicationContext) springApplicationContextClass.getDeclaredConstructor(ServletContext.class).newInstance(servletContextEvent.getServletContext());
      } catch (InstantiationException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      } catch (IllegalAccessException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      } catch (IllegalArgumentException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      } catch (SecurityException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      } catch (InvocationTargetException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
        throw new SherpaRuntimeException(e);
      }
    } else {
      applicationContext = new GenericApplicationContext();
    }
   
View Full Code Here

        }
        initialized.add(clazz);
        try {
        clazz.newInstance().sherpaInitialize(applicationContext);
      } catch (Exception e) {
        throw new SherpaRuntimeException(e);
      }
      }
  }
View Full Code Here

 
  private Object mapAnnotation(String endpoint,String action,Class<?> type, Param param) {
    String name = param.value();
   
    if(name == null || name.length() == 0) {
      throw new SherpaRuntimeException("parameters required")
    }
   
    String value = requestProcessor.getParmeter(request, name);
    if(value == null) {
      throw new RuntimeException("Endpoint = "+endpoint+" Action = "+action+" - Parameter name ("+name+") not found in request");   
View Full Code Here

              ReflectionUtils.withModifier(Modifier.PUBLIC),
              Predicates.not(ReflectionUtils.withModifier(Modifier.ABSTRACT)),
              Predicates.not(SherpaPredicates.withGeneric()))
          );
    } catch (NoSuchManagedBeanExcpetion e) {
      throw new SherpaRuntimeException(e);
    }
   
    for(Method method: methods) {
     
      Map<String, Object> action = new HashMap<String, Object>();
View Full Code Here

      if(methods.size() == 0) {
        throw new SherpaActionNotFoundException(action);
      }
     
    } catch (NoSuchManagedBeanExcpetion e) {
      throw new SherpaRuntimeException(e);
    }
   
    return this.processEndpoint(target, methods.toArray(new Method[] {}), httpMethod);
  }
View Full Code Here

    }
   
    this.hasPermission(method, userid, token);
    Action annotation = method.getAnnotation(Action.class);
    if (annotation == null) {
      throw new SherpaRuntimeException("Error executing"+target+" @Action annotation required for not endpoint methods"  );
    }
    if(annotation.contentType() != null) {
      response.setContentType(method.getAnnotation(Action.class).contentType().type);
    }
    return this.invokeMethod(target, method)
View Full Code Here

  protected void hasPermission(Class<?> target, String userid, String token) {
    SessionTokenService service = null;
    try {
      service = applicationContext.getManagedBean(SessionTokenService.class);
    } catch (NoSuchManagedBeanExcpetion e) {
      throw new SherpaRuntimeException(e);
    }
   
    // make sure Endpoint Authentication is turned on
    if((Boolean)applicationContext.getAttribute(ApplicationContext.SETTINGS_ENDPOINT_AUTH) == false) {
      return;
View Full Code Here

  protected void hasPermission(Method method, String userid, String token) {
    SessionTokenService service = null;
    try {
      service = applicationContext.getManagedBean(SessionTokenService.class);
    } catch (NoSuchManagedBeanExcpetion e) {
      throw new SherpaRuntimeException(e);
    }

    if(method.isAnnotationPresent(DenyAll.class)) {
      throw new SherpaPermissionExcpetion("method ["+method.getName()+"] in class ["+method.getDeclaringClass().getCanonicalName()+"] has `@DenyAll` annotation", "DENY_ALL");
    }
View Full Code Here

TOP

Related Classes of com.khs.sherpa.exception.SherpaRuntimeException

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.