当前位置: 首页>>代码示例>>Java>>正文


Java PluginException类代码示例

本文整理汇总了Java中org.bimserver.shared.exceptions.PluginException的典型用法代码示例。如果您正苦于以下问题:Java PluginException类的具体用法?Java PluginException怎么用?Java PluginException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PluginException类属于org.bimserver.shared.exceptions包,在下文中一共展示了PluginException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadPlugin

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public PluginContext loadPlugin(PluginBundle pluginBundle, Class<? extends Plugin> interfaceClass, URI location, String classLocation, Plugin plugin, ClassLoader classLoader, PluginSourceType pluginType,
		AbstractPlugin pluginImplementation, Set<org.bimserver.plugins.Dependency> dependencies, String identifier) throws PluginException {
	LOGGER.debug("Loading plugin " + plugin.getClass().getSimpleName() + " of type " + interfaceClass.getSimpleName());
	if (!Plugin.class.isAssignableFrom(interfaceClass)) {
		throw new PluginException("Given interface class (" + interfaceClass.getName() + ") must be a subclass of " + Plugin.class.getName());
	}
	if (!implementations.containsKey(interfaceClass)) {
		implementations.put(interfaceClass, new LinkedHashSet<PluginContext>());
	}
	Set<PluginContext> set = (Set<PluginContext>) implementations.get(interfaceClass);
	try {
		PluginContext pluginContext = new PluginContext(this, pluginBundle, interfaceClass, classLoader, pluginType, pluginImplementation.getDescription(), location, plugin, classLocation, dependencies, identifier);
		pluginToPluginContext.put(plugin, pluginContext);
		set.add(pluginContext);
		return pluginContext;
	} catch (IOException e) {
		throw new PluginException(e);
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:20,代码来源:PluginManager.java

示例2: loadAllPluginsFromEclipseWorkspace

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public void loadAllPluginsFromEclipseWorkspace(Path file, boolean showExceptions) throws PluginException, IOException {
	if (file != null && Files.isDirectory(file)) {
		for (Path project : PathUtils.list(file)) {
			if (Files.isDirectory(project)) {
				Path pluginDir = project.resolve("plugin");
				if (Files.exists(pluginDir)) {
					Path pluginFile = pluginDir.resolve("plugin.xml");
					if (Files.exists(pluginFile)) {
						if (showExceptions) {
							loadPluginsFromEclipseProject(project);
						} else {
							loadPluginsFromEclipseProjectNoExceptions(project);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:20,代码来源:PluginManager.java

示例3: loadAllPluginsFromEclipseWorkspaces

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public void loadAllPluginsFromEclipseWorkspaces(Path directory, boolean showExceptions) throws PluginException, IOException {
	if (!Files.isDirectory(directory)) {
		return;
	}
	if (Files.exists(directory.resolve("plugin/plugin.xml"))) {
		if (showExceptions) {
			loadPluginsFromEclipseProject(directory);
		} else {
			loadPluginsFromEclipseProjectNoExceptions(directory);
		}
	}
	loadAllPluginsFromEclipseWorkspace(directory, showExceptions);
	for (Path workspace : PathUtils.list(directory)) {
		if (Files.isDirectory(workspace)) {
			loadAllPluginsFromEclipseWorkspace(workspace, showExceptions);
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:19,代码来源:PluginManager.java

示例4: getRenderEnginePool

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public RenderEnginePool getRenderEnginePool(Schema schema, String className, PluginConfiguration pluginConfiguration) throws PluginException {
	if (pools.containsKey(schema)) {
		Map<String, RenderEnginePool> map = pools.get(schema);
		if (map.containsKey(className)) {
			return map.get(className);
		} else {
			// Maybe this plugin has been installed after startup, let's have a look in the PluginManager
			RenderEnginePlugin renderEnginePlugin = bimServer.getPluginManager().getRenderEnginePlugin(className, true);
			if (renderEnginePlugin == null) {
				throw new PluginException("No render engine found for className " + className);
			} else {
				RenderEnginePool renderEnginePool = renderEnginePoolFactory.newRenderEnginePool(new RenderEngineFactory(){
					@Override
					public RenderEngine createRenderEngine() throws RenderEngineException {
						return renderEnginePlugin.createRenderEngine(pluginConfiguration, schema.name());
					}});
				map.put(className, renderEnginePool);
				return renderEnginePool;
			}
		}
	} else {
		throw new PluginException("No render engine found for schema " + schema);
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:25,代码来源:RenderEnginePools.java

示例5: start

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
private void start() {
	Path src = TestFile.RIOLERING_TEST.getFile();
	PluginManager pluginManager;
	try {
		pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
		DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
		Deserializer deserializer = deserializerPlugin.createDeserializer(new PluginConfiguration());
		deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
		try {
			model = DeserializerUtils.readFromFile(deserializer, src);
		} catch (Exception e) {
			e.printStackTrace();
		}
		step1();
	} catch (PluginException e1) {
		e1.printStackTrace();
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:19,代码来源:IfcRioleringTest.java

示例6: readModel

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public IfcModelInterface readModel(Path file) {
	PluginManager pluginManager;
	try {
		pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
		DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
		Deserializer deserializer = deserializerPlugin.createDeserializer(new PluginConfiguration());
		deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
		try {
			IfcModelInterface model = DeserializerUtils.readFromFile(deserializer, file);
			return model;
		} catch (Exception e) {
			e.printStackTrace();
		}
	} catch (PluginException e1) {
		e1.printStackTrace();
	}
	return null;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:19,代码来源:GuidHighlighterTester.java

示例7: fromFileName

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public static PluginBundleVersionIdentifier fromFileName(String filename) throws PluginException {
	try {
		String groupId = null;
		String artifactId = null;
		String version = null;
		if (filename.endsWith(".jar")) {
			filename = filename.substring(0, filename.length() - 4);
			version = filename.substring(filename.lastIndexOf("-") + 1);
			filename = filename.substring(0, filename.lastIndexOf("-"));
			artifactId = filename.substring(filename.lastIndexOf(".") + 1);
			groupId = filename.substring(0, filename.lastIndexOf("."));
			PluginBundleIdentifier pluginBundleIdentifier = new PluginBundleIdentifier(groupId, artifactId);
			PluginBundleVersionIdentifier pluginBundleVersionIdentifier = new PluginBundleVersionIdentifier(pluginBundleIdentifier, version);
			return pluginBundleVersionIdentifier;
		}
	} catch (Exception e) {
		throw new PluginException("Problem parsing filename " + filename, e);
	}
	return null;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:21,代码来源:PluginBundleVersionIdentifier.java

示例8: loadPluginsFromEclipseProjectNoExceptions

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public void loadPluginsFromEclipseProjectNoExceptions(Path projectRoot) {
	try {
		loadPluginsFromEclipseProject(projectRoot);
	} catch (PluginException e) {
		LOGGER.error("", e);
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:8,代码来源:PluginManager.java

示例9: initAllLoadedPlugins

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
/**
 * This method will initialize all the loaded plugins
 * 
 * @throws PluginException
 */
public void initAllLoadedPlugins() throws PluginException {
	LOGGER.debug("Initializig all loaded plugins");
	for (Class<? extends Plugin> pluginClass : implementations.keySet()) {
		Set<PluginContext> set = implementations.get(pluginClass);
		for (PluginContext pluginContext : set) {
			try {
				pluginContext.initialize();
			} catch (Throwable e) {
				LOGGER.error("", e);
				pluginContext.setEnabled(false, false);
			}
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:20,代码来源:PluginManager.java

示例10: getFirstDeserializer

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public DeserializerPlugin getFirstDeserializer(String extension, Schema schema, boolean onlyEnabled) throws PluginException {
	Collection<DeserializerPlugin> allDeserializerPlugins = getAllDeserializerPlugins(extension, onlyEnabled);
	Iterator<DeserializerPlugin> iterator = allDeserializerPlugins.iterator();
	while (iterator.hasNext()) {
		DeserializerPlugin next = iterator.next();
		if (!next.getSupportedSchemas().contains(schema)) {
			iterator.remove();
		}
	}
	if (allDeserializerPlugins.size() == 0) {
		throw new PluginException("No deserializers with extension " + extension + " found");
	}
	return allDeserializerPlugins.iterator().next();
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:15,代码来源:PluginManager.java

示例11: getFirstStreamingDeserializer

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public StreamingDeserializerPlugin getFirstStreamingDeserializer(String extension, Schema schema, boolean onlyEnabled) throws PluginException {
	Map<PluginContext, StreamingDeserializerPlugin> allDeserializerPlugins = getAllStreamingDeserializerPlugins(onlyEnabled);
	Iterator<StreamingDeserializerPlugin> iterator = allDeserializerPlugins.values().iterator();
	while (iterator.hasNext()) {
		StreamingDeserializerPlugin next = iterator.next();
		if (!next.getSupportedSchemas().contains(schema)) {
			iterator.remove();
		}
	}
	if (allDeserializerPlugins.size() == 0) {
		throw new PluginException("No deserializers with extension " + extension + " found");
	}
	return allDeserializerPlugins.values().iterator().next();
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:15,代码来源:PluginManager.java

示例12: getPluginInformationFromJar

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public List<SPluginInformation> getPluginInformationFromJar(Path file) throws PluginException, FileNotFoundException, IOException, JAXBException {
	try (JarFile jarFile = new JarFile(file.toFile())) {
		ZipEntry entry = jarFile.getEntry("plugin/plugin.xml");
		if (entry == null) {
			throw new PluginException("No plugin/plugin.xml found in " + file.getFileName().toString());
		}
		InputStream pluginStream = jarFile.getInputStream(entry);
		return getPluginInformationFromPluginFile(pluginStream);
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:11,代码来源:PluginManager.java

示例13: getPluginInformationFromPluginFile

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public List<SPluginInformation> getPluginInformationFromPluginFile(InputStream inputStream) throws PluginException, FileNotFoundException, IOException, JAXBException {
	PluginDescriptor pluginDescriptor = getPluginDescriptor(inputStream);
	if (pluginDescriptor == null) {
		throw new PluginException("No plugin descriptor could be created");
	}
	List<SPluginInformation> list = new ArrayList<>();
	processPluginDescriptor(pluginDescriptor, list);
	return list;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:10,代码来源:PluginManager.java

示例14: loadPlugins

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
public static void loadPlugins(PluginManager pluginManager, Path[] pluginDirectories) throws PluginException {
	if (pluginDirectories != null) {
		for (Path pluginDirectory : pluginDirectories) {
			try {
				pluginManager.loadPluginsFromEclipseProject(pluginDirectory);
			} catch (PluginException e) {
				LOGGER.error("", e);
			}
		}
	}
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:12,代码来源:LocalDevPluginLoader.java

示例15: createPluginManager

import org.bimserver.shared.exceptions.PluginException; //导入依赖的package包/类
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;
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:15,代码来源:LocalDevPluginLoader.java


注:本文中的org.bimserver.shared.exceptions.PluginException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。