Search in sources :

Example 1 with OsDiscoveryNodeValidationProcessor

use of org.apache.ignite.internal.processors.nodevalidation.OsDiscoveryNodeValidationProcessor in project ignite by apache.

the class IgniteKernal method createComponent.

/**
     * Creates optional component.
     *
     * @param cls Component interface.
     * @param ctx Kernal context.
     * @return Created component.
     * @throws IgniteCheckedException If failed to create component.
     */
private static <T extends GridComponent> T createComponent(Class<T> cls, GridKernalContext ctx) throws IgniteCheckedException {
    assert cls.isInterface() : cls;
    T comp = ctx.plugins().createComponent(cls);
    if (comp != null)
        return comp;
    if (cls.equals(IgniteCacheObjectProcessor.class))
        return (T) new CacheObjectBinaryProcessorImpl(ctx);
    if (cls.equals(DiscoveryNodeValidationProcessor.class))
        return (T) new OsDiscoveryNodeValidationProcessor(ctx);
    Class<T> implCls = null;
    try {
        String clsName;
        // Handle special case for PlatformProcessor
        if (cls.equals(PlatformProcessor.class))
            clsName = ctx.config().getPlatformConfiguration() == null ? PlatformNoopProcessor.class.getName() : cls.getName() + "Impl";
        else
            clsName = componentClassName(cls);
        implCls = (Class<T>) Class.forName(clsName);
    } catch (ClassNotFoundException ignore) {
    // No-op.
    }
    if (implCls == null)
        throw new IgniteCheckedException("Failed to find component implementation: " + cls.getName());
    if (!cls.isAssignableFrom(implCls))
        throw new IgniteCheckedException("Component implementation does not implement component interface " + "[component=" + cls.getName() + ", implementation=" + implCls.getName() + ']');
    Constructor<T> constructor;
    try {
        constructor = implCls.getConstructor(GridKernalContext.class);
    } catch (NoSuchMethodException e) {
        throw new IgniteCheckedException("Component does not have expected constructor: " + implCls.getName(), e);
    }
    try {
        return constructor.newInstance(ctx);
    } catch (ReflectiveOperationException e) {
        throw new IgniteCheckedException("Failed to create component [component=" + cls.getName() + ", implementation=" + implCls.getName() + ']', e);
    }
}
Also used : PlatformNoopProcessor(org.apache.ignite.internal.processors.platform.PlatformNoopProcessor) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IGNITE_REST_START_ON_CLIENT(org.apache.ignite.IgniteSystemProperties.IGNITE_REST_START_ON_CLIENT) ATTR_ACTIVE_ON_START(org.apache.ignite.internal.IgniteNodeAttributes.ATTR_ACTIVE_ON_START) ATTR_LATE_AFFINITY_ASSIGNMENT(org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT) ATTR_JMX_PORT(org.apache.ignite.internal.IgniteNodeAttributes.ATTR_JMX_PORT) BEFORE_NODE_START(org.apache.ignite.lifecycle.LifecycleEventType.BEFORE_NODE_START) COPYRIGHT(org.apache.ignite.internal.IgniteVersionUtils.COPYRIGHT) LT(org.apache.ignite.internal.util.typedef.internal.LT) AFTER_NODE_START(org.apache.ignite.lifecycle.LifecycleEventType.AFTER_NODE_START) CacheObjectBinaryProcessorImpl(org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl) OsDiscoveryNodeValidationProcessor(org.apache.ignite.internal.processors.nodevalidation.OsDiscoveryNodeValidationProcessor)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IGNITE_REST_START_ON_CLIENT (org.apache.ignite.IgniteSystemProperties.IGNITE_REST_START_ON_CLIENT)1 ATTR_ACTIVE_ON_START (org.apache.ignite.internal.IgniteNodeAttributes.ATTR_ACTIVE_ON_START)1 ATTR_JMX_PORT (org.apache.ignite.internal.IgniteNodeAttributes.ATTR_JMX_PORT)1 ATTR_LATE_AFFINITY_ASSIGNMENT (org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY_ASSIGNMENT)1 COPYRIGHT (org.apache.ignite.internal.IgniteVersionUtils.COPYRIGHT)1 CacheObjectBinaryProcessorImpl (org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl)1 OsDiscoveryNodeValidationProcessor (org.apache.ignite.internal.processors.nodevalidation.OsDiscoveryNodeValidationProcessor)1 PlatformNoopProcessor (org.apache.ignite.internal.processors.platform.PlatformNoopProcessor)1 LT (org.apache.ignite.internal.util.typedef.internal.LT)1 AFTER_NODE_START (org.apache.ignite.lifecycle.LifecycleEventType.AFTER_NODE_START)1 BEFORE_NODE_START (org.apache.ignite.lifecycle.LifecycleEventType.BEFORE_NODE_START)1