本文整理了Java中org.wso2.siddhi.query.api.annotation.Annotation.getElement()
方法的一些代码示例,展示了Annotation.getElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.getElement()
方法的具体详情如下:
包路径:org.wso2.siddhi.query.api.annotation.Annotation
类名称:Annotation
方法名:getElement
暂无
代码示例来源:origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.core
/**
* Traverse the annotation and returns the execute group id
*
* @param annotations
* @return
*/
private static String getExecuteGroup(List<Annotation> annotations) {
String id = null;
if (annotations != null) {
for (Annotation annotation : annotations) {
if (annotation.getName().equals(EventProcessorConstants.DIST)) {
if (annotation.getElement(EventProcessorConstants.EXEC_GROUP) != null) {
id = annotation.getElement(EventProcessorConstants.EXEC_GROUP);
}
}
}
}
return id;
}
代码示例来源:origin: org.wso2.siddhi/siddhi-extension-event-table
String dataSourceName = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_DATASOURCE_NAME);
String tableName = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_TABLE_NAME);
DataSource dataSource = executionPlanContext.getSiddhiContext().getSiddhiDataSource(dataSourceName);
List<Attribute> attributeList = tableDefinition.getAttributeList();
String jdbcConnectionUrl = fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_JDBC_URL);
String username = fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_USERNAME);
String password = fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_PASSWORD);
String driverName = fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_DRIVER_NAME);
List<Element> connectionPropertyElements = null;
String cacheType = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE);
cacheSizeInString = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_SIZE);
String cacheLoadingType = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_LOADING);
String cacheValidityInterval = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_VALIDITY_PERIOD);
String bloomsEnabled = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS);
String bloomFilterValidityInterval = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_VALIDITY_PERIOD);
String bloomsFilterSize = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_SIZE);
String bloomsFilterHash = fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_HASH);
if (bloomsFilterSize != null) {
bloomFilterSize = Integer.parseInt(bloomsFilterSize);
代码示例来源:origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms
List<Element> indexElementList = (indices == null) ? new ArrayList<>() : indices.getElements();
List<String> queries = new ArrayList<>();
Map<String, String> fieldLengths = RDBMSTableUtils.processFieldLengths(storeAnnotation.getElement(
ANNOTATION_ELEMENT_FIELD_LENGTHS));
this.validateFieldLengths(fieldLengths);
代码示例来源:origin: org.wso2.carbon.event-processing/org.wso2.carbon.event.processor.core
/**
* Traverse the annotation and returns the parallelism hint
*
* @param annotations
* @return
*/
private static int getParallelism(List<Annotation> annotations, String elementKey) {
int parallelism = 1;
if (annotations != null) {
for (Annotation annotation : annotations) {
if (annotation.getName().equals(EventProcessorConstants.DIST)) {
if (annotation.getElement(elementKey) != null) {
parallelism = Integer.parseInt(annotation.getElement(elementKey));
if (parallelism == 0) {
parallelism = 1;
}
return parallelism;
}
}
}
}
return parallelism;
}
代码示例来源:origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms
RDBMSTableUtils.validateAnnotation(primaryKeys);
RDBMSTableUtils.validateAnnotation(indices);
jndiResourceName = storeAnnotation.getElement(ANNOTATION_ELEMENT_JNDI_RESOURCE);
dataSourceName = storeAnnotation.getElement(ANNOTATION_ELEMENT_DATASOURCE);
if (null != configReader) {
this.configReader = configReader;
this.configReader = new DefaultConfigReader();
String tableName = storeAnnotation.getElement(ANNOTATION_ELEMENT_TABLE_NAME);
this.tableName = RDBMSTableUtils.isEmpty(tableName) ? tableDefinition.getId() : tableName;
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core
/**
* Provide the parallelism count for pass-through query. In case of multiple user given values,
* lowest one will be selected. Default parallelism value would be 1.
*
* @param annotation Source annotation
* @return Parallelism count for pass-through query
*/
private int getSourceParallelism(Annotation annotation) {
Set<Integer> parallelismSet = new HashSet<>();
List<Annotation> distAnnotations = annotation.getAnnotations(
SiddhiTopologyCreatorConstants.DISTRIBUTED_IDENTIFIER);
if (distAnnotations.size() > 0) {
for (Annotation distAnnotation : distAnnotations) {
if (distAnnotation.getElement(SiddhiTopologyCreatorConstants.PARALLEL_IDENTIFIER) != null) {
parallelismSet.add(Integer.valueOf(distAnnotation.getElement(
SiddhiTopologyCreatorConstants.PARALLEL_IDENTIFIER)));
} else {
return SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL;
}
}
} else {
return SiddhiTopologyCreatorConstants.DEFAULT_PARALLEL;
}
return parallelismSet.stream().min(Comparator.comparing(Integer::intValue)).get();
}
}
代码示例来源:origin: org.wso2.siddhi/siddhi-extension-event-table
String clusterName = fromAnnotation.getElement(
HazelcastEventTableConstants.ANNOTATION_ELEMENT_HAZELCAST_CLUSTER_NAME);
String clusterPassword = fromAnnotation.getElement(
HazelcastEventTableConstants.ANNOTATION_ELEMENT_HAZELCAST_CLUSTER_PASSWORD);
String hosts = fromAnnotation.getElement(
HazelcastEventTableConstants.ANNOTATION_ELEMENT_HAZELCAST_CLUSTER_ADDRESSES);
String collectionName = fromAnnotation.getElement(
HazelcastEventTableConstants.ANNOTATION_ELEMENT_HAZELCAST_CLUSTER_COLLECTION);
Annotation annotation = AnnotationHelper.getAnnotation(
boolean serverMode = (hosts == null || hosts.isEmpty());
if (serverMode) {
hosts = fromAnnotation.getElement(
HazelcastEventTableConstants.ANNOTATION_ELEMENT_HAZELCAST_WELL_KNOWN_ADDRESSES);
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.siddhi.editor.core
/**
* Extracts the query name from the annotation list, or returns the default query name
* @param annotations Query annotation list
* @return query name name of the query
*/
private String generateQueryName(List<Annotation> annotations) {
for (Annotation annotation : annotations) {
if (annotation.getName().equalsIgnoreCase("info")) {
preserveCodeSegment(annotation);
return annotation.getElement("name");
}
}
return DEFAULT_QUERY_NAME;
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.sp.jobmanager.core
/**
* @param aggregationId Id of the aggregation which Store value to be checked.
* @return True if the given aggregation uses in-memory store.
*/
private boolean isInMemoryStore(String aggregationId) {
String storeType = SiddhiTopologyCreatorConstants.INMEMORY;
for (Annotation annotation : siddhiApp.getAggregationDefinitionMap().get(aggregationId).getAnnotations()) {
if (annotation.getName().equals(SiddhiTopologyCreatorConstants.PERSISTENCETABLE_IDENTIFIER)) {
storeType = annotation.getElement(SiddhiTopologyCreatorConstants.TYPE_IDENTIFIER);
break;
}
}
return storeType.equalsIgnoreCase(SiddhiTopologyCreatorConstants.INMEMORY);
}
代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.analytics.eventtable
tableDefinition.getAnnotations());
this.tableDefinition = tableDefinition;
this.tableName = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_TABLE_NAME);
if (this.tableName == null) {
throw new IllegalArgumentException("The property " + AnalyticsEventTableConstants.ANNOTATION_TABLE_NAME +
" must be provided for analytics event tables.");
this.primaryKeys = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_PRIMARY_KEYS);
this.indices = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_INDICES);
String mergeSchemaProp = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_MERGE_SCHEMA);
if (mergeSchemaProp != null) {
mergeSchemaProp = mergeSchemaProp.trim();
String waitForIndexingProp = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_WAIT_FOR_INDEXING);
if (waitForIndexingProp != null) {
waitForIndexingProp = waitForIndexingProp.trim();
String maxSearchResultCountProp = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_MAX_SEARCH_RESULT_COUNT);
if (maxSearchResultCountProp != null) {
maxSearchResultCountProp = maxSearchResultCountProp.trim();
String cachingProp = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_CACHING);
if (cachingProp != null) {
this.caching = Boolean.parseBoolean(cachingProp.trim());
String cacheTimeoutSecsProp = fromAnnotation.getElement(AnalyticsEventTableConstants.ANNOTATION_CACHE_TIMEOUT_SECONDS);
if (cacheTimeoutSecsProp != null) {
this.cacheTimeoutSeconds = Integer.parseInt(cacheTimeoutSecsProp.trim());
代码示例来源:origin: org.wso2.extension.siddhi.store.rdbms/siddhi-store-rdbms
String poolPropertyString = storeAnnotation.getElement(ANNOTATION_ELEMENT_POOL_PROPERTIES);
String url = storeAnnotation.getElement(ANNOTATION_ELEMENT_URL);
String username = storeAnnotation.getElement(ANNOTATION_ELEMENT_USERNAME);
String password = storeAnnotation.getElement(ANNOTATION_ELEMENT_PASSWORD);
String driverClassName = storeAnnotation.getElement(ANNOTATION_DRIVER_CLASS_NAME);
if (RDBMSTableUtils.isEmpty(url)) {
throw new RDBMSTableException("Required parameter '" + ANNOTATION_ELEMENT_URL + "' for DB " +
代码示例来源:origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb
@Override
protected void init(TableDefinition tableDefinition, ConfigReader configReader) {
this.attributeNames =
tableDefinition.getAttributeList().stream().map(Attribute::getName).collect(Collectors.toList());
Annotation storeAnnotation = AnnotationHelper
.getAnnotation(ANNOTATION_STORE, tableDefinition.getAnnotations());
Annotation primaryKeys = AnnotationHelper
.getAnnotation(ANNOTATION_PRIMARY_KEY, tableDefinition.getAnnotations());
Annotation indices = AnnotationHelper
.getAnnotation(ANNOTATION_INDEX_BY, tableDefinition.getAnnotations());
this.initializeConnectionParameters(storeAnnotation, configReader);
this.expectedIndexModels = new ArrayList<>();
IndexModel primaryKey = MongoTableUtils.extractPrimaryKey(primaryKeys, this.attributeNames);
if (primaryKey != null) {
this.expectedIndexModels.add(primaryKey);
}
this.expectedIndexModels.addAll(MongoTableUtils.extractIndexModels(indices, this.attributeNames));
String customCollectionName = storeAnnotation.getElement(
MongoTableConstants.ANNOTATION_ELEMENT_COLLECTION_NAME);
this.collectionName = MongoTableUtils.isEmpty(customCollectionName) ?
tableDefinition.getId() : customCollectionName;
this.initialCollectionTest = false;
}
代码示例来源:origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb
String secureConnectionEnabled = storeAnnotation.getElement(
MongoTableConstants.ANNOTATION_ELEMENT_SECURE_CONNECTION);
secureConnectionEnabled = secureConnectionEnabled == null ? "false" : secureConnectionEnabled;
String trustStore = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_TRUSTSTORE);
trustStore = trustStore == null ?
configReader.readConfig("trustStore", DEFAULT_TRUST_STORE_FILE) : trustStore;
storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_TRUSTSTOREPASS);
trustStorePassword = trustStorePassword == null ?
configReader.readConfig("trustStorePassword", DEFAULT_TRUST_STORE_PASSWORD) :
trustStorePassword;
String keyStore = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_KEYSTORE);
keyStore = keyStore == null ?
configReader.readConfig("keyStore", DEFAULT_KEY_STORE_FILE) : keyStore;
keyStore = resolveCarbonHome(keyStore);
String keyStorePassword = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_STOREPASS);
keyStorePassword = keyStorePassword == null ?
configReader.readConfig("keyStorePassword", DEFAULT_KEY_STORE_PASSWORD) :
代码示例来源:origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb
/**
* Method for initializing mongoClientURI and database name.
*
* @param storeAnnotation the source annotation which contains the needed parameters.
* @param configReader {@link ConfigReader} ConfigurationReader.
* @throws MongoTableException when store annotation does not contain mongodb.uri or contains an illegal
* argument for mongodb.uri
*/
private void initializeConnectionParameters(Annotation storeAnnotation, ConfigReader configReader) {
String mongoClientURI = storeAnnotation.getElement(MongoTableConstants.ANNOTATION_ELEMENT_URI);
if (mongoClientURI != null) {
MongoClientOptions.Builder mongoClientOptionsBuilder =
MongoTableUtils.extractMongoClientOptionsBuilder(storeAnnotation, configReader);
try {
this.mongoClientURI = new MongoClientURI(mongoClientURI, mongoClientOptionsBuilder);
this.databaseName = this.mongoClientURI.getDatabase();
} catch (IllegalArgumentException e) {
throw new SiddhiAppCreationException("Annotation '" + storeAnnotation.getName() + "' contains " +
"illegal value for 'mongodb.uri' as '" + mongoClientURI + "'. Please check your query and " +
"try again.", e);
}
} else {
throw new SiddhiAppCreationException("Annotation '" + storeAnnotation.getName() +
"' must contain the element 'mongodb.uri'. Please check your query and try again.");
}
}
内容来源于网络,如有侵权,请联系作者删除!