public static Field getField(final Class clazz, final String fieldName) throws OpenEJBException { try { return clazz.getField(fieldName); } catch (final NoSuchFieldException e) { throw new OpenEJBException("Unable to get primary key field from entity bean class: " + clazz.getName(), e); } }
public static Field getField(Class clazz, String fieldName) throws OpenEJBException { try { return clazz.getField(fieldName); } catch (NoSuchFieldException e) { throw new OpenEJBException("Unable to get primary key field from entity bean class: " + clazz.getName(), e); } }
private URL toUrl(final String jarPath) throws OpenEJBException { try { return new File(jarPath).toURI().toURL(); } catch (final MalformedURLException e) { throw new OpenEJBException(messages.format("cl0001", jarPath, e.getMessage()), e); } }
private Class getType(final String type, final InjectableInfo injectable) throws OpenEJBException { if (type != null) { try { return classLoader.loadClass(type.trim()); } catch (final ClassNotFoundException e) { throw new OpenEJBException("Unable to load type '" + type + "' for " + injectable.referenceName); } } return inferType(injectable); }
@SuppressWarnings({"unchecked"}) public static Application unmarshal(final URL url) throws OpenEJBException { try { return ApplicationXml.unmarshal(url); } catch (final Exception e) { throw new OpenEJBException("Encountered error parsing the application.xml file: " + url.toExternalForm(), e); } }
private Class getType(final String type, final InjectableInfo injectable) throws OpenEJBException { if (type != null) { try { return classLoader.loadClass(type.trim()); } catch (final ClassNotFoundException e) { throw new OpenEJBException("Unable to load type '" + type + "' for " + injectable.referenceName); } } return inferType(injectable); }
@SuppressWarnings({"unchecked"}) public static Application unmarshal(final URL url) throws OpenEJBException { try { return ApplicationXml.unmarshal(url); } catch (final Exception e) { throw new OpenEJBException("Encountered error parsing the application.xml file: " + url.toExternalForm(), e); } }
protected static void checkImplementation(Class intrfce, Class factory, String serviceType, String serviceName) throws OpenEJBException { if (!intrfce.isAssignableFrom(factory)) { throw new OpenEJBException(messages.format("init.0100", serviceType, serviceName, factory.getName(), intrfce.getName())); } }
private static File unpack(final File jarFile, final File destinationDir) throws OpenEJBException, DeploymentTerminatedException { try { checkDest(destinationDir, jarFile); JarExtractor.extract(jarFile, destinationDir); return destinationDir; } catch (final IOException e) { throw new OpenEJBException("Unable to extract jar. " + e.getMessage(), e); } }
private static File unpack(final File jarFile, final File destinationDir) throws OpenEJBException, DeploymentTerminatedException { try { checkDest(destinationDir, jarFile); JarExtractor.extract(jarFile, destinationDir); return destinationDir; } catch (final IOException e) { throw new OpenEJBException("Unable to extract jar. " + e.getMessage(), e); } }
protected static void checkImplementation(final Class intrfce, final Class factory, final String serviceType, final String serviceName) throws OpenEJBException { if (!intrfce.isAssignableFrom(factory)) { throw new OpenEJBException(new Messages("org.apache.openejb.util.resources").format("init.0100", serviceType, serviceName, factory.getName(), intrfce.getName())); } }
public SimpleKeyGenerator(final Class beanClass, final String pkField) throws OpenEJBException { this.pkField = getField(beanClass, pkField); if (!isValidPkField(this.pkField)) { throw new OpenEJBException("Invalid primray key field: " + pkField); } }
protected Class<?> loadClass(final String clazz) throws OpenEJBException { final ClassLoader cl = module.getClassLoader(); try { return Class.forName(clazz, false, cl); } catch (final ClassNotFoundException cnfe) { throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, module.getJarLocation()), cnfe); } } }
private Class load(final String className, final String messageCode) throws OpenEJBException { try { return Class.forName(className, true, moduleContext.getClassLoader()); } catch (final ClassNotFoundException e) { final String message = SafeToolkit.messages.format("cl0007", className, bean.codebase); throw new OpenEJBException(AssemblerTool.messages.format(messageCode, className, bean.ejbDeploymentId, message)); } } }
protected void install(final ContainerInfo serviceInfo) throws OpenEJBException { if (sys != null) { sys.containerSystem.containers.add(serviceInfo); } else if (!offline) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { assembler.createContainer(serviceInfo); }else{ throw new OpenEJBException("ContainerInfo: Assembler has not been defined"); } } }
protected Class<?> loadClass(String clazz) throws OpenEJBException { ClassLoader cl = module.getClassLoader(); try { return Class.forName(clazz, false, cl); } catch (ClassNotFoundException cnfe) { throw new OpenEJBException(SafeToolkit.messages.format("cl0007", clazz, module.getJarLocation()), cnfe); } } }
protected Class<?> loadClass(final ClassLoader cl, final String clazz) throws OpenEJBException { try { return Class.forName(clazz, false, cl == null ? module.getClassLoader() : cl); } catch (final ClassNotFoundException cnfe) { throw new OpenEJBException( new Messages("org.apache.openejb.util.resources").format("cl0007", clazz, module.getJarLocation()), cnfe); } } }
public ContainerInfo createContainerInfo(final Container container) throws OpenEJBException { final Class<? extends ContainerInfo> infoClass = getContainerInfoType(container.getType()); if (infoClass == null) { throw new OpenEJBException(messages.format("unrecognizedContainerType", container.getType())); } return configureService(container, infoClass); }
public ContainerInfo createContainerInfo(final Container container) throws OpenEJBException { final Class<? extends ContainerInfo> infoClass = getContainerInfoType(container.getType()); if (infoClass == null) { throw new OpenEJBException(messages.format("unrecognizedContainerType", container.getType())); } return configureService(container, infoClass); }
public ContainerInfo createContainerInfo(Container container) throws OpenEJBException { Class<? extends ContainerInfo> infoClass = getContainerInfoType(container.getType()); if (infoClass == null) { throw new OpenEJBException(messages.format("unrecognizedContainerType", container.getType())); } ContainerInfo info = configureService(container, infoClass); return info; }