protected void deployElement(InputStream stream, Ejb3HandlerFactory factory, InitialContext ctx) throws Exception { DataInputStream dstream = new DataInputStream(new BufferedInputStream(stream)); ClassFile cf = null; try { cf = new ClassFile(dstream); } finally { dstream.close(); stream.close(); } deployElement(factory, cf, ctx); }
protected void deploy() throws Exception { if(metaData == null || !metaData.isMetadataComplete()) { Ejb3HandlerFactory factory = Ejb3HandlerFactory.getInstance(this); // Scan and deploy if (unit.getUrl() != null) deployUrl(factory); // Deploy any classes that have been explicitly marked if (unit.getClasses() != null) { for (Class explicit : unit.getClasses()) { if (explicit.isAnnotationPresent(Entity.class)) { continue; } String name = explicit.getName().replace('.', '/') + ".class"; InputStream stream = explicit.getClassLoader().getResourceAsStream(name); deployElement(stream, factory, initialContext); } } } // Deploy the beans from the descriptor deployBeansFromLib(initialContext); }
protected void deployUrl(Ejb3HandlerFactory factory) throws Exception { // make sure we are not deploying ejbs from client jar List<VirtualFile> clientDescriptors = unit.getResources(new org.jboss.ejb3.ClientDescriptorFileFilter()); if (clientDescriptors.size() > 0) return; InitialContext ctx = initialContext; // need to look into every entry in the archive to see if anybody has tags // defined. List<VirtualFile> classes = unit.getResources(new org.jboss.ejb3.ClassFileFilter()); for (VirtualFile classFile : classes) { InputStream stream = classFile.openStream(); deployElement(stream, factory, ctx); } }