/** * Create a new instance of Deployer from a configuration stream. * @param configStream stream containing switchyard config * @throws IOException Error reading configuration model. */ public Deployment(InputStream configStream) throws IOException { super(new ModelPuller<SwitchYardModel>().pull(configStream)); }
/** * Safely pulls (constructs) a basic Model from a qualified name. * @param qname the qualified name * @return the model, or null if the qualified name is null */ public M pull(QName qname) { return pull(new ElementPuller().pull(qname)); }
/** * {@inheritDoc} */ @Override public M pull(InputStream stream) throws IOException { return pull(new ElementPuller().pull(stream)); }
private SwitchYardModel readSwitchYardConfig(FileResource<?> file) throws java.io.IOException { return new ModelPuller<SwitchYardModel>().pull(file.getUnderlyingResourceObject()); }
/** * Safely pulls a Model from a Reader. * @param reader a Reader of the Model * @return the Model, or null if not found * @throws IOException if a problem occurred */ public M pull(Reader reader) throws IOException { return pull(new ElementPuller().pull(reader)); }
/** * Lookup camel binding model without usage of SCA parser. * * @param config Configuration location. * @return Camel binding. * @throws Exception In case of any problems exception is not handled. */ @SuppressWarnings("unchecked") protected T getFirstCamelModelBinding(final String config) throws Exception { final InputStream in = Classes.getResourceAsStream(config, getClass()); final CamelBindingModel model = new ModelPuller<CamelBindingModel>().pull(in); return (T) model; }
/** * Safely pulls a Model from an InputSource. * @param source an InputSource of the Model * @return the Model, or null if not found * @throws IOException if a problem occurred */ public M pull(InputSource source) throws IOException { return pull(new ElementPuller().pull(source)); }
/** * Lookup camel binding model without usage of SCA parser. * * @param config Configuration location. * @return Camel binding. * @throws Exception In case of any problems exception is not handled. */ @SuppressWarnings("unchecked") protected T getFirstCamelModelBinding(final String config) throws Exception { final InputStream in = Classes.getResourceAsStream(config, getClass()); final CamelBindingModel model = new ModelPuller<CamelBindingModel>().pull(in); return (T) model; }
/** * Safely constructs a Model from a Document. * @param document the Model Document * @return the Model, or null if document is null */ public M pull(Document document) { return pull(new ElementPuller().pull(document)); }
case CLASSPATH: if (_caller != null) { model = new ModelPuller<M>().pull(_classpath, _caller); } else if (_loader != null) { model = new ModelPuller<M>().pull(_classpath, _loader); } else { model = new ModelPuller<M>().pull(_classpath, getClass()); model = new ModelPuller<M>().pull(_resource, _caller); } else if (_loader != null) { model = new ModelPuller<M>().pull(_resource, _loader); } else { model = new ModelPuller<M>().pull(_resource, getClass()); model = new ModelPuller<M>().pull(_uri); break; case URL: model = new ModelPuller<M>().pull(_url); break; case FILE: model = new ModelPuller<M>().pull(_file); break; case INPUT_STREAM: model = new ModelPuller<M>().pull(_inputStream); break; case READER: model = new ModelPuller<M>().pull(_reader); break; case INPUT_SOURCE:
/** * Safely pulls (constructs) a basic Model from a qualified name. * @param qname the qualified name * @return the model, or null if the qualified name is null */ public M pull(QName qname) { return pull(new ElementPuller().pull(qname)); }
case CLASSPATH: if (_caller != null) { model = new ModelPuller<M>().pull(_classpath, _caller); } else if (_loader != null) { model = new ModelPuller<M>().pull(_classpath, _loader); } else { model = new ModelPuller<M>().pull(_classpath, getClass()); model = new ModelPuller<M>().pull(_resource, _caller); } else if (_loader != null) { model = new ModelPuller<M>().pull(_resource, _loader); } else { model = new ModelPuller<M>().pull(_resource, getClass()); model = new ModelPuller<M>().pull(_uri); break; case URL: model = new ModelPuller<M>().pull(_url); break; case FILE: model = new ModelPuller<M>().pull(_file); break; case INPUT_STREAM: model = new ModelPuller<M>().pull(_inputStream); break; case READER: model = new ModelPuller<M>().pull(_reader); break; case INPUT_SOURCE:
/** * {@inheritDoc} */ @Override public M pull(InputStream stream) throws IOException { return pull(new ElementPuller().pull(stream)); }
/** * Parse the SwitchYard configuration * @param metaData SwitchYard MetaData * @throws IOException IOException */ private void parseSwitchYardConfig(SwitchYardMetaData metaData) throws IOException { InputStream is = metaData.getSwitchYardFile().openStream(); try { SwitchYardModel switchyardModel = new ModelPuller<SwitchYardModel>().pull(is); metaData.setSwitchYardModel(switchyardModel); } finally { is.close(); } }
/** * Safely pulls a Model from an InputSource. * @param source an InputSource of the Model * @return the Model, or null if not found * @throws IOException if a problem occurred */ public M pull(InputSource source) throws IOException { return pull(new ElementPuller().pull(source)); }
/** * Lookup camel reference binding model in SCA configuration and use Switchard * model as root and return first element from it. * * @param config Configuration location. * @return Camel binding. * @throws Exception In case of any problems exception is not handled. */ @SuppressWarnings("unchecked") protected T getFirstCamelReferenceBinding(final String config) throws Exception { final InputStream in = Classes.getResourceAsStream(config, getClass()); final SwitchYardModel model = new ModelPuller<SwitchYardModel>().pull(in); final List<CompositeReferenceModel> services = model.getComposite().getReferences(); final CompositeReferenceModel compositeServiceModel = services.get(0); final List<BindingModel> bindings = compositeServiceModel.getBindings(); return (T) bindings.get(0); }
/** * Safely pulls a Model from a Reader. * @param reader a Reader of the Model * @return the Model, or null if not found * @throws IOException if a problem occurred */ public M pull(Reader reader) throws IOException { return pull(new ElementPuller().pull(reader)); }
/** * Lookup camel binding model in SCA configuration and use Switchard model * as root and return first element from it. * * @param config Configuration location. * @return Camel binding. * @throws Exception In case of any problems exception is not handled. */ @SuppressWarnings("unchecked") protected T getFirstCamelBinding(final String config) throws Exception { final InputStream in = Classes.getResourceAsStream(config, getClass()); final SwitchYardModel model = new ModelPuller<SwitchYardModel>().pull(in); final List<CompositeServiceModel> services = model.getComposite().getServices(); final CompositeServiceModel compositeServiceModel = services.get(0); final List<BindingModel> bindings = compositeServiceModel.getBindings(); return (T) bindings.get(0); }
/** * Safely constructs a Model from a Document. * @param document the Model Document * @return the Model, or null if document is null */ public M pull(Document document) { return pull(new ElementPuller().pull(document)); }
/** * Lookup camel binding model in SCA configuration and use Switchard model * as root and return first element from it. * * @param config Configuration location. * @return Camel binding. * @throws Exception In case of any problems exception is not handled. */ @SuppressWarnings("unchecked") protected T getFirstCamelBinding(final String config) throws Exception { final InputStream in = Classes.getResourceAsStream(config, getClass()); final SwitchYardModel model = new ModelPuller<SwitchYardModel>().pull(in); final List<CompositeServiceModel> services = model.getComposite().getServices(); final CompositeServiceModel compositeServiceModel = services.get(0); final List<BindingModel> bindings = compositeServiceModel.getBindings(); return (T) bindings.get(0); }