Examples of MapBackedClassLoader


Examples of org.drools.rule.MapBackedClassLoader

        if ( this.config.isSequential() ) {
            this.agendaGroupRuleTotals = new HashMap();
        }

        this.packageClassLoader = new CompositePackageClassLoader( this.config.getClassLoader() );
        this.classLoader = new MapBackedClassLoader( this.config.getClassLoader() );
        this.packageClassLoader.addClassLoader( this.classLoader );
        this.pkgs = new HashMap();
        this.processes = new HashMap();
        this.globals = new HashMap();
        this.statefulSessions = new ObjectHashSet();
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

       
        if ( stream instanceof DroolsObjectInputStream ) {
            final DroolsObjectInputStream parentStream = (DroolsObjectInputStream) stream;
            parentStream.setRuleBase( this );
            this.packageClassLoader = new CompositePackageClassLoader( parentStream.getClassLoader() );
            this.classLoader = new MapBackedClassLoader( parentStream.getClassLoader(), store );
        } else {
            this.packageClassLoader = new CompositePackageClassLoader( Thread.currentThread().getContextClassLoader() );
            this.classLoader = new MapBackedClassLoader( Thread.currentThread().getContextClassLoader(), store );
        }

        this.packageClassLoader.addClassLoader( this.classLoader );

    for ( final Iterator it = this.pkgs.values().iterator(); it.hasNext(); ) {
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

        knowledgeSession.dispose();
    }

    @Test
    public void testGUVNOR578_2() throws Exception {
        MapBackedClassLoader loader = new MapBackedClassLoader( this.getClass().getClassLoader() );

        JarInputStream jis = new JarInputStream( this.getClass().getResourceAsStream( "/primespoc.jar" ) );

        JarEntry entry = null;
        byte[] buf = new byte[1024];
        int len = 0;
        while ( (entry = jis.getNextJarEntry()) != null ) {
            if ( !entry.isDirectory() ) {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                while ( (len = jis.read( buf )) >= 0 ) {
                    out.write( buf,
                               0,
                               len );
                }
                loader.addResource( entry.getName(),
                                    out.toByteArray() );
            }
        }

        List<JarInputStream> jarInputStreams = new ArrayList<JarInputStream>();
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

    /**
     * In this case we are dealing with facts which are not on the systems classpath.
     */
    @Test
    public void testSerializabilityWithJarFacts() throws Exception {
        MapBackedClassLoader loader = new MapBackedClassLoader( this.getClass().getClassLoader() );

        JarInputStream jis = new JarInputStream( this.getClass().getResourceAsStream( "/billasurf.jar" ) );

        JarEntry entry = null;
        byte[] buf = new byte[ 1024 ];
        int len = 0;
        while ( (entry = jis.getNextJarEntry()) != null ) {
            if ( !entry.isDirectory() ) {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                while ( (len = jis.read( buf )) >= 0 ) {
                    out.write( buf,
                               0,
                               len );
                }
                loader.addResource( entry.getName(),
                                    out.toByteArray() );
            }
        }

        String drl = "package foo.bar \n" +
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

        knowledgeSession.dispose();
    }

    @Test
    public void testGUVNOR578_2() throws Exception {
        MapBackedClassLoader loader = new MapBackedClassLoader( this.getClass().getClassLoader() );

        JarInputStream jis = new JarInputStream( this.getClass().getResourceAsStream( "/primespoc.jar" ) );

        JarEntry entry = null;
        byte[] buf = new byte[1024];
        int len = 0;
        while ( (entry = jis.getNextJarEntry()) != null ) {
            if ( !entry.isDirectory() ) {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                while ( (len = jis.read( buf )) >= 0 ) {
                    out.write( buf,
                               0,
                               len );
                }
                loader.addResource( entry.getName(),
                                    out.toByteArray() );
            }
        }

        List<JarInputStream> jarInputStreams = new ArrayList<JarInputStream>();
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

            classLoader = Thread.currentThread().getContextClassLoader();
            if ( classLoader == null ) {
                classLoader = this.getClass().getClassLoader();
            }
        }
        this.loader = new MapBackedClassLoader( classLoader );
        this.resolver = new ClassTypeResolver( new HashSet(),
                                               this.loader );
    }
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

     * using the given classpath.
     * @param classpath The classpath from the package
     * @param buildProps Properties to pass into the package builder configuration.
     */
    public static BRMSPackageBuilder getInstance(List<JarInputStream> classpath, Properties buildProps) {
        MapBackedClassLoader loader = createClassLoader(classpath);


        // See if we can find a packagebuilder.conf
        // We do this manually here, as we cannot rely on PackageBuilder doing this correctly
        // note this chainedProperties already checks System properties too
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader



        final ClassLoader p = parentClassLoader;

        MapBackedClassLoader loader = AccessController.doPrivileged( new PrivilegedAction<MapBackedClassLoader>() {
            public MapBackedClassLoader run() {
                return new MapBackedClassLoader( p );
            }
        });


        try {
            for ( JarInputStream jis : classpath ) {
                JarEntry entry = null;
                byte[] buf = new byte[1024];
                int len = 0;
                while ( (entry = jis.getNextJarEntry()) != null ) {
                    if ( !entry.isDirectory() && !entry.getName().endsWith( ".java" ) ) {
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        while ( (len = jis.read( buf )) >= 0 ) {
                            out.write( buf, 0, len );
                        }

                        loader.addResource( entry.getName() , out.toByteArray() );
                    }
                }

            }
        } catch ( IOException e ) {
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader

     * using the given classpath.
     * @param classpath The classpath from the package
     * @param buildProps Properties to pass into the package builder configuration.
     */
    public static BRMSPackageBuilder getInstance(List<JarInputStream> classpath, Properties buildProps) {
        MapBackedClassLoader loader = createClassLoader(classpath);


        // See if we can find a packagebuilder.conf
        // We do this manually here, as we cannot rely on PackageBuilder doing this correctly
        // note this chainedProperties already checks System properties too
View Full Code Here

Examples of org.drools.rule.MapBackedClassLoader



        final ClassLoader p = parentClassLoader;

        MapBackedClassLoader loader = AccessController.doPrivileged( new PrivilegedAction<MapBackedClassLoader>() {
            public MapBackedClassLoader run() {
                return new MapBackedClassLoader( p );
            }
        });


        try {
            for ( JarInputStream jis : classpath ) {
                JarEntry entry = null;
                byte[] buf = new byte[1024];
                int len = 0;
                while ( (entry = jis.getNextJarEntry()) != null ) {
                    if ( !entry.isDirectory() && !entry.getName().endsWith( ".java" ) ) {
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        while ( (len = jis.read( buf )) >= 0 ) {
                            out.write( buf, 0, len );
                        }

                        loader.addResource( entry.getName() , out.toByteArray() );
                    }
                }

            }
        } catch ( IOException e ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.