/** * Get the agent description. * @return The agent description. */ public IComponentDescription getComponentDescription() { return agent.getComponentDescription(); }
/** * Get the component description. * @return The component description. */ // Todo: hack??? should be internal to CMS!? public IComponentDescription getComponentDescription() { return access.getComponentDescription(); }
/** * Get the component description. * @return The component description. */ public IComponentDescription getComponentDescription() { return agent.getComponentDescription(); }
/** * Get the component description. * @return The component description. */ public IComponentDescription getComponentDescription() { return getComponent().getComponentDescription(); }
/** * Measure the value. */ public Long measureValue() { return System.currentTimeMillis()-comp.getComponentDescription().getCreationTime(); } }
/** * Get the local type name of this component as defined in the parent. * @return The type of this component type. */ public String getLocalType() { return getComponent().getComponentDescription().getLocalType(); }
/** * Get the monitoring event emit level. */ public PublishEventLevel getPublishEmitLevelMonitoring() { return getComponent().getComponentDescription().getMonitoring() != null ? getComponent().getComponentDescription().getMonitoring() : PublishEventLevel.OFF; // return emitlevelmon; }
/** * Get the component descriptions. * @return The component descriptions. */ public IFuture<IComponentDescription[]> getComponentDescriptions() { Future<IComponentDescription[]> fut = new Future<IComponentDescription[]>(); IComponentDescription[] ret = new IComponentDescription[components.size()]; int i=0; for(Iterator<IPlatformComponentAccess> it=components.values().iterator(); i<ret.length; i++) { ret[i] = (IComponentDescription)((CMSComponentDescription)it.next().getInternalAccess().getComponentDescription()).clone(); } fut.setResult(ret); return fut; }
/** * Get the description for a component (if any). */ protected IComponentDescription getDescription(IComponentIdentifier cid) { IPlatformComponentAccess component = components.get(cid); // Hack? Allows components to get description in init phase if(component==null) { InitInfo ii = getInitInfo(cid); if(ii!=null) component = ii.getComponent(); } return component!=null ? component.getInternalAccess().getComponentDescription() : null; }
/** * Test if current thread is the component thread. * @return True if the current thread is the component thread. */ public boolean isComponentThread() { return Thread.currentThread()==componentthread || IComponentDescription.STATE_TERMINATED.equals(getComponent().getComponentDescription().getState()) && Starter.isRescueThread(getComponent().getComponentIdentifier()); }
/** * Add a new component to its parent. */ protected IFuture<Void> addSubcomponent(IInternalAccess pad, IComponentDescription ad, IModelInfo lmodel) { CMSComponentDescription padesc = (CMSComponentDescription)pad.getComponentDescription(); padesc.addChild(ad.getName()); // if(padesc.isAutoShutdown() && !ad.isDaemon()) // if(pas!=null && pas.booleanValue() && (dae==null || !dae.booleanValue())) // cannot check parent shutdown state because could be still uninited if(!ad.isDaemon()) { Integer childcount = (Integer)childcounts.get(padesc.getName()); int cc = childcount!=null ? childcount.intValue()+1 : 1; childcounts.put(padesc.getName(), Integer.valueOf(cc)); } // Register component at parent. return ((IInternalSubcomponentsFeature)pad.getComponentFeature(ISubcomponentsFeature.class)).componentCreated(ad);//, lmodel); }
public void resultAvailable(IMonitoringService monser) { CallAccess.setCurrentInvocation(cur); CallAccess.setNextInvocation(next); if(monser!=null) { if(getComponent().hasEventTargets(PublishTarget.TOALL, PublishEventLevel.MEDIUM)) { // todo: clock? long end = System.currentTimeMillis(); ServiceCall sc = sic.getServiceCall(); Cause cause = sc==null? null: sc.getCause(); monser.publishEvent(new MonitoringEvent(getComponent().getComponentIdentifier(), getComponent().getComponentDescription().getCreationTime(), sic.getMethod().getDeclaringClass().getName()+"."+sic.getMethod().getName(), IMonitoringEvent.TYPE_SERVICECALL_END, cause, end, PublishEventLevel.MEDIUM)); } } ReturnValueResultListener.super.customResultAvailable(null); }
/** * Static method for creating a delegation service proxy for * provided service that is not offered by the component itself. */ public static IInternalService createDelegationProvidedServiceProxy(IInternalAccess ia, IComponentAdapter adapter, IServiceIdentifier sid, RequiredServiceInfo info, RequiredServiceBinding binding, ClassLoader classloader, boolean realtime) { BasicServiceInvocationHandler handler = new BasicServiceInvocationHandler(ia, sid, adapter.getLogger(), realtime, ia.getComponentDescription().getCause(), false); handler.addFirstServiceInterceptor(new MethodInvocationInterceptor()); handler.addFirstServiceInterceptor(new DelegationInterceptor(ia, info, binding, null, sid, realtime)); handler.addFirstServiceInterceptor(new DecouplingReturnInterceptor(/*ea, null,*/)); // return (IInternalService)Proxy.newProxyInstance(ea.getModel().getClassLoader(), new Class[]{IInternalService.class, sid.getServiceType()}, handler); return (IInternalService)Proxy.newProxyInstance(classloader, new Class[]{IInternalService.class, info.getType().getType(classloader)}, handler); //sid.getServiceType() }
public void customResultAvailable(Object result) { if(step.getPriority()<STEP_PRIORITY_IMMEDIATE && getComponent().getComponentFeature0(IMonitoringComponentFeature.class)!=null && getComponent().getComponentFeature(IMonitoringComponentFeature.class).hasEventTargets(PublishTarget.TOALL, PublishEventLevel.FINE)) { getComponent().getComponentFeature(IMonitoringComponentFeature.class).publishEvent(new MonitoringEvent(getComponent().getComponentIdentifier(), getComponent().getComponentDescription().getCreationTime(), step.getStep().toString(), IMonitoringEvent.EVENT_TYPE_DISPOSAL+"." +IMonitoringEvent.SOURCE_CATEGORY_EXECUTION, null, System.currentTimeMillis(), PublishEventLevel.FINE), PublishTarget.TOALL); // null was step.getCause() } super.customResultAvailable(result); } });
public void customResultAvailable(Void result) { if(getInternalAccess().hasEventTargets(PublishTarget.TOALL, PublishEventLevel.COARSE)) { MonitoringEvent me = new MonitoringEvent(getInternalAccess().getComponentIdentifier(), getInternalAccess().getComponentDescription().getCreationTime(), MonitoringEvent.TYPE_PROPERTY_REMOVED, System.currentTimeMillis(), PublishEventLevel.COARSE); me.setProperty("propname", name); getInternalAccess().publishEvent(me, PublishTarget.TOALL).addResultListener(new DelegationResultListener<Void>(ret)); } else { ret.setResult(null); } } });
public void customResultAvailable(Void result) { if(getInternalAccess().hasEventTargets(PublishTarget.TOALL, PublishEventLevel.COARSE)) { MonitoringEvent me = new MonitoringEvent(getInternalAccess().getComponentIdentifier(), getInternalAccess().getComponentDescription().getCreationTime(), MonitoringEvent.TYPE_PROPERTY_REMOVED, System.currentTimeMillis(), PublishEventLevel.COARSE); me.setProperty("propname", name); getInternalAccess().publishEvent(me, PublishTarget.TOALL).addResultListener(new DelegationResultListener<Void>(ret)); } else { ret.setResult(null); } } });
/** * Static method for creating a delegation service proxy for * provided service that is not offered by the component itself. */ public static IInternalService createDelegationProvidedServiceProxy(IInternalAccess ia, IServiceIdentifier sid, RequiredServiceInfo info, RequiredServiceBinding binding, ClassLoader classloader, boolean realtime) { BasicServiceInvocationHandler handler = new BasicServiceInvocationHandler(ia, sid, ia.getLogger(), realtime, ia.getComponentDescription().getCause(), false); handler.addFirstServiceInterceptor(new MethodInvocationInterceptor()); handler.addFirstServiceInterceptor(new DelegationInterceptor(ia, info, binding, null, sid, realtime)); handler.addFirstServiceInterceptor(new DecouplingReturnInterceptor(/*ea, null,*/)); // return (IInternalService)Proxy.newProxyInstance(ea.getModel().getClassLoader(), new Class[]{IInternalService.class, sid.getServiceType()}, handler); return (IInternalService)Proxy.newProxyInstance(classloader, new Class[]{IInternalService.class, info.getType().getType(classloader, ia.getModel().getAllImports())}, handler); //sid.getServiceType() }
/** * Publish a step event. */ public void publishStepEvent(StepInfo step, String type) { if(step.getPriority()<IExecutionFeature.STEP_PRIORITY_IMMEDIATE && getComponent().getComponentFeature0(IMonitoringComponentFeature.class)!=null && getComponent().getComponentFeature(IMonitoringComponentFeature.class).hasEventTargets(PublishTarget.TOALL, PublishEventLevel.FINE)) { MonitoringEvent event = new MonitoringEvent(getComponent().getComponentIdentifier(), getComponent().getComponentDescription().getCreationTime(), step.getStep().toString(), type+"."+TYPE_STEP, null, System.currentTimeMillis(), PublishEventLevel.FINE); // null was step.getCause() event.setProperty("sourcename", SReflect.getUnqualifiedClassName(step.getStep().getClass())); event.setProperty("details", getStepDetails(step)); event.setProperty("id", step.getStepCount()); getComponent().getComponentFeature(IMonitoringComponentFeature.class).publishEvent(event, PublishTarget.TOALL); } }
public void customResultAvailable(Void result) { if(getInternalAccess().getComponentFeature(IMonitoringComponentFeature.class).hasEventTargets(PublishTarget.TOALL, PublishEventLevel.COARSE)) { MonitoringEvent me = new MonitoringEvent(getInternalAccess().getComponentIdentifier(), getInternalAccess().getComponentDescription().getCreationTime(), MonitoringEvent.TYPE_PROPERTY_REMOVED, System.currentTimeMillis(), PublishEventLevel.COARSE); me.setProperty("propname", name); getInternalAccess().getComponentFeature(IMonitoringComponentFeature.class).publishEvent(me, PublishTarget.TOALL).addResultListener(new DelegationResultListener<Void>(ret)); } else { ret.setResult(null); } } });
public void customResultAvailable(Void result) { if(getInternalAccess().getComponentFeature(IMonitoringComponentFeature.class).hasEventTargets(PublishTarget.TOALL, PublishEventLevel.COARSE)) { MonitoringEvent me = new MonitoringEvent(getInternalAccess().getComponentIdentifier(), getInternalAccess().getComponentDescription().getCreationTime(), MonitoringEvent.TYPE_PROPERTY_REMOVED, System.currentTimeMillis(), PublishEventLevel.COARSE); me.setProperty("propname", name); getInternalAccess().getComponentFeature(IMonitoringComponentFeature.class).publishEvent(me, PublishTarget.TOALL).addResultListener(new DelegationResultListener<Void>(ret)); } else { ret.setResult(null); } } });