當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyDescriptor.isDynamic方法代碼示例

本文整理匯總了Java中org.apache.nifi.components.PropertyDescriptor.isDynamic方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyDescriptor.isDynamic方法的具體用法?Java PropertyDescriptor.isDynamic怎麽用?Java PropertyDescriptor.isDynamic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.nifi.components.PropertyDescriptor的用法示例。


在下文中一共展示了PropertyDescriptor.isDynamic方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setConnectionFactoryProperties

import org.apache.nifi.components.PropertyDescriptor; //導入方法依賴的package包/類
/**
 * This operation follows standard bean convention by matching property name to its corresponding 'setter' method.
 * Once the method was located it is invoked to set the corresponding property to a value provided by during service
 * configuration. For example, 'channel' property will correspond to 'setChannel(..) method and 'queueManager'
 * property will correspond to setQueueManager(..) method with a single argument.
 *
 * There are also few adjustments to accommodate well known brokers. For example ActiveMQ ConnectionFactory accepts
 * address of the Message Broker in a form of URL while IBMs in the form of host/port pair (more common). So this
 * method will use value retrieved from the 'BROKER_URI' static property 'as is' if ConnectionFactory implementation
 * is coming from ActiveMQ and for all others (for now) the 'BROKER_URI' value will be split on ':' and the
 * resulting pair will be used to execute setHostName(..) and setPort(..) methods on the provided ConnectionFactory.
 * This may need to be maintained and adjusted to accommodate other implementation of ConnectionFactory, but only
 * for URL/Host/Port issue. All other properties are set as dynamic properties where user essentially provides both
 * property name and value, The bean convention is also explained in user manual for this component with links
 * pointing to documentation of various ConnectionFactories.
 *
 * @see #setProperty(String, String) method
 */
private void setConnectionFactoryProperties(ConfigurationContext context) {
    for (final Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
        logger.info("entry = " + entry.toString());
        PropertyDescriptor descriptor = entry.getKey();
        String propertyName = descriptor.getName();
        if (descriptor.isDynamic()) {
            this.setProperty(propertyName, entry.getValue());
        } else {
            if (propertyName.equals(BROKER)) {
                if (context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue().startsWith("org.apache.activemq")) {
                    this.setProperty("brokerURL", entry.getValue());
                } else if (isSolace(context)) {
                    // TODO 
                    ;
                } else {

                    String[] hostPort = entry.getValue().split(":");
                    if (hostPort.length == 2) {
                        this.setProperty("hostName", hostPort[0]);
                        this.setProperty("port", hostPort[1]);
                    } else if (hostPort.length != 2) {
                        this.setProperty("serverUrl", entry.getValue()); // for tibco
                    } else {
                        throw new IllegalArgumentException("Failed to parse broker url: " + entry.getValue());
                    }
                }
                SSLContextService sc = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
                if (sc != null) {
                    SSLContext ssl = sc.createSSLContext(ClientAuth.NONE);
                    this.setProperty("sSLSocketFactory", ssl.getSocketFactory());
                }
            } // ignore 'else', since it's the only non-dynamic property that is relevant to CF configuration
        }
    }
}
 
開發者ID:lsac,項目名稱:nifi-jms-jndi,代碼行數:54,代碼來源:JNDIConnectionFactoryProvider.java

示例2: setConnectionFactoryProperties

import org.apache.nifi.components.PropertyDescriptor; //導入方法依賴的package包/類
/**
 * This operation follows standard bean convention by matching property name
 * to its corresponding 'setter' method. Once the method was located it is
 * invoked to set the corresponding property to a value provided by during
 * service configuration. For example, 'channel' property will correspond to
 * 'setChannel(..) method and 'queueManager' property will correspond to
 * setQueueManager(..) method with a single argument.
 *
 * There are also few adjustments to accommodate well known brokers. For
 * example ActiveMQ ConnectionFactory accepts address of the Message Broker
 * in a form of URL while IBMs in the form of host/port pair (more common).
 * So this method will use value retrieved from the 'BROKER_URI' static
 * property 'as is' if ConnectionFactory implementation is coming from
 * ActiveMQ and for all others (for now) the 'BROKER_URI' value will be
 * split on ':' and the resulting pair will be used to execute
 * setHostName(..) and setPort(..) methods on the provided
 * ConnectionFactory. This may need to be maintained and adjusted to
 * accommodate other implementation of ConnectionFactory, but only for
 * URL/Host/Port issue. All other properties are set as dynamic properties
 * where user essentially provides both property name and value, The bean
 * convention is also explained in user manual for this component with links
 * pointing to documentation of various ConnectionFactories.
 *
 * @see #setProperty(String, String) method
 */
