use of org.bimserver.plugins.PluginManager in project BIMserver by opensourceBIM.
the class TriggerImportDataRemote method main.
public static void main(String[] args) {
/*
* Args:
* 0: Address of new server
* 1: Username
* 2: Password
* 3: Address of old server
* 4: Local path to incoming folder of old server, this local path has to be available on the new server, so you have to copy it from the old server
*/
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 (JsonBimServerClientFactory factory = new JsonBimServerClientFactory(metaDataManager, args[0])) {
BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo(args[1], args[2]));
client.getServiceInterface().importData(args[3], args[1], args[2], args[4]);
} catch (Exception e) {
e.printStackTrace();
}
} catch (PluginException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
}
}
use of org.bimserver.plugins.PluginManager 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.plugins.PluginManager 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(home.resolve("maven"));
PluginManager pluginManager = new PluginManager(home.resolve("tmp"), home.resolve("plugins"), mavenPluginRepository, System.getProperty("java.class.path"), null, null, null);
loadPlugins(pluginManager, pluginDirectories);
pluginManager.initAllLoadedPlugins();
return pluginManager;
}
use of org.bimserver.plugins.PluginManager 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.plugins.PluginManager 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;
}
Aggregations