Search in sources :

Example 1 with OptionsParser

use of org.bimserver.plugins.OptionsParser in project BIMserver by opensourceBIM.

the class LocalDevBimServerStarterJar method main.

public static void main(String[] args) {
    OptionsParser optionsParser = new OptionsParser(args);
    ResourceFetcher resourceFetcher = new ClasspathResourceFetcher();
    try {
        String resourceBase = resourceFetcher.getURL("www").toExternalForm();
        System.out.println("Resource base" + resourceBase);
        new LocalDevBimServerStarterJar().start(-1, "127.0.0.1", "LocalDev BIMserver (8080)", 8080, 8085, optionsParser.getPluginDirectories(), optionsParser.getHome(), resourceFetcher, resourceBase, false);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ClasspathResourceFetcher(org.bimserver.resources.ClasspathResourceFetcher) ClasspathResourceFetcher(org.bimserver.resources.ClasspathResourceFetcher) ResourceFetcher(org.bimserver.plugins.ResourceFetcher) OptionsParser(org.bimserver.plugins.OptionsParser)

Example 2 with OptionsParser

use of org.bimserver.plugins.OptionsParser in project BIMserver by opensourceBIM.

the class TestInOut method start.

private void start(String[] args) {
    BimServerConfig config = new BimServerConfig();
    Path homeDir = Paths.get("home");
    try {
        if (Files.isDirectory(homeDir)) {
            PathUtils.removeDirectoryWithContent(homeDir);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    config.setClassPath(System.getProperty("java.class.path"));
    config.setHomeDir(homeDir);
    config.setPort(8080);
    config.setStartEmbeddedWebServer(true);
    config.setResourceFetcher(new LocalDevelopmentResourceFetcher(Paths.get("../")));
    BimServer bimServer = new BimServer(config);
    try {
        LocalDevPluginLoader.loadPlugins(bimServer.getPluginBundleManager(), new OptionsParser(args).getPluginDirectories());
        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:8080", "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);
        }
        BimServerClientInterface client = LocalDevSetup.setupJson("http://localhost:8080");
        SProject project = client.getServiceInterface().addProject("test", "ifc2x3tc1");
        SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
        Path inputFile = Paths.get("../TestData/data/AC11-Institute-Var-2-IFC.ifc");
        client.checkinSync(project.getOid(), "test", deserializer.getOid(), false, inputFile);
        project = client.getServiceInterface().getProjectByPoid(project.getOid());
        SSerializerPluginConfiguration serializer = client.getServiceInterface().getSerializerByContentType("application/ifc");
        Path outputFile = Paths.get("output.ifc");
        client.download(project.getLastRevisionId(), serializer.getOid(), outputFile);
        Diff diff = new Diff(false, false, false, inputFile, outputFile);
        diff.start();
    } catch (ServerException e) {
        e.printStackTrace();
    } catch (DatabaseInitException e) {
        e.printStackTrace();
    } catch (BimserverDatabaseException e) {
        e.printStackTrace();
    } catch (PluginException e) {
        e.printStackTrace();
    } catch (DatabaseRestartRequiredException e) {
        e.printStackTrace();
    } catch (UserException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (PublicInterfaceNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    } catch (CompareException e) {
        e.printStackTrace();
    } catch (BimServerClientException e) {
        e.printStackTrace();
    }
}
Also used : Path(java.nio.file.Path) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) ServerException(org.bimserver.shared.exceptions.ServerException) Diff(org.bimserver.tests.diff.Diff) BimServer(org.bimserver.BimServer) PluginException(org.bimserver.shared.exceptions.PluginException) IOException(java.io.IOException) SystemAuthorization(org.bimserver.webservices.authorization.SystemAuthorization) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) BimServerConfig(org.bimserver.BimServerConfig) OptionsParser(org.bimserver.plugins.OptionsParser) SProject(org.bimserver.interfaces.objects.SProject) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException) LocalDevelopmentResourceFetcher(org.bimserver.shared.LocalDevelopmentResourceFetcher) AdminInterface(org.bimserver.shared.interfaces.AdminInterface) DatabaseInitException(org.bimserver.database.berkeley.DatabaseInitException) SettingsInterface(org.bimserver.shared.interfaces.SettingsInterface) BimserverDatabaseException(org.bimserver.BimserverDatabaseException) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) DatabaseRestartRequiredException(org.bimserver.database.DatabaseRestartRequiredException) SSerializerPluginConfiguration(org.bimserver.interfaces.objects.SSerializerPluginConfiguration) UserException(org.bimserver.shared.exceptions.UserException) CompareException(org.bimserver.tests.diff.CompareException)

