Package org.rhq.core.pluginapi.event

Examples of org.rhq.core.pluginapi.event.EventContext


        return newResources;
    }

    @Nullable
    private EventContext getEventContext(Resource resource) {
        EventContext eventContext;
        if (resource.getResourceType().getEventDefinitions() != null
            && !resource.getResourceType().getEventDefinitions().isEmpty()) {
            eventContext = new EventContextImpl(resource, eventManager);
        } else {
            eventContext = null;
View Full Code Here


                LogEventSourcePropertyNames.MINIMUM_SEVERITY, null);
            if (minimumSeverityString != null) {
                EventSeverity minimumSeverity = EventSeverity.valueOf(minimumSeverityString.toUpperCase());
                processor.setMinimumSeverity(minimumSeverity);
            }
            EventContext eventContext = this.resourceContext.getEventContext();
            EventPoller poller = new LogFileEventPoller(eventContext, LOG_ENTRY_EVENT_TYPE, logFile, processor);
            eventContext.registerEventPoller(poller, POLLING_INTERVAL_IN_SECONDS, logFile.getPath());
            this.startedEventSources.add(logEventSource);
        }
    }
View Full Code Here

            return;
        }

        for (Iterator<PropertyMap> iterator = this.startedEventSources.iterator(); iterator.hasNext(); ) {
            PropertyMap logEventSource = iterator.next();
            EventContext eventContext = this.resourceContext.getEventContext();
            String logFilePath = logEventSource.getSimpleValue(LogEventSourcePropertyNames.LOG_FILE_PATH, null);
            eventContext.unregisterEventPoller(LOG_ENTRY_EVENT_TYPE, logFilePath);
            iterator.remove();
        }
    }
View Full Code Here

        serverComponent = new ApacheServerComponent();

        Resource resource = new Resource(result.getResourceKey(), null, apacheServerResourceType);
        resource.setPluginConfiguration(config);
        resourceContext = new ResourceContext<PlatformComponent>(resource, null, null, discoveryComponent, systemInfo,
            null, null, null, new EventContext() {

                @Override
                public void unregisterEventPoller(@NotNull
                String eventType, @NotNull
                String sourceLocation) {
View Full Code Here

            return result;
        }


        EventContext eventContext = resourceContext.getEventContext();

        for (int i = 0; i < count; ++i) {
            Event event = new Event(eventType, source, System.currentTimeMillis(), severity, details);
            eventContext.publishEvent(event);
        }

        result = new OperationResult("failed");
        return result;
    }
View Full Code Here

        ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent();
        SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
        File temporaryDirectory = temp;
        File dataDirectory = temp;
        String pluginContainerName = "rhq";
        EventContext eventContext = new EventContextImpl(resource, eventManager);
        OperationContext operationContext = new OperationContextImpl(0);
        ContentContext contentContext = new ContentContextImpl(0);
        PluginContainerDeployment pluginContainerDeployment = null;
        AvailabilityContext availContext = new AvailabilityContextImpl(resource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(resource, pluginContainer.getInventoryManager());
View Full Code Here

        ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance();

        availabilityContext = new AvailabilityContextImpl(cresource, pluginContainer.getInventoryManager());
        inventoryContext = new InventoryContextImpl(cresource, pluginContainer.getInventoryManager());

        EventContext eventContext = new EventContextImpl(resource, eventManager);
        ResourceContext context = new ResourceContext(cresource, parentComponent,
                null, rdc, systemInfo, temporaryDirectory, dataDirectory,
                pluginContainerName, eventContext, operationContext, contentContext,
                availabilityContext, inventoryContext, pluginContainerDeployment);
View Full Code Here

        ResourceComponent component = (ResourceComponent) Class.forName(rclassname).newInstance();

        AvailabilityContext availContext = new AvailabilityContextImpl(cresource, pluginContainer.getInventoryManager());
        InventoryContext inventoryContext = new InventoryContextImpl(cresource, pluginContainer.getInventoryManager());

        EventContext eventContext = new EventContextImpl(resource, eventManager);
        ResourceContext context = new ResourceContext(cresource, parentComponent,
                null, rdc, systemInfo, temporaryDirectory, dataDirectory,
                pluginContainerName, eventContext, operationContext, contentContext,
                availContext, inventoryContext,pluginContainerDeployment);
View Full Code Here

        }
    }

    @Override
    public void stop() {
        EventContext events = getResourceContext().getEventContext();
        if (events != null && eventsRegistered) {
            eventsRegistered = false;
            events.unregisterEventPoller(LOG_EVENT_TYPE);
            discardPoller();
        }
        super.stop();
    }
View Full Code Here

        // It is safe to read prior snapshot as getNativeProcess always return a fresh instance
        AvailabilityType ret = process == null ? AvailabilityType.DOWN
            : (process.priorSnaphot().isRunning() ? AvailabilityType.UP : AvailabilityType.DOWN);

        EventContext events = getResourceContext().getEventContext();
        if (events != null) {
            if (ret == AvailabilityType.UP) {
                if (!eventsRegistered) {
                    File logFile = determineLogFile();
                    int interval = Integer.parseInt(getResourceContext().getPluginConfiguration().getSimpleValue(
                        LOG_POLLING_INTERVAL_PROPERTY, "60"));
                    events.registerEventPoller(createNewEventPoller(events, logFile), interval);
                    eventsRegistered = true;
                }
            } else if (eventsRegistered) {
                eventsRegistered = false;
                events.unregisterEventPoller(LOG_EVENT_TYPE);
                discardPoller();
            }
        }

        return ret;
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.event.EventContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.