private void checkExtension() { if (extension == null) { throw new Fabric3Exception("Channel proxy service extension not installed"); } }
public <B> B getService(Class<B> interfaze, String referenceName) { try { return interfaze.cast(getSession().getAttribute(referenceName)); } catch (Fabric3Exception e) { throw new ServiceRuntimeException(e.getMessage(), e); } }
@SuppressWarnings({"unchecked"}) public <B> ServiceReference<B> getServiceReference(Class<B> interfaze, String referenceName) { try { return ServiceReference.class.cast(getSession().getAttribute(referenceName)); } catch (Fabric3Exception e) { throw new ServiceRuntimeException(e.getMessage(), e); } }
private void checkExtension() { if (extension == null) { throw new Fabric3Exception("Channel proxy service extension not installed"); } }
public String getURI() { try { return component.getUri().toString(); } catch (Fabric3Exception e) { throw new ServiceRuntimeException(e.getMessage(), e); } }
public String transform(Object source, ClassLoader loader) throws Fabric3Exception { try { return mapper.writeValueAsString(source); } catch (IOException e) { throw new Fabric3Exception(e); } }
public <B> B getProperty(Class<B> type, String propertyName) { try { return component.getProperty(type, propertyName); } catch (Fabric3Exception e) { throw new ServiceRuntimeException(e.getMessage(), e); } }
public void stop() { try { if (stream != null) { stream.close(); stream = null; } } catch (IOException e) { throw new Fabric3Exception(e); } }
private int parseInt(String value, String name) throws Fabric3Exception { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new Fabric3Exception("Invalid value for " + name, e); } }
public Date transform(final Node node, ClassLoader loader) throws Fabric3Exception { try { return dateFormatter.parse(node.getTextContent()); } catch (ParseException pe) { throw new Fabric3Exception("Unsupported Date Format ", pe); } }
public synchronized void register(URI id, ClassLoader classLoader) { if (registry.containsKey(id)) { throw new Fabric3Exception("Duplicate classloader: " + id); } registry.put(id, classLoader); }
@SuppressWarnings("unchecked") public <T extends ResourceReference> ResourceReferenceGenerator<T> getResourceReferenceGenerator(Class<T> clazz) { ResourceReferenceGenerator<T> generator = (ResourceReferenceGenerator<T>) resourceReferenceGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Resource reference generator not found for " + clazz.getName()); } return generator; }
@SuppressWarnings("unchecked") public <T extends Implementation<?>> ComponentGenerator<LogicalComponent<T>> getComponentGenerator(Class<T> clazz) { ComponentGenerator<LogicalComponent<T>> generator = (ComponentGenerator<LogicalComponent<T>>) componentGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Component generator not found for " + clazz.getName()); } return generator; }
@SuppressWarnings("unchecked") public <T extends ResourceReference> ResourceReferenceGenerator<T> getResourceReferenceGenerator(Class<T> clazz) { ResourceReferenceGenerator<T> generator = (ResourceReferenceGenerator<T>) resourceReferenceGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Resource reference generator not found for " + clazz.getName()); } return generator; }
public XMLStreamReader transform(Node element, ClassLoader loader) throws Fabric3Exception { DOMSource source = new DOMSource(element); try { return xmlFactory.createXMLStreamReader(source); } catch (XMLStreamException e) { throw new Fabric3Exception(e); } } }
@SuppressWarnings("unchecked") public <T extends Implementation<?>> ComponentGenerator<LogicalComponent<T>> getComponentGenerator(Class<T> clazz) { ComponentGenerator<LogicalComponent<T>> generator = (ComponentGenerator<LogicalComponent<T>>) componentGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Component generator not found for " + clazz.getName()); } return generator; }
@SuppressWarnings("unchecked") public <T extends Binding> WireBindingGenerator<T> getBindingGenerator(Class<T> clazz) { WireBindingGenerator<T> generator = (WireBindingGenerator<T>) bindingGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Wire binding generator not found for " + clazz.getName()); } return generator; }
@SuppressWarnings({"unchecked"}) public <T extends Binding> ConnectionBindingGenerator<T> getConnectionBindingGenerator(Class<T> clazz) { ConnectionBindingGenerator<T> generator = (ConnectionBindingGenerator<T>) connectionBindingGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Connection binding generator not found for " + clazz.getName()); } return generator; }
public static Class<?> loadClass(ClassLoader cl, String className) { Class<?> clazz = PRIMITIVES.get(className); if (clazz == null) { try { clazz = Class.forName(className, true, cl); } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } } return clazz; }
@SuppressWarnings({"unchecked"}) public <T extends Binding> ConnectionBindingGenerator<T> getConnectionBindingGenerator(Class<T> clazz) { ConnectionBindingGenerator<T> generator = (ConnectionBindingGenerator<T>) connectionBindingGenerators.get(clazz); if (generator == null) { throw new Fabric3Exception("Connection binding generator not found for " + clazz.getName()); } return generator; }