public void registerOpenLConfiguration(String name, IOpenLConfiguration oplc) throws OpenConfigurationException { IOpenLConfiguration configuration = configurations.get(name); if (configuration != null) { throw new OpenConfigurationException("The configuration " + name + " already exists", null, null); } configurations.put(name, oplc); }
OpenL getOpenlConfiguration(IFile file) { try { String openlName = getOpenlName(file.getName()); return OpenL.getInstance(openlName, getUserContext()); } catch (OpenConfigurationException oce) { int severity = IMarker.SEVERITY_ERROR; OpenlMarkers.addMarker(file, file.getFullPath().toString(), "Openl Configuration Exception: " + oce.getMessage(), severity, null, null, null); return null; } }
public void registerOpenL(String name, OpenL opl) throws OpenConfigurationException { OpenL openl = openls.get(name); if (openl != null) { throw new OpenConfigurationException("The openl " + name + " already exists", null, null); } openls.put(name, opl); }
public static Object newInstance(Class<?> cc, String uri) throws OpenConfigurationException { try { return cc.newInstance(); } catch (Throwable t) { throw new OpenConfigurationException("Can't create a new " + cc.getName(), uri, t); } }
public void registerOpenL(String name, OpenL opl) throws OpenConfigurationException { OpenL openl = openls.get(name); if (openl != null) { throw new OpenConfigurationException("The openl " + name + " already exists", null, null); } openls.put(name, opl); }
public void registerOpenLConfiguration(String name, IOpenLConfiguration oplc) throws OpenConfigurationException { IOpenLConfiguration configuration = configurations.get(name); if (configuration != null) { throw new OpenConfigurationException("The configuration " + name + " already exists", null, null); } configurations.put(name, oplc); }
public static Object newInstance(Class<?> cc, String uri) throws OpenConfigurationException { try { return cc.newInstance(); } catch (Throwable t) { throw new OpenConfigurationException("Can't create a new " + cc.getName(), uri, t); } }
static public Class<?> validateClassExistsAndPublic(String className, ClassLoader cl, String uri) throws OpenConfigurationException { Class<?> c; try { c = cl.loadClass(className); } catch (Throwable t) { throw new OpenConfigurationException("Can't load class: " + className, uri, t); } if (!Modifier.isPublic(c.getModifiers())) { throw new OpenConfigurationException(c.getName() + " must be public ", uri, null); } return c; }
static public Class<?> validateClassExistsAndPublic(String className, ClassLoader cl, String uri) throws OpenConfigurationException { Class<?> c; try { c = cl.loadClass(className); } catch (Throwable t) { throw new OpenConfigurationException("Can't load class: " + className, uri, t); } if (!Modifier.isPublic(c.getModifiers())) { throw new OpenConfigurationException(c.getName() + " must be public ", uri, null); } return c; }
static public void validateSuper(Class<?> clazz, Class<?> superClazz, String uri) throws OpenConfigurationException { if (!superClazz.isAssignableFrom(clazz)) { String verb = superClazz.isInterface() ? "implement" : "extend"; throw new OpenConfigurationException(clazz.getName() + " does not " + verb + " " + superClazz.getName(), uri, null); } }
static public void validateSuper(Class<?> clazz, Class<?> superClazz, String uri) throws OpenConfigurationException { if (!superClazz.isAssignableFrom(clazz)) { String verb = superClazz.isInterface() ? "implement" : "extend"; throw new OpenConfigurationException(clazz.getName() + " does not " + verb + " " + superClazz.getName(), uri, null); } }
static public void validateHaveNewInstance(Class<?> clazz, String uri) throws OpenConfigurationException { if (Modifier.isAbstract(clazz.getModifiers())) { throw new OpenConfigurationException(clazz.getName() + " must not be abstract ", uri, null); } try { Constructor<?> constr = clazz.getConstructor(NO_PARAMS); if (!Modifier.isPublic(constr.getModifiers())) { throw new OpenConfigurationException("Default constructor of " + clazz.getName() + " must be public", uri, null); } } catch (OpenConfigurationException ex) { throw ex; } catch (Throwable t) { throw new OpenConfigurationException(clazz.getName() + " must have a default constructor", uri, null); } }
static public void validateHaveNewInstance(Class<?> clazz, String uri) throws OpenConfigurationException { if (Modifier.isAbstract(clazz.getModifiers())) { throw new OpenConfigurationException(clazz.getName() + " must not be abstract ", uri, null); } try { Constructor<?> constr = clazz.getConstructor(NO_PARAMS); if (!Modifier.isPublic(constr.getModifiers())) { throw new OpenConfigurationException("Default constructor of " + clazz.getName() + " must be public", uri, null); } } catch (OpenConfigurationException ex) { throw ex; } catch (Throwable t) { throw new OpenConfigurationException(clazz.getName() + " must have a default constructor", uri, null); } }
public static Object newInstance(String classname, IConfigurableResourceContext cxt, String uri) throws OpenConfigurationException { try { return cxt.getClassLoader().loadClass(classname).newInstance(); } catch (Throwable t) { throw new OpenConfigurationException("Can't create a new " + classname, uri, t); } }
static public Method validateHasMethod(Class<?> clazz, String methodName, Class<?>[] params, String uri) throws OpenConfigurationException { Method m; try { m = clazz.getMethod(methodName, params); } catch (Throwable t) { String methodString = MethodUtil.printMethod(methodName, params); throw new OpenConfigurationException( "Class " + clazz.getName() + " does not have a method " + methodString, uri, t); } if (!Modifier.isPublic(m.getModifiers())) { throw new OpenConfigurationException(methodName + " must be public ", uri, null); } return m; }
public static Object newInstance(String classname, IConfigurableResourceContext cxt, String uri) throws OpenConfigurationException { try { return cxt.getClassLoader().loadClass(classname).newInstance(); } catch (Throwable t) { throw new OpenConfigurationException("Can't create a new " + classname, uri, t); } }
static public Method validateHasMethod(Class<?> clazz, String methodName, Class<?>[] params, String uri) throws OpenConfigurationException { Method m; try { m = clazz.getMethod(methodName, params); } catch (Throwable t) { String methodString = MethodUtil.printMethod(methodName, params); throw new OpenConfigurationException( "Class " + clazz.getName() + " does not have a method " + methodString, uri, t); } if (!Modifier.isPublic(m.getModifiers())) { throw new OpenConfigurationException(methodName + " must be public ", uri, null); } return m; }
static public Constructor<?> validateHasConstructor(Class<?> clazz, Class<?>[] params, String uri) throws OpenConfigurationException { Constructor<?> c; try { c = clazz.getConstructor(params); } catch (Throwable t) { String methodString = MethodUtil.printMethod("", params); throw new OpenConfigurationException("Class " + clazz.getName() + " does not have a constructor " + methodString, uri, t); } if (!Modifier.isPublic(c.getModifiers())) { throw new OpenConfigurationException("Constructor " + clazz.getName() + MethodUtil.printMethod("", params) + " must be public ", uri, null); } return c; }