Package org.drools.repository

Examples of org.drools.repository.RulesRepositoryConfigurator


                    log.info( "DELETE test repo dir: " + repoDir.getAbsolutePath() );
                    RepositorySessionUtil.deleteDir( repoDir );
                    log.info( "TEST repo dir deleted." );
                }

                RulesRepositoryConfigurator config = RulesRepositoryConfigurator.getInstance( null );
                String home = System.getProperty( "guvnor.repository.dir" );
                Properties properties = new Properties();
                if ( home != null ) {
                    properties.setProperty( JCRRepositoryConfigurator.REPOSITORY_ROOT_DIRECTORY,
                                            home );
                }
                repository = config.getJCRRepository();

                //-->Workaround for lock problems
                int retries = 3;
                Session testSession = null;
                while ( retries > 0 ) {
                    try {
                        testSession = repository.login( new SimpleCredentials( "alan_parsons",
                                                                               "password".toCharArray() ) );
                       
                        retries = 0;
                    } catch ( RepositoryException re ) {
                        System.err.println( "Failed to get the repository session: Retrying... " );
                        re.printStackTrace();
                       
                        System.err.println( "Attemptng to shutdown repository... " );
                        shutdown();
                        repository = config.getJCRRepository();
                       
                        retries--;
                        try {
                            Thread.sleep( 500 );
                        } catch ( InterruptedException ie ) {
                        }
                    }
                }
                if ( testSession == null ) {
                    throw new IllegalStateException( "Unable to get Repository Session. Refer to previous messages for details." );
                }
                //<--

                RulesRepositoryAdministrator admin = new RulesRepositoryAdministrator( testSession );
                if ( erase && admin.isRepositoryInitialized() ) {
                    admin.clearRulesRepository();
                }
                config.setupRepository( testSession );
                File file = File.createTempFile( "pete",
                                                 "txt" );
                file.deleteOnExit();
                PrintWriter out = new PrintWriter( new FileOutputStream( file ) );
                out.close();
View Full Code Here


                    log.info("DELETE test repo dir: " + repoDir.getAbsolutePath());
                    RepositorySessionUtil.deleteDir(repoDir);
                    log.info("TEST repo dir deleted.");
                }

                RulesRepositoryConfigurator config = RulesRepositoryConfigurator.getInstance(null);
                String home = System.getProperty("guvnor.repository.dir");
                Properties properties = new Properties();
                if (home != null) {
                    properties.setProperty(JCRRepositoryConfigurator.REPOSITORY_ROOT_DIRECTORY,
                            home);
                }
                repository = config.getJCRRepository();

                //-->Workaround for lock problems
                int retries = 3;
                Session testSession = null;
                while (retries > 0) {
                    try {
                        testSession = repository.login(new SimpleCredentials("alan_parsons",
                                "password".toCharArray()));

                        retries = 0;
                    } catch (RepositoryException re) {
                        System.err.println("Failed to get the repository session: Retrying... ");
                        re.printStackTrace();

                        System.err.println("Attemptng to shutdown repository... ");
                        shutdown();
                        repository = config.getJCRRepository();

                        retries--;
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException ie) {
                        }
                    }
                }
                if (testSession == null) {
                    throw new IllegalStateException("Unable to get Repository Session. Refer to previous messages for details.");
                }
                //<--

                RulesRepositoryAdministrator admin = new RulesRepositoryAdministrator(testSession);
                if (erase && admin.isRepositoryInitialized()) {
                    admin.clearRulesRepository();
                }
                config.setupRepository(testSession);
                File file = File.createTempFile("pete",
                        "txt");
                file.deleteOnExit();
                PrintWriter out = new PrintWriter(new FileOutputStream(file));
                out.close();
View Full Code Here

                    log.info( "DELETE test repo dir: " + repoDir.getAbsolutePath() );
                    RepositorySessionUtil.deleteDir( repoDir );
                    log.info( "TEST repo dir deleted." );
                }

                RulesRepositoryConfigurator config = RulesRepositoryConfigurator.getInstance( null );
                String home = System.getProperty( "guvnor.repository.dir" );
                Properties properties = new Properties();
                if ( home != null ) {
                    properties.setProperty( JCRRepositoryConfigurator.REPOSITORY_ROOT_DIRECTORY,
                                            home );
                }
                repository = config.getJCRRepository();

                Session testSession = repository.login( new SimpleCredentials( "alan_parsons",
                                                                               "password".toCharArray() ) );

                RulesRepositoryAdministrator admin = new RulesRepositoryAdministrator( testSession );
                if ( erase && admin.isRepositoryInitialized() ) {
                    admin.clearRulesRepository();
                }
                config.setupRepository( testSession );
                File file = File.createTempFile( "pete",
                                                 "txt" );
                file.deleteOnExit();
                PrintWriter out = new PrintWriter( new FileOutputStream( file ) );
                out.close();
View Full Code Here

TOP

Related Classes of org.drools.repository.RulesRepositoryConfigurator

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.