/** {@inheritDoc} */ @Override public void start(Map<String, String> props) { try { A.notNullOrEmpty(props.get(IgniteSourceConstants.CACHE_NAME), "cache name"); A.notNullOrEmpty(props.get(IgniteSourceConstants.CACHE_CFG_PATH), "path to cache config file"); A.notNullOrEmpty(props.get(IgniteSourceConstants.CACHE_EVENTS), "Registered cache events"); A.notNullOrEmpty(props.get(IgniteSourceConstants.TOPIC_NAMES), "Kafka topics"); } catch (IllegalArgumentException e) { throw new ConnectException("Cannot start IgniteSourceConnector due to configuration error", e); } configProps = props; }
/** * A sink lifecycle method. Validates grid-specific sink properties. * * @param props Sink properties. */ @Override public void start(Map<String, String> props) { configProps = props; try { A.notNullOrEmpty(configProps.get(SinkConnector.TOPICS_CONFIG), "topics"); A.notNullOrEmpty(configProps.get(IgniteSinkConstants.CACHE_NAME), "cache name"); A.notNullOrEmpty(configProps.get(IgniteSinkConstants.CACHE_CFG_PATH), "path to cache config file"); } catch (IllegalArgumentException e) { throw new ConnectException("Cannot start IgniteSinkConnector due to configuration error", e); } }
/** {@inheritDoc} */ @Override public BinaryObject buildEnum(String typeName, int ord) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); int typeId = binaryCtx.typeId(typeName); typeName = binaryCtx.userTypeName(typeName); updateMetadata(typeId, typeName, null, null, true, null); return new BinaryEnumObjectImpl(binaryCtx, typeId, null, ord); }
/** Initializes this IP Finder by creating the appropriate Curator objects. */ private void init() { if (!initGuard.compareAndSet(false, true)) return; String sysPropZkConnString = System.getProperty(PROP_ZK_CONNECTION_STRING); if (sysPropZkConnString != null && !sysPropZkConnString.trim().isEmpty()) zkConnectionString = sysPropZkConnString; if (log.isInfoEnabled()) log.info("Initializing ZooKeeper IP Finder."); if (curator == null) { A.notNullOrEmpty(zkConnectionString, String.format("ZooKeeper URL (or system property %s) cannot be null " + "or empty if a CuratorFramework object is not provided explicitly", PROP_ZK_CONNECTION_STRING)); curator = CuratorFrameworkFactory.newClient(zkConnectionString, retryPolicy); } if (curator.getState() == CuratorFrameworkState.LATENT) curator.start(); A.ensure(curator.getState() == CuratorFrameworkState.STARTED, "CuratorFramework can't be started."); discovery = ServiceDiscoveryBuilder.builder(IgniteInstanceDetails.class) .client(curator) .basePath(basePath) .serializer(new JsonInstanceSerializer<>(IgniteInstanceDetails.class)) .build(); }
/** {@inheritDoc} */ @Override public BinaryObject buildEnum(String typeName, String name) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); A.notNullOrEmpty(name, "enum name"); int typeId = binaryCtx.typeId(typeName); BinaryMetadata metadata = metadata0(typeId); if (metadata == null) throw new BinaryObjectException("Failed to get metadata for type [typeId=" + typeId + ", typeName='" + typeName + "']"); Integer ordinal = metadata.getEnumOrdinalByName(name); typeName = binaryCtx.userTypeName(typeName); if (ordinal == null) throw new BinaryObjectException("Failed to resolve enum ordinal by name [typeId=" + typeId + ", typeName='" + typeName + "', name='" + name + "']"); return new BinaryEnumObjectImpl(binaryCtx, typeId, null, ordinal); }
/** {@inheritDoc} */ @Override public BinaryType registerEnum(String typeName, Map<String, Integer> vals) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); int typeId = binaryCtx.typeId(typeName); typeName = binaryCtx.userTypeName(typeName); BinaryUtils.validateEnumValues(typeName, vals); updateMetadata(typeId, typeName, null, null, true, vals); return binaryCtx.metadata(typeId); }
A.notNullOrEmpty(zkConnectionString, "zkConnectionString can not be empty"); A.notNullOrEmpty(zkRootPath, "zkRootPath can not be empty");
A.ensure(getSingleTupleExtractor() == null || getMultipleTupleExtractor() == null, "cannot provide both single and multiple tuple extractor"); A.notNullOrEmpty(brokerUrl, "broker URL"); A.notNullOrEmpty(t, "topic in list of topics");
A.notNullOrEmpty(clientId, "client id is compulsory when using durable subscriptions"); A.notNullOrEmpty(durableSubscriptionName, "durable subscription name is compulsory when using " + "durable subscriptions"); A.ensure(destinationType.isAssignableFrom(Queue.class) || destinationType.isAssignableFrom(Topic.class), "this streamer can only handle Queues or Topics."); A.notNullOrEmpty(destinationName, "destination or destination name");
A.notNullOrEmpty(endpointUri, "endpoint URI must be provided");
A.notNull(topic, "topic"); A.notNull(consumerGrp, "consumer group"); A.notNullOrEmpty(nameSrvAddr, "nameserver address"); A.ensure(null != getMultipleTupleExtractor(), "Multiple tuple extractor must be configured");
/** {@inheritDoc} */ @Override public BinaryObject buildEnum(String typeName, int ord) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); int typeId = binaryCtx.typeId(typeName); typeName = binaryCtx.userTypeName(typeName); updateMetadata(typeId, typeName, null, null, true, null); return new BinaryEnumObjectImpl(binaryCtx, typeId, null, ord); }
/** {@inheritDoc} */ @Override public BinaryObject buildEnum(String typeName, String name) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); A.notNullOrEmpty(name, "enum name"); int typeId = binaryCtx.typeId(typeName); BinaryMetadata metadata = metadata0(typeId); if (metadata == null) throw new BinaryObjectException("Failed to get metadata for type [typeId=" + typeId + ", typeName='" + typeName + "']"); Integer ordinal = metadata.getEnumOrdinalByName(name); typeName = binaryCtx.userTypeName(typeName); if (ordinal == null) throw new BinaryObjectException("Failed to resolve enum ordinal by name [typeId=" + typeId + ", typeName='" + typeName + "', name='" + name + "']"); return new BinaryEnumObjectImpl(binaryCtx, typeId, null, ordinal); }
/** {@inheritDoc} */ @Override public BinaryType registerEnum(String typeName, Map<String, Integer> vals) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); int typeId = binaryCtx.typeId(typeName); typeName = binaryCtx.userTypeName(typeName); BinaryUtils.validateEnumValues(typeName, vals); updateMetadata(typeId, typeName, null, null, true, vals); return binaryCtx.metadata(typeId); }