Search in sources :

Example 1 with MavenPluginRepository

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

the class LocalDevPluginLoader method createPluginManager.

public static PluginManager createPluginManager(Path home, Path[] pluginDirectories) throws PluginException {
    if (!Files.exists(home)) {
        try {
            Files.createDirectories(home);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    MavenPluginRepository mavenPluginRepository = new MavenPluginRepository();
    PluginManager pluginManager = new PluginManager(home.resolve("tmp"), System.getProperty("java.class.path"), null, null, null, null);
    PluginBundleManager pluginBundleManager = new PluginBundleManager(pluginManager, mavenPluginRepository, home.resolve("plugins"));
    loadPlugins(pluginBundleManager, pluginDirectories);
    pluginManager.initAllLoadedPlugins();
    return pluginManager;
}
Also used : PluginManager(org.bimserver.plugins.PluginManager) PluginBundleManager(org.bimserver.plugins.PluginBundleManager) MavenPluginRepository(org.bimserver.plugins.MavenPluginRepository) IOException(java.io.IOException)

Example 2 with MavenPluginRepository

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

the class LocalDevSetup method setupJson.

/**
 * @param address
 * @return
 */
@SuppressWarnings("resource")
public static final BimServerClientInterface setupJson(String address) {
    try {
        Path home = Paths.get("home");
        if (!Files.isDirectory(home)) {
            Files.createDirectory(home);
        }
        Path tmp = home.resolve("tmp");
        if (!Files.isDirectory(tmp)) {
            Files.createDirectory(tmp);
        }
        MavenPluginRepository mavenPluginRepository = new MavenPluginRepository();
        PluginManager pluginManager = new PluginManager(tmp, System.getProperty("java.class.path"), null, null, null, null);
        PluginBundleManager pluginBundleManager = new PluginBundleManager(pluginManager, mavenPluginRepository, home.resolve("plugins"));
        pluginBundleManager.loadAllPluginsFromEclipseWorkspace(Paths.get("../"), true);
        MetaDataManager metaDataManager = new MetaDataManager(tmp);
        pluginManager.setMetaDataManager(metaDataManager);
        metaDataManager.init(false);
        pluginManager.initAllLoadedPlugins();
        BimServerClientFactory factory = new JsonBimServerClientFactory(metaDataManager, address);
        return factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
    } catch (PluginException e) {
        LOGGER.error("", e);
    } catch (ServiceException e) {
        LOGGER.error("", e);
    } catch (ChannelConnectionException e) {
        LOGGER.error("", e);
    } catch (IOException e) {
        LOGGER.error("", e);
    } catch (BimServerClientException e) {
        LOGGER.error("", e);
    }
    return null;
}
Also used : Path(java.nio.file.Path) ChannelConnectionException(org.bimserver.shared.ChannelConnectionException) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) PluginException(org.bimserver.shared.exceptions.PluginException) MetaDataManager(org.bimserver.emf.MetaDataManager) IOException(java.io.IOException) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException) ProtocolBuffersBimServerClientFactory(org.bimserver.client.protocolbuffers.ProtocolBuffersBimServerClientFactory) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) BimServerClientFactory(org.bimserver.shared.BimServerClientFactory) SoapBimServerClientFactory(org.bimserver.client.soap.SoapBimServerClientFactory) PluginManager(org.bimserver.plugins.PluginManager) PluginBundleManager(org.bimserver.plugins.PluginBundleManager) ServiceException(org.bimserver.shared.exceptions.ServiceException) MavenPluginRepository(org.bimserver.plugins.MavenPluginRepository)

Example 3 with MavenPluginRepository

use of org.bimserver.plugins.MavenPluginRepository 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

IOException (java.io.IOException)3 MavenPluginRepository (org.bimserver.plugins.MavenPluginRepository)3 PluginBundleManager (org.bimserver.plugins.PluginBundleManager)3 PluginManager (org.bimserver.plugins.PluginManager)3 Path (java.nio.file.Path)2 MetaDataManager (org.bimserver.emf.MetaDataManager)2 PluginException (org.bimserver.shared.exceptions.PluginException)2 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)1 ProtocolBuffersBimServerClientFactory (org.bimserver.client.protocolbuffers.ProtocolBuffersBimServerClientFactory)1 SoapBimServerClientFactory (org.bimserver.client.soap.SoapBimServerClientFactory)1 OptionsParser (org.bimserver.plugins.OptionsParser)1 BimServerClientFactory (org.bimserver.shared.BimServerClientFactory)1 ChannelConnectionException (org.bimserver.shared.ChannelConnectionException)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 BimServerClientException (org.bimserver.shared.exceptions.BimServerClientException)1 ServiceException (org.bimserver.shared.exceptions.ServiceException)1