Search in sources :

Example 6 with SystemAuthorization

use of org.bimserver.webservices.authorization.SystemAuthorization 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

SystemAuthorization (org.bimserver.webservices.authorization.SystemAuthorization)6 IOException (java.io.IOException)4 DatabaseInitException (org.bimserver.database.berkeley.DatabaseInitException)4 LocalDevelopmentResourceFetcher (org.bimserver.shared.LocalDevelopmentResourceFetcher)4 Date (java.util.Date)3 DatabaseRestartRequiredException (org.bimserver.database.DatabaseRestartRequiredException)3 PluginException (org.bimserver.shared.exceptions.PluginException)3 UserException (org.bimserver.shared.exceptions.UserException)3 AdminInterface (org.bimserver.shared.interfaces.AdminInterface)3 SettingsInterface (org.bimserver.shared.interfaces.SettingsInterface)3 Path (java.nio.file.Path)2 BimServer (org.bimserver.BimServer)2 BimServerConfig (org.bimserver.BimServerConfig)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 InconsistentModelsException (org.bimserver.database.migrations.InconsistentModelsException)2 MigrationException (org.bimserver.database.migrations.MigrationException)2 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)2 ServiceException (org.bimserver.shared.exceptions.ServiceException)2 DatabaseNotFoundException (com.sleepycat.je.DatabaseNotFoundException)1 BufferedReader (java.io.BufferedReader)1