index
int64
0
0
repo_id
stringlengths
9
205
file_path
stringlengths
31
246
content
stringlengths
1
12.2M
__index_level_0__
int64
0
10k
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/CacheProperties.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.properties; import lombok.Data; /** * Properties related to cache configuration. * * @author amajumdar * @since 1.2.0 */ @Data public class CacheProperties { private static final int DEFAULT_CACHE_MUTATION_TIMEOUT_MILLIS = 20; private boolean enabled; private boolean throwOnEvictionFailure; private int evictionTimeoutMs = DEFAULT_CACHE_MUTATION_TIMEOUT_MILLIS; private String name; }
1,900
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/AliasServiceProperties.java
/* * Copyright 2019 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import lombok.Data; /** * Alias Service Properties. * * @author rveeramacheneni * @since 1.3.0 */ @Data public class AliasServiceProperties { private boolean enabled; }
1,901
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/UserMetadata.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import lombok.Data; import lombok.NonNull; /** * Usermetadata service related properties. * * @author amajumdar * @since 1.1.0 */ @Data public class UserMetadata { @NonNull private Config config = new Config(); private int queryTimeoutInSeconds = 60; /** * config related properties. * * @author amajumdar * @since 1.1.0 */ @Data public static class Config { private String location = "usermetadata.properties"; } }
1,902
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/AuthorizationServiceProperties.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import com.google.common.annotations.VisibleForTesting; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.exception.MetacatException; import lombok.Data; import lombok.NonNull; import org.apache.commons.lang3.StringUtils; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * Properties related to authorization. * * @author zhenl * @since 1.2.0 */ @Data public class AuthorizationServiceProperties { private boolean enabled; @NonNull private CreateAcl createAcl = new CreateAcl(); @NonNull private DeleteAcl deleteAcl = new DeleteAcl(); /** * Create Acl properties. * * @author zhenl * @since 1.2.0 */ @Data public static class CreateAcl { private String createAclStr; private Map<QualifiedName, Set<String>> createAclMap; /** * Get the create acl map. * * @return The create acl map */ public Map<QualifiedName, Set<String>> getCreateAclMap() { if (createAclMap == null) { createAclMap = createAclStr == null ? new HashMap<>() : getAclMap(createAclStr); } return createAclMap; } } /** * Delete Acl properties. * * @author zhenl * @since 1.2.0 */ @Data public static class DeleteAcl { private String deleteAclStr; private Map<QualifiedName, Set<String>> deleteAclMap; /** * Get the delete acl map. * * @return The delete acl map */ public Map<QualifiedName, Set<String>> getDeleteAclMap() { if (deleteAclMap == null) { deleteAclMap = deleteAclStr == null ? new HashMap<>() : getAclMap(deleteAclStr); } return deleteAclMap; } } /** * Parse the configuration to get operation control. The control is at userName level * and the controlled operations include create, delete, and rename for table. * The format is below. * db1:user1,user2|db2:user1,user2 * * @param aclConfig the config strings for dbs * @return acl config */ @VisibleForTesting private static Map<QualifiedName, Set<String>> getAclMap(final String aclConfig) { final Map<QualifiedName, Set<String>> aclMap = new HashMap<>(); try { for (String aclstr : StringUtils.split(aclConfig, "|")) { for (QualifiedName key : PropertyUtils.delimitedStringsToQualifiedNamesList( aclstr.substring(0, aclstr.indexOf(":")), ',')) { aclMap.put(key, new HashSet<>(Arrays.asList( StringUtils.split(aclstr.substring(aclstr.indexOf(":") + 1), ",")))); } } } catch (Exception e) { throw new MetacatException("metacat acl property parsing error" + e.getMessage()); } return aclMap; } }
1,903
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/Config.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.properties; import com.netflix.metacat.common.QualifiedName; import java.util.List; import java.util.Map; import java.util.Set; /** * Property configurations. */ public interface Config { /** * Default type converter. * * @return Default type converter */ String getDefaultTypeConverter(); /** * Enable elastic search. * * @return true if elastic search is enabled */ boolean isElasticSearchEnabled(); /** * If true, a table update should trigger updating data metadata of all table documents containing the same uri. * * @return true, if data metadata of all table documents needs to be updated if their uri is the same * as the updated table. */ boolean isElasticSearchUpdateTablesWithSameUriEnabled(); /** * Enable publishing partitions to elastic search. * * @return true if publishing partitions to elastic search is enabled */ boolean isElasticSearchPublishPartitionEnabled(); /** * Enable publishing metacat es error logs to elastic search. * * @return true if publishing metacat es error logs to elastic search is enabled */ boolean isElasticSearchPublishMetacatLogEnabled(); /** * Elastic search cluster name. * * @return cluster name */ String getElasticSearchClusterName(); /** * Comm aseparated list of elastic search cluster nodes. * * @return String */ String getElasticSearchClusterNodes(); /** * Elastic search cluster port. * * @return cluster port */ int getElasticSearchClusterPort(); /** * Elastic search fetch size. * * @return elastic search fetch size */ int getElasticSearchScrollFetchSize(); /** * Elastic search scroll timeout. * * @return elastic search scroll timeout */ int getElasticSearchScrollTimeout(); /** * Elastic search call timeout. * * @return elastic search call timeout */ long getElasticSearchCallTimeout(); /** * Elastic search bulk call timeout. * * @return elastic search bulk call timeout */ long getElasticSearchBulkCallTimeout(); /** * Names to exclude when refreshing elastic search. * * @return Names to exclude when refreshing elastic search */ List<QualifiedName> getElasticSearchRefreshExcludeQualifiedNames(); /** * Catalogs to include when refreshing elastic search. * * @return Catalogs to include when refreshing elastic search */ String getElasticSearchRefreshIncludeCatalogs(); /** * Databases to include when refreshing elastic search. * * @return Databases to include when refreshing elastic search */ List<QualifiedName> getElasticSearchRefreshIncludeDatabases(); /** * Catalogs to include when refreshing elastic search partitions. * * @return Catalogs to include when refreshing elastic search partitions */ String getElasticSearchRefreshPartitionsIncludeCatalogs(); /** * Threshold no. of databases to delete. * * @return Threshold no. of databases to delete */ int getElasticSearchThresholdUnmarkedDatabasesDelete(); /** * Threshold no. of tables to delete. * * @return Threshold no. of tables to delete */ int getElasticSearchThresholdUnmarkedTablesDelete(); /** * Thread count. * * @return thread count */ int getEventBusExecutorThreadCount(); /** * Event bus thread count. * * @return thread count */ int getEventBusThreadCount(); /** * Hive partition white list pattern. * * @return pattern */ String getHivePartitionWhitelistPattern(); /** * If true, will escape partition names when filtering partitions. * * @return Whether to escape partition names when filtering partitions */ boolean escapePartitionNameOnFilter(); /** * Number of records to fetch in one call from Hive Metastore. * * @return fetch size */ int getHiveMetastoreFetchSize(); /** * Number of records to save in one call to Hive Metastore. * * @return batch size */ int getHiveMetastoreBatchSize(); /** * Lookup service admin user name. * * @return user name */ String getLookupServiceUserAdmin(); /** * Metacat version. * * @return metacat version */ String getMetacatVersion(); /** * Config location. * * @return config location */ String getPluginConfigLocation(); /** * Tag service admin username. * * @return username */ String getTagServiceUserAdmin(); /** * Thrift server max worker threads. * * @return Thrift server max worker threads */ int getThriftServerMaxWorkerThreads(); /** * Thrift server client timeout. * * @return Thrift server client timeout */ int getThriftServerSocketClientTimeoutInSeconds(); /** * Epoch. * * @return epoch */ boolean isEpochInSeconds(); /** * Do we use pig types. * * @return Do we use pig types */ boolean isUsePigTypes(); /** * Max. number of threads for service. * * @return Max. number of threads for service */ int getServiceMaxNumberOfThreads(); /** * List of names for which the partition listing show throw error when no filter is specified. * * @return list of names */ List<QualifiedName> getNamesToThrowErrorOnListPartitionsWithNoFilter(); /** * Threshold for list of partitions returned. * * @return Threshold for list of partitions returned */ int getMaxPartitionsThreshold(); /** * Threshold for list of partitions to be added. * * @return Threshold for list of partitions to be added */ int getMaxAddedPartitionsThreshold(); /** * Threshold for list of partitions to be deleted. * * @return Threshold for list of partitions to be deleted */ int getMaxDeletedPartitionsThreshold(); /** * Elastic search index. * * @return elastic search index name */ String getEsIndex(); /** * Elastic search index. * * @return elastic search merge index name that's the new index to migrate to */ String getMergeEsIndex(); /** * Lifetime. * * @return lifetime */ int getDataMetadataDeleteMarkerLifetimeInDays(); /** * soft delete data metadata. * * @return true if we can delete data metadata */ boolean canSoftDeleteDataMetadata(); /** * cascade view and metadata delete on table delete. * * @return true if cascade */ boolean canCascadeViewsMetadataOnTableDelete(); /** * Max. number of in clause items in user metadata service queries. * * @return Max. number of in clause items in user metadata service queries */ int getUserMetadataMaxInClauseItems(); /** * Whether or not notifications should be published to SNS. If this is enabled the table topic ARN and * partition topic arn must also exist or SNS won't be enabled. * * @return Whether SNS notifications should be enabled */ boolean isSnsNotificationEnabled(); /** * Get the AWS ARN for the SNS topic to publish to for table related notifications. * * @return The table topic ARN or null if no property set */ String getSnsTopicTableArn(); /** * Get the AWS ARN for the SNS topic to publish to for partition related notifications. * * @return The partition topic ARN or null if no property set */ String getSnsTopicPartitionArn(); /** * Get the fallback AWS ARN for the SNS topic to publish to for table related notifications. * * @return The table topic ARN or null if no property set */ String getFallbackSnsTopicTableArn(); /** * Get the fallback AWS ARN for the SNS topic to publish to for partition related notifications. * * @return The partition topic ARN or null if no property set */ String getFallbackSnsTopicPartitionArn(); /** * Whether or not notifications should be published to SNS Partition topic. If this is enabled, the * partition topic arn must also exist or SNS won't be enabled. * * @return Whether SNS notifications to partitions topic should be enabled */ boolean isSnsNotificationTopicPartitionEnabled(); /** * Enable attaching the partition ids in the payload. * * @return whether the partition ids in the payload. */ boolean isSnsNotificationAttachPartitionIdsEnabled(); /** * The number of max partition ids in the payload. * * @return The number of max partition ids in the payload. */ int getSnsNotificationAttachPartitionIdMax(); /** * Whether or not to delete definition metadata for tables. * * @return Whether or not to delete definition metadata for tables. */ boolean canDeleteTableDefinitionMetadata(); /** * List of names for which the table definition metadata will be deleted. * * @return list of names */ Set<QualifiedName> getNamesEnabledForDefinitionMetadataDelete(); /** * Enable cache. * * @return true if cache is enabled */ boolean isCacheEnabled(); /** * Enable authorization. * * @return true if authorization is enabled */ boolean isAuthorizationEnabled(); /** * Get the metacat create acl property. * * @return The metacat create acl property */ Map<QualifiedName, Set<String>> getMetacatCreateAcl(); /** * Get the metacat delete acl property. * * @return The metacat delete acl property */ Map<QualifiedName, Set<String>> getMetacatDeleteAcl(); /** * get Iceberg Table Summary Fetch Size. * * @return Iceberg Table Summary Fetch Size */ int getIcebergTableSummaryFetchSize(); /** * Enable iceberg table processing. * * @return true if iceberg table processing is enabled */ boolean isIcebergEnabled(); /** * Enable iceberg table cache. * * @return true if iceberg table cache is enabled */ boolean isIcebergCacheEnabled(); /** * Enable iceberg table TableMetadata cache. * * @return true if iceberg table cache is enabled */ boolean isIcebergTableMetadataCacheEnabled(); /** * Enable common view processing. * * @return true if common view processing is enabled */ boolean isCommonViewEnabled(); /** * Whether the underlying storage table should be deleted * for a materialized common view. * * @return true if the storage table should be deleted when the common view is. */ boolean deleteCommonViewStorageTable(); /** * get Iceberg table refresh metadata location retry number. * * @return Refresh metadata location retry number. */ int getIcebergRefreshFromMetadataLocationRetryNumber(); /** * get Iceberg table max metadata file size allowed in metacat. * * @return Refresh Iceberg table max metadata file size. */ long getIcebergMaxMetadataFileSize(); /** * get Iceberg partition uri scheme. * * @return Iceberg table partition uri scheme. */ String getIcebergPartitionUriScheme(); /** * Whether the table alias is enabled. * * @return True if it is. */ boolean isTableAliasEnabled(); /** * Set of tags that disable table delete. * * @return set of tags */ Set<String> getNoTableDeleteOnTags(); /** * Set of tags that disable table rename. * * @return set of tags */ Set<String> getNoTableRenameOnTags(); /** * Set of tags that disable table update. * * @return set of tags */ Set<String> getNoTableUpdateOnTags(); /** * Whether the rate limiter is enabled. * * @return True if it is. */ boolean isRateLimiterEnabled(); /** * Whether the rate limiter is enforced * and rejecting requests. * * @return True if it is. */ boolean isRateLimiterEnforced(); /** * Whether the update iceberg table post event handler * is enabled. * * @return True if it is. */ boolean isUpdateIcebergTableAsyncPostEventEnabled(); /** * Whether to list table names by default on getDatabase request call. * * @return True if it is. */ boolean listTableNamesByDefaultOnGetDatabase(); /** * Whether to list database names by default on getCatalog request call. * * @return True if it is. */ boolean listDatabaseNameByDefaultOnGetCatalog(); /** * Metadata query timeout in seconds. * * @return Metadata query timeout in seconds */ int getMetadataQueryTimeout(); /** * Whether to check the existence of the iceberg metadata location before updating the table. * * @return Whether to check the existence of the iceberg metadata location before updating the table */ boolean isIcebergPreviousMetadataLocationCheckEnabled(); /** * Whether partition definition metadata should be disabled. * * @return True if it should be blocked. */ boolean disablePartitionDefinitionMetadata(); /** * Whether the request flag to only fetch the iceberg metadata location should be respected. * * @return True if it should be. */ boolean shouldFetchOnlyMetadataLocationEnabled(); }
1,904
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/PropertyUtils.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import com.google.common.base.Splitter; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.netflix.metacat.common.QualifiedName; import lombok.NonNull; import org.apache.commons.lang3.StringUtils; import javax.annotation.Nonnull; import java.util.List; import java.util.Set; import java.util.stream.Collectors; /** * Utility methods for working with properties. * * @author tgianos * @since 1.1.0 */ public final class PropertyUtils { /** * Protected constructor for utility class. */ protected PropertyUtils() { } /** * Convert a delimited string into a List of {@code QualifiedName}. * * @param names The list of names to split * @param delimiter The delimiter to use for splitting * @return The list of qualified names */ static List<QualifiedName> delimitedStringsToQualifiedNamesList( @Nonnull @NonNull final String names, final char delimiter ) { if (StringUtils.isNotBlank(names)) { return Splitter.on(delimiter) .omitEmptyStrings() .splitToList(names).stream() .map(QualifiedName::fromString) .collect(Collectors.toList()); } else { return Lists.newArrayList(); } } /** * Convert a delimited string into a Set of {@code QualifiedName}. * * @param names The list of names to split * @param delimiter The delimiter to use for splitting * @return The list of qualified names */ static Set<QualifiedName> delimitedStringsToQualifiedNamesSet( @Nonnull @NonNull final String names, final char delimiter ) { if (StringUtils.isNotBlank(names)) { return Splitter.on(delimiter) .omitEmptyStrings() .splitToList(names).stream() .map(QualifiedName::fromString) .collect(Collectors.toSet()); } else { return Sets.newHashSet(); } } }
1,905
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/LookupServiceProperties.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import lombok.Data; import lombok.NonNull; /** * Lookup service related properties. * * @author tgianos * @since 1.1.0 */ @Data public class LookupServiceProperties { @NonNull private String userAdmin = "admin"; }
1,906
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/ServiceProperties.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import com.google.common.collect.Lists; import com.netflix.metacat.common.QualifiedName; import lombok.Data; import lombok.NonNull; /** * Service related properties. * * @author tgianos * @since 1.1.0 */ @Data public class ServiceProperties { @NonNull private Max max = new Max(); @NonNull private Tables tables = new Tables(); private boolean listTableNamesByDefaultOnGetDatabase = true; private boolean listDatabaseNameByDefaultOnGetCatalog = true; /** * Max related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class Max { @NonNull private Number number = new Number(); /** * Max number related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class Number { private int threads = 50; } } /** * Service tables related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class Tables { @NonNull private Error error = new Error(); /** * Service tables error related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class Error { @NonNull private List list = new List(); /** * Service tables error list related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class List { @NonNull private Partitions partitions = new Partitions(); /** * Service tables error list partitions related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class Partitions { private int threshold = Integer.MAX_VALUE; private int addThreshold = Integer.MAX_VALUE; private int deleteThreshold = Integer.MAX_VALUE; @NonNull private No no = new No(); /** * Service tables error list partitions no related properties. * * @author tgianos * @since 1.1.0 */ @Data public static class No { private String filter; private java.util.List<QualifiedName> filterList; /** * Get the filter list as a list of qualified names. * * @return The filtered list */ public java.util.List<QualifiedName> getFilterAsListOfQualifiedNames() { if (filterList == null) { filterList = filter == null ? Lists.newArrayList() : PropertyUtils.delimitedStringsToQualifiedNamesList(filter, ','); } return filterList; } } } } } } }
1,907
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/TagServiceProperties.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.properties; import lombok.Data; import lombok.NonNull; /** * Tag service related properties. * * @author tgianos * @since 1.1.0 */ @Data public class TagServiceProperties { @NonNull private String userAdmin = "admin"; }
1,908
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/properties/package-info.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Classes related to binding properties to POJO's for simplicity and type safety. * * @author tgianos * @since 1.1.0 */ package com.netflix.metacat.common.server.properties;
1,909
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/model/Lookup.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.model; import lombok.Data; import java.util.Date; import java.util.Set; /** * Lookup. */ @Data public class Lookup { private Long id; private String name; private String type = "string"; private Set<String> values; private Date dateCreated; private Date lastUpdated; private String createdBy = "admin"; private String lastUpdatedBy = "admin"; }
1,910
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/model/TagItem.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.model; import lombok.Data; import java.util.Date; import java.util.Set; /** * Tag item details. */ @Data public class TagItem { private Long id; private String name; private Set<String> values; private Date dateCreated; private Date lastUpdated; private String createdBy = "admin"; private String lastUpdatedBy = "admin"; }
1,911
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/model/package-info.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Common model classes used in User metadata service. * * @author amajumdar */ @ParametersAreNonnullByDefault package com.netflix.metacat.common.server.model; import javax.annotation.ParametersAreNonnullByDefault;
1,912
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/package-info.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Interfaces the API controllers extend. * * TODO: Remove all these. * * @author tgianos * @since 1.1.0 */ @ParametersAreNonnullByDefault package com.netflix.metacat.common.server.api; import javax.annotation.ParametersAreNonnullByDefault;
1,913
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/v1/PartitionV1.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.api.v1; import com.netflix.metacat.common.dto.GetPartitionsRequestDto; import com.netflix.metacat.common.dto.PartitionDto; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import com.netflix.metacat.common.dto.PartitionsSaveResponseDto; import com.netflix.metacat.common.dto.SortOrder; import javax.annotation.Nullable; import java.util.List; /** * Interfaces needed by Thrift. * <p> * TODO: Get rid of this once Thrift moves to using services. * * @author tgianos * @since 1.1.0 */ public interface PartitionV1 { /** * Add/update partitions to the given table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param partitionsSaveRequestDto partition request containing the list of partitions to be added/updated * @return Response with the number of partitions added/updated */ PartitionsSaveResponseDto savePartitions( final String catalogName, final String databaseName, final String tableName, final PartitionsSaveRequestDto partitionsSaveRequestDto ); /** * Delete named partitions from a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param partitionIds lis of partition names */ void deletePartitions( final String catalogName, final String databaseName, final String tableName, final List<String> partitionIds ); /** * Return list of partitions for a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param sortBy sort by this name * @param sortOrder sort order to use * @param offset offset of the list * @param limit size of the list * @param includeUserMetadata whether to include user metadata for every partition in the list * @param getPartitionsRequestDto request * @return list of partitions for a table */ List<PartitionDto> getPartitionsForRequest( final String catalogName, final String databaseName, final String tableName, @Nullable final String sortBy, @Nullable final SortOrder sortOrder, @Nullable final Integer offset, @Nullable final Integer limit, final boolean includeUserMetadata, @Nullable final GetPartitionsRequestDto getPartitionsRequestDto ); /** * Return list of partition names for a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param filter filter expression * @param sortBy sort by this name * @param sortOrder sort order to use * @param offset offset of the list * @param limit size of the list * @return list of partition names for a table */ List<String> getPartitionKeys( final String catalogName, final String databaseName, final String tableName, @Nullable final String filter, @Nullable final String sortBy, @Nullable final SortOrder sortOrder, @Nullable final Integer offset, @Nullable final Integer limit ); /** * Return list of partitions for a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param filter filter expression * @param sortBy sort by this name * @param sortOrder sort order to use * @param offset offset of the list * @param limit size of the list * @param includeUserMetadata whether to include user metadata for every partition in the list * @return list of partitions for a table */ List<PartitionDto> getPartitions( final String catalogName, final String databaseName, final String tableName, @Nullable final String filter, @Nullable final String sortBy, @Nullable final SortOrder sortOrder, @Nullable final Integer offset, @Nullable final Integer limit, final boolean includeUserMetadata ); }
1,914
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/v1/MetacatV1.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.api.v1; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.CatalogDto; import com.netflix.metacat.common.dto.DatabaseCreateRequestDto; import com.netflix.metacat.common.dto.DatabaseDto; import com.netflix.metacat.common.dto.TableDto; import javax.annotation.Nullable; import java.util.List; /** * Interface for methods needed by Thrift. * <p> * TODO: Get rid of this after thrift classes move to depending on services as they should * * @author tgianos * @since 1.1.0 */ public interface MetacatV1 { /** * Get the table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name. * @param includeInfo true if the details need to be included * @param includeDefinitionMetadata true if the definition metadata to be included * @param includeDataMetadata true if the data metadata to be included * @return table */ default TableDto getTable( final String catalogName, final String databaseName, final String tableName, final boolean includeInfo, final boolean includeDefinitionMetadata, final boolean includeDataMetadata ) { return getTable(catalogName, databaseName, tableName, includeInfo, includeDefinitionMetadata, includeDataMetadata, false); } /** * Get the table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name. * @param includeInfo true if the details need to be included * @param includeDefinitionMetadata true if the definition metadata to be included * @param includeDataMetadata true if the data metadata to be included * @param includeInfoDetails true if the more info details to be included * @return table */ default TableDto getTable( final String catalogName, final String databaseName, final String tableName, final boolean includeInfo, final boolean includeDefinitionMetadata, final boolean includeDataMetadata, final boolean includeInfoDetails ) { return getTable(catalogName, databaseName, tableName, includeInfo, includeDefinitionMetadata, includeDataMetadata, includeInfoDetails, false); } /** * Get the table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name. * @param includeInfo true if the details need to be included * @param includeDefinitionMetadata true if the definition metadata to be included * @param includeDataMetadata true if the data metadata to be included * @param includeInfoDetails true if the more info details to be included * @param includeMetadataLocationOnly true if only metadata location needs to be included. * All other flags are ignored * @return table */ TableDto getTable( final String catalogName, final String databaseName, final String tableName, final boolean includeInfo, final boolean includeDefinitionMetadata, final boolean includeDataMetadata, final boolean includeInfoDetails, final boolean includeMetadataLocationOnly ); /** * Returns true, if table exists. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name. */ void tableExists( final String catalogName, final String databaseName, final String tableName ); /** * Returns a filtered list of table names. * @param catalogName catalog name * @param filter filter expression * @param limit list size * @return list of table names */ List<QualifiedName> getTableNames( final String catalogName, final String filter, final Integer limit ); /** * Returns a filtered list of table names. * @param catalogName catalog name * @param databaseName database name * @param filter filter expression * @param limit list size * @return list of table names */ List<QualifiedName> getTableNames( final String catalogName, final String databaseName, final String filter, final Integer limit ); /** * Rename table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param newTableName new table name */ void renameTable( final String catalogName, final String databaseName, final String tableName, final String newTableName ); /** * Update table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param table table * @return table */ TableDto updateTable( final String catalogName, final String databaseName, final String tableName, final TableDto table ); /** * Creates the given database in the given catalog. * * @param catalogName catalog name * @param databaseName database name * @param databaseCreateRequestDto database create request */ void createDatabase( final String catalogName, final String databaseName, @Nullable final DatabaseCreateRequestDto databaseCreateRequestDto ); /** * Updates the given database in the given catalog. * * @param catalogName catalog name * @param databaseName database name * @param databaseUpdateRequestDto database update request */ void updateDatabase( final String catalogName, final String databaseName, final DatabaseCreateRequestDto databaseUpdateRequestDto ); /** * Creates a table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @param table TableDto with table details * @return created <code>TableDto</code> table */ TableDto createTable( final String catalogName, final String databaseName, final String tableName, final TableDto table ); /** * Delete table. * * @param catalogName catalog name * @param databaseName database name * @param tableName table name * @return deleted <code>TableDto</code> table. */ TableDto deleteTable(final String catalogName, final String databaseName, final String tableName); /** * Delete database. * * @param catalogName catalog name * @param databaseName database name */ void deleteDatabase(final String catalogName, final String databaseName); /** * Get the database with the list of table names under it. * * @param catalogName catalog name * @param databaseName database name * @param includeUserMetadata true if details should include user metadata * @param includeTableNames if true, then table names are listed * @return database with details */ DatabaseDto getDatabase(final String catalogName, final String databaseName, final boolean includeUserMetadata, final Boolean includeTableNames); /** * Get the catalog by name. * * @param catalogName catalog name * @return catalog */ CatalogDto getCatalog(final String catalogName); /** * Get the catalog by name. * * @param catalogName catalog name * @param includeDatabaseNames if true, the response includes the database names * @param includeUserMetadata if true, the response includes the user metadata * @return catalog */ CatalogDto getCatalog(final String catalogName, final Boolean includeDatabaseNames, final boolean includeUserMetadata); }
1,915
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/v1/package-info.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * V1 API interfaces. * * @author tgianos * @since 1.1.0 */ @ParametersAreNonnullByDefault package com.netflix.metacat.common.server.api.v1; import javax.annotation.ParametersAreNonnullByDefault;
1,916
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/ratelimiter/DefaultRateLimiter.java
/* * * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.api.ratelimiter; /** * Default RateLimiter service implementation. */ public class DefaultRateLimiter implements RateLimiter { }
1,917
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/ratelimiter/RateLimiterRequestContext.java
/* * * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.api.ratelimiter; import com.netflix.metacat.common.QualifiedName; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; /** * Context pertaining to a rate-limited API request. * * @author rveeramacheneni */ @AllArgsConstructor @Builder @Getter @EqualsAndHashCode public class RateLimiterRequestContext { /** * The API request. eg. getTable, updateTable etc. */ private String requestName; /** * The QualifiedName of the resource. */ private QualifiedName name; }
1,918
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/ratelimiter/RateLimiter.java
/* * * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.api.ratelimiter; import lombok.NonNull; /** * Request rate-limiter service API. * * @author rveeramacheneni */ public interface RateLimiter { /** * Whether a given request has exceeded * the pre-configured API request rate-limit. * * @param context The rate-limiter request context. * @return True if it has exceeded the API request rate-limit. */ default boolean hasExceededRequestLimit(@NonNull RateLimiterRequestContext context) { return false; } }
1,919
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/ratelimiter/package-info.java
/* * * Copyright 2020 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Rate limiter service interfaces. */ package com.netflix.metacat.common.server.api.ratelimiter;
1,920
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/traffic_control/RequestGateway.java
package com.netflix.metacat.common.server.api.traffic_control; import com.netflix.metacat.common.QualifiedName; import lombok.NonNull; /** * An interface to gate incoming requests against unauthorized operations, * blocked resources/apis etc. */ public interface RequestGateway { /** * Validate whether the request is alloed or not for the given resource. Implementations * are expected to throw the relevant exception with the right context and detail. * * @param requestName the name of the request (ex: getTable). * @param resource the primary resource of the request; like a table. */ void validateRequest(@NonNull String requestName, @NonNull QualifiedName resource); }
1,921
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/traffic_control/package-info.java
/** * Package for traffic control related classes like rate limiting * and request validation against blocked lists. */ package com.netflix.metacat.common.server.api.traffic_control;
1,922
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/api/traffic_control/DefaultRequestGateway.java
package com.netflix.metacat.common.server.api.traffic_control; import com.netflix.metacat.common.QualifiedName; import lombok.NonNull; /** * A default no-op gateway. */ public class DefaultRequestGateway implements RequestGateway { @Override public void validateRequest(@NonNull final String requestName, @NonNull final QualifiedName resource) { // no-op } }
1,923
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/package-info.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Package conatins the expression builder logic for partition filter expressions. * * @author amajumdar */ package com.netflix.metacat.common.server.partition;
1,924
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/util/PartitionUtil.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.util; import com.google.common.base.Splitter; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import java.util.List; import java.util.Map; /** * Partition utility. */ @Slf4j public final class PartitionUtil { /** Default partition value. */ public static final String DEFAULT_PARTITION_NAME = "__HIVE_DEFAULT_PARTITION__"; private static final Splitter EQUAL_SPLITTER = Splitter.on('=').trimResults(); private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings().trimResults(); private PartitionUtil() { } /** * Returns the partition key values from the given path. * @param location location path * @return the partition key values from the given path. */ public static Map<String, String> getPartitionKeyValues(final String location) { final Map<String, String> parts = Maps.newLinkedHashMap(); getPartitionKeyValues(location, parts); return parts; } /** * Sets the partition key values from the given path. * @param location location path * @param parts parts */ public static void getPartitionKeyValues(final String location, final Map<String, String> parts) { for (String part : Splitter.on('/').omitEmptyStrings().split(location)) { if (part.contains("=")) { final String[] values = part.split("=", 2); // // Ignore the partition value, if it is null or the hive default. Hive sets the default value if the // value is null/empty string or any other values that cannot be escaped. // if (values[0].equalsIgnoreCase("null") || values[1].equalsIgnoreCase("null")) { log.debug("Found 'null' string in kvp [{}] skipping.", part); } else if (values[1].equalsIgnoreCase(DEFAULT_PARTITION_NAME)) { parts.put(values[0], null); } else { parts.put(values[0], values[1]); } } } } /** * Validates the partition name. * @param partitionName partition name * @param partitionKeys partition keys */ public static void validatePartitionName(final String partitionName, final List<String> partitionKeys) { if (partitionKeys == null || partitionKeys.isEmpty()) { throw new IllegalStateException("No partitionKeys are defined"); } for (String part : SLASH_SPLITTER.split(partitionName)) { final List<String> tokens = EQUAL_SPLITTER.splitToList(part); if (tokens.size() != 2) { throw new IllegalArgumentException(String.format("Partition name '%s' is invalid", partitionName)); } final String key = tokens.get(0); final String value = tokens.get(1); if (!partitionKeys.contains(key) || value.isEmpty() || "null".equalsIgnoreCase(value)) { throw new IllegalArgumentException(String.format("Partition name '%s' is invalid", partitionName)); } } } }
1,925
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/util/package-info.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Includes utility classes. * * @author amajumdar */ package com.netflix.metacat.common.server.partition.util;
1,926
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/util/FilterPartition.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.util; import com.google.common.collect.Maps; import com.netflix.metacat.common.server.partition.parser.ParseException; import com.netflix.metacat.common.server.partition.parser.PartitionParser; import com.netflix.metacat.common.server.partition.parser.TokenMgrError; import com.netflix.metacat.common.server.partition.visitor.PartitionParserEval; import lombok.extern.slf4j.Slf4j; import java.io.IOException; import java.io.StringReader; import java.util.Map; /** * Partition filter utility. */ @Slf4j public class FilterPartition { private PartitionParser parser; private Map<String, String> context = Maps.newLinkedHashMap(); /** * Evaluates the given expression. * @param partitionExpression expression * @param name name * @param path partition uri path * @return true if the expression evaluates to true * @throws IOException exception */ public boolean evaluatePartitionExpression(final String partitionExpression, final String name, final String path) throws IOException { return evaluatePartitionExpression(partitionExpression, name, path, false, null); } /** * Evaluates the given expression. * @param partitionExpression expression * @param name name * @param path partition uri path * @param batchid batch id * @param values map of values * @return true if the expression evaluates to true */ public boolean evaluatePartitionExpression(final String partitionExpression, final String name, final String path, final boolean batchid, final Map<String, String> values) { if (partitionExpression != null) { try { if (parser == null) { parser = new PartitionParser(new StringReader(partitionExpression)); } else { parser.ReInit(new StringReader(partitionExpression)); } context.clear(); if (batchid) { addPathValues(path, context); } addNameValues(name, context); if (values != null) { context.putAll(values); } if (context.size() > 0) { return (Boolean) parser.filter().jjtAccept(new PartitionParserEval(context), null); } else { return false; } } catch (ParseException | TokenMgrError e) { throw new IllegalArgumentException(String.format("Invalid expression: %s", partitionExpression), e); } catch (StackOverflowError | ArrayIndexOutOfBoundsException | NullPointerException e) { throw new IllegalArgumentException(String.format("Expression too long: %s", partitionExpression), e); } catch (IllegalArgumentException e) { throw e; } catch (Throwable t) { log.warn("Caught unexpected exception during evaluatePartitionExpression", t); return false; } } return true; } /** * Adds the path part values to context. * @param path location * @param values Map of part keys and values. */ protected void addPathValues(final String path, final Map<String, String> values) { PartitionUtil.getPartitionKeyValues(path, values); } /** * Adds the name part values to context. * @param name part name * @param values Map of part keys and values. */ protected void addNameValues(final String name, final Map<String, String> values) { PartitionUtil.getPartitionKeyValues(name, values); } }
1,927
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTNULL.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTNULL.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTNULL extends SimpleNode { public boolean not; public ASTNULL(int id) { super(id); } public ASTNULL(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=a05a11e9613d782cca1635c6a484834b (do not edit this line) */
1,928
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTBOOLEAN.java
/* Generated By:JJTree: Do not edit this line. ASTBOOLEAN.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTBOOLEAN extends SimpleNode { public ASTBOOLEAN(int id) { super(id); } public ASTBOOLEAN(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=7e8340603e599a7a237489918f589168 (do not edit this line) */
1,929
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTNOT.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTNOT.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTNOT extends SimpleNode { public ASTNOT(int id) { super(id); } public ASTNOT(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=5dc823c0268b77235bab8e091a016cff (do not edit this line) */
1,930
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/Node.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. Node.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; /* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes. */ public interface Node { /** This method is called after the node has been made the current node. It indicates that child nodes can now be added to it. */ public void jjtOpen(); /** This method is called after all the child nodes have been added. */ public void jjtClose(); /** This pair of methods are used to inform the node of its parent. */ public void jjtSetParent(Node n); public Node jjtGetParent(); /** This method tells the node to add its argument to the node's list of children. */ public void jjtAddChild(Node n, int i); /** This method returns a child node. The children are numbered from zero, left to right. */ public Node jjtGetChild(int i); /** Return the number of children the node has. */ public int jjtGetNumChildren(); public int getId(); /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data); } /* JavaCC - OriginalChecksum=334ed1ebebd1735ac4fc4c275c58338c (do not edit this line) */
1,931
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParserTokenManager.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* PartitionParserTokenManager.java */ /* Generated By:JJTree&JavaCC: Do not edit this line. PartitionParserTokenManager.java */ package com.netflix.metacat.common.server.partition.parser; /** Token Manager. */ @SuppressWarnings("unused")public class PartitionParserTokenManager implements PartitionParserConstants { /** Debug output. */ public java.io.PrintStream debugStream = System.out; /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0){ switch (pos) { case 0: if ((active0 & 0x7f00000L) != 0L) { jjmatchedKind = 28; return 54; } if ((active0 & 0x180L) != 0L) return 5; return -1; case 1: if ((active0 & 0x4800000L) != 0L) return 54; if ((active0 & 0x3700000L) != 0L) { jjmatchedKind = 28; jjmatchedPos = 1; return 54; } return -1; case 2: if ((active0 & 0x100000L) != 0L) return 54; if ((active0 & 0x3600000L) != 0L) { jjmatchedKind = 28; jjmatchedPos = 2; return 54; } return -1; case 3: if ((active0 & 0x2200000L) != 0L) { jjmatchedKind = 28; jjmatchedPos = 3; return 54; } if ((active0 & 0x1400000L) != 0L) return 54; return -1; case 4: if ((active0 & 0x2200000L) != 0L) { jjmatchedKind = 28; jjmatchedPos = 4; return 54; } return -1; case 5: if ((active0 & 0x2200000L) != 0L) { jjmatchedKind = 28; jjmatchedPos = 5; return 54; } return -1; default : return -1; } } private final int jjStartNfa_0(int pos, long active0){ return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private int jjMoveStringLiteralDfa0_0(){ switch(curChar) { case 34: return jjStopAtPos(0, 30); case 39: return jjStopAtPos(0, 31); case 40: return jjStopAtPos(0, 9); case 41: return jjStopAtPos(0, 10); case 44: return jjStopAtPos(0, 11); case 60: jjmatchedKind = 8; return jjMoveStringLiteralDfa1_0(0x80L); case 62: jjmatchedKind = 6; return jjMoveStringLiteralDfa1_0(0x20L); case 66: case 98: return jjMoveStringLiteralDfa1_0(0x2000000L); case 73: case 105: return jjMoveStringLiteralDfa1_0(0x4800000L); case 76: case 108: return jjMoveStringLiteralDfa1_0(0x400000L); case 77: case 109: return jjMoveStringLiteralDfa1_0(0x200000L); case 78: case 110: return jjMoveStringLiteralDfa1_0(0x1100000L); default : return jjMoveNfa_0(1, 0); } } private int jjMoveStringLiteralDfa1_0(long active0){ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 61: if ((active0 & 0x20L) != 0L) return jjStopAtPos(1, 5); else if ((active0 & 0x80L) != 0L) return jjStopAtPos(1, 7); break; case 65: case 97: return jjMoveStringLiteralDfa2_0(active0, 0x200000L); case 69: case 101: return jjMoveStringLiteralDfa2_0(active0, 0x2000000L); case 73: case 105: return jjMoveStringLiteralDfa2_0(active0, 0x400000L); case 78: case 110: if ((active0 & 0x4000000L) != 0L) return jjStartNfaWithStates_0(1, 26, 54); break; case 79: case 111: return jjMoveStringLiteralDfa2_0(active0, 0x100000L); case 83: case 115: if ((active0 & 0x800000L) != 0L) return jjStartNfaWithStates_0(1, 23, 54); break; case 85: case 117: return jjMoveStringLiteralDfa2_0(active0, 0x1000000L); default : break; } return jjStartNfa_0(0, active0); } private int jjMoveStringLiteralDfa2_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0); return 2; } switch(curChar) { case 75: case 107: return jjMoveStringLiteralDfa3_0(active0, 0x400000L); case 76: case 108: return jjMoveStringLiteralDfa3_0(active0, 0x1000000L); case 84: case 116: if ((active0 & 0x100000L) != 0L) return jjStartNfaWithStates_0(2, 20, 54); return jjMoveStringLiteralDfa3_0(active0, 0x2200000L); default : break; } return jjStartNfa_0(1, active0); } private int jjMoveStringLiteralDfa3_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch(curChar) { case 67: case 99: return jjMoveStringLiteralDfa4_0(active0, 0x200000L); case 69: case 101: if ((active0 & 0x400000L) != 0L) return jjStartNfaWithStates_0(3, 22, 54); break; case 76: case 108: if ((active0 & 0x1000000L) != 0L) return jjStartNfaWithStates_0(3, 24, 54); break; case 87: case 119: return jjMoveStringLiteralDfa4_0(active0, 0x2000000L); default : break; } return jjStartNfa_0(2, active0); } private int jjMoveStringLiteralDfa4_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); return 4; } switch(curChar) { case 69: case 101: return jjMoveStringLiteralDfa5_0(active0, 0x2000000L); case 72: case 104: return jjMoveStringLiteralDfa5_0(active0, 0x200000L); default : break; } return jjStartNfa_0(3, active0); } private int jjMoveStringLiteralDfa5_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { case 69: case 101: return jjMoveStringLiteralDfa6_0(active0, 0x2200000L); default : break; } return jjStartNfa_0(4, active0); } private int jjMoveStringLiteralDfa6_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { case 78: case 110: if ((active0 & 0x2000000L) != 0L) return jjStartNfaWithStates_0(6, 25, 54); break; case 83: case 115: if ((active0 & 0x200000L) != 0L) return jjStartNfaWithStates_0(6, 21, 54); break; default : break; } return jjStartNfa_0(5, active0); } private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); } private int jjMoveNfa_0(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 54; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 54: if ((0x3ff200000000000L & l) != 0L) { if (kind > 28) kind = 28; { jjCheckNAdd(37); } } if ((0x3ff200000000000L & l) != 0L) { if (kind > 28) kind = 28; { jjCheckNAdd(36); } } break; case 1: if ((0x3ff000000000000L & l) != 0L) { if (kind > 12) kind = 12; { jjCheckNAddStates(0, 6); } } else if (curChar == 45) { jjCheckNAddStates(7, 9); } else if (curChar == 38) jjstateSet[jjnewStateCnt++] = 19; else if (curChar == 46) { jjCheckNAddTwoStates(8, 15); } else if (curChar == 60) jjstateSet[jjnewStateCnt++] = 5; else if (curChar == 33) jjstateSet[jjnewStateCnt++] = 3; else if (curChar == 61) { if (kind > 3) kind = 3; } if (curChar == 61) jjstateSet[jjnewStateCnt++] = 0; break; case 0: if (curChar == 61 && kind > 3) kind = 3; break; case 2: if (curChar == 61 && kind > 3) kind = 3; break; case 3: if (curChar == 61 && kind > 4) kind = 4; break; case 4: if (curChar == 33) jjstateSet[jjnewStateCnt++] = 3; break; case 5: if (curChar == 62) kind = 4; break; case 6: if (curChar == 60) jjstateSet[jjnewStateCnt++] = 5; break; case 7: if (curChar == 46) { jjCheckNAddTwoStates(8, 15); } break; case 8: if (curChar == 45) { jjCheckNAdd(9); } break; case 9: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAddTwoStates(9, 10); } break; case 11: if ((0x280000000000L & l) != 0L) { jjCheckNAddTwoStates(12, 14); } break; case 12: if (curChar == 45) { jjCheckNAdd(13); } break; case 13: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAdd(13); } break; case 14: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAdd(14); } break; case 15: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAddTwoStates(15, 10); } break; case 19: if (curChar == 38 && kind > 18) kind = 18; break; case 20: if (curChar == 38) jjstateSet[jjnewStateCnt++] = 19; break; case 34: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 28) kind = 28; jjstateSet[jjnewStateCnt++] = 34; break; case 36: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAdd(36); } break; case 37: if ((0x3ff200000000000L & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAdd(37); } break; case 38: if (curChar == 45) { jjCheckNAddStates(7, 9); } break; case 39: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; { jjCheckNAdd(39); } break; case 40: if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(40, 41); } break; case 42: if ((0x280000000000L & l) != 0L) { jjCheckNAddTwoStates(43, 45); } break; case 43: if (curChar == 45) { jjCheckNAdd(44); } break; case 44: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAdd(44); } break; case 45: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAdd(45); } break; case 46: if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(46, 47); } break; case 47: if (curChar != 46) break; if (kind > 14) kind = 14; { jjCheckNAddTwoStates(48, 10); } break; case 48: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 14) kind = 14; { jjCheckNAddTwoStates(48, 10); } break; case 49: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; { jjCheckNAddStates(0, 6); } break; case 50: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 12) kind = 12; { jjCheckNAdd(50); } break; case 51: if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(51, 41); } break; case 52: if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(52, 47); } break; case 53: if ((0x3ff000000000000L & l) != 0L) { jjCheckNAddTwoStates(53, 7); } break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 54: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 28) kind = 28; { jjCheckNAdd(37); } } if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 28) kind = 28; { jjCheckNAdd(36); } } break; case 1: if ((0x7fffffe07fffffeL & l) != 0L) { if (kind > 28) kind = 28; { jjCheckNAddTwoStates(36, 37); } } else if (curChar == 95) { jjCheckNAdd(34); } else if (curChar == 124) jjstateSet[jjnewStateCnt++] = 23; if ((0x4000000040L & l) != 0L) jjstateSet[jjnewStateCnt++] = 31; else if ((0x10000000100000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 27; else if ((0x800000008000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 21; else if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 17; break; case 10: if ((0x2000000020L & l) != 0L) { jjAddStates(10, 12); } break; case 16: if ((0x1000000010L & l) != 0L && kind > 18) kind = 18; break; case 17: if ((0x400000004000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 16; break; case 18: if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 17; break; case 21: if ((0x4000000040000L & l) != 0L && kind > 19) kind = 19; break; case 22: if ((0x800000008000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 21; break; case 23: if (curChar == 124 && kind > 19) kind = 19; break; case 24: if (curChar == 124) jjstateSet[jjnewStateCnt++] = 23; break; case 25: if ((0x2000000020L & l) != 0L && kind > 27) kind = 27; break; case 26: if ((0x20000000200000L & l) != 0L) { jjCheckNAdd(25); } break; case 27: if ((0x4000000040000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 26; break; case 28: if ((0x10000000100000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 27; break; case 29: if ((0x8000000080000L & l) != 0L) { jjCheckNAdd(25); } break; case 30: if ((0x100000001000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 29; break; case 31: if ((0x200000002L & l) != 0L) jjstateSet[jjnewStateCnt++] = 30; break; case 32: if ((0x4000000040L & l) != 0L) jjstateSet[jjnewStateCnt++] = 31; break; case 33: if (curChar == 95) { jjCheckNAdd(34); } break; case 34: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAdd(34); } break; case 35: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAddTwoStates(36, 37); } break; case 36: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAdd(36); } break; case 37: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 28) kind = 28; { jjCheckNAdd(37); } break; case 41: if ((0x2000000020L & l) != 0L) { jjAddStates(13, 15); } break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 54 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private int jjMoveStringLiteralDfa0_2() { return jjMoveNfa_2(0, 0); } static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private int jjMoveNfa_2(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 2; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 0: if ((0xffffff7fffffffffL & l) != 0L) { if (kind > 35) kind = 35; } else if (curChar == 39) { if (kind > 34) kind = 34; } break; case 1: if ((0xffffff7fffffffffL & l) != 0L) kind = 35; break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: kind = 35; break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if ((jjbitVec0[i2] & l2) != 0L && kind > 35) kind = 35; break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } private int jjMoveStringLiteralDfa0_1() { return jjMoveNfa_1(0, 0); } private int jjMoveNfa_1(int startState, int curPos) { int startsAt = 0; jjnewStateCnt = 2; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; do { switch(jjstateSet[--i]) { case 0: if ((0xfffffffbffffffffL & l) != 0L) { if (kind > 33) kind = 33; } else if (curChar == 34) { if (kind > 32) kind = 32; } break; case 1: if ((0xfffffffbffffffffL & l) != 0L) kind = 33; break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: kind = 33; break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { case 0: if ((jjbitVec0[i2] & l2) != 0L && kind > 33) kind = 33; break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } static final int[] jjnextStates = { 50, 51, 41, 52, 47, 53, 7, 39, 40, 46, 11, 12, 14, 42, 43, 45, }; /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, "\76\75", "\76", "\74\75", "\74", "\50", "\51", "\54", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "\42", "\47", null, null, null, null, }; protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = Token.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; /** Get the next Token. */ public Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(Exception e) { jjmatchedKind = 0; jjmatchedPos = -1; matchedToken = jjFillToken(); return matchedToken; } switch(curLexState) { case 0: try { input_stream.backup(0); while (curChar <= 32 && (0x100000200L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); break; case 2: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_2(); break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; return matchedToken; } else { if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } private void jjCheckNAddStates(int start, int end) { do { jjCheckNAdd(jjnextStates[start]); } while (start++ != end); } /** Constructor. */ public PartitionParserTokenManager(SimpleCharStream stream){ if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } /** Constructor. */ public PartitionParserTokenManager (SimpleCharStream stream, int lexState){ ReInit(stream); SwitchTo(lexState); } /** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 54; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ public void ReInit( SimpleCharStream stream, int lexState) { ReInit( stream); SwitchTo(lexState); } /** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 3 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", "STRING_STATE", "SSTRING_STATE", }; /** Lex State array. */ public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 0, -1, 0, -1, }; static final long[] jjtoToken = { 0xfdffc5ff9L, }; static final long[] jjtoSkip = { 0x6L, }; protected SimpleCharStream input_stream; private final int[] jjrounds = new int[54]; private final int[] jjstateSet = new int[2 * 54]; protected int curChar; }
1,932
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTBETWEEN.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTBETWEEN.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTBETWEEN extends SimpleNode { public boolean not; public ASTBETWEEN(int id) { super(id); } public ASTBETWEEN(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=4b4698cb03acb7058f35eb0b6db6be5d (do not edit this line) */
1,933
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/JJTPartitionParserState.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. JJTPartitionParserState.java Version 6.1_2 */ package com.netflix.metacat.common.server.partition.parser; public class JJTPartitionParserState { private java.util.List<Node> nodes; private java.util.List<Integer> marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; public JJTPartitionParserState() { nodes = new java.util.ArrayList<Node>(); marks = new java.util.ArrayList<Integer>(); sp = 0; mk = 0; } /* Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope. */ public boolean nodeCreated() { return node_created; } /* Call this to reinitialize the node stack. It is called automatically by the parser's ReInit() method. */ public void reset() { nodes.clear(); marks.clear(); sp = 0; mk = 0; } /* Returns the root node of the AST. It only makes sense to call this after a successful parse. */ public Node rootNode() { return nodes.get(0); } /* Pushes a node on to the stack. */ public void pushNode(Node n) { nodes.add(n); ++sp; } /* Returns the node on the top of the stack, and remove it from the stack. */ public Node popNode() { if (--sp < mk) { mk = marks.remove(marks.size()-1); } return nodes.remove(nodes.size()-1); } /* Returns the node currently on the top of the stack. */ public Node peekNode() { return nodes.get(nodes.size()-1); } /* Returns the number of children on the stack in the current node scope. */ public int nodeArity() { return sp - mk; } public void clearNodeScope(Node n) { while (sp > mk) { popNode(); } mk = marks.remove(marks.size()-1); } public void openNodeScope(Node n) { marks.add(mk); mk = sp; n.jjtOpen(); } /* A definite node is constructed from a specified number of children. That number of nodes are popped from the stack and made the children of the definite node. Then the definite node is pushed on to the stack. */ public void closeNodeScope(Node n, int num) { mk = marks.remove(marks.size()-1); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; } /* A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack. */ public void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = marks.remove(marks.size()-1); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = marks.remove(marks.size()-1); node_created = false; } } } /* JavaCC - OriginalChecksum=74e520c03c9ff6f5de7ff6afc4577aae (do not edit this line) */
1,934
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTLT.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTLT.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTLT extends SimpleNode { public ASTLT(int id) { super(id); } public ASTLT(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=32e29fc080692c40e10bb780be9e3e00 (do not edit this line) */
1,935
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTAND.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTAND.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTAND extends SimpleNode { public ASTAND(int id) { super(id); } public ASTAND(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=47624dd380cfe00f384e5c8af03d69b3 (do not edit this line) */
1,936
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTNUM.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTNUM.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTNUM extends SimpleNode { public ASTNUM(int id) { super(id); } public ASTNUM(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=8c978f5115fa4de48e54d30148a58bf1 (do not edit this line) */
1,937
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTOR.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTOR.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTOR extends SimpleNode { public ASTOR(int id) { super(id); } public ASTOR(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=b1f74c0c73a8c4b265e886c9e24da36a (do not edit this line) */
1,938
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTNEQ.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTNEQ.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTNEQ extends SimpleNode { public ASTNEQ(int id) { super(id); } public ASTNEQ(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=4ed9b560c660a3074aeba567abf5c70b (do not edit this line) */
1,939
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParserVisitor.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. PartitionParserVisitor.java Version 6.1_2 */ package com.netflix.metacat.common.server.partition.parser; public interface PartitionParserVisitor { public Object visit(SimpleNode node, Object data); public Object visit(ASTFILTER node, Object data); public Object visit(ASTAND node, Object data); public Object visit(ASTOR node, Object data); public Object visit(ASTNOT node, Object data); public Object visit(ASTBETWEEN node, Object data); public Object visit(ASTIN node, Object data); public Object visit(ASTLIKE node, Object data); public Object visit(ASTNULL node, Object data); public Object visit(ASTCOMPARE node, Object data); public Object visit(ASTGT node, Object data); public Object visit(ASTLT node, Object data); public Object visit(ASTLTE node, Object data); public Object visit(ASTGTE node, Object data); public Object visit(ASTEQ node, Object data); public Object visit(ASTNEQ node, Object data); public Object visit(ASTMATCHES node, Object data); public Object visit(ASTNUM node, Object data); public Object visit(ASTSTRING node, Object data); public Object visit(ASTBOOLEAN node, Object data); public Object visit(ASTVAR node, Object data); } /* JavaCC - OriginalChecksum=c4e323f2dccde5ac3f4e73a7741c2619 (do not edit this line) */
1,940
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/TokenMgrError.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 6.1 */ /* JavaCCOptions: */ package com.netflix.metacat.common.server.partition.parser; /** Token Manager Error. */ public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the <i>serialized</i> form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ public static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ public static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ public static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ public static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { char curChar1 = (char)curChar; return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=39aae34c59a71eabaec2e72513b570b1 (do not edit this line) */
1,941
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTEQ.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTEQ.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTEQ extends SimpleNode { public ASTEQ(int id) { super(id); } public ASTEQ(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=bbf13f81c94ea7197914ce9f46cc3526 (do not edit this line) */
1,942
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTFILTER.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTFILTER.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTFILTER extends SimpleNode { public ASTFILTER(int id) { super(id); } public ASTFILTER(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=502a3e691142a2ee92a5d005f0a1bb28 (do not edit this line) */
1,943
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParser.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* PartitionParser.java */ /* Generated By:JJTree&JavaCC: Do not edit this line. PartitionParser.java */ package com.netflix.metacat.common.server.partition.parser; public class PartitionParser/*@bgen(jjtree)*/implements PartitionParserTreeConstants, PartitionParserConstants {/*@bgen(jjtree)*/ protected JJTPartitionParserState jjtree = new JJTPartitionParserState();public static void main (String args []) throws ParseException { PartitionParser parser = new PartitionParser(new java.io.StringReader(args[0])); SimpleNode root = parser.filter(); root.dump(""); System.out.println(root.jjtAccept(new com.netflix.metacat.common.server.partition.visitor.PartitionParserEval(), null)); } final public SimpleNode filter() throws ParseException {/*@bgen(jjtree) FILTER */ ASTFILTER jjtn000 = new ASTFILTER(JJTFILTER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { expr(); jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; {if ("" != null) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } throw new Error("Missing return statement in function"); } final public void expr() throws ParseException { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN:{ jj_consume_token(LPAREN); expr(); jj_consume_token(RPAREN); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND: case OR:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND:{ jj_consume_token(AND); ASTAND jjtn001 = new ASTAND(JJTAND); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { expr(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } break; } case OR:{ jj_consume_token(OR); ASTOR jjtn002 = new ASTOR(JJTOR); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { expr(); } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte002;} } if (jjte002 instanceof ParseException) { {if (true) throw (ParseException)jjte002;} } {if (true) throw (Error)jjte002;} } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } break; } default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; } default: jj_la1[1] = jj_gen; ; } break; } default: jj_la1[4] = jj_gen; if (jj_2_1(1)) { EvalExpr(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND: case OR:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND:{ jj_consume_token(AND); ASTAND jjtn003 = new ASTAND(JJTAND); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { expr(); } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte003;} } if (jjte003 instanceof ParseException) { {if (true) throw (ParseException)jjte003;} } {if (true) throw (Error)jjte003;} } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } break; } case OR:{ jj_consume_token(OR); ASTOR jjtn004 = new ASTOR(JJTOR); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { expr(); } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte004;} } if (jjte004 instanceof ParseException) { {if (true) throw (ParseException)jjte004;} } {if (true) throw (Error)jjte004;} } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } break; } default: jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; } default: jj_la1[3] = jj_gen; ; } } else { jj_consume_token(-1); throw new ParseException(); } } } final public void EvalExpr() throws ParseException {boolean not = false; ASTNOT jjtn001 = new ASTNOT(JJTNOT); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT:{ jj_consume_token(NOT); not=true; break; } default: jj_la1[5] = jj_gen; ; } eval(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, not); } } } final public void eval() throws ParseException { if (getToken(2).kind==BETWEEN || getToken(3).kind==BETWEEN) { BetweenEval(); } else if (getToken(2).kind==IN || getToken(3).kind==IN) { InEval(); } else if (getToken(2).kind==LIKE || getToken(3).kind==LIKE) { LikeEval(); } else if (getToken(2).kind==IS) { NullEval(); } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INT: case FLOAT: case BOOLEAN: case VARIABLE: case QUOTE: case SQUOTE:{ CompareEval(); break; } default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } } final public void BetweenEval() throws ParseException {/*@bgen(jjtree) BETWEEN */ ASTBETWEEN jjtn000 = new ASTBETWEEN(JJTBETWEEN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { term(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT:{ jj_consume_token(NOT); jjtn000.not=true; break; } default: jj_la1[7] = jj_gen; ; } jj_consume_token(BETWEEN); term(); jj_consume_token(AND); term(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void InEval() throws ParseException {/*@bgen(jjtree) IN */ ASTIN jjtn000 = new ASTIN(JJTIN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { term(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT:{ jj_consume_token(NOT); jjtn000.not=true; break; } default: jj_la1[8] = jj_gen; ; } jj_consume_token(IN); jj_consume_token(LPAREN); term(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA:{ ; break; } default: jj_la1[9] = jj_gen; break label_1; } jj_consume_token(COMMA); term(); } jj_consume_token(RPAREN); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void LikeEval() throws ParseException {/*@bgen(jjtree) LIKE */ ASTLIKE jjtn000 = new ASTLIKE(JJTLIKE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { term(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT:{ jj_consume_token(NOT); jjtn000.not=true; break; } default: jj_la1[10] = jj_gen; ; } jj_consume_token(LIKE); term(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void NullEval() throws ParseException {/*@bgen(jjtree) NULL */ ASTNULL jjtn000 = new ASTNULL(JJTNULL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { term(); jj_consume_token(IS); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NOT:{ jj_consume_token(NOT); jjtn000.not=true; break; } default: jj_la1[11] = jj_gen; ; } jj_consume_token(NULL); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void CompareEval() throws ParseException {/*@bgen(jjtree) COMPARE */ ASTCOMPARE jjtn000 = new ASTCOMPARE(JJTCOMPARE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { term(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case EQUAL: case NEQUAL: case GTE: case GT: case LTE: case LT: case MATCHES:{ comp(); term(); break; } default: jj_la1[12] = jj_gen; ; } } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } } final public void comp() throws ParseException { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GT:{ ASTGT jjtn001 = new ASTGT(JJTGT); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { jj_consume_token(GT); } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); } } break; } case LT:{ ASTLT jjtn002 = new ASTLT(JJTLT); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { jj_consume_token(LT); } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, true); } } break; } case LTE:{ ASTLTE jjtn003 = new ASTLTE(JJTLTE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { jj_consume_token(LTE); } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, true); } } break; } case GTE:{ ASTGTE jjtn004 = new ASTGTE(JJTGTE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { jj_consume_token(GTE); } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, true); } } break; } case EQUAL:{ ASTEQ jjtn005 = new ASTEQ(JJTEQ); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); try { jj_consume_token(EQUAL); } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, true); } } break; } case NEQUAL:{ ASTNEQ jjtn006 = new ASTNEQ(JJTNEQ); boolean jjtc006 = true; jjtree.openNodeScope(jjtn006); try { jj_consume_token(NEQUAL); } finally { if (jjtc006) { jjtree.closeNodeScope(jjtn006, true); } } break; } case MATCHES:{ ASTMATCHES jjtn007 = new ASTMATCHES(JJTMATCHES); boolean jjtc007 = true; jjtree.openNodeScope(jjtn007); try { jj_consume_token(MATCHES); } finally { if (jjtc007) { jjtree.closeNodeScope(jjtn007, true); } } break; } default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } final public void term() throws ParseException {Token t; StringBuilder builder = new StringBuilder(); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INT:{ t = jj_consume_token(INT); ASTNUM jjtn001 = new ASTNUM(JJTNUM); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { jjtree.closeNodeScope(jjtn001, true); jjtc001 = false; jjtn001.value = new java.math.BigDecimal(t.image); } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); } } break; } case FLOAT:{ t = jj_consume_token(FLOAT); ASTNUM jjtn002 = new ASTNUM(JJTNUM); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); try { jjtree.closeNodeScope(jjtn002, true); jjtc002 = false; jjtn002.value = new java.math.BigDecimal(t.image); } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, true); } } break; } case QUOTE:{ jj_consume_token(QUOTE); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CHAR:{ ; break; } default: jj_la1[14] = jj_gen; break label_2; } t = jj_consume_token(CHAR); builder.append(t.image); } jj_consume_token(ENDQUOTE); ASTSTRING jjtn003 = new ASTSTRING(JJTSTRING); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); try { jjtree.closeNodeScope(jjtn003, true); jjtc003 = false; jjtn003.value = builder.toString(); } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, true); } } break; } case SQUOTE:{ jj_consume_token(SQUOTE); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SCHAR:{ ; break; } default: jj_la1[15] = jj_gen; break label_3; } t = jj_consume_token(SCHAR); builder.append(t.image); } jj_consume_token(SENDQUOTE); ASTSTRING jjtn004 = new ASTSTRING(JJTSTRING); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); try { jjtree.closeNodeScope(jjtn004, true); jjtc004 = false; jjtn004.value = builder.toString(); } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, true); } } break; } case BOOLEAN:{ t = jj_consume_token(BOOLEAN); ASTBOOLEAN jjtn005 = new ASTBOOLEAN(JJTBOOLEAN); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); try { jjtree.closeNodeScope(jjtn005, true); jjtc005 = false; jjtn005.value = t.image; } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, true); } } break; } case VARIABLE:{ t = jj_consume_token(VARIABLE); ASTVAR jjtn006 = new ASTVAR(JJTVAR); boolean jjtc006 = true; jjtree.openNodeScope(jjtn006); try { jjtree.closeNodeScope(jjtn006, true); jjtc006 = false; jjtn006.value = new Variable(t.image); } finally { if (jjtc006) { jjtree.closeNodeScope(jjtn006, true); } } break; } default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } private boolean jj_3R_8() { if (jj_3R_13()) return true; return false; } private boolean jj_3R_5() { if (jj_scan_token(NOT)) return true; return false; } private boolean jj_3R_7() { if (jj_3R_12()) return true; return false; } private boolean jj_3R_6() { Token xsp; xsp = jj_scanpos; jj_lookingAhead = true; jj_semLA = getToken(2).kind==BETWEEN || getToken(3).kind==BETWEEN; jj_lookingAhead = false; if (!jj_semLA || jj_3R_7()) { jj_scanpos = xsp; jj_lookingAhead = true; jj_semLA = getToken(2).kind==IN || getToken(3).kind==IN; jj_lookingAhead = false; if (!jj_semLA || jj_3R_8()) { jj_scanpos = xsp; jj_lookingAhead = true; jj_semLA = getToken(2).kind==LIKE || getToken(3).kind==LIKE; jj_lookingAhead = false; if (!jj_semLA || jj_3R_9()) { jj_scanpos = xsp; jj_lookingAhead = true; jj_semLA = getToken(2).kind==IS; jj_lookingAhead = false; if (!jj_semLA || jj_3R_10()) { jj_scanpos = xsp; if (jj_3R_11()) return true; } } } } return false; } private boolean jj_3R_4() { Token xsp; xsp = jj_scanpos; if (jj_3R_5()) jj_scanpos = xsp; if (jj_3R_6()) return true; return false; } private boolean jj_3_1() { if (jj_3R_4()) return true; return false; } private boolean jj_3R_16() { if (jj_3R_17()) return true; return false; } private boolean jj_3R_15() { if (jj_3R_17()) return true; return false; } private boolean jj_3R_14() { if (jj_3R_17()) return true; return false; } private boolean jj_3R_13() { if (jj_3R_17()) return true; return false; } private boolean jj_3R_12() { if (jj_3R_17()) return true; return false; } private boolean jj_3R_23() { if (jj_scan_token(VARIABLE)) return true; return false; } private boolean jj_3R_22() { if (jj_scan_token(BOOLEAN)) return true; return false; } private boolean jj_3R_11() { if (jj_3R_16()) return true; return false; } private boolean jj_3R_21() { if (jj_scan_token(SQUOTE)) return true; return false; } private boolean jj_3R_20() { if (jj_scan_token(QUOTE)) return true; return false; } private boolean jj_3R_10() { if (jj_3R_15()) return true; return false; } private boolean jj_3R_19() { if (jj_scan_token(FLOAT)) return true; return false; } private boolean jj_3R_9() { if (jj_3R_14()) return true; return false; } private boolean jj_3R_17() { Token xsp; xsp = jj_scanpos; if (jj_3R_18()) { jj_scanpos = xsp; if (jj_3R_19()) { jj_scanpos = xsp; if (jj_3R_20()) { jj_scanpos = xsp; if (jj_3R_21()) { jj_scanpos = xsp; if (jj_3R_22()) { jj_scanpos = xsp; if (jj_3R_23()) return true; } } } } } return false; } private boolean jj_3R_18() { if (jj_scan_token(INT)) return true; return false; } /** Generated Token Manager. */ public PartitionParserTokenManager token_source; SimpleCharStream jj_input_stream; /** Current token. */ public Token token; /** Next token. */ public Token jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; /** Whether we are looking ahead. */ private boolean jj_lookingAhead = false; private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[17]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { jj_la1_init_0(); jj_la1_init_1(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0xc0000,0xc0000,0xc0000,0xc0000,0x200,0x100000,0xd8005000,0x100000,0x100000,0x800,0x100000,0x100000,0x2001f8,0x2001f8,0x0,0x0,0xd8005000,}; } private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x8,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[1]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with InputStream. */ public PartitionParser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public PartitionParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new PartitionParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor. */ public PartitionParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new PartitionParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); } else { jj_input_stream.ReInit(stream, 1, 1); } if (token_source == null) { token_source = new PartitionParserTokenManager(jj_input_stream); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Constructor with generated Token Manager. */ public PartitionParser(PartitionParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(PartitionParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jjtree.reset(); jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } @SuppressWarnings("serial") static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; } /** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ final public Token getToken(int index) { Token t = jj_lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } private int jj_ntk_f() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; private void jj_add_error_token(int kind, int pos) { if (pos >= 100) { return; } if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } for (int[] oldentry : jj_expentries) { if (oldentry.length == jj_expentry.length) { boolean isMatched = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { isMatched = false; break; } } if (isMatched) { jj_expentries.add(jj_expentry); break; } } } if (pos != 0) { jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } } /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[36]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 17; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { la1tokens[j] = true; } if ((jj_la1_1[i] & (1<<j)) != 0) { la1tokens[32+j] = true; } } } } for (int i = 0; i < 36; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.add(jj_expentry); } } jj_endpos = 0; jj_rescan_token(); jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } /** Enable tracing. */ final public void enable_tracing() { } /** Disable tracing. */ final public void disable_tracing() { } private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 1; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; } } p = p.next; } while (p != null); } catch(LookaheadSuccess ls) { } } jj_rescan = false; } private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } }
1,944
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ParseException.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.1 */ /* JavaCCOptions:KEEP_LINE_COLUMN=true */ package com.netflix.metacat.common.server.partition.parser; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * The version identifier for this Serializable class. * Increment only if the <i>serialized</i> form of the * class changes. */ private static final long serialVersionUID = 1L; /** * The end of line string for this machine. */ protected static String EOL = System.getProperty("line.separator", "\n"); /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(EOL).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + EOL; if (expectedTokenSequences.length == 0) { // Nothing to add here } else { if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + EOL + " "; } else { retval += "Was expecting one of:" + EOL + " "; } retval += expected.toString(); } return retval; } /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=49058b52f63ed1ca5d5417de303d18a1 (do not edit this line) */
1,945
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTGTE.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTGTE.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTGTE extends SimpleNode { public ASTGTE(int id) { super(id); } public ASTGTE(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=64550e3fbfe981b802deef725b683e1a (do not edit this line) */
1,946
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/Variable.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.parser; public class Variable { private String name; public Variable(String name) { this.setName(name); } public String getName() { return name; } public void setName(String name) { this.name = name; } }
1,947
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParserTreeConstants.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. PartitionParserTreeConstants.java Version 6.1_2 */ package com.netflix.metacat.common.server.partition.parser; public interface PartitionParserTreeConstants { public int JJTFILTER = 0; public int JJTVOID = 1; public int JJTAND = 2; public int JJTOR = 3; public int JJTNOT = 4; public int JJTBETWEEN = 5; public int JJTIN = 6; public int JJTLIKE = 7; public int JJTNULL = 8; public int JJTCOMPARE = 9; public int JJTGT = 10; public int JJTLT = 11; public int JJTLTE = 12; public int JJTGTE = 13; public int JJTEQ = 14; public int JJTNEQ = 15; public int JJTMATCHES = 16; public int JJTNUM = 17; public int JJTSTRING = 18; public int JJTBOOLEAN = 19; public int JJTVAR = 20; public String[] jjtNodeName = { "FILTER", "void", "AND", "OR", "NOT", "BETWEEN", "IN", "LIKE", "NULL", "COMPARE", "GT", "LT", "LTE", "GTE", "EQ", "NEQ", "MATCHES", "NUM", "STRING", "BOOLEAN", "VAR", }; } /* JavaCC - OriginalChecksum=a96463cb7122b404fe59a717feec7105 (do not edit this line) */
1,948
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParserDefaultVisitor.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. PartitionParserDefaultVisitor.java Version 6.1_2 */ package com.netflix.metacat.common.server.partition.parser; public class PartitionParserDefaultVisitor implements PartitionParserVisitor{ public Object defaultVisit(SimpleNode node, Object data){ node.childrenAccept(this, data); return data; } public Object visit(SimpleNode node, Object data){ return defaultVisit(node, data); } public Object visit(ASTFILTER node, Object data){ return defaultVisit(node, data); } public Object visit(ASTAND node, Object data){ return defaultVisit(node, data); } public Object visit(ASTOR node, Object data){ return defaultVisit(node, data); } public Object visit(ASTNOT node, Object data){ return defaultVisit(node, data); } public Object visit(ASTBETWEEN node, Object data){ return defaultVisit(node, data); } public Object visit(ASTIN node, Object data){ return defaultVisit(node, data); } public Object visit(ASTLIKE node, Object data){ return defaultVisit(node, data); } public Object visit(ASTNULL node, Object data){ return defaultVisit(node, data); } public Object visit(ASTCOMPARE node, Object data){ return defaultVisit(node, data); } public Object visit(ASTGT node, Object data){ return defaultVisit(node, data); } public Object visit(ASTLT node, Object data){ return defaultVisit(node, data); } public Object visit(ASTLTE node, Object data){ return defaultVisit(node, data); } public Object visit(ASTGTE node, Object data){ return defaultVisit(node, data); } public Object visit(ASTEQ node, Object data){ return defaultVisit(node, data); } public Object visit(ASTNEQ node, Object data){ return defaultVisit(node, data); } public Object visit(ASTMATCHES node, Object data){ return defaultVisit(node, data); } public Object visit(ASTNUM node, Object data){ return defaultVisit(node, data); } public Object visit(ASTSTRING node, Object data){ return defaultVisit(node, data); } public Object visit(ASTBOOLEAN node, Object data){ return defaultVisit(node, data); } public Object visit(ASTVAR node, Object data){ return defaultVisit(node, data); } } /* JavaCC - OriginalChecksum=bf03e212165a1a62c99d5fccedf6e302 (do not edit this line) */
1,949
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTVAR.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTVAR.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTVAR extends SimpleNode { public ASTVAR(int id) { super(id); } public ASTVAR(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=69622d5c2212551b77e16c4e9145bc5c (do not edit this line) */
1,950
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/PartitionParserConstants.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree&JavaCC: Do not edit this line. PartitionParserConstants.java */ package com.netflix.metacat.common.server.partition.parser; /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface PartitionParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int EQUAL = 3; /** RegularExpression Id. */ int NEQUAL = 4; /** RegularExpression Id. */ int GTE = 5; /** RegularExpression Id. */ int GT = 6; /** RegularExpression Id. */ int LTE = 7; /** RegularExpression Id. */ int LT = 8; /** RegularExpression Id. */ int LPAREN = 9; /** RegularExpression Id. */ int RPAREN = 10; /** RegularExpression Id. */ int COMMA = 11; /** RegularExpression Id. */ int INT = 12; /** RegularExpression Id. */ int DIGIT = 13; /** RegularExpression Id. */ int FLOAT = 14; /** RegularExpression Id. */ int EXPONENT = 15; /** RegularExpression Id. */ int MANTISSA = 16; /** RegularExpression Id. */ int DIGITS = 17; /** RegularExpression Id. */ int AND = 18; /** RegularExpression Id. */ int OR = 19; /** RegularExpression Id. */ int NOT = 20; /** RegularExpression Id. */ int MATCHES = 21; /** RegularExpression Id. */ int LIKE = 22; /** RegularExpression Id. */ int IS = 23; /** RegularExpression Id. */ int NULL = 24; /** RegularExpression Id. */ int BETWEEN = 25; /** RegularExpression Id. */ int IN = 26; /** RegularExpression Id. */ int BOOLEAN = 27; /** RegularExpression Id. */ int VARIABLE = 28; /** RegularExpression Id. */ int CHARS = 29; /** RegularExpression Id. */ int QUOTE = 30; /** RegularExpression Id. */ int SQUOTE = 31; /** RegularExpression Id. */ int ENDQUOTE = 32; /** RegularExpression Id. */ int CHAR = 33; /** RegularExpression Id. */ int SENDQUOTE = 34; /** RegularExpression Id. */ int SCHAR = 35; /** Lexical state. */ int DEFAULT = 0; /** Lexical state. */ int STRING_STATE = 1; /** Lexical state. */ int SSTRING_STATE = 2; /** Literal token values. */ String[] tokenImage = { "<EOF>", "\" \"", "\"\\t\"", "<EQUAL>", "<NEQUAL>", "\">=\"", "\">\"", "\"<=\"", "\"<\"", "\"(\"", "\")\"", "\",\"", "<INT>", "<DIGIT>", "<FLOAT>", "<EXPONENT>", "<MANTISSA>", "<DIGITS>", "<AND>", "<OR>", "\"not\"", "\"matches\"", "\"like\"", "\"is\"", "\"null\"", "\"between\"", "\"in\"", "<BOOLEAN>", "<VARIABLE>", "<CHARS>", "\"\\\"\"", "\"\\\'\"", "<ENDQUOTE>", "<CHAR>", "<SENDQUOTE>", "<SCHAR>", }; }
1,951
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/SimpleCharStream.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 6.1 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 1; protected boolean trackLineColumn = true; public void setTabSize(int i) { tabSize = i; } public int getTabSize() { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } @Deprecated /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } boolean getTrackLineColumn() { return trackLineColumn; } void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; } } /* JavaCC - OriginalChecksum=c34799d44c4c2ce99700976e5f2a9064 (do not edit this line) */
1,952
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTLTE.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTLTE.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTLTE extends SimpleNode { public ASTLTE(int id) { super(id); } public ASTLTE(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=5166b2cf4d389162d081829f20e53bb9 (do not edit this line) */
1,953
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTLIKE.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTLIKE.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTLIKE extends SimpleNode { public boolean not; public ASTLIKE(int id) { super(id); } public ASTLIKE(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=4c9049dc18265f1076e67d7fbab0250d (do not edit this line) */
1,954
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTIN.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTIN.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTIN extends SimpleNode { public boolean not; public ASTIN(int id) { super(id); } public ASTIN(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=740044ed6bd874710eabdf47e1b15683 (do not edit this line) */
1,955
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/Token.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JavaCC: Do not edit this line. Token.java Version 6.1 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; /** * Describes the input token stream. */ public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the <i>serialized</i> form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=0a3aa83d3f2cdefa7bb0715471f36007 (do not edit this line) */
1,956
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTGT.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTGT.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTGT extends SimpleNode { public ASTGT(int id) { super(id); } public ASTGT(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=97fa861ee8d9421ccb94612e513bc388 (do not edit this line) */
1,957
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/SimpleNode.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected PartitionParser parser; public SimpleNode(int i) { id = i; } public SimpleNode(PartitionParser p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** Accept the visitor. **/ public Object childrenAccept(PartitionParserVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return PartitionParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode) children[i]; if (n != null) { n.dump(prefix + " "); } } } } public int getId() { return id; } } /* JavaCC - OriginalChecksum=d933f51a60f5df18ee957e3447d1a0d6 (do not edit this line) */
1,958
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTCOMPARE.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTCOMPARE.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTCOMPARE extends SimpleNode { public ASTCOMPARE(int id) { super(id); } public ASTCOMPARE(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=293b662dd68f567a1f0f972651310eac (do not edit this line) */
1,959
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTMATCHES.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTMATCHES.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTMATCHES extends SimpleNode { public ASTMATCHES(int id) { super(id); } public ASTMATCHES(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=db244b83ab6cf6833b7dbd96aea93a2c (do not edit this line) */
1,960
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/parser/ASTSTRING.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Generated By:JJTree: Do not edit this line. ASTSTRING.java Version 6.1 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.netflix.metacat.common.server.partition.parser; public class ASTSTRING extends SimpleNode { public ASTSTRING(int id) { super(id); } public ASTSTRING(PartitionParser p, int id) { super(p, id); } /** Accept the visitor. **/ public Object jjtAccept(PartitionParserVisitor visitor, Object data) { return visitor.visit(this, data); } } /* JavaCC - OriginalChecksum=8d75dfe50ee57545277a64f4f0a63221 (do not edit this line) */
1,961
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/visitor/PartitionParserEval.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.visitor; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.netflix.metacat.common.server.partition.parser.ASTAND; import com.netflix.metacat.common.server.partition.parser.ASTBETWEEN; import com.netflix.metacat.common.server.partition.parser.ASTBOOLEAN; import com.netflix.metacat.common.server.partition.parser.ASTCOMPARE; import com.netflix.metacat.common.server.partition.parser.ASTEQ; import com.netflix.metacat.common.server.partition.parser.ASTFILTER; import com.netflix.metacat.common.server.partition.parser.ASTGT; import com.netflix.metacat.common.server.partition.parser.ASTGTE; import com.netflix.metacat.common.server.partition.parser.ASTIN; import com.netflix.metacat.common.server.partition.parser.ASTLIKE; import com.netflix.metacat.common.server.partition.parser.ASTLT; import com.netflix.metacat.common.server.partition.parser.ASTLTE; import com.netflix.metacat.common.server.partition.parser.ASTMATCHES; import com.netflix.metacat.common.server.partition.parser.ASTNEQ; import com.netflix.metacat.common.server.partition.parser.ASTNOT; import com.netflix.metacat.common.server.partition.parser.ASTNULL; import com.netflix.metacat.common.server.partition.parser.ASTNUM; import com.netflix.metacat.common.server.partition.parser.ASTOR; import com.netflix.metacat.common.server.partition.parser.ASTSTRING; import com.netflix.metacat.common.server.partition.parser.ASTVAR; import com.netflix.metacat.common.server.partition.parser.PartitionParserVisitor; import com.netflix.metacat.common.server.partition.parser.SimpleNode; import com.netflix.metacat.common.server.partition.parser.Variable; import java.math.BigDecimal; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Partition Expression Visitor. */ public class PartitionParserEval implements PartitionParserVisitor { /** Like patterns. */ public static final Pattern LIKE_PATTERN = Pattern.compile("(\\[%\\]|\\[_\\]|\\[\\[\\]|%|_)"); /** LIKE to Regex token replacements. */ public static final Map<String, String> LIKE_TO_REGEX_REPLACEMENTS = new ImmutableMap.Builder<String, String>() .put("[%]", "%") .put("[_]", "_") .put("[[]", "[") .put("%", ".*") .put("_", ".").build(); /** Compare enum. */ public enum Compare { /** Compare. */ EQ("="), GT(">"), GTE(">="), LT("<"), LTE("<="), NEQ("!="), MATCHES("MATCHES"), LIKE("LIKE"); private String expression; Compare(final String expression) { this.expression = expression; } public String getExpression() { return expression; } } private Map<String, String> context; /** * Constructor. */ public PartitionParserEval() { this(Maps.newHashMap()); } /** * Constructor. * @param context context parameters */ public PartitionParserEval(final Map<String, String> context) { this.context = context; } /** * Compares. * @param node node in the tree * @param data data * @return comparison result */ public Boolean evalCompare(final SimpleNode node, final Object data) { final Object value1 = node.jjtGetChild(0).jjtAccept(this, data); final Compare comparison = (Compare) node.jjtGetChild(1).jjtAccept(this, data); final Object value2 = node.jjtGetChild(2).jjtAccept(this, data); return compare(comparison, value1, value2); } /** * Compare value1 and value2. * @param comparison comparison expression * @param value1 value * @param value2 value * @return comparison result */ @SuppressWarnings({ "unchecked", "rawtypes", "checkstyle:methodname" }) public boolean compare(final Compare comparison, final Object value1, final Object value2) { if (value1 == null) { switch (comparison) { case EQ: case MATCHES: case LIKE: return value2 == null; case NEQ: return value2 != null; default: return false; } } if (value2 instanceof String) { return _compare(comparison, value1.toString(), value2.toString()); } if (value2 instanceof BigDecimal) { final BigDecimal valueDecimal = new BigDecimal(value1.toString()); return _compare(comparison, valueDecimal, (BigDecimal) value2); } if (value1 instanceof Comparable && value2 instanceof Comparable) { return _compare(comparison, (Comparable) value1, (Comparable) value2); } throw new IllegalStateException("error processing partition filter"); } @SuppressWarnings({ "unchecked", "rawtypes", "checkstyle:methodname" }) private boolean _compare(final Compare comparison, final Comparable value1, final Comparable value2) { if (comparison.equals(Compare.MATCHES) || comparison.equals(Compare.LIKE)) { if (value2 != null) { String value = value2.toString(); if (comparison.equals(Compare.LIKE)) { value = sqlLiketoRegexExpression(value); } return value1.toString().matches(value); } } else { final int compare = value1.compareTo(value2); switch (comparison) { case GT: return compare > 0; case GTE: return compare >= 0; case LT: return compare < 0; case LTE: return compare <= 0; case EQ: return compare == 0; case NEQ: return compare != 0; default: return false; } } return false; } //TODO: Need to escape regex meta characters protected String sqlLiketoRegexExpression(final String likeExpression) { final Matcher m = LIKE_PATTERN.matcher(likeExpression); final StringBuffer builder = new StringBuffer(); while (m.find()) { m.appendReplacement(builder, LIKE_TO_REGEX_REPLACEMENTS.get(m.group())); } m.appendTail(builder); return builder.toString(); } @Override public Object visit(final ASTAND node, final Object data) { final Boolean v1 = (Boolean) node.jjtGetChild(0).jjtAccept(this, data); return v1 && (Boolean) node.jjtGetChild(1).jjtAccept(this, data); } @Override public Object visit(final ASTEQ node, final Object data) { return Compare.EQ; } @Override public Object visit(final ASTBETWEEN node, final Object data) { final Object value = node.jjtGetChild(0).jjtAccept(this, data); final Object startValue = node.jjtGetChild(1).jjtAccept(this, data); final Object endValue = node.jjtGetChild(2).jjtAccept(this, data); final boolean compare1 = compare(Compare.GTE, value, startValue); final boolean compare2 = compare(Compare.LTE, value, endValue); final boolean result = compare1 && compare2; return node.not != result; } @Override public Object visit(final ASTIN node, final Object data) { Object value = node.jjtGetChild(0).jjtAccept(this, data); boolean result = false; for (int i = 1; i < node.jjtGetNumChildren(); i++) { final Object inValue = node.jjtGetChild(i).jjtAccept(this, data); if (value != null && inValue instanceof BigDecimal) { value = new BigDecimal(value.toString()); } if ((value == null && inValue == null) || (value != null && value.equals(inValue))) { result = true; break; } } return node.not != result; } @Override public Object visit(final ASTCOMPARE node, final Object data) { if (node.jjtGetNumChildren() == 1) { return evalSingleTerm(node, data); } else { return evalCompare(node, data); } } private Boolean evalSingleTerm(final ASTCOMPARE node, final Object data) { Boolean result = Boolean.FALSE; final Object value = node.jjtGetChild(0).jjtAccept(this, data); if (value != null) { result = Boolean.parseBoolean(value.toString()); } return result; } @Override public Object visit(final ASTBOOLEAN node, final Object data) { return Boolean.parseBoolean(node.jjtGetValue().toString()); } @Override public Object visit(final ASTFILTER node, final Object data) { return node.jjtGetChild(0).jjtAccept(this, data); } @Override public Object visit(final ASTGT node, final Object data) { return Compare.GT; } @Override public Object visit(final ASTGTE node, final Object data) { return Compare.GTE; } @Override public Object visit(final ASTLT node, final Object data) { return Compare.LT; } @Override public Object visit(final ASTLTE node, final Object data) { return Compare.LTE; } @Override public Object visit(final ASTNEQ node, final Object data) { return Compare.NEQ; } @Override public Object visit(final ASTMATCHES node, final Object data) { return Compare.MATCHES; } @Override public Object visit(final ASTLIKE node, final Object data) { final Object value1 = node.jjtGetChild(0).jjtAccept(this, data); final Object value2 = node.jjtGetChild(1).jjtAccept(this, data); final boolean result = compare(Compare.LIKE, value1, value2); return node.not != result; } @Override public Object visit(final ASTNULL node, final Object data) { final Object value = node.jjtGetChild(0).jjtAccept(this, data); return node.not != (value == null); } @Override public Object visit(final ASTNUM node, final Object data) { return node.jjtGetValue(); } @Override public Object visit(final ASTOR node, final Object data) { final Boolean v1 = (Boolean) node.jjtGetChild(0).jjtAccept(this, data); return v1 || (Boolean) node.jjtGetChild(1).jjtAccept(this, data); } @Override public Object visit(final ASTNOT node, final Object data) { return !(Boolean) node.jjtGetChild(0).jjtAccept(this, data); } @Override public Object visit(final ASTSTRING node, final Object data) { return node.jjtGetValue(); } @Override public Object visit(final ASTVAR node, final Object data) { if (!context.containsKey(((Variable) node.jjtGetValue()).getName())) { throw new IllegalArgumentException("Missing variable: " + ((Variable) node.jjtGetValue()).getName()); } return context.get(((Variable) node.jjtGetValue()).getName()); } @Override public Object visit(final SimpleNode node, final Object data) { return null; } }
1,962
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/visitor/PartitionKeyParserEval.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.visitor; import com.google.common.collect.Sets; import com.netflix.metacat.common.server.partition.parser.ASTAND; import com.netflix.metacat.common.server.partition.parser.ASTBETWEEN; import com.netflix.metacat.common.server.partition.parser.ASTCOMPARE; import com.netflix.metacat.common.server.partition.parser.ASTEQ; import com.netflix.metacat.common.server.partition.parser.ASTIN; import com.netflix.metacat.common.server.partition.parser.ASTLIKE; import com.netflix.metacat.common.server.partition.parser.ASTNOT; import com.netflix.metacat.common.server.partition.parser.ASTNULL; import com.netflix.metacat.common.server.partition.parser.ASTOR; import com.netflix.metacat.common.server.partition.parser.ASTVAR; import com.netflix.metacat.common.server.partition.parser.SimpleNode; import com.netflix.metacat.common.server.partition.parser.Variable; import com.netflix.metacat.common.server.partition.util.PartitionUtil; import java.util.Collection; import java.util.HashSet; import java.util.Set; /** * Partition key evaluation. */ public class PartitionKeyParserEval extends PartitionParserEval { /** * Evaluate the expression. * @param node node in the expression tree * @param data data * @return Evaluated string */ public String evalString(final SimpleNode node, final Object data) { final Object value1 = node.jjtGetChild(0).jjtAccept(this, data); final Compare comparison = (Compare) node.jjtGetChild(1).jjtAccept(this, data); final Object value2 = node.jjtGetChild(2).jjtAccept(this, data); if (comparison != Compare.EQ) { return null; } return String.format("%s=%s", value1, toValue(value2)); } /** * Converts to String. * @param value value object * @return String */ protected String toValue(final Object value) { return value == null ? PartitionUtil.DEFAULT_PARTITION_NAME : value.toString(); } @SuppressWarnings("unchecked") @Override public Object visit(final ASTAND node, final Object data) { final Collection v1 = (Collection) node.jjtGetChild(0).jjtAccept(this, data); final Object b = node.jjtGetChild(1).jjtAccept(this, data); v1.addAll((Collection) b); return v1; } @Override public Object visit(final ASTEQ node, final Object data) { return Compare.EQ; } @Override public Object visit(final ASTCOMPARE node, final Object data) { Set<String> result = Sets.newHashSet(); if (node.jjtGetNumChildren() == 3) { final String value = evalString(node, data); if (value != null) { result = Sets.newHashSet(value); } } return result; } @Override public Object visit(final ASTOR node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTBETWEEN node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTIN node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTLIKE node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTNOT node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTNULL node, final Object data) { return new HashSet<String>(); } @Override public Object visit(final ASTVAR node, final Object data) { return ((Variable) node.jjtGetValue()).getName(); } }
1,963
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/visitor/PartitionParamParserEval.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.partition.visitor; import com.netflix.metacat.common.server.partition.parser.SimpleNode; /** * Partition param evaluation. */ public class PartitionParamParserEval extends PartitionKeyParserEval { @Override public String evalString(final SimpleNode node, final Object data) { final Object value1 = node.jjtGetChild(0).jjtAccept(this, data); if (!"dateCreated".equals(value1)) { return null; } final Compare comparison = (Compare) node.jjtGetChild(1).jjtAccept(this, data); final Object value2 = node.jjtGetChild(2).jjtAccept(this, data); return String.format("%s%s%s", value1, comparison.getExpression(), value2.toString()); } }
1,964
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/partition/visitor/package-info.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Includes visitor classes. * * @author amajumdar */ package com.netflix.metacat.common.server.partition.visitor;
1,965
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/monitoring/package-info.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * Includes utility classes for servo classes. * * @author amajumdar */ package com.netflix.metacat.common.server.monitoring;
1,966
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/monitoring/Metrics.java
/* * Copyright 2016 Netflix, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.monitoring; import com.google.common.collect.ImmutableMap; import lombok.Getter; import java.util.Map; //CHECKSTYLE:OFF /** * Metric measures. * * @author zhenl * @since 1.0.0 */ @Getter public enum Metrics { /** * Events. */ CounterEventPublish(Component.events, Type.counter, "publish"), /** * thrift request. */ CounterThrift(Component.thrift, Type.counter, "request"), /** * DistributionSummary. */ DistributionSummaryAddPartitions(Component.partionservice, Type.distributionSummary, "partitionAdd"), DistributionSummaryMetadataOnlyAddPartitions(Component.partionservice, Type.distributionSummary, "partitionMetadataOnlyAdd"), DistributionSummaryGetPartitions(Component.partionservice, Type.distributionSummary, "partitionGet"), DistributionSummaryDeletePartitions(Component.partionservice, Type.distributionSummary, "partitionDelete"), /** * metacat request. */ CounterRequestCount(Component.server, Type.counter, "request"), CounterRequestFailureCount(Component.server, Type.counter, "requestfailure"), CounterTransactionRetryFailure(Component.server, Type.counter, "transactionRetryFailure"), CounterDeleteMetaData(Component.server, Type.counter, "deleteMetadata"), CounterCatalogTraversal(Component.server, Type.counter, "catalogTraversal"), CounterCatalogTraversalAlreadyRunning(Component.server, Type.counter, "catalogTraversalAlreadyRunning"), CounterCatalogTraversalCatalogReadFailed(Component.server, Type.counter, "catalogTraversalCatalogReadFailed"), CounterCatalogTraversalDatabaseReadFailed(Component.server, Type.counter, "catalogTraversalDatabaseReadFailed"), CounterCatalogTraversalTableReadFailed(Component.server, Type.counter, "catalogTraversalTableReadFailed"), CounterTableUpdateIgnoredException(Component.tableservice, Type.counter, "tableUpdateIgnoredException"), CounterTableCreateIgnoredException(Component.tableservice, Type.counter, "tableCreateIgnoredException"), CounterRequestRateLimitExceededCount(Component.server, Type.counter, "requestRateLimitExceeded"), /** * Notifications. */ CounterSNSNotificationPartitionAdd(Component.notifications, Type.counter, "partitionsAdd"), CounterSNSNotificationPartitionLatestDeleteColumnAdd(Component.notifications, Type.counter, "partitionsLatestDeleteColumnAdd"), CounterSNSNotificationTablePartitionAdd(Component.notifications, Type.counter, "table.partitionsAdd"), CounterSNSNotificationPartitionDelete(Component.notifications, Type.counter, "partitionsDelete"), CounterSNSNotificationTablePartitionDelete(Component.notifications, Type.counter, "table.partitionsDelete"), CounterSNSNotificationTableCreate(Component.notifications, Type.counter, "table.Create"), CounterSNSNotificationTableDelete(Component.notifications, Type.counter, "table.Delete"), CounterSNSNotificationTableRename(Component.notifications, Type.counter, "table.Rename"), CounterSNSNotificationTableUpdate(Component.notifications, Type.counter, "table.Update"), CounterSNSNotificationPublishMessageSizeExceeded(Component.notifications, Type.counter, "publish.message.size.exceeded"), CounterSNSNotificationPublishFallback(Component.notifications, Type.counter, "publish.fallback"), CounterSNSNotificationPublishPartitionIdNumberExceeded(Component.notifications, Type.counter, "publish.partitionid.number.exceeded"), /** * ElasticSearch. */ TimerElasticSearchEventsDelay(Component.elasticsearch, Type.timer, "events.delay"), TimerElasticSearchDatabaseCreate(Component.elasticsearch, Type.timer, "databaseCreate"), TimerElasticSearchDatabaseDelete(Component.elasticsearch, Type.timer, "databaseDelete"), TimerElasticSearchTableCreate(Component.elasticsearch, Type.timer, "tableCreate"), TimerElasticSearchTableDelete(Component.elasticsearch, Type.timer, "tableDelete"), TimerElasticSearchTableSave(Component.elasticsearch, Type.timer, "tableSave"), TimerElasticSearchTableRename(Component.elasticsearch, Type.timer, "tableRename"), TimerElasticSearchTableUpdate(Component.elasticsearch, Type.timer, "tableUpdate"), TimerElasticSearchPartitionSave(Component.elasticsearch, Type.timer, "partitionSave"), TimerElasticSearchPartitionDelete(Component.elasticsearch, Type.timer, "partitionDelete"), CounterElasticSearchDelete(Component.elasticsearch, Type.counter, "esDelete"), CounterElasticSearchBulkDelete(Component.elasticsearch, Type.counter, "esBulkDelete"), CounterElasticSearchUpdate(Component.elasticsearch, Type.counter, "esUpdate"), CounterElasticSearchBulkUpdate(Component.elasticsearch, Type.counter, "esBulkUpdate"), CounterElasticSearchSave(Component.elasticsearch, Type.counter, "esSave"), CounterElasticSearchBulkSave(Component.elasticsearch, Type.counter, "esBulkSave"), CounterElasticSearchLog(Component.elasticsearch, Type.counter, "esLog"), CounterElasticSearchRefresh(Component.elasticsearch, Type.counter, "esRefresh"), CounterElasticSearchRefreshAlreadyRunning(Component.elasticsearch, Type.counter, "esRefreshAlreadyRunning"), CounterElasticSearchUnmarkedDatabaseThreshholdReached(Component.elasticsearch, Type.counter, "unmarkedDatabasesThresholdReached"), CounterElasticSearchUnmarkedTableThreshholdReached(Component.elasticsearch, Type.counter, "unmarkedTablesThresholdReached"), /** * Jdbc Interceptor */ GaugeConnectionsTotal(Component.jdbcinterceptor, Type.gauge, "connections.total"), GaugeConnectionsActive(Component.jdbcinterceptor, Type.gauge, "connections.active"), GaugeConnectionsIdle(Component.jdbcinterceptor, Type.gauge, "connections.idle"), /** * Timers. */ TimerRequest(Component.server, Type.timer, "requests"), TimerThriftRequest(Component.server, Type.timer, "requests"), TimerElasticSearchRefresh(Component.server, Type.timer, "esRefresh"), TimerCatalogTraversal(Component.server, Type.timer, "catalogTraversal"), TimerNotificationsPublishDelay(Component.server, Type.timer, "publish.delay"), TimerNotificationsBeforePublishDelay(Component.server, Type.timer, "before.publish.delay"), TimerSavePartitionMetadata(Component.partionservice, Type.timer, "savePartitionMetadata"), TimerSaveTableMetadata(Component.tableservice, Type.timer, "saveTableMetadata"), TagEventsType("metacat.events.type"); public final static Map<String, String> tagStatusSuccessMap = ImmutableMap.of("status", "success"); public final static Map<String, String> tagStatusFailureMap = ImmutableMap.of("status", "failure"); enum Type { counter, gauge, timer, distributionSummary } enum Component { metacat, events, thrift, server, notifications, tableservice, partionservice, elasticsearch, jdbcinterceptor } private final String metricName; Metrics(final Component component, final Type type, final String measure) { this.metricName = Component.metacat.name() + "." + component.name() + "." + type.name() + "." + measure; } Metrics(final String tagName) { this.metricName = tagName; } @Override public String toString() { return metricName; } }
1,967
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateMViewPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * Post create metacat view event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateMViewPostEvent extends MetacatEvent { private final TableDto table; private final String filter; private final Boolean snapshot; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info * @param snapshot snapshot * @param filter filter */ public MetacatCreateMViewPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table, final Boolean snapshot, @Nullable final String filter ) { super(name, requestContext, source); this.table = table; this.snapshot = snapshot; this.filter = filter; } }
1,968
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteDatabasePreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.DatabaseDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre database delete event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteDatabasePreEvent extends MetacatEvent { private final DatabaseDto database; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param database database info */ public MetacatDeleteDatabasePreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final DatabaseDto database ) { super(name, requestContext, source); this.database = database; } }
1,969
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteMViewPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post delete view event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteMViewPostEvent extends MetacatEvent { private final TableDto table; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info */ public MetacatDeleteMViewPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table ) { super(name, requestContext, source); this.table = table; } }
1,970
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateTablePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post create table event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateTablePostEvent extends MetacatEvent { private final TableDto table; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info */ public MetacatCreateTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table ) { super(name, requestContext, source); this.table = table; } }
1,971
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatApplicationEventMulticaster.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.google.common.collect.Maps; import com.netflix.metacat.common.server.properties.MetacatProperties; import com.netflix.metacat.common.server.util.RegistryUtil; import com.netflix.spectator.api.Registry; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ApplicationEventMulticaster; import org.springframework.context.event.SimpleApplicationEventMulticaster; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.Map; /** * Event bus implementation using Springs Event Multicaster. By default, Spring supports synchronous event publishing. * This implementation supports both synchronous and asynchronous event publishing. If the listener is annotated with * AsyncListener, the event will be published asynchronously using a separate executor pool. * This implementation should be used as the application event multicaster in the Springs context. * Synchronous publishing of events is handled by this class and the asynchronous publishing of events is handled by * the asyncEventMulticaster. * * @author amajumdar * @since 1.1.x */ @Slf4j public class MetacatApplicationEventMulticaster extends SimpleApplicationEventMulticaster { //Map of event multicasters keyed by the listener class name. private final Map<String, ApplicationEventMulticaster> asyncEventMulticasters = Maps.newHashMap(); private final Registry registry; private final MetacatProperties metacatProperties; /** * Constructor. * * @param registry registry for spectator * @param metacatProperties The metacat properties to get number of executor threads from. * Likely best to do one more than number of CPUs */ public MetacatApplicationEventMulticaster(final Registry registry, final MetacatProperties metacatProperties) { super(); this.registry = registry; this.metacatProperties = metacatProperties; } /** * Post event. Events will be handles synchronously or asynchronously based on the listener annotation. * * @param event event */ public void post(final ApplicationEvent event) { super.multicastEvent(event); asyncEventMulticasters.values().forEach(aem -> aem.multicastEvent(event)); } @Override public void addApplicationListener(final ApplicationListener listener) { if (isAsyncListener(listener)) { final Class<?> clazz = getListenerTargetClass(listener); final String clazzName = clazz.getName(); if (!asyncEventMulticasters.containsKey(clazzName)) { // Using simple name of the class to use for registering it with registry. // There is a chance of name collision if two class names are the same under different packages. asyncEventMulticasters.put(clazzName, createApplicationEventMultiCaster(clazz.getSimpleName())); } asyncEventMulticasters.get(clazzName).addApplicationListener(listener); } else { super.addApplicationListener(listener); } } private boolean isAsyncListener(final ApplicationListener listener) { return listener.getClass().isAnnotationPresent(AsyncListener.class) || (listener instanceof MetacatApplicationListenerMethodAdapter && ((MetacatApplicationListenerMethodAdapter) listener).getTargetClass() .isAnnotationPresent(AsyncListener.class)); } private Class<?> getListenerTargetClass(final ApplicationListener listener) { return listener instanceof MetacatApplicationListenerMethodAdapter ? ((MetacatApplicationListenerMethodAdapter) listener).getTargetClass() : listener.getClass(); } private ApplicationEventMulticaster createApplicationEventMultiCaster(final String name) { final SimpleApplicationEventMulticaster result = new SimpleApplicationEventMulticaster(); final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(metacatProperties.getEvent().getBus().getExecutor().getThread().getCount()); executor.initialize(); RegistryUtil.registerThreadPool(registry, "metacat.event.pool." + name, executor.getThreadPoolExecutor()); result.setTaskExecutor(executor); return result; } @Override public void removeApplicationListener(final ApplicationListener listener) { super.removeApplicationListener(listener); asyncEventMulticasters.values().forEach(aem -> aem.removeApplicationListener(listener)); } @Override public void removeAllListeners() { super.removeAllListeners(); asyncEventMulticasters.values().forEach(ApplicationEventMulticaster::removeAllListeners); } }
1,972
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteTablePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post table delete event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteTablePostEvent extends MetacatEvent { private final TableDto table; private final boolean isMView; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info */ public MetacatDeleteTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table ) { this(name, requestContext, source, table, false); } /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info * @param isMView true, if the table is a materialized view */ public MetacatDeleteTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table, final boolean isMView ) { super(name, requestContext, source); this.table = table; this.isMView = isMView; } }
1,973
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatSaveTablePartitionPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre table partition save event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatSaveTablePartitionPreEvent extends MetacatEvent { private final PartitionsSaveRequestDto saveRequest; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param saveRequest request */ public MetacatSaveTablePartitionPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final PartitionsSaveRequestDto saveRequest ) { super(name, requestContext, source); this.saveRequest = saveRequest; } }
1,974
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatUpdateDatabasePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post database update event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatUpdateDatabasePostEvent extends MetacatEvent { /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event */ public MetacatUpdateDatabasePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source ) { super(name, requestContext, source); } }
1,975
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteTablePartitionPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre table partition delete event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteTablePartitionPreEvent extends MetacatEvent { private final PartitionsSaveRequestDto saveRequest; /** * Constructor. * * @param name name * @param metacatRequestContext context * @param source The source object which threw this event * @param saveRequest request */ public MetacatDeleteTablePartitionPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext metacatRequestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final PartitionsSaveRequestDto saveRequest ) { super(name, metacatRequestContext, source); this.saveRequest = saveRequest; } }
1,976
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatSaveMViewPartitionPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; /** * Post partition save event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatSaveMViewPartitionPostEvent extends MetacatEvent { private final List<PartitionDto> partitions; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param partitions partitions */ public MetacatSaveMViewPartitionPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final List<PartitionDto> partitions ) { super(name, requestContext, source); this.partitions = Collections.unmodifiableList(partitions); } }
1,977
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatUpdateIcebergTablePostEvent.java
package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; /** * Event fired after an Iceberg table has been updated. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatUpdateIcebergTablePostEvent extends MetacatEvent { private final TableDto oldTable; private final TableDto requestTable; /** * Constructor. * * @param name The name of the Table. * @param requestContext The request context. * @param source The source of this event. * @param oldTable The old Table instance. * @param requestTable The TableDto instance sent in the request. */ public MetacatUpdateIcebergTablePostEvent( final QualifiedName name, final MetacatRequestContext requestContext, final Object source, @NonNull final TableDto oldTable, @NonNull final TableDto requestTable ) { super(name, requestContext, source); this.oldTable = oldTable; this.requestTable = requestTable; } }
1,978
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatSaveMViewPartitionPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre view partition save event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatSaveMViewPartitionPreEvent extends MetacatEvent { private final PartitionsSaveRequestDto saveRequest; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param saveRequest request */ public MetacatSaveMViewPartitionPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final PartitionsSaveRequestDto saveRequest ) { super(name, requestContext, source); this.saveRequest = saveRequest; } }
1,979
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteMViewPartitionPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteMViewPartitionPreEvent extends MetacatEvent { private final PartitionsSaveRequestDto saveRequest; /** * Constructor. * * @param name name * @param metacatRequestContext context * @param source The source object which threw this event * @param saveRequest request */ public MetacatDeleteMViewPartitionPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext metacatRequestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final PartitionsSaveRequestDto saveRequest ) { super(name, metacatRequestContext, source); this.saveRequest = saveRequest; } }
1,980
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteTablePartitionPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; /** * Post table partition delete event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteTablePartitionPostEvent extends MetacatEvent { private final List<String> partitionIds; private final List<PartitionDto> partitions; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param partitions partition dtos */ public MetacatDeleteTablePartitionPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final List<PartitionDto> partitions ) { super(name, requestContext, source); this.partitions = Collections.unmodifiableList(partitions); this.partitionIds = partitions.stream() .map(dto -> dto.getName().getPartitionName()).collect(Collectors.toList()); } }
1,981
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateDatabasePreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre create database event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateDatabasePreEvent extends MetacatEvent { /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event */ public MetacatCreateDatabasePreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source ) { super(name, requestContext, source); } }
1,982
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatUpdateDatabasePreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre database update event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatUpdateDatabasePreEvent extends MetacatEvent { /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event */ public MetacatUpdateDatabasePreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source ) { super(name, requestContext, source); } }
1,983
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateDatabasePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.DatabaseDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post create database event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateDatabasePostEvent extends MetacatEvent { private final DatabaseDto database; /** * Constructor. * * @param name name * @param requestContext request context * @param source The source object which threw this event * @param database database info */ public MetacatCreateDatabasePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final DatabaseDto database ) { super(name, requestContext, source); this.database = database; } }
1,984
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatRenameMViewPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post rename view event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatRenameMViewPostEvent extends MetacatEvent { /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event */ public MetacatRenameMViewPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source ) { super(name, requestContext, source); } }
1,985
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateTablePreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre create table event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateTablePreEvent extends MetacatEvent { private final TableDto table; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info */ public MetacatCreateTablePreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table ) { super(name, requestContext, source); this.table = table; } }
1,986
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatSaveTablePartitionMetadataOnlyPostEvent.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionDto; import com.netflix.metacat.common.dto.PartitionsSaveResponseDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import java.util.List; /** * Metacat save table partition metadata only post event. * * @author zhenl * @since 1.2.0 */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatSaveTablePartitionMetadataOnlyPostEvent extends MetacatEvent { private final List<PartitionDto> partitions; private final PartitionsSaveResponseDto partitionsSaveResponse; /** * Constructor. * * @param name name * @param metacatRequestContext context * @param source The source object which threw this event * @param partitions partitions * @param partitionsSaveResponse response */ public MetacatSaveTablePartitionMetadataOnlyPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext metacatRequestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final List<PartitionDto> partitions, @Nonnull @NonNull final PartitionsSaveResponseDto partitionsSaveResponse ) { super(name, metacatRequestContext, source); this.partitions = partitions; this.partitionsSaveResponse = partitionsSaveResponse; } }
1,987
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatRenameTablePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post table rename event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatRenameTablePostEvent extends MetacatEvent { private final TableDto currentTable; private final TableDto oldTable; private final boolean isMView; /** * Constructor. * * @param name The old name of the table * @param requestContext The metacat request context * @param source The source object which threw this event * @param oldTable The old dto of the table * @param currentTable The new representation of the table */ public MetacatRenameTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto oldTable, @Nonnull @NonNull final TableDto currentTable ) { this(name, requestContext, source, oldTable, currentTable, false); } /** * Constructor. * * @param name The old name of the table * @param requestContext The metacat request context * @param source The source object which threw this event * @param oldTable The old dto of the table * @param currentTable The new representation of the table * @param isMView true, if the table is a materialized view */ public MetacatRenameTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto oldTable, @Nonnull @NonNull final TableDto currentTable, final boolean isMView ) { super(name, requestContext, source); this.oldTable = oldTable; this.currentTable = currentTable; this.isMView = isMView; } }
1,988
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatEventBus.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.server.monitoring.Metrics; import com.netflix.spectator.api.Counter; import com.netflix.spectator.api.Registry; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationEvent; import javax.annotation.Nonnull; /** * Event bus. * * @author amajumdar * @author tgianos * @since 0.x */ @Slf4j public class MetacatEventBus { private final MetacatApplicationEventMulticaster applicationEventMulticaster; private final Counter eventPublishCounter; /** * Constructor. * * @param applicationEventMulticaster The event multicaster to use * @param registry The registry to spectator */ public MetacatEventBus( @Nonnull @NonNull final MetacatApplicationEventMulticaster applicationEventMulticaster, @Nonnull @NonNull final Registry registry ) { this.applicationEventMulticaster = applicationEventMulticaster; this.eventPublishCounter = registry.counter(Metrics.CounterEventPublish.getMetricName()); } /** * Post event. * * @param event event */ public void post(final ApplicationEvent event) { log.debug("Received request to post an event {}", event); this.eventPublishCounter.increment(); this.applicationEventMulticaster.post(event); } }
1,989
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/AsyncListener.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.events; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to mark a listener class whose methods will be processed asynchronously by the event bus. * * @author amajumdar */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface AsyncListener { }
1,990
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatCreateMViewPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * Pre create view event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatCreateMViewPreEvent extends MetacatEvent { private final String filter; private final Boolean snapshot; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param snapshot snapshot * @param filter filter */ public MetacatCreateMViewPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, final Boolean snapshot, @Nullable final String filter ) { super(name, requestContext, source); this.snapshot = snapshot; this.filter = filter; } }
1,991
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatUpdateTablePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post table update event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatUpdateTablePostEvent extends MetacatEvent { private TableDto oldTable; private TableDto currentTable; private boolean isLatestCurrentTable; /** * Constructor. * * @param name The name of the table that was updated * @param requestContext The metacat request context * @param source The source object which threw this event * @param oldTable The old DTO representation of the table * @param currentTable The current DTO representation of the table */ public MetacatUpdateTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto oldTable, @Nonnull @NonNull final TableDto currentTable ) { this(name, requestContext, source, oldTable, currentTable, true); } /** * Constructor. * * @param name The name of the table that was updated * @param requestContext The metacat request context * @param source The source object which threw this event * @param oldTable The old DTO representation of the table * @param currentTable The current DTO representation of the table * @param isLatestCurrentTable Whether the current table was successfully refreshed post-update */ public MetacatUpdateTablePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto oldTable, @Nonnull @NonNull final TableDto currentTable, final boolean isLatestCurrentTable ) { super(name, requestContext, source); this.oldTable = oldTable; this.currentTable = currentTable; this.isLatestCurrentTable = isLatestCurrentTable; } }
1,992
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatRenameTablePreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre table rename event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatRenameTablePreEvent extends MetacatEvent { private final QualifiedName newName; /** * Constructor. * * @param name name. * @param requestContext context * @param source The source object which threw this event * @param newName new name */ public MetacatRenameTablePreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final QualifiedName newName ) { super(name, requestContext, source); this.newName = newName; } }
1,993
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteMViewPartitionPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; /** * Post delete view partition event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteMViewPartitionPostEvent extends MetacatEvent { private final List<String> partitionIds; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param partitionIds partition names */ public MetacatDeleteMViewPartitionPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final List<String> partitionIds ) { super(name, requestContext, source); this.partitionIds = Collections.unmodifiableList(partitionIds); } }
1,994
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatSaveTablePartitionMetadataOnlyPreEvent.java
/* * * Copyright 2017 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.PartitionsSaveRequestDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Metacat save table partition metadata only pre event. * * @author zhenl * @since 1.2.0 */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatSaveTablePartitionMetadataOnlyPreEvent extends MetacatEvent { private final PartitionsSaveRequestDto saveRequest; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param saveRequest request */ public MetacatSaveTablePartitionMetadataOnlyPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final PartitionsSaveRequestDto saveRequest ) { super(name, requestContext, source); this.saveRequest = saveRequest; } }
1,995
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatDeleteDatabasePostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.DatabaseDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post delete database event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatDeleteDatabasePostEvent extends MetacatEvent { private final DatabaseDto database; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param database database info */ public MetacatDeleteDatabasePostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final DatabaseDto database ) { super(name, requestContext, source); this.database = database; } }
1,996
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatApplicationListenerMethodAdapter.java
/* * Copyright 2018 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.metacat.common.server.events; import org.springframework.context.event.ApplicationListenerMethodAdapter; import java.lang.reflect.Method; /** * This class has been introduced to get access to the targetClass in ApplicationListenerMethodAdapter. * * @author amajumdar * @since 1.2.x */ public class MetacatApplicationListenerMethodAdapter extends ApplicationListenerMethodAdapter { private final Class<?> targetClass; /** * Constructor. * @param beanName bean name * @param targetClass bean class * @param method bean method */ public MetacatApplicationListenerMethodAdapter(final String beanName, final Class<?> targetClass, final Method method) { super(beanName, targetClass, method); this.targetClass = targetClass; } public Class<?> getTargetClass() { return targetClass; } }
1,997
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatRenameMViewPreEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Pre view rename event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatRenameMViewPreEvent extends MetacatEvent { /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event */ public MetacatRenameMViewPreEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source ) { super(name, requestContext, source); } }
1,998
0
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/events/MetacatUpdateMViewPostEvent.java
/* * * Copyright 2016 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.netflix.metacat.common.server.events; import com.netflix.metacat.common.MetacatRequestContext; import com.netflix.metacat.common.QualifiedName; import com.netflix.metacat.common.dto.TableDto; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NonNull; import lombok.ToString; import javax.annotation.Nonnull; /** * Post view update event. */ @Getter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class MetacatUpdateMViewPostEvent extends MetacatEvent { private final TableDto table; /** * Constructor. * * @param name name * @param requestContext context * @param source The source object which threw this event * @param table table info */ public MetacatUpdateMViewPostEvent( @Nonnull @NonNull final QualifiedName name, @Nonnull @NonNull final MetacatRequestContext requestContext, @Nonnull @NonNull final Object source, @Nonnull @NonNull final TableDto table ) { super(name, requestContext, source); this.table = table; } }
1,999