Search in sources :

Example 1 with GeneratedResourceEntry

use of org.glassfish.api.deployment.GeneratedResourceEntry in project Payara by payara.

the class WebappClassLoader method addResourceEntry.

@Override
public Class addResourceEntry(String name, String path, ResourceEntry entry) {
    Class clazz = null;
    if (!this.resourceEntries.containsKey(name)) {
        definePackage(name, entry);
        clazz = defineLoadedClass(name, entry);
        this.resourceEntries.put(name, entry);
        for (Map.Entry<String, GeneratedResourceEntry> e : entry.generatedResources.entrySet()) {
            String generatedClassName = e.getKey();
            GeneratedResourceEntry generatedEntry = e.getValue();
            generatedEntry.loadedClass = defineClass(generatedClassName, generatedEntry.binaryContent, 0, generatedEntry.binaryContent.length, generatedEntry.protectionDomain);
        }
    }
    return clazz;
}
Also used : GeneratedResourceEntry(org.glassfish.api.deployment.GeneratedResourceEntry) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with GeneratedResourceEntry

use of org.glassfish.api.deployment.GeneratedResourceEntry in project Payara by payara.

the class WebappClassLoader method addGeneratedResourceEntry.

@Override
public Class addGeneratedResourceEntry(String mainClassName, String generatedClassName, byte[] generatedBinaryContent, ProtectionDomain protectionDomain) {
    Class generatedClass;
    if (this.resourceEntries.containsKey(mainClassName)) {
        generatedClass = defineClass(generatedClassName, generatedBinaryContent, 0, generatedBinaryContent.length, protectionDomain);
        GeneratedResourceEntry generatedResourceEntry = new GeneratedResourceEntry();
        generatedResourceEntry.binaryContent = generatedBinaryContent;
        generatedResourceEntry.loadedClass = generatedClass;
        generatedResourceEntry.protectionDomain = protectionDomain;
        ResourceEntry entry = this.resourceEntries.get(mainClassName);
        entry.generatedResources.put(generatedClassName, generatedResourceEntry);
    } else {
        generatedClass = defineClass(generatedClassName, generatedBinaryContent, 0, generatedBinaryContent.length, protectionDomain);
    }
    return generatedClass;
}
Also used : GeneratedResourceEntry(org.glassfish.api.deployment.GeneratedResourceEntry) GeneratedResourceEntry(org.glassfish.api.deployment.GeneratedResourceEntry) ResourceEntry(org.glassfish.api.deployment.ResourceEntry)

Aggregations

GeneratedResourceEntry (org.glassfish.api.deployment.GeneratedResourceEntry)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ResourceEntry (org.glassfish.api.deployment.ResourceEntry)1