private void setConnectionFactoryProperties(ConfigurationContext context) {
    for (final Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
        PropertyDescriptor descriptor = entry.getKey();
        String propertyName = descriptor.getName();
        if (descriptor.isDynamic()) {
            this.setProperty(propertyName, entry.getValue());
        } else {
            if (propertyName.equals(BROKER)) {
                String impl = context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue();
                boolean isSolace  = "com.solacesystems.jms.SolConnectionFactoryImpl".equals(impl);
                if (impl.startsWith("org.apache.activemq")) {
                    this.setProperty("brokerURL", entry.getValue());
                } else {
                    String val = entry.getValue();
                    if(val != null) {
                        String[] hostPort = val.split(":");
                        if (hostPort.length == 2) {
                            this.setProperty(isSolace? "Host" :"hostName", hostPort[0]);
                            this.setProperty("port", hostPort[1]);
                        } else if (hostPort.length != 2) {
                            this.setProperty(isSolace? "Host" : "serverUrl", val); // for tibco
                        } else {
                            throw new IllegalArgumentException("Failed to parse broker url: " + entry.getValue());
                        }
                    }
                }
                SSLContextService sc = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
                if (sc != null) {
                    SSLContext ssl = sc.createSSLContext(ClientAuth.NONE);
                    this.setProperty("sSLSocketFactory", ssl.getSocketFactory());
                }
            } // ignore 'else', since it's the only non-dynamic property that is relevant to CF configuration
        }
    }
}
 
開發者ID:lsac,項目名稱:nifi-jms-jndi,代碼行數:61,代碼來源:JMSConnectionFactoryProvider.java

示例3: setConnectionFactoryProperties

import org.apache.nifi.components.PropertyDescriptor; //導入方法依賴的package包/類
/**
 * This operation follows standard bean convention by matching property name
 * to its corresponding 'setter' method. Once the method was located it is
 * invoked to set the corresponding property to a value provided by during
 * service configuration. For example, 'channel' property will correspond to
 * 'setChannel(..) method and 'queueManager' property will correspond to
 * setQueueManager(..) method with a single argument.
 *
 * There are also few adjustments to accommodate well known brokers. For
 * example ActiveMQ ConnectionFactory accepts address of the Message Broker
 * in a form of URL while IBMs in the form of host/port pair (more common).
 * So this method will use value retrieved from the 'BROKER_URI' static
 * property 'as is' if ConnectionFactory implementation is coming from
 * ActiveMQ and for all others (for now) the 'BROKER_URI' value will be
 * split on ':' and the resulting pair will be used to execute
 * setHostName(..) and setPort(..) methods on the provided
 * ConnectionFactory. This may need to be maintained and adjusted to
 * accommodate other implementation of ConnectionFactory, but only for
 * URL/Host/Port issue. All other properties are set as dynamic properties
 * where user essentially provides both property name and value, The bean
 * convention is also explained in user manual for this component with links
 * pointing to documentation of various ConnectionFactories.
 *
 * @see #setProperty(String, String) method
 */
private void setConnectionFactoryProperties(ConfigurationContext context) {
    for (final Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) {
        PropertyDescriptor descriptor = entry.getKey();
        String propertyName = descriptor.getName();
        if (descriptor.isDynamic()) {
            this.setProperty(propertyName, entry.getValue());
        } else {
            if (propertyName.equals(BROKER)) {
                if (context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue().startsWith("org.apache.activemq")) {
                    this.setProperty("brokerURL", entry.getValue());
                } else {
                    String[] hostPort = entry.getValue().split(":");
                    if (hostPort.length == 2) {
                        this.setProperty("hostName", hostPort[0]);
                        this.setProperty("port", hostPort[1]);
                    } else if (hostPort.length != 2) {
                        this.setProperty("serverUrl", entry.getValue()); // for tibco
                    } else {
                        throw new IllegalArgumentException("Failed to parse broker url: " + entry.getValue());
                    }
                }
                SSLContextService sc = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
                if (sc != null) {
                    SSLContext ssl = sc.createSSLContext(ClientAuth.NONE);
                    this.setProperty("sSLSocketFactory", ssl.getSocketFactory());
                }
            } // ignore 'else', since it's the only non-dynamic property that is relevant to CF configuration
        }
    }
}
 
開發者ID:SolaceLabs,項目名稱:solace-integration-guides,代碼行數:56,代碼來源:JMSConnectionFactoryProvider.java


注:本文中的org.apache.nifi.components.PropertyDescriptor.isDynamic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。