Search in sources :

Example 6 with LocalDevelopmentResourceFetcher

use of org.bimserver.shared.LocalDevelopmentResourceFetcher in project BIMserver by opensourceBIM.

the class MemoryLeakTester method start.

public void start(int id, String address, int port, int pbport, Path[] pluginDirectories) {
    BimServerConfig config = new BimServerConfig();
    config.setHomeDir(Paths.get("home" + id));
    config.setResourceFetcher(new LocalDevelopmentResourceFetcher(Paths.get("../")));
    config.setStartEmbeddedWebServer(true);
    config.setClassPath(System.getProperty("java.class.path"));
    config.setStartCommandLine(false);
    config.setLocalDev(true);
    config.setPort(port);
    bimServer = new BimServer(config);
    bimServer.getVersionChecker().getLocalVersion().setDate(new Date());
    try {
        LocalDevPluginLoader.loadPlugins(bimServer.getPluginManager(), pluginDirectories);
        bimServer.start();
        if (bimServer.getServerInfo().getServerState() == ServerState.NOT_SETUP) {
            AdminInterface adminInterface = bimServer.getServiceFactory().get(new SystemAuthorization(1, TimeUnit.HOURS), AccessMethod.INTERNAL).get(AdminInterface.class);
            adminInterface.setup("http://localhost:" + port, "Administrator", "admin@bimserver.org", "admin", null, null, null);
            SettingsInterface settingsInterface = bimServer.getServiceFactory().get(new SystemAuthorization(1, TimeUnit.HOURS), AccessMethod.INTERNAL).get(SettingsInterface.class);
            settingsInterface.setCacheOutputFiles(false);
        }
        bimServer.stop();
        bimServer = null;
        Thread.sleep(1000000);
    } catch (PluginException e) {
        LOGGER.error("", e);
    } catch (ServiceException e) {
        LOGGER.error("", e);
    } catch (DatabaseInitException e) {
        LOGGER.error("", e);
    } catch (BimserverDatabaseException e) {
        LOGGER.error("", e);
    } catch (DatabaseRestartRequiredException e) {
        LOGGER.error("", e);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Also used : PluginException(org.bimserver.shared.exceptions.PluginException) SystemAuthorization(org.bimserver.webservices.authorization.SystemAuthorization) LocalDevelopmentResourceFetcher(org.bimserver.shared.LocalDevelopmentResourceFetcher) Date(java.util.Date) AdminInterface(org.bimserver.shared.interfaces.AdminInterface) DatabaseInitException(org.bimserver.database.berkeley.DatabaseInitException) SettingsInterface(org.bimserver.shared.interfaces.SettingsInterface) ServiceException(org.bimserver.shared.exceptions.ServiceException) DatabaseRestartRequiredException(org.bimserver.database.DatabaseRestartRequiredException)

Aggregations

LocalDevelopmentResourceFetcher (org.bimserver.shared.LocalDevelopmentResourceFetcher)6 IOException (java.io.IOException)5 Path (java.nio.file.Path)4 BimServer (org.bimserver.BimServer)4 BimServerConfig (org.bimserver.BimServerConfig)4 DatabaseRestartRequiredException (org.bimserver.database.DatabaseRestartRequiredException)4 DatabaseInitException (org.bimserver.database.berkeley.DatabaseInitException)4 PluginException (org.bimserver.shared.exceptions.PluginException)4 AdminInterface (org.bimserver.shared.interfaces.AdminInterface)4 SettingsInterface (org.bimserver.shared.interfaces.SettingsInterface)4 SystemAuthorization (org.bimserver.webservices.authorization.SystemAuthorization)4 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)3 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)3 Date (java.util.Date)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 SProject (org.bimserver.interfaces.objects.SProject)2 SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)2 ServerException (org.bimserver.shared.exceptions.ServerException)2