Package org.fakereplace.api.environment

Examples of org.fakereplace.api.environment.ChangedClasses


                log.trace(traceString.toString());

            }
        }
        return new ChangedClasses(ret, newClasses, loader);
    }
View Full Code Here


            readAvailable(input, resources);

            log.info("Fakereplace is checking for updates classes. Client sent " + classes.size() + "classes");


            final ChangedClasses classesToReplace = CurrentEnvironment.getEnvironment().getUpdatedClasses(archiveName, classes);
            final Map<String, Class> classMap = new HashMap<String, Class>();
            output.writeInt(classesToReplace.getChanged().size() + classesToReplace.getNewClasses().size());
            for (Class clazz : classesToReplace.getChanged()) {
                final String cname = clazz.getName();
                output.writeInt(cname.length());
                output.write(cname.getBytes());
                classMap.put(cname, clazz);
            }
            for (String cname : classesToReplace.getNewClasses()) {
                output.writeInt(cname.length());
                output.write(cname.getBytes());
            }
            final Set<String> resourcesToReplace = CurrentEnvironment.getEnvironment().getUpdatedResources(archiveName, resources);
            output.writeInt(resourcesToReplace.size());
            for (String cname : resourcesToReplace) {
                output.writeInt(cname.length());
                output.write(cname.getBytes());
            }

            output.flush();

            final Set<ClassDefinition> classDefinitions = new HashSet<ClassDefinition>();
            final Set<Class<?>> replacedClasses = new HashSet<Class<?>>();
            final List<AddedClass> addedClassList = new ArrayList<AddedClass>();
            int noClasses = input.readInt();
            for (int i = 0; i < noClasses; ++i) {
                final String className = readString(input);
                int length = input.readInt();
                byte[] buffer = new byte[length];
                for (int j = 0; j < length; ++j) {
                    buffer[j] = (byte) input.read();
                }
                final Class theClass = classMap.get(className);
                if (theClass != null) {
                    classDefinitions.add(new ClassDefinition(theClass, buffer));
                    replacedClasses.add(theClass);
                } else {
                    addedClassList.add(new AddedClass(className, buffer, classesToReplace.getClassLoader()));
                }
            }

            final Map<String, byte[]> replacedResources = new HashMap<String, byte[]>();
View Full Code Here

                } catch (ClassNotFoundException e) {
                    log.error("Could not load class " + entry, e);
                }
            }
        }
        return new ChangedClasses(ret, Collections.<String>emptySet(), loader);
    }
View Full Code Here

TOP

Related Classes of org.fakereplace.api.environment.ChangedClasses

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.