use of org.bimserver.emf.MetaDataManager in project BIMserver by opensourceBIM.
the class ExtractFurniture method main.
public static void main(String[] args) {
try {
Path home = Paths.get("home");
PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(home);
DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
Deserializer deserializer = deserializerPlugin.createDeserializer(null);
MetaDataManager metaDataManager = new MetaDataManager(home.resolve("tmp"));
PackageMetaData packageMetaData = metaDataManager.getPackageMetaData("ifc2x3tc1");
deserializer.init(packageMetaData);
IfcModelInterface model = DeserializerUtils.readFromFile(deserializer, Paths.get("../TestData/data/ADT-FZK-Haus-2005-2006.ifc"));
model.fixOids(new IncrementingOidProvider());
IfcFurnishingElement picknick = (IfcFurnishingElement) model.getByName(Ifc2x3tc1Package.eINSTANCE.getIfcFurnishingElement(), "Picknik Bank");
IfcModelInterface newModel = new BasicIfcModel(packageMetaData, null);
ModelHelper modelHelper = new ModelHelper(pluginManager.getMetaDataManager(), new HideAllInversesObjectIDM(CollectionUtils.singleSet(Ifc2x3tc1Package.eINSTANCE), pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1")), newModel);
modelHelper.copy(picknick, false);
SerializerPlugin serializerPlugin = pluginManager.getSerializerPlugin("org.bimserver.ifc.step.serializer.IfcStepSerializerPlugin", true);
Serializer serializer = serializerPlugin.createSerializer(null);
serializer.init(newModel, null, true);
SerializerUtils.writeToFile(serializer, Paths.get("test.ifc"));
} catch (PluginException e) {
e.printStackTrace();
} catch (DeserializeException e) {
e.printStackTrace();
} catch (IfcModelInterfaceException e) {
e.printStackTrace();
} catch (SerializerException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
use of org.bimserver.emf.MetaDataManager 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(home.resolve("maven"));
PluginManager pluginManager = new PluginManager(tmp, home.resolve("plugins"), mavenPluginRepository, System.getProperty("java.class.path"), null, null, null);
MetaDataManager metaDataManager = new MetaDataManager(tmp);
pluginManager.setMetaDataManager(metaDataManager);
loadPlugins(pluginManager, Paths.get(".."), new OptionsParser(args).getPluginDirectories());
metaDataManager.init();
pluginManager.initAllLoadedPlugins();
return pluginManager;
} catch (PluginException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
use of org.bimserver.emf.MetaDataManager in project BIMserver by opensourceBIM.
the class LocalDevSetup method setupProtocolBuffers.
public static final BimServerClientInterface setupProtocolBuffers(String address) {
Path home = Paths.get("home");
Path tmp = home.resolve("tmp");
MetaDataManager metaDataManager = new MetaDataManager(tmp);
try (BimServerClientFactory factory = new ProtocolBuffersBimServerClientFactory(address, 8000, 8000, null, metaDataManager, new SServicesMap())) {
PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(home);
pluginManager.setMetaDataManager(metaDataManager);
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 (BimServerClientException e) {
LOGGER.error("", e);
} catch (Exception e) {
LOGGER.error("", e);
}
return null;
}
use of org.bimserver.emf.MetaDataManager 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(home.resolve("maven"));
PluginManager pluginManager = new PluginManager(tmp, home.resolve("plugins"), mavenPluginRepository, System.getProperty("java.class.path"), null, null, null);
pluginManager.loadAllPluginsFromEclipseWorkspace(Paths.get("../"), true);
MetaDataManager metaDataManager = new MetaDataManager(tmp);
pluginManager.setMetaDataManager(metaDataManager);
metaDataManager.init();
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;
}
use of org.bimserver.emf.MetaDataManager in project BIMserver by opensourceBIM.
the class LocalDevSetup method setupSoap.
public static final BimServerClientInterface setupSoap(String address) {
try {
Path home = Paths.get("home");
Path tmp = home.resolve("tmp");
PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(home);
MetaDataManager metaDataManager = new MetaDataManager(tmp);
pluginManager.setMetaDataManager(metaDataManager);
try (BimServerClientFactory factory = new SoapBimServerClientFactory(metaDataManager, address)) {
return factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
} catch (Exception e) {
LOGGER.error("", e);
}
} catch (PluginException e) {
LOGGER.error("", e);
}
return null;
}
Aggregations