Java Code Examples for org.osgi.framework.InvalidSyntaxException#printStackTrace()
The following examples show how to use
org.osgi.framework.InvalidSyntaxException#printStackTrace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOSGiResource.java From concierge with Eclipse Public License 1.0 | 6 votes |
protected ServiceReference<?> getServiceReferenceFromKey(final String key) { final String id = (String) getRequest().getAttributes().get(key); if (id == null) { return null; } if (!id.matches(number)) { throw new IllegalArgumentException("Invalid service id " + id); } try { final ServiceReference<?>[] srefs = getBundleContext() .getServiceReferences((String) null, "(" + Constants.SERVICE_ID + "=" + id + ")"); return srefs != null ? srefs[0] : null; } catch (final InvalidSyntaxException e) { // does not happen e.printStackTrace(); return null; } }
Example 2
Source File: Concierge.java From concierge with Eclipse Public License 1.0 | 6 votes |
protected List<Capability> findProviders(Requirement requirement){ final String filterStr = requirement.getDirectives() .get(Namespace.REQUIREMENT_FILTER_DIRECTIVE); final List<Capability> providers; if (filterStr == null) { providers = capabilityRegistry .getAll(requirement.getNamespace()); } else { try { providers = RFC1960Filter.filterWithIndex( requirement, filterStr, capabilityRegistry); } catch (final InvalidSyntaxException ise) { // TODO: debug output ise.printStackTrace(); return Collections.emptyList(); } } return providers; }
Example 3
Source File: ConverterTracker.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * The Constructor. * @param bundleContext * 插件所在的 bundle context * @param direction * 取<code>Converter.DIRECTION_POSITIVE</code>或 <code>Converter.DIRECTION_REVERSE</code> */ public ConverterTracker(BundleContext bundleContext, String direction) { this.direction = direction; supportTypes = new ArrayList<ConverterBean>(); this.context = bundleContext; String filterStr = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter( Converter.ATTR_DIRECTION, direction)).toString(); Filter filter = null; try { filter = context.createFilter(filterStr); } catch (InvalidSyntaxException e) { // ignore the exception e.printStackTrace(); } if (filter != null) { converterServiceTracker = new ServiceTracker(context, filter, new ConverterCustomizer()); } converterServiceTracker.open(); }
Example 4
Source File: ConverterTracker.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * The Constructor. * @param bundleContext * 插件所在的 bundle context * @param direction * 取<code>Converter.DIRECTION_POSITIVE</code>或 <code>Converter.DIRECTION_REVERSE</code> */ public ConverterTracker(BundleContext bundleContext, String direction) { this.direction = direction; supportTypes = new ArrayList<ConverterBean>(); this.context = bundleContext; String filterStr = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter( Converter.ATTR_DIRECTION, direction)).toString(); Filter filter = null; try { filter = context.createFilter(filterStr); } catch (InvalidSyntaxException e) { // ignore the exception e.printStackTrace(); } if (filter != null) { converterServiceTracker = new ServiceTracker(context, filter, new ConverterCustomizer()); } converterServiceTracker.open(); }
Example 5
Source File: Shell.java From concierge with Eclipse Public License 1.0 | 5 votes |
protected static ServiceReference<?> getServiceRef(final String serviceIdString) { try { final ServiceReference<?>[] ref = ShellActivator.context.getServiceReferences((String) null, "(" + Constants.SERVICE_ID + "=" + serviceIdString + ")"); if (ref == null) { err.println("Unknown service " + serviceIdString); return null; } return ref[0]; } catch (final InvalidSyntaxException e) { e.printStackTrace(err); return null; } }
Example 6
Source File: Concierge.java From concierge with Eclipse Public License 1.0 | 5 votes |
static boolean matches(final Requirement req, final Capability cap) { final String reqNamespace = req.getNamespace(); final String capNamespace = cap.getNamespace(); if (!reqNamespace.equals(capNamespace)) { return false; } /* * final String effective = req.getDirectives().get( * Namespace.REQUIREMENT_EFFECTIVE_DIRECTIVE); if (!(effective == null * || effective .equals(Namespace.EFFECTIVE_RESOLVE))) { return false; } */ final String filter = req.getDirectives() .get(Namespace.REQUIREMENT_FILTER_DIRECTIVE); try { if (!(filter == null || RFC1960Filter.fromString(filter) .matches(cap.getAttributes()))) { return false; } return matches0(capNamespace, req, cap, filter); } catch (final InvalidSyntaxException e) { // TODO: to log e.printStackTrace(); return false; } }