/** * Get the fetcher. * @return The fetcher. */ // Todo: move to IPlatformComponent? public IValueFetcher getFetcher() { return access.getFetcher(); }
for(UnparsedExpression entry: params) Object val = SJavaParser.evaluateExpression(entry.getValue(), comp.getModel().getAllImports(), comp.getFetcher(), comp.getClassLoader()); ps.put(entry.getName(), val);
/** * Get the number of components to start. * @return The number. */ protected int getNumber(ComponentInstanceInfo component, IModelInfo model) { Object ret = component.getNumber()!=null? SJavaParser.evaluateExpression(component.getNumber(), model.getAllImports(), this.component.getFetcher(), this.component.getClassLoader()): null; return ret instanceof Integer? ((Integer)ret).intValue(): 1; }
/** * Create a new listener. */ public IntermediateMethodResultListener(Future fut, Method method, Object[] args, Method muxmethod) { Class<? extends IMultiplexDistributor> cdcl = SimpleMultiplexDistributor.class; IFilter<Tuple2<IService, Object[]>> fil = null; IParameterConverter conv = null; if(muxmethod.isAnnotationPresent(MultiplexDistributor.class)) { MultiplexDistributor mda = muxmethod.getAnnotation(MultiplexDistributor.class); fil = (IFilter<Tuple2<IService, Object[]>>)createValue(mda.filter(), agent.getFetcher()); conv = (IParameterConverter)createValue(mda.paramconverter(), agent.getFetcher()); cdcl = mda.value(); } muldis = (IMultiplexDistributor)createValue(cdcl); IIntermediateFuture<Object> muldisres = muldis.init(method, args, fil, conv); Class<? extends IMultiplexCollector> mccl = FlattenMultiplexCollector.class; if(muxmethod.isAnnotationPresent(MultiplexCollector.class)) { MultiplexCollector mc = muxmethod.getAnnotation(MultiplexCollector.class); mccl = mc.value(); } IMultiplexCollector coll = (IMultiplexCollector)createValue(mccl); coll.init(fut, method, args, muxmethod); muldisres.addResultListener(coll); }
/** * Create a new listener. */ public IntermediateMethodResultListener(Future fut, Method method, Object[] args, Method muxmethod) { Class<? extends IMultiplexDistributor> cdcl = SimpleMultiplexDistributor.class; IFilter<Tuple2<IService, Object[]>> fil = null; IParameterConverter conv = null; if(muxmethod.isAnnotationPresent(MultiplexDistributor.class)) { MultiplexDistributor mda = muxmethod.getAnnotation(MultiplexDistributor.class); fil = (IFilter<Tuple2<IService, Object[]>>)createValue(mda.filter(), agent.getFetcher()); conv = (IParameterConverter)createValue(mda.paramconverter(), agent.getFetcher()); cdcl = mda.value(); } muldis = (IMultiplexDistributor)createValue(cdcl); IIntermediateFuture<Object> muldisres = muldis.init(method, args, fil, conv); Class<? extends IMultiplexCollector> mccl = FlattenMultiplexCollector.class; if(muxmethod.isAnnotationPresent(MultiplexCollector.class)) { MultiplexCollector mc = muxmethod.getAnnotation(MultiplexCollector.class); mccl = mc.value(); } IMultiplexCollector coll = (IMultiplexCollector)createValue(mccl); coll.init(fut, method, args, muxmethod); muldisres.addResultListener(coll); }
Object val = SJavaParser.evaluateExpression(arguments[i].getValue(), model.getAllImports(), this.component.getFetcher(), this.component.getClassLoader()); ret.put(arguments[i].getName(), val); ret = (Map<String, Object>)SJavaParser.evaluateExpression(argumentsexp.getValue(), model.getAllImports(), this.component.getFetcher(), this.component.getClassLoader());
/** * Set an injected field value. */ protected void setFieldValue(Object val, Field field, String convert) { if(val!=null || !SReflect.isBasicType(field.getType())) { try { Object agent = getComponent().getComponentFeature(IPojoComponentFeature.class).getPojoAgent(); if(convert!=null) { SimpleValueFetcher fetcher = new SimpleValueFetcher(getComponent().getFetcher()); fetcher.setValue("$value", val); val = SJavaParser.evaluateExpression(convert, getComponent().getModel().getAllImports(), fetcher, getComponent().getClassLoader()); } field.setAccessible(true); field.set(agent, val); } catch(Exception e) { throw new RuntimeException(e); } } } }
/** * Get the number of components to start. * Allows filename to be dynamically evaluated. * @return The number. */ protected String getFilename(ComponentInstanceInfo component, IModelInfo model) { String ret = null; SubcomponentTypeInfo si = component.getType(model); ret = (String)SJavaParser.evaluateExpressionPotentially(si.getFilename(), model.getAllImports(), this.component.getFetcher(), this.component.getClassLoader()); // if(si.getFilename()!=null && si.getFilename().startsWith("%{")) // { // try // { // ret = (String)SJavaParser.evaluateExpression(si.getFilename().substring(2, si.getFilename().length()-1), model.getAllImports(), this.component.getFetcher(), this.component.getClassLoader()); // } // catch(Exception e) // { // ret = si.getFilename(); // } // } // else // { // ret = si.getFilename(); // } return ret; }
/** * Get the name of components to start. * @return The name. */ protected String getName(ComponentInstanceInfo component, IModelInfo model, int cnt) { String ret = component.getName(); if(ret!=null) { SimpleValueFetcher fetcher = new SimpleValueFetcher(this.component.getFetcher()); fetcher.setValue("$n", Integer.valueOf(cnt)); try { ret = (String)SJavaParser.evaluateExpression(component.getName(), model.getAllImports(), fetcher, this.component.getClassLoader()); if(ret==null) ret = component.getName(); } catch(RuntimeException e) { } } return ret; }
arguments.put(upes[i].getName(), SJavaParser.getParsedValue(upes[i], component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); arguments.put(margs[i].getName(), SJavaParser.getParsedValue(margs[i].getDefaultValue(), component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader()));
component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null);
tmp = SJavaParser.evaluateExpression(unexp.getValue(), getComponent().getModel().getAllImports(), getComponent().getFetcher(), getComponent().getClassLoader());
/** * Init unset results from default values. */ protected void initDefaultResults() { // Init the results with initial or default values. ConfigurationInfo ci = component.getConfiguration()!=null ? component.getModel().getConfiguration(component.getConfiguration()) : null; if(ci!=null) { UnparsedExpression[] upes = ci.getResults(); for(int i=0; i<upes.length; i++) { results.put(upes[i].getName(), SJavaParser.getParsedValue(upes[i], component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); } } IArgument[] res = component.getModel().getResults(); for(int i=0; i<res.length; i++) { // Prevents unset results being added to be able to check whether a user has // set an argument explicitly to null or if it just is null (e.g. for field injections) if(!results.containsKey(res[i].getName()) && res[i].getDefaultValue().getValue()!=null) { results.put(res[i].getName(), SJavaParser.getParsedValue(res[i].getDefaultValue(), component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); } } }
ei.createInstance(component.getExternalAccess(), component.getFetcher()).addResultListener( component.getComponentFeature(IExecutionFeature.class).createResultListener(new IResultListener<IExtensionInstance>()
interceptors[i].getValue(), ia.getModel().getAllImports(), ia.getFetcher(), ia.getClassLoader()); handler.addServiceInterceptor(interceptor);
SimpleValueFetcher fetcher = new SimpleValueFetcher(getComponent().getFetcher()); fetcher.setValue("$value", val); val = SJavaParser.evaluateExpression(convback, getComponent().getModel().getAllImports(), fetcher, getComponent().getClassLoader());
IValueFetcher ret = agent.getFetcher();
interceptors[i].getValue(), ea.getModel().getAllImports(), ia.getFetcher(), ia.getClassLoader()); handler.addServiceInterceptor(interceptor);
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getComponent().getModel().getAllImports(), getComponent().getFetcher(), getComponent().getClassLoader());
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getComponent().getModel().getAllImports(), getComponent().getFetcher(), getComponent().getClassLoader());