Example 3 with OptionsParser

use of org.bimserver.plugins.OptionsParser in project BIMserver by opensourceBIM.

the class LocalDevBimServerStarter method main.

public static void main(String[] args) {
    OptionsParser optionsParser = new OptionsParser(args);
    ResourceFetcher resourceFetcher = new LocalDevelopmentResourceFetcher(Paths.get("../"));
    new LocalDevBimServerStarter().start(-1, "127.0.0.1", "LocalDev BIMserver (8080)", 8080, 8085, optionsParser.getPluginDirectories(), optionsParser.getHome(), resourceFetcher, Paths.get("../BimServer").resolve("www").toAbsolutePath().toString(), true);
}
Also used : ResourceFetcher(org.bimserver.plugins.ResourceFetcher) LocalDevelopmentResourceFetcher(org.bimserver.shared.LocalDevelopmentResourceFetcher) OptionsParser(org.bimserver.plugins.OptionsParser) LocalDevelopmentResourceFetcher(org.bimserver.shared.LocalDevelopmentResourceFetcher)

Example 4 with OptionsParser

use of org.bimserver.plugins.OptionsParser in project BIMserver by opensourceBIM.

the class LocalDevSetup method setupPluginManager.

public static final PluginManagerInterface setupPluginManager(String[] args) {
    try {
        Path home = Paths.get("home");
        if (!Files.exists(home)) {
            Files.createDirectory(home);
        }
        Path tmp = home.resolve("tmp");
        if (!Files.exists(tmp)) {
            Files.createDirectories(tmp);
        }
        MavenPluginRepository mavenPluginRepository = new MavenPluginRepository();
        PluginManager pluginManager = new PluginManager(tmp, System.getProperty("java.class.path"), null, null, null, null);
        MetaDataManager metaDataManager = new MetaDataManager(tmp);
        pluginManager.setMetaDataManager(metaDataManager);
        PluginBundleManager pluginBundleManager = new PluginBundleManager(pluginManager, mavenPluginRepository, home.resolve("plugins"));
        loadPlugins(pluginBundleManager, Paths.get(".."), new OptionsParser(args).getPluginDirectories());
        metaDataManager.init(false);
        pluginManager.initAllLoadedPlugins();
        return pluginManager;
    } catch (PluginException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : Path(java.nio.file.Path) PluginManager(org.bimserver.plugins.PluginManager) PluginBundleManager(org.bimserver.plugins.PluginBundleManager) MavenPluginRepository(org.bimserver.plugins.MavenPluginRepository) PluginException(org.bimserver.shared.exceptions.PluginException) MetaDataManager(org.bimserver.emf.MetaDataManager) IOException(java.io.IOException) OptionsParser(org.bimserver.plugins.OptionsParser)

Aggregations

OptionsParser (org.bimserver.plugins.OptionsParser)4 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 ResourceFetcher (org.bimserver.plugins.ResourceFetcher)2 LocalDevelopmentResourceFetcher (org.bimserver.shared.LocalDevelopmentResourceFetcher)2 PluginException (org.bimserver.shared.exceptions.PluginException)2 MalformedURLException (java.net.MalformedURLException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 BimServer (org.bimserver.BimServer)1 BimServerConfig (org.bimserver.BimServerConfig)1 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)1 DatabaseRestartRequiredException (org.bimserver.database.DatabaseRestartRequiredException)1 DatabaseInitException (org.bimserver.database.berkeley.DatabaseInitException)1 MetaDataManager (org.bimserver.emf.MetaDataManager)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1 SProject (org.bimserver.interfaces.objects.SProject)1 SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)1 MavenPluginRepository (org.bimserver.plugins.MavenPluginRepository)1 PluginBundleManager (org.bimserver.plugins.PluginBundleManager)1 PluginManager (org.bimserver.plugins.PluginManager)1