index
int64 0
0
| repo_id
stringlengths 26
205
| file_path
stringlengths 51
246
| content
stringlengths 8
433k
| __index_level_0__
int64 0
10k
|
---|---|---|---|---|
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/model/AuditInfo.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.connectors.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* Audit information.
*
* @author amajumdar
* @since 1.0.0
*/
@SuppressWarnings("unused")
@Data
@EqualsAndHashCode(callSuper = false)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AuditInfo implements Serializable {
private static final long serialVersionUID = -4683417661637244309L;
/* Created By */
private String createdBy;
/* Created date */
private Date createdDate;
/* Last modified by */
private String lastModifiedBy;
/* Last modified date */
private Date lastModifiedDate;
}
| 9,800 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/model/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 and interfaces related to model objects for catalog connectors.
*
* @author amajumdar
* @since 1.0.0
*/
package com.netflix.metacat.common.server.connectors.model;
| 9,801 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/AlreadyExistsException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import lombok.Getter;
import javax.annotation.Nullable;
/**
* Abstract not found error exception class.
*
* @author zhenl
*/
@Getter
public abstract class AlreadyExistsException extends ConnectorException {
private QualifiedName name;
protected AlreadyExistsException(final QualifiedName name) {
this(name, null);
}
protected AlreadyExistsException(final QualifiedName name, @Nullable final Throwable cause) {
this(name, cause, false, false);
}
protected AlreadyExistsException(
final QualifiedName name,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
this(name, String.format("%s '%s' already exists.", name.getType(), name.toString()),
cause, enableSuppression, writableStackTrace);
}
protected AlreadyExistsException(
final QualifiedName name,
final String message,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
super(message, cause, enableSuppression, writableStackTrace);
this.name = name;
}
}
| 9,802 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/InvalidMetadataException.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.connectors.exception;
/**
* Invalid BusinessMetadata Exception.
* @author zhenl
* @since 1.2.0
*/
public class InvalidMetadataException extends ConnectorException {
/**
* Constructor.
*
* @param message message
*/
public InvalidMetadataException(final String message) {
super(message);
}
}
| 9,803 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/DatabaseAlreadyExistsException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when schema already exists.
*
* @author zhenl
*/
public class DatabaseAlreadyExistsException extends AlreadyExistsException {
/**
* Constructor.
*
* @param databaseName schema name
*/
public DatabaseAlreadyExistsException(final QualifiedName databaseName) {
this(databaseName, null);
}
/**
* Constructor.
*
* @param databaseName schema name
* @param cause error cause
*/
public DatabaseAlreadyExistsException(final QualifiedName databaseName, @Nullable final Throwable cause) {
super(databaseName, cause);
}
}
| 9,804 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/PartitionAlreadyExistsException.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.connectors.exception;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
import java.util.List;
/**
* Exception when partition already exists.
*
* @author zhenl
*/
public class PartitionAlreadyExistsException extends AlreadyExistsException {
private static final Joiner COMMA_JOINER = Joiner.on(',');
/**
* Constructor.
*
* @param tableName table name
* @param partitionName partition name
*/
public PartitionAlreadyExistsException(final QualifiedName tableName, final String partitionName) {
this(tableName, partitionName, null);
}
/**
* Constructor.
*
* @param tableName table name
* @param partitionName partition name
* @param cause error cause
*/
public PartitionAlreadyExistsException(
final QualifiedName tableName,
final String partitionName,
@Nullable final Throwable cause
) {
this(tableName, Lists.newArrayList(partitionName), cause);
}
/**
* Constructor.
*
* @param tableName table name
* @param partitionNames partition names
* @param cause error cause
*/
public PartitionAlreadyExistsException(
final QualifiedName tableName,
final List<String> partitionNames,
@Nullable final Throwable cause
) {
super(tableName,
String.format("One or more of the partitions '%s' already exists for table '%s'",
COMMA_JOINER.join(partitionNames), tableName), cause, false, false);
}
}
| 9,805 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/TableMigrationInProgressException.java
|
package com.netflix.metacat.common.server.connectors.exception;
import com.netflix.metacat.common.exception.MetacatTooManyRequestsException;
/**
* Exception indicating that the table is currently under migration
* and cannot be modified.
*
* Extends MetacatTooManyRequestsException so users can handle a HTTP 429 error code
* to retry with a backoff until migration completes.
*/
public class TableMigrationInProgressException extends MetacatTooManyRequestsException {
/**
* Ctor.
*
* @param reason The exception message.
*/
public TableMigrationInProgressException(final String reason) {
super(reason);
}
}
| 9,806 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/TablePreconditionFailedException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import lombok.Getter;
import javax.annotation.Nullable;
/**
* Exception when table is not found.
*
* @author amajumdar
*/
@Getter
public class TablePreconditionFailedException extends ConnectorException {
// Current metadata location for the table
private final String metadataLocation;
// Provided metadata location
private final String previousMetadataLocation;
/**
* Constructor.
*
* @param name qualified name of the table
* @param message error cause
* @param metadataLocation current metadata location
* @param previousMetadataLocation previous metadata location
*/
public TablePreconditionFailedException(final QualifiedName name,
@Nullable final String message,
final String metadataLocation,
final String previousMetadataLocation) {
super(String.format("Precondition failed to update table %s. %s", name, message));
this.metadataLocation = metadataLocation;
this.previousMetadataLocation = previousMetadataLocation;
}
}
| 9,807 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/InvalidMetaException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when the given information about an entity is invalid.
*
* @author zhenl
*/
public class InvalidMetaException extends ConnectorException {
private QualifiedName tableName;
private String partitionId;
/**
* Constructor.
*
* @param tableName table name
* @param cause error cause
*/
public InvalidMetaException(final QualifiedName tableName, @Nullable final Throwable cause) {
super(String.format("Invalid metadata for %s.", tableName), cause);
this.tableName = tableName;
}
/**
* Constructor.
*
* @param tableName table name
* @param partitionId partition name
* @param cause error cause
*/
public InvalidMetaException(final QualifiedName tableName,
final String partitionId, @Nullable final Throwable cause) {
super(String.format("Invalid metadata for %s for partition %s.", tableName, partitionId), cause);
this.tableName = tableName;
this.partitionId = partitionId;
}
/**
* Constructor.
*
* @param message error message
* @param cause error cause
*/
public InvalidMetaException(final String message, @Nullable final Throwable cause) {
super(message, cause);
}
}
| 9,808 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/ConnectorException.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.connectors.exception;
import javax.annotation.Nullable;
/**
* Connector exception class.
*
* @author zhenl
*/
public class ConnectorException extends RuntimeException {
/**
* Constructor.
*
* @param message message
*/
public ConnectorException(final String message) {
super(message);
}
/**
* Constructor.
*
* @param message message
* @param cause cause
*/
public ConnectorException(final String message, @Nullable final Throwable cause) {
super(message, cause);
}
/**
* Constructor.
*
* @param message message
* @param cause cause
* @param enableSuppression eable suppression
* @param writableStackTrace stacktrace
*/
public ConnectorException(
final String message,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
super(message, cause, enableSuppression, writableStackTrace);
}
/**
* {@inheritDoc}
*/
@Override
public String getMessage() {
String message = super.getMessage();
if (message == null && getCause() != null) {
message = getCause().getMessage();
}
return message;
}
}
| 9,809 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/TableAlreadyExistsException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when schema already exists.
*
* @author zhenl
*/
public class TableAlreadyExistsException extends AlreadyExistsException {
/**
* Constructor.
*
* @param tableName table name
*/
public TableAlreadyExistsException(final QualifiedName tableName) {
this(tableName, null);
}
/**
* Constructor.
*
* @param tableName table name
* @param cause error cause
*/
public TableAlreadyExistsException(final QualifiedName tableName, @Nullable final Throwable cause) {
super(tableName, cause);
}
}
| 9,810 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/CatalogNotFoundException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when a catalog is not found.
*
* @author zhenl
*/
public class CatalogNotFoundException extends NotFoundException {
/**
* Constructor.
*
* @param catalogName catalog name
*/
public CatalogNotFoundException(final String catalogName) {
this(catalogName, null);
}
/**
* Constructor.
*
* @param catalogName catalog name
* @param cause error cause
*/
public CatalogNotFoundException(final String catalogName, @Nullable final Throwable cause) {
super(QualifiedName.ofCatalog(catalogName), cause);
}
}
| 9,811 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/PartitionNotFoundException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import lombok.Getter;
import javax.annotation.Nullable;
/**
* Exception when partition is not found.
*
* @author zhenl
*/
@Getter
public class PartitionNotFoundException extends NotFoundException {
private final QualifiedName tableName;
private final String partitionName;
/**
* Constructor.
*
* @param tableName table name
* @param partitionName partition name
*/
public PartitionNotFoundException(final QualifiedName tableName, final String partitionName) {
this(tableName, partitionName, null);
}
/**
* Constructor.
*
* @param tableName table name
* @param partitionName partition name
* @param cause error cause
*/
public PartitionNotFoundException(
final QualifiedName tableName,
final String partitionName,
@Nullable final Throwable cause
) {
super(QualifiedName.ofPartition(tableName.getCatalogName(),
tableName.getDatabaseName(), tableName.getTableName(), partitionName),
String.format("Partition %s not found for table %s", partitionName, tableName),
cause, false, false);
this.tableName = tableName;
this.partitionName = partitionName;
}
}
| 9,812 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/DatabaseNotFoundException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when database is not found.
*
* @author amajumdar
*/
public class DatabaseNotFoundException extends NotFoundException {
/**
* Constructor.
*
* @param name qualified name of the database
*/
public DatabaseNotFoundException(final QualifiedName name) {
super(name);
}
/**
* Constructor.
*
* @param name qualified name of the database
* @param cause error cause
*/
public DatabaseNotFoundException(final QualifiedName name, @Nullable final Throwable cause) {
super(name, cause);
}
/**
* Constructor.
*
* @param name qualified name of the database
* @param cause error cause
* @param enableSuppression enable suppression of the stacktrace
* @param writableStackTrace writable stacktrace
*/
public DatabaseNotFoundException(
final QualifiedName name,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
super(name, cause, enableSuppression, writableStackTrace);
}
}
| 9,813 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/TableNotFoundException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
/**
* Exception when table is not found.
*
* @author amajumdar
*/
public class TableNotFoundException extends NotFoundException {
/**
* Constructor.
*
* @param name qualified name of the table
*/
public TableNotFoundException(final QualifiedName name) {
super(name);
}
/**
* Constructor.
*
* @param name qualified name of the table
* @param cause error cause
*/
public TableNotFoundException(final QualifiedName name, @Nullable final Throwable cause) {
super(name, cause);
}
/**
* Constructor.
*
* @param name qualified name of the table
* @param cause error cause
* @param enableSuppression enable suppression of the stacktrace
* @param writableStackTrace writable stacktrace
*/
public TableNotFoundException(
final QualifiedName name,
final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
super(name, cause, enableSuppression, writableStackTrace);
}
}
| 9,814 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/NotFoundException.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.connectors.exception;
import com.netflix.metacat.common.QualifiedName;
import lombok.Getter;
import javax.annotation.Nullable;
/**
* Abstract not found error exception class.
*
* @author zhenl
*/
@Getter
public abstract class NotFoundException extends ConnectorException {
private QualifiedName name;
protected NotFoundException(final QualifiedName name) {
this(name, null);
}
protected NotFoundException(final QualifiedName name, @Nullable final Throwable cause) {
this(name, cause, false, false);
}
protected NotFoundException(
final QualifiedName name,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
this(name, String.format("%s '%s' not found.", name.getType().name(), name.toString()),
cause, enableSuppression, writableStackTrace);
}
protected NotFoundException(
final QualifiedName name,
final String message,
@Nullable final Throwable cause,
final boolean enableSuppression,
final boolean writableStackTrace
) {
super(message, cause, enableSuppression, writableStackTrace);
this.name = name;
}
}
| 9,815 |
0 |
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors
|
Create_ds/metacat/metacat-common-server/src/main/java/com/netflix/metacat/common/server/connectors/exception/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.
*/
/**
* Exception package for Metacat connectors.
*
* @author zhenl
*/
@ParametersAreNonnullByDefault
package com.netflix.metacat.common.server.connectors.exception;
import javax.annotation.ParametersAreNonnullByDefault;
| 9,816 |
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/converter/DozerTypeConverter.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.converter;
import com.netflix.metacat.common.server.connectors.ConnectorTypeConverter;
import com.netflix.metacat.common.server.util.MetacatContextManager;
import com.netflix.metacat.common.type.Type;
import lombok.NonNull;
import org.dozer.DozerConverter;
import javax.annotation.Nonnull;
/**
* Dozer converter implementation for data types.
*
* @author amajumdar
* @author tgianos
* @since 1.0.0
*/
public class DozerTypeConverter extends DozerConverter<Type, String> {
private TypeConverterFactory typeConverterFactory;
/**
* Constructor.
*
* @param typeConverterFactory Type converter factory
*/
public DozerTypeConverter(@Nonnull @NonNull final TypeConverterFactory typeConverterFactory) {
super(Type.class, String.class);
this.typeConverterFactory = typeConverterFactory;
}
/**
* {@inheritDoc}
*/
@Override
public String convertTo(final Type source, final String destination) {
final ConnectorTypeConverter typeConverter;
try {
typeConverter = this.typeConverterFactory.get(MetacatContextManager.getContext().getDataTypeContext());
} catch (final Exception e) {
throw new IllegalStateException("Unable to get a type converter", e);
}
return typeConverter.fromMetacatType(source);
}
/**
* {@inheritDoc}
*/
@Override
public Type convertFrom(final String source, final Type destination) {
final ConnectorTypeConverter typeConverter;
try {
typeConverter = this.typeConverterFactory.get(MetacatContextManager.getContext().getDataTypeContext());
} catch (final Exception e) {
throw new IllegalStateException("Unable to get a type converter", e);
}
return typeConverter.toMetacatType(source);
}
}
| 9,817 |
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/converter/TypeConverterFactory.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.converter;
import com.google.common.collect.Maps;
import com.netflix.metacat.common.server.connectors.ConnectorTypeConverter;
import javax.annotation.Nullable;
import java.util.Map;
/**
* Type converter factory.
*
* @author amajumdar
* @author tgianos
* @since 1.0.0
*/
public class TypeConverterFactory {
private static final String METACAT_TYPE_CONTEXT = "metacat";
private Map<String, ConnectorTypeConverter> registry = Maps.newHashMap();
private ConnectorTypeConverter defaultTypeConverter;
/**
* Constructor.
*
* @param defaultTypeConverter default type converter
*/
public TypeConverterFactory(final ConnectorTypeConverter defaultTypeConverter) {
this.defaultTypeConverter = defaultTypeConverter;
this.registry.put(METACAT_TYPE_CONTEXT, new DefaultTypeConverter());
}
/**
* Adds the type converter to the registry.
*
* @param connectorType connector type
* @param typeConverter types converter
*/
public void register(final String connectorType, final ConnectorTypeConverter typeConverter) {
this.registry.put(connectorType, typeConverter);
}
/**
* Returns the right type converter based on the context.
*
* @param context context
* @return type converter
*/
public ConnectorTypeConverter get(@Nullable final String context) {
if (context == null) {
return defaultTypeConverter;
}
final ConnectorTypeConverter result = this.registry.get(context);
if (result == null) {
throw new IllegalArgumentException("No handler for " + context);
}
return result;
}
}
| 9,818 |
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/converter/DozerJsonTypeConverter.java
|
package com.netflix.metacat.common.server.converter;
import com.fasterxml.jackson.databind.JsonNode;
import com.netflix.metacat.common.server.connectors.ConnectorTypeConverter;
import com.netflix.metacat.common.server.util.MetacatContextManager;
import com.netflix.metacat.common.type.Type;
import lombok.NonNull;
import org.dozer.CustomConverter;
import javax.annotation.Nonnull;
/**
* Dozer converter implementation to convert data types to JSON format.
*
* @author amajumdar
*/
public class DozerJsonTypeConverter implements CustomConverter {
private TypeConverterFactory typeConverterFactory;
/**
* Constructor.
*
* @param typeConverterFactory Type converter factory
*/
public DozerJsonTypeConverter(@Nonnull @NonNull final TypeConverterFactory typeConverterFactory) {
this.typeConverterFactory = typeConverterFactory;
}
@Override
public Object convert(final Object existingDestinationFieldValue,
final Object sourceFieldValue,
final Class<?> destinationClass,
final Class<?> sourceClass) {
JsonNode result = null;
final Type type = (Type) sourceFieldValue;
final ConnectorTypeConverter typeConverter;
try {
typeConverter = this.typeConverterFactory.get(MetacatContextManager.getContext().getDataTypeContext());
} catch (final Exception e) {
throw new IllegalStateException("Unable to get a type converter", e);
}
try {
result = typeConverter.fromMetacatTypeToJson(type);
} catch (final Exception ignored) {
// TODO: Handle exception.
}
return result;
}
}
| 9,819 |
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/converter/ConverterUtil.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.converter;
import com.google.common.collect.Maps;
import com.netflix.metacat.common.MetacatRequestContext;
import com.netflix.metacat.common.dto.AuditDto;
import com.netflix.metacat.common.dto.CatalogDto;
import com.netflix.metacat.common.dto.ClusterDto;
import com.netflix.metacat.common.dto.DatabaseDto;
import com.netflix.metacat.common.dto.FieldDto;
import com.netflix.metacat.common.dto.GetPartitionsRequestDto;
import com.netflix.metacat.common.dto.ViewDto;
import com.netflix.metacat.common.dto.Pageable;
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.Sort;
import com.netflix.metacat.common.dto.StorageDto;
import com.netflix.metacat.common.dto.TableDto;
import com.netflix.metacat.common.server.connectors.ConnectorRequestContext;
import com.netflix.metacat.common.server.connectors.model.AuditInfo;
import com.netflix.metacat.common.server.connectors.model.CatalogInfo;
import com.netflix.metacat.common.server.connectors.model.ClusterInfo;
import com.netflix.metacat.common.server.connectors.model.DatabaseInfo;
import com.netflix.metacat.common.server.connectors.model.FieldInfo;
import com.netflix.metacat.common.server.connectors.model.ViewInfo;
import com.netflix.metacat.common.server.connectors.model.PartitionInfo;
import com.netflix.metacat.common.server.connectors.model.PartitionListRequest;
import com.netflix.metacat.common.server.connectors.model.PartitionsSaveRequest;
import com.netflix.metacat.common.server.connectors.model.PartitionsSaveResponse;
import com.netflix.metacat.common.server.connectors.model.StorageInfo;
import com.netflix.metacat.common.server.connectors.model.TableInfo;
import lombok.NonNull;
import org.dozer.CustomConverter;
import org.dozer.DozerBeanMapper;
import org.dozer.Mapper;
import org.dozer.loader.api.BeanMappingBuilder;
import org.dozer.loader.api.FieldsMappingOptions;
import org.dozer.loader.api.TypeMappingOptions;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;
/**
* Mapper from Dto to Connector Info.
*
* @author amajumdar
* @since 1.0.0
*/
public class ConverterUtil {
private static final String ID_TYPE_CONVERTER = "typeConverter";
private static final String ID_JSON_TYPE_CONVERTER = "jsonTypeConverter";
private final Mapper mapper;
/**
* Constructor.
*
* @param dozerTypeConverter custom dozer converter for types
* @param dozerJsonTypeConverter custom dozer converter for types to JSON format
*/
public ConverterUtil(@Nonnull @NonNull final DozerTypeConverter dozerTypeConverter,
@Nonnull @NonNull final DozerJsonTypeConverter dozerJsonTypeConverter) {
final DozerBeanMapper dozerBeanMapper = new DozerBeanMapper();
final BeanMappingBuilder builder = new BeanMappingBuilder() {
@Override
protected void configure() {
mapping(FieldDto.class, FieldInfo.class, TypeMappingOptions.oneWay())
.fields("type", "type", FieldsMappingOptions.customConverterId(ID_TYPE_CONVERTER))
.fields("partition_key", "partitionKey", FieldsMappingOptions.copyByReference())
.fields("source_type", "sourceType", FieldsMappingOptions.copyByReference());
mapping(FieldInfo.class, FieldDto.class, TypeMappingOptions.oneWay())
.fields("type", "type", FieldsMappingOptions.customConverterId(ID_TYPE_CONVERTER))
.fields("partitionKey", "partition_key", FieldsMappingOptions.copyByReference())
.fields("sourceType", "source_type", FieldsMappingOptions.copyByReference())
.fields("type", "jsonType", FieldsMappingOptions.customConverterId(ID_JSON_TYPE_CONVERTER));
mapping(TableDto.class, TableInfo.class)
.fields("name", "name", FieldsMappingOptions.copyByReference());
mapping(DatabaseDto.class, DatabaseInfo.class)
.fields("name", "name", FieldsMappingOptions.copyByReference());
mapping(PartitionDto.class, PartitionInfo.class)
.fields("name", "name", FieldsMappingOptions.copyByReference());
mapping(CatalogDto.class, CatalogInfo.class);
mapping(ClusterDto.class, ClusterInfo.class);
mapping(AuditDto.class, AuditInfo.class);
mapping(ViewDto.class, ViewInfo.class);
mapping(StorageDto.class, StorageInfo.class);
}
};
dozerBeanMapper.addMapping(builder);
final Map<String, CustomConverter> customConverterMap = Maps.newHashMap();
customConverterMap.put(ID_TYPE_CONVERTER, dozerTypeConverter);
customConverterMap.put(ID_JSON_TYPE_CONVERTER, dozerJsonTypeConverter);
dozerBeanMapper.setCustomConvertersWithId(customConverterMap);
this.mapper = dozerBeanMapper;
}
/**
* Converts from CatalogInfo to CatalogDto.
*
* @param catalogInfo connector catalog info
* @return catalog dto
*/
public CatalogDto toCatalogDto(final CatalogInfo catalogInfo) {
return this.mapper.map(catalogInfo, CatalogDto.class);
}
/**
* Converts from CatalogDto to CatalogInfo.
*
* @param catalogDto catalog dto
* @return connector catalog info
*/
public CatalogInfo fromCatalogDto(final CatalogDto catalogDto) {
return this.mapper.map(catalogDto, CatalogInfo.class);
}
/**
* Converts from ClusterInfo to ClusterDto.
*
* @param clusterInfo catalog cluster info
* @return cluster dto
*/
public ClusterDto toClusterDto(final ClusterInfo clusterInfo) {
return this.mapper.map(clusterInfo, ClusterDto.class);
}
/**
* Converts from ClusterDto to ClusterInfo.
*
* @param clusterDto catalog cluster dto
* @return cluster info
*/
public ClusterInfo fromClusterDto(final ClusterDto clusterDto) {
return this.mapper.map(clusterDto, ClusterInfo.class);
}
/**
* Converts from DatabaseInfo to DatabaseDto.
*
* @param databaseInfo connector table info
* @return database dto
*/
public DatabaseDto toDatabaseDto(final DatabaseInfo databaseInfo) {
return this.mapper.map(databaseInfo, DatabaseDto.class);
}
/**
* Converts from TableDto to TableInfo.
*
* @param databaseDto database dto
* @return connector database info
*/
public DatabaseInfo fromDatabaseDto(final DatabaseDto databaseDto) {
return this.mapper.map(databaseDto, DatabaseInfo.class);
}
/**
* Converts from TableInfo to TableDto.
*
* @param tableInfo connector table info
* @return table dto
*/
public TableDto toTableDto(final TableInfo tableInfo) {
final TableDto result = this.mapper.map(tableInfo, TableDto.class);
//TODO: Add this logic in the mapping
final List<FieldDto> fields = result.getFields();
if (fields != null) {
int index = 0;
for (final FieldDto field : fields) {
field.setPos(index++);
}
}
return result;
}
/**
* Converts from TableDto to TableInfo.
*
* @param tableDto table dto
* @return connector table info
*/
public TableInfo fromTableDto(final TableDto tableDto) {
return mapper.map(tableDto, TableInfo.class);
}
/**
* Converts from PartitionInfo to PartitionDto.
*
* @param partitionInfo connector partition info
* @return partition dto
*/
public PartitionDto toPartitionDto(final PartitionInfo partitionInfo) {
return mapper.map(partitionInfo, PartitionDto.class);
}
/**
* Converts from PartitionDto to PartitionInfo.
*
* @param partitionDto partition dto
* @return connector partition info
*/
public PartitionInfo fromPartitionDto(final PartitionDto partitionDto) {
return mapper.map(partitionDto, PartitionInfo.class);
}
/**
* Creates the connector context.
*
* @param metacatRequestContext request context
* @return connector context
*/
public ConnectorRequestContext toConnectorContext(final MetacatRequestContext metacatRequestContext) {
return mapper.map(metacatRequestContext, ConnectorRequestContext.class);
}
/**
* Creates the partition list connector request.
*
* @param partitionsRequestDto request containing the filter and other properties used for listing
* @param pageable pageable info
* @param sort sort info
* @return connector request
*/
public PartitionListRequest toPartitionListRequest(final GetPartitionsRequestDto partitionsRequestDto,
final Pageable pageable, final Sort sort) {
if (partitionsRequestDto != null) {
if (partitionsRequestDto.getIncludePartitionDetails() == null) {
partitionsRequestDto.setIncludePartitionDetails(false);
}
if (partitionsRequestDto.getIncludeAuditOnly() == null) {
partitionsRequestDto.setIncludeAuditOnly(false);
}
final PartitionListRequest result = mapper.map(partitionsRequestDto, PartitionListRequest.class);
result.setPageable(pageable);
result.setSort(sort);
return result;
} else {
return new PartitionListRequest(null, null, false, pageable, sort, false);
}
}
/**
* Creates the partition list connector request.
*
* @param partitionsRequestDto request containing the save request information
* @return connector request
*/
public PartitionsSaveRequest toPartitionsSaveRequest(final PartitionsSaveRequestDto partitionsRequestDto) {
return mapper.map(partitionsRequestDto, PartitionsSaveRequest.class);
}
/**
* Creates the partition list connector request.
*
* @param partitionsSaveResponse response on saving partitions
* @return response dto
*/
public PartitionsSaveResponseDto toPartitionsSaveResponseDto(final PartitionsSaveResponse partitionsSaveResponse) {
return mapper.map(partitionsSaveResponse, PartitionsSaveResponseDto.class);
}
}
| 9,820 |
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/converter/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.
*
*/
/**
* Converter classes.
*
* @author amajumdar
*/
package com.netflix.metacat.common.server.converter;
| 9,821 |
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/converter/DefaultTypeConverter.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.converter;
import com.netflix.metacat.common.server.connectors.ConnectorTypeConverter;
import com.netflix.metacat.common.type.Type;
import com.netflix.metacat.common.type.TypeRegistry;
import com.netflix.metacat.common.type.TypeSignature;
import lombok.NonNull;
import javax.annotation.Nonnull;
/**
* Default type converter. Converter for metacat type representations.
*
* @author amajumdar
* @since 1.0.0
*/
public class DefaultTypeConverter implements ConnectorTypeConverter {
/**
* {@inheritDoc}
*/
@Override
public Type toMetacatType(@Nonnull @NonNull final String type) {
final TypeSignature signature = TypeSignature.parseTypeSignature(type);
return TypeRegistry.getTypeRegistry().getType(signature);
}
/**
* {@inheritDoc}
*/
@Override
public String fromMetacatType(@Nonnull @NonNull final Type type) {
return type.getDisplayName();
}
}
| 9,822 |
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/util/DataSourceManager.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.util;
import com.google.common.collect.Maps;
import java.sql.SQLException;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.jdbc.pool.DataSourceFactory;
import org.apache.tomcat.jdbc.pool.DataSourceProxy;
import javax.annotation.PreDestroy;
import javax.management.ObjectName;
import javax.sql.DataSource;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
/**
* Data source manager.
*/
@Slf4j
public final class DataSourceManager {
private static final String JDO_PREFIX = "javax.jdo.option.";
private static DataSourceManager instance = new DataSourceManager();
private Map<String, DataSource> dataSources = Maps.newConcurrentMap();
private DataSourceManager() {
}
/**
* This method has been provided so that it can be used in the connectors. We could have injected into the plugins.
*
* @return DataSourceManager
*/
public static DataSourceManager get() {
return instance;
}
/**
* Initialize a data source and store it.
*
* @param name catalog name
* @param properties properties
* @return DataSourceManager
*/
public DataSourceManager load(final String name, final Map<String, String> properties) {
if (dataSources.get(name) == null) {
createDataSource(name, properties);
}
return this;
}
/**
* Initialize a data source and store it.
*
* @param catalogName catalog name
* @param properties properties
* @return DataSourceManager
*/
public DataSourceManager load(final String catalogName, final Properties properties) {
if (dataSources.get(catalogName) == null) {
createDataSource(catalogName, properties);
}
return this;
}
/**
* Returns the data source loaded for the given catalog.
*
* @param name catalog name
* @return DataSource
*/
public DataSource get(final String name) {
return dataSources.get(name);
}
/**
* Refresh the Connection Pool of the data source.
* @param name of the DataSource whose ConnectionPool has to be refreshed.
* @throws SQLException if pool cannot be re-created.
* @return true if success. false otherwise.
*/
public synchronized boolean refreshConnectionPool(final String name) throws SQLException {
final DataSource source = dataSources.get(name);
if (!(source instanceof DataSourceProxy)) {
return false;
}
final DataSourceProxy proxy = (DataSourceProxy) source;
proxy.close(true);
proxy.createPool();
return true;
}
private synchronized void createDataSource(final String name, final Map props) {
if (dataSources.get(name) == null) {
final Properties dataSourceProperties = new Properties();
props.forEach((key, value) -> {
final String prop = String.valueOf(key);
if (prop.startsWith(JDO_PREFIX)) {
dataSourceProperties.put(prop.substring(JDO_PREFIX.length()), value);
}
});
if (!dataSourceProperties.isEmpty()) {
try {
final DataSource dataSource = new DataSourceFactory().createDataSource(dataSourceProperties);
//
// Explicitly registering the datasource with the JMX server bean.
//
((org.apache.tomcat.jdbc.pool.DataSource) dataSource)
.preRegister(null, new ObjectName(String.format("jdbc.pool:name=%s", name)));
dataSources.put(name, dataSource);
} catch (Exception e) {
throw new RuntimeException(String
.format("Failed to load the data source for catalog %s with error [%s]", name,
e.getMessage()), e);
}
}
}
}
/**
* Closes all the data sources stored in the manager.
*/
@PreDestroy
public void close() {
final Iterator<DataSource> iter = dataSources.values().iterator();
while (iter.hasNext()) {
final DataSourceProxy dataSource = (DataSourceProxy) iter.next();
if (dataSource != null) {
dataSource.close();
}
iter.remove();
}
}
}
| 9,823 |
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/util/MetacatUtils.java
|
//CHECKSTYLE:OFF
package com.netflix.metacat.common.server.util;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;
import com.netflix.metacat.common.dto.TableDto;
import com.netflix.metacat.common.server.connectors.ConnectorContext;
import com.netflix.metacat.common.server.properties.Config;
import com.netflix.metacat.common.server.spi.MetacatCatalogConfig;
import com.netflix.spectator.api.Registry;
import org.springframework.context.ApplicationContext;
import javax.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
/**
* General metacat utility methods.
*/
public class MetacatUtils {
public static final String ICEBERG_MIGRATION_DO_NOT_MODIFY_TAG = "iceberg_migration_do_not_modify";
public static final String NAME_TAGS = "tags";
/**
* Iceberg common view field names.
*/
public static final String COMMON_VIEW = "common_view";
public static final String STORAGE_TABLE = "storage_table";
/**
* Default Ctor.
*/
private MetacatUtils() {
}
/**
* List files in a given dir.
*
* @param dir The directory.
* @return List of files if any.
*/
public static List<File> listFiles(final File dir) {
if (dir != null && dir.isDirectory()) {
final File[] files = dir.listFiles();
if (files != null) {
return ImmutableList.copyOf(files);
}
}
return ImmutableList.of();
}
/**
* Load properties from a file.
*
* @param file Properties file.
* @return A Map of properties.
* @throws Exception IOException on failure to load file.
*/
public static Map<String, String> loadProperties(final File file) throws Exception {
Preconditions.checkNotNull(file, "file is null");
final Properties properties = new Properties();
try (FileInputStream in = new FileInputStream(file)) {
properties.load(in);
}
return Maps.fromProperties(properties);
}
public static ConnectorContext buildConnectorContext(
final File file,
final String connectorType,
final Config config,
final Registry registry,
final ApplicationContext applicationContext,
final Map<String, String> properties) {
// Catalog shard name should be unique. Usually the catalog name is same as the catalog shard name.
// If multiple catalog property files refer the same catalog name, then there will be multiple shard names
// with the same catalog name.
final String catalogShardName = Files.getNameWithoutExtension(file.getName());
// If catalog name is not specified, then use the catalog shard name.
final String catalogName = properties.getOrDefault(MetacatCatalogConfig.Keys.CATALOG_NAME, catalogShardName);
return new ConnectorContext(catalogName, catalogShardName, connectorType, config, registry,
applicationContext, properties);
}
public static boolean configHasDoNotModifyForIcebergMigrationTag(final Set<String> tags) {
return Optional.ofNullable(tags).orElse(Collections.emptySet()).stream().
anyMatch(t -> t.trim().equalsIgnoreCase(ICEBERG_MIGRATION_DO_NOT_MODIFY_TAG));
}
public static boolean hasDoNotModifyForIcebergMigrationTag(@Nullable final TableDto tableDto,
final Set<String> tags) {
if (tableDto != null) {
final Set<String> tableTags = getTableTags(tableDto.getDefinitionMetadata());
if (tableTags != null) {
return configHasDoNotModifyForIcebergMigrationTag(tags) &&
tableTags.stream().anyMatch(t -> t.trim().equalsIgnoreCase(ICEBERG_MIGRATION_DO_NOT_MODIFY_TAG));
}
}
return false;
}
public static Set<String> getTableTags(@Nullable final ObjectNode definitionMetadata) {
final Set<String> tags = Sets.newHashSet();
if (definitionMetadata != null && definitionMetadata.get(NAME_TAGS) != null) {
final JsonNode tagsNode = definitionMetadata.get(NAME_TAGS);
if (tagsNode.isArray() && tagsNode.size() > 0) {
for (JsonNode tagNode : tagsNode) {
tags.add(tagNode.textValue().trim());
}
}
}
return tags;
}
public static String getIcebergMigrationExceptionMsg(final String requestType,
final String tableName) {
return String.format("%s to hive table: %s are temporarily blocked " +
"for automated migration to iceberg. Please retry",
requestType, tableName);
}
/**
* check if the table is a common view.
*
* @param tableMetadata table metadata map
* @return true for common view
*/
public static boolean isCommonView(final Map<String, String> tableMetadata) {
return tableMetadata != null && Boolean.parseBoolean(tableMetadata.get(COMMON_VIEW));
}
/**
* Returns the name of the common view storage table if present.
*
* @param tableMetadata the table metadata
* @return Storage table name.
*/
public static Optional<String> getCommonViewStorageTable(final Map<String, String> tableMetadata) {
if (tableMetadata != null) {
return Optional.ofNullable(tableMetadata.get(STORAGE_TABLE));
}
return Optional.empty();
}
}
| 9,824 |
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/util/MetacatContextManager.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.util;
import com.netflix.metacat.common.MetacatRequestContext;
/**
* Metacat context manager.
*/
public final class MetacatContextManager {
private static InheritableThreadLocal<MetacatRequestContext> context = new InheritableThreadLocal<>();
private MetacatContextManager() {
}
/**
* Removes the context from this manager.
*/
public static void removeContext() {
context.remove();
}
/**
* Returns the current thread context.
*
* @return context
*/
public static MetacatRequestContext getContext() {
MetacatRequestContext result = context.get();
if (result == null) {
result = new MetacatRequestContext();
setContext(result);
}
return result;
}
/**
* Sets the context in this manager.
*
* @param context context
*/
public static void setContext(final MetacatRequestContext context) {
MetacatContextManager.context.set(context);
}
}
| 9,825 |
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/util/RegistryUtil.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.util;
import com.netflix.spectator.api.Registry;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Utility functions for Registry.
* @author amajumdar
*/
public final class RegistryUtil {
private static final String NAME_MONITORED_POOL = "MonitoredThreadPool_";
private RegistryUtil() { }
/**
* Register the pool properties.
* @param registry Spectator registry
* @param name name of the monitor
* @param pool thread pool
*/
public static void registerThreadPool(final Registry registry,
final String name,
final ThreadPoolExecutor pool) {
registry.gauge(NAME_MONITORED_POOL + name + "_" + "activeCount", pool, ThreadPoolExecutor::getActiveCount);
registry.gauge(NAME_MONITORED_POOL + name + "_" + "completedTaskCount", pool,
ThreadPoolExecutor::getCompletedTaskCount);
registry.gauge(NAME_MONITORED_POOL + name + "_" + "corePoolSize", pool, ThreadPoolExecutor::getCorePoolSize);
registry
.gauge(NAME_MONITORED_POOL + name + "_" + "maximumPoolSize", pool, ThreadPoolExecutor::getMaximumPoolSize);
registry.gauge(NAME_MONITORED_POOL + name + "_" + "poolSize", pool, ThreadPoolExecutor::getPoolSize);
registry.collectionSize(NAME_MONITORED_POOL + name + "_" + "queueSize", pool.getQueue());
registry.gauge(NAME_MONITORED_POOL + name + "_" + "taskCount", pool, ThreadPoolExecutor::getTaskCount);
}
}
| 9,826 |
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/util/ThreadServiceManager.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.util;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.netflix.metacat.common.server.properties.Config;
import com.netflix.spectator.api.Registry;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PreDestroy;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Thread service manager.
*
* @author amajumdar
*/
@Getter
@Slf4j
public class ThreadServiceManager {
private ListeningExecutorService executor;
/**
* Constructor.
*
* @param registry registry for spectator
* @param config Program configuration
*/
@Autowired
public ThreadServiceManager(final Registry registry, final Config config) {
final ExecutorService executorService = newFixedThreadPool(
config.getServiceMaxNumberOfThreads(),
config.getServiceMaxNumberOfThreads(),
"metacat-service-pool-%d",
1000
);
this.executor = MoreExecutors.listeningDecorator(executorService);
RegistryUtil.registerThreadPool(registry, "metacat-service-pool", (ThreadPoolExecutor) executorService);
}
/**
* Constructor.
*
* @param registry registry for spectator
* @param maxThreads maximum number of threads
* @param maxQueueSize maximum queue size
* @param usage an identifier where this pool is used
*/
public ThreadServiceManager(final Registry registry, final int maxThreads,
final int maxQueueSize, final String usage) {
final ExecutorService executorService = newFixedThreadPool(
2,
maxThreads,
"metacat-" + usage + "-pool-%d",
maxQueueSize
);
this.executor = MoreExecutors.listeningDecorator(executorService);
RegistryUtil.registerThreadPool(registry, "metacat-" + usage + "-pool",
(ThreadPoolExecutor) executorService);
}
/**
* Stops this manager.
*/
@PreDestroy
public void stop() {
if (this.executor != null) {
// Make the executor accept no new threads and finish all existing
// threads in the queue
this.executor.shutdown();
try {
this.executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
log.error("Error while shutting down executor service : ", e);
}
}
}
@SuppressWarnings("checkstyle:hiddenfield")
private ExecutorService newFixedThreadPool(
final int minThreads,
final int maxThreads,
final String threadFactoryName,
final int queueSize
) {
return new ThreadPoolExecutor(
minThreads,
maxThreads,
0L,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(queueSize),
new ThreadFactoryBuilder().setNameFormat(threadFactoryName).build(),
(r, executor) -> {
// this will block if the queue is full
try {
executor.getQueue().put(r);
} catch (InterruptedException e) {
throw Throwables.propagate(e);
}
}
);
}
}
| 9,827 |
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/util/PoolStatsInterceptor.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.util;
import com.netflix.metacat.common.server.monitoring.Metrics;
import com.netflix.spectator.api.Gauge;
import com.netflix.spectator.api.Registry;
import com.netflix.spectator.api.Spectator;
import org.apache.tomcat.jdbc.pool.ConnectionPool;
import org.apache.tomcat.jdbc.pool.JdbcInterceptor;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.apache.tomcat.jdbc.pool.PooledConnection;
import java.util.Map;
/**
* Pool stats interceptor.
*
* @author amajumdar
*/
public class PoolStatsInterceptor extends JdbcInterceptor {
/**
* Metric name.
*/
public static final String PROP_METRIC_NAME = "name";
private Gauge metricNameTotalGauage;
private Gauge metricNameActiveGauage;
private Gauge metricNameIdleGauage;
private final Registry registry = Spectator.globalRegistry();
/**
* Constructor.
*/
public PoolStatsInterceptor() {
super();
}
@Override
public void reset(final ConnectionPool parent, final PooledConnection con) {
publishMetric(parent);
}
@Override
public void disconnected(final ConnectionPool parent, final PooledConnection con, final boolean finalizing) {
publishMetric(parent);
}
private void publishMetric(final ConnectionPool parent) {
if (parent != null
&& metricNameTotalGauage != null
&& metricNameActiveGauage != null
&& metricNameIdleGauage != null) {
metricNameTotalGauage.set(parent.getSize());
metricNameActiveGauage.set(parent.getActive());
metricNameIdleGauage.set(parent.getIdle());
}
}
/**
* Sets the metric.
*
* @param metricName metric name
*/
public void setMetricName(final String metricName) {
metricNameIdleGauage = registry.gauge(
registry.createId(Metrics.GaugeConnectionsIdle + "." + metricName));
metricNameActiveGauage = registry.gauge(
registry.createId(Metrics.GaugeConnectionsActive + "." + metricName));
metricNameTotalGauage = registry.gauge(
registry.createId(Metrics.GaugeConnectionsTotal + "." + metricName));
}
@Override
public void setProperties(final Map<String, PoolProperties.InterceptorProperty> properties) {
super.setProperties(properties);
final PoolProperties.InterceptorProperty nameProperty = properties.get(PROP_METRIC_NAME);
if (nameProperty != null) {
setMetricName(nameProperty.getValue());
}
}
}
| 9,828 |
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/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.
*
*/
/**
* This package includes utility classes.
*
* @author amajumdar
*/
@ParametersAreNonnullByDefault
package com.netflix.metacat.common.server.util;
import javax.annotation.ParametersAreNonnullByDefault;
| 9,829 |
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/usermetadata/UserMetadataService.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.usermetadata;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.netflix.metacat.common.QualifiedName;
import com.netflix.metacat.common.dto.DefinitionMetadataDto;
import com.netflix.metacat.common.dto.HasDefinitionMetadata;
import com.netflix.metacat.common.dto.HasMetadata;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* User metadata service API.
*
* @author amajumdar,zhenl
*/
public interface UserMetadataService {
/**
* Config location.
*/
String METACAT_USERMETADATA_CONFIG_LOCATION = "metacat.usermetadata.config.location";
/**
* Datasource key.
*/
String NAME_DATASOURCE = "metacat-usermetadata";
/**
* Delete data metadata for the given uris.
*
* @param uris list of uris.
*/
default void deleteDataMetadata(List<String> uris) {
}
/**
* Delete the delete markers for data metadata for the given uris.
*
* @param uris list of uris.
*/
default void deleteDataMetadataDeletes(List<String> uris) {
}
/**
* Mark data metadatas for the given uris for deletion.
*
* @param userId user name
* @param uris list of uris
*/
default void softDeleteDataMetadata(String userId, List<String> uris) {
}
/**
* Delete definition metadatas for the given names.
*
* @param names list of names
*/
default void deleteDefinitionMetadata(List<QualifiedName> names) {
}
/**
* Delete definition metadata older than the given timestamp for names
* that match the given pattern.
*
* @param qualifiedNamePattern The pattern to match against qualified names.
* @param lastUpdated The lastUpdated timestamp to use as a cut-off.
*/
default void deleteStaleDefinitionMetadata(String qualifiedNamePattern, Date lastUpdated) {
}
/**
* Delete definition metadata and soft delete data metadata.
*
* @param userId username
* @param holders metadatas
*/
default void deleteMetadata(String userId, List<HasMetadata> holders) {
}
/**
* Returns data metadata for the given uri.
*
* @param uri uri.
* @return data metadata for the given uri.
*/
default Optional<ObjectNode> getDataMetadata(String uri) {
return Optional.empty();
}
/**
* Returns the map of uri to data metadata.
*
* @param uris list of uris.
* @return map of uri to data metadata.
*/
@Nonnull
default Map<String, ObjectNode> getDataMetadataMap(List<String> uris) {
return Collections.emptyMap();
}
/**
* Returns the definition metadata for the given name. This method is used for internal query without
* applying interceptor.
*
* @param name name
* @return definition metadata for the given name
*/
default Optional<ObjectNode> getDefinitionMetadata(QualifiedName name) {
return Optional.empty();
}
/**
* Returns the definition metadata for the given name after applying interceptor. This method should be used for
* all the calls return to outside. We assume that all the REST apis ( get, update, search, create) will return
* the same result of a table.
* @param name name
* @param getMetadataInterceptorParameters get Metadata Interceptor parameters
* @return definition metadata for the given name
*/
@Nonnull
default Optional<ObjectNode> getDefinitionMetadataWithInterceptor(
QualifiedName name,
GetMetadataInterceptorParameters getMetadataInterceptorParameters) {
return Optional.empty();
}
/**
* Returns the descendants for the given name.
*
* @param name name
* @return list of qualified names
*/
default List<QualifiedName> getDescendantDefinitionNames(QualifiedName name) {
return Collections.emptyList();
}
/**
* Returns the descendant uris.
*
* @param uri uri
* @return list of descendant uris.
*/
default List<String> getDescendantDataUris(String uri) {
return Collections.emptyList();
}
/**
* Returns a map of name to definition metadata. This is used for partitions only. We do not apply interceptor
* for partition level definition metadata.
*
* @param names list of names
* @return map of name to definition metadata
*/
@Nonnull
default Map<String, ObjectNode> getDefinitionMetadataMap(List<QualifiedName> names) {
return Collections.emptyMap();
}
/**
* Save data metadata.
*
* @param uri uri
* @param userId user name
* @param metadata metadata
* @param merge if true, will merge with existing metadata
*/
default void saveDataMetadata(
String uri,
String userId,
Optional<ObjectNode> metadata,
boolean merge
) {
}
/**
* Saves definition metadata with interceptor applied.
*
* @param name name
* @param userId username
* @param metadata metadata
* @param merge if true, will merge with existing metadata
*/
default void saveDefinitionMetadata(
QualifiedName name,
String userId,
Optional<ObjectNode> metadata,
boolean merge
) {
}
/**
* Save metadata.
*
* @param userId username
* @param holder metadata
* @param merge if true, will merge with existing metadata
*/
default void saveMetadata(String userId, HasMetadata holder, boolean merge) {
}
/**
* Populate the metadata.
*
* @param holder metadata
* @param disableInterceptor diable interceptor
*/
default void populateMetadata(HasMetadata holder, boolean disableInterceptor) {
}
/**
* Populate the metadata.
*
* @param holder metadata
* @param definitionMetadata definition metadata
* @param dataMetadata data metadata
*/
default void populateMetadata(HasMetadata holder,
ObjectNode definitionMetadata, @Nullable ObjectNode dataMetadata) {
}
/**
* Rename data metadata uri.
*
* @param oldUri old uri
* @param newUri new uri
* @return number of records updated
*/
default int renameDataMetadataKey(String oldUri, String newUri) {
return 0;
}
/**
* Rename definition metadata name.
*
* @param oldName old name
* @param newName new name
* @return number of records updated
*/
default int renameDefinitionMetadataKey(QualifiedName oldName, QualifiedName newName) {
return 0;
}
/**
* Stop the user metadata service.
*
* @throws Exception error
*/
default void stop() throws Exception {
}
/**
* Saves metadata.
*
* @param user username
* @param holders metadatas
* @param merge if true, will merge with existing metadata
*/
default void saveMetadata(String user, List<? extends HasMetadata> holders, boolean merge) {
}
/**
* Return the list of definition metadata for the given property names.
*
* @param propertyNames names
* @param type type
* @param name name
* @param holder dto
* @param sortBy sort column
* @param sortOrder sort order
* @param offset offset
* @param limit size of the list
* @return list of definition metadata
*/
default List<DefinitionMetadataDto> searchDefinitionMetadata(
@Nullable Set<String> propertyNames,
@Nullable String type,
@Nullable String name,
@Nullable HasMetadata holder,
@Nullable String sortBy,
@Nullable String sortOrder,
@Nullable Integer offset,
@Nullable Integer limit
) {
return Collections.emptyList();
}
/**
* List the names for the given owners.
*
* @param owners list of owner names.
* @return list of qualified names
*/
default List<QualifiedName> searchByOwners(Set<String> owners) {
return Collections.emptyList();
}
/**
* List of uris marked for deletion.
*
* @param deletedPriorTo date
* @param offset offset
* @param limit size of the list
* @return list of uris.
*/
default List<String> getDeletedDataMetadataUris(Date deletedPriorTo, Integer offset, Integer limit) {
return Collections.emptyList();
}
/**
* Populate the owner in definitionMetadata, if missing, with the provider owner.
*
* @param holder definition metadata holder
* @param owner owner name.
*/
default void populateOwnerIfMissing(HasDefinitionMetadata holder, String owner) {
}
}
| 9,830 |
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/usermetadata/AuthorizationService.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.usermetadata;
import com.netflix.metacat.common.QualifiedName;
/**
* Authorization Service API.
*
* @author zhenl
* @since 1.2.0
*/
public interface AuthorizationService {
/**
* Check metacat acl property if this operation is permitted.
*
* @param userName username
* @param name qualified Name
* @param op operation
*/
default void checkPermission(final String userName,
final QualifiedName name,
final MetacatOperation op) {
}
}
| 9,831 |
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/usermetadata/DefaultTagService.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.usermetadata;
/**
* Default Tag Service.
*
* @author zhenl
* @since 1.1.0
*/
public class DefaultTagService implements TagService {
}
| 9,832 |
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/usermetadata/BaseUserMetadataService.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.usermetadata;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.netflix.metacat.common.dto.HasDataMetadata;
import com.netflix.metacat.common.dto.HasDefinitionMetadata;
import com.netflix.metacat.common.dto.HasMetadata;
import java.util.Optional;
/**
* Base class for UserMetadataService.
*
* @author amajumdar
*/
public abstract class BaseUserMetadataService implements UserMetadataService {
/**
* Saves user metadata.
*
* @param userId user name
* @param holder metadata
* @param merge true if the metadata should be merged with existing metadata
*/
@Override
public void saveMetadata(final String userId, final HasMetadata holder, final boolean merge) {
if (holder instanceof HasDefinitionMetadata) {
final HasDefinitionMetadata defDto = (HasDefinitionMetadata) holder;
// If the user is updating the definition metadata do a merge on the existing metadata
final ObjectNode newMetadata = defDto.getDefinitionMetadata();
if (newMetadata != null) {
saveDefinitionMetadata(defDto.getDefinitionName(), userId, Optional.of(newMetadata), merge);
}
}
if (holder instanceof HasDataMetadata) {
final HasDataMetadata dataDto = (HasDataMetadata) holder;
// If the user is updating the data metadata and a separate data location exists,
// do a merge on the existing metadata
final ObjectNode newMetadata = dataDto.getDataMetadata();
if (newMetadata != null && dataDto.isDataExternal()) {
saveDataMetadata(dataDto.getDataUri(), userId, Optional.of(newMetadata), merge);
}
}
}
/**
* Populate the given metadata.
*
* @param holder metadata
*/
@Override
public void populateMetadata(final HasMetadata holder, final boolean disableIntercetpor) {
Optional<ObjectNode> metadata = Optional.empty();
if (holder instanceof HasDataMetadata) {
final HasDataMetadata dataDto = (HasDataMetadata) holder;
if (dataDto.isDataExternal()) {
metadata = getDataMetadata(dataDto.getDataUri());
}
}
Optional<ObjectNode> definitionMetadata = Optional.empty();
if (holder instanceof HasDefinitionMetadata) {
final HasDefinitionMetadata definitionDto = (HasDefinitionMetadata) holder;
definitionMetadata = disableIntercetpor ? this.getDefinitionMetadata(definitionDto.getDefinitionName())
: this.getDefinitionMetadataWithInterceptor(definitionDto.getDefinitionName(),
GetMetadataInterceptorParameters.builder().hasMetadata(holder).build());
}
populateMetadata(holder, definitionMetadata.orElse(null), metadata.orElse(null));
}
/**
* Populate metadata.
*
* @param holder metadata
* @param definitionMetadata definition metadata
* @param dataMetadata data metadata
*/
@Override
public void populateMetadata(
final HasMetadata holder,
final ObjectNode definitionMetadata,
final ObjectNode dataMetadata
) {
if (holder instanceof HasDefinitionMetadata) {
final HasDefinitionMetadata defDto = (HasDefinitionMetadata) holder;
defDto.setDefinitionMetadata(definitionMetadata);
}
if (holder instanceof HasDataMetadata) {
final HasDataMetadata dataDto = (HasDataMetadata) holder;
//data Metadata can be populated from iceberg metrics directly
if (dataDto.isDataExternal() || dataMetadata != null) {
dataDto.setDataMetadata(dataMetadata);
}
}
}
}
| 9,833 |
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/usermetadata/TagService.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.usermetadata;
import com.netflix.metacat.common.QualifiedName;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/**
* Tag Service API.
*
* @author amajumdar
* @author zhenl
*/
public interface TagService {
/**
* Returns the list of tags.
*
* @return list of tag names
*/
default Set<String> getTags() {
return Collections.emptySet();
}
/**
* Returns the list of <code>QualifiedName</code> of items that are tagged by the given <code>includeTags</code> and
* do not contain the given <code>excludeTags</code>.
*
* @param includeTags include items that contain tags
* @param excludeTags include items that do not contain tags
* @param sourceName catalog/source name
* @param databaseName database name
* @param tableName table name
* @param type metacat qualified name type
* @return list of qualified names of the items
*/
default List<QualifiedName> list(
@Nullable final Set<String> includeTags,
@Nullable final Set<String> excludeTags,
@Nullable final String sourceName,
@Nullable final String databaseName,
@Nullable final String tableName,
@Nullable final QualifiedName.Type type
) {
return Collections.emptyList();
}
/**
* Returns the list of <code>QualifiedName</code> of items that have tags containing the given tag text.
*
* @param tag partial text of a tag
* @param sourceName source/catalog name
* @param databaseName database name
* @param tableName table name
* @return list of qualified names of the items
*/
default List<QualifiedName> search(
@Nullable final String tag,
@Nullable final String sourceName,
@Nullable final String databaseName,
@Nullable final String tableName
) {
return Collections.emptyList();
}
/**
* Tags the given table with the given <code>tags</code>.
*
* @param qualifiedName qualified name
* @param tags list of tags
* @param updateUserMetadata if true, updates the tags in the user metadata
* @return return the complete list of tags associated with the resource
*/
default Set<String> setTags(
final QualifiedName qualifiedName,
final Set<String> tags,
final boolean updateUserMetadata
) {
return Collections.emptySet();
}
/**
* Removes the tags from the given qualified name.
*
* @param qualifiedName table name
* @param deleteAll if true, will delete all tags associated with the given qualified name
* @param tags list of tags to be removed for the given qualified name
* @param updateUserMetadata if true, updates the tags in the user metadata
*/
default void removeTags(
final QualifiedName qualifiedName,
final Boolean deleteAll,
@Nullable final Set<String> tags,
final boolean updateUserMetadata
) {
}
/**
* Delete the tag item along with its associated tags.
*
* @param name qualified name
* @param updateUserMetadata if true, updates the tags in the user metadata
*/
default void delete(final QualifiedName name, final boolean updateUserMetadata) {
}
/**
* Renames the tag item name with the new table name.
* Can only be used in table rename
* @param name table qualified name
* @param newTableName new table name
*/
default void renameTableTags(final QualifiedName name, final String newTableName) {
}
}
| 9,834 |
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/usermetadata/MetacatOperation.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.usermetadata;
import lombok.Getter;
/**
* Metacat Operation.
*
* @author zhenl
* @since 1.2.0
*/
@Getter
public enum MetacatOperation {
/**
* create operation.
*/
CREATE,
/**
* delete operation.
*/
DELETE,
/**
* rename operation.
*/
RENAME
}
| 9,835 |
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/usermetadata/UserMetadataServiceException.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.usermetadata;
/**
* User metadata service exception.
*/
public class UserMetadataServiceException extends RuntimeException {
/**
* Constructor.
*
* @param m message
* @param e exception
*/
public UserMetadataServiceException(final String m, final Exception e) {
super(m, e);
}
}
| 9,836 |
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/usermetadata/MetadataInterceptorImpl.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.usermetadata;
/**
* Default Metadata Interceptor Impl.
* @author zhenl
* @since 1.2.0
*/
public class MetadataInterceptorImpl implements MetadataInterceptor {
}
| 9,837 |
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/usermetadata/AliasService.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.usermetadata;
import com.netflix.metacat.common.QualifiedName;
import lombok.NonNull;
/**
* Alias Service API.
*
* @author rveeramacheneni
* @since 1.3.0
*/
public interface AliasService {
/**
* Returns the original table name if present.
*
* @param tableAlias the table alias.
* @return the original name if present or the alias otherwise.
*/
default QualifiedName getTableName(@NonNull final QualifiedName tableAlias) {
return tableAlias;
}
}
| 9,838 |
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/usermetadata/GetMetadataInterceptorParameters.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.usermetadata;
import com.netflix.metacat.common.dto.HasMetadata;
import lombok.Builder;
import java.util.Optional;
/**
* Get definition metadata parameters.
*
* @author zhenl
* @since 1.2.0
*/
@Builder
public class GetMetadataInterceptorParameters {
private HasMetadata hasMetadata;
public Optional<HasMetadata> getHasMetadata() {
return Optional.ofNullable(hasMetadata);
}
}
| 9,839 |
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/usermetadata/DefaultLookupService.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.usermetadata;
/**
* Default Look up Service.
*
* @author zhenl
* @since 1.1.0
*/
public class DefaultLookupService implements LookupService {
}
| 9,840 |
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/usermetadata/DefaultUserMetadataService.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.usermetadata;
/**
* Default User Metadata Service.
*
* @author zhenl
* @since 1.1.0
*/
public class DefaultUserMetadataService implements UserMetadataService {
}
| 9,841 |
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/usermetadata/LookupService.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.usermetadata;
import com.netflix.metacat.common.server.model.Lookup;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Set;
/**
* Lookup service API.
*
* @author amajumdar
*/
public interface LookupService {
/**
* Returns the lookup for the given <code>name</code>.
*
* @param name lookup name
* @return lookup
*/
@Nullable
default Lookup get(final String name) {
return null;
}
/**
* Returns the value of the lookup name.
*
* @param name lookup name
* @return scalar lookup value
*/
default String getValue(final String name) {
return null;
}
/**
* Returns the list of values of the lookup name.
*
* @param name lookup name
* @return list of lookup values
*/
default Set<String> getValues(final String name) {
return Collections.emptySet();
}
/**
* Returns the list of values of the lookup name.
*
* @param lookupId lookup id
* @return list of lookup values
*/
default Set<String> getValues(final Long lookupId) {
return Collections.emptySet();
}
/**
* Saves the lookup value.
*
* @param name lookup name
* @param values multiple values
* @return updated lookup
*/
@Nullable
default Lookup setValues(final String name, final Set<String> values) {
return null;
}
/**
* Saves the lookup value.
*
* @param name lookup name
* @param values multiple values
* @return updated lookup
*/
@Nullable
default Lookup addValues(final String name, final Set<String> values) {
return null;
}
/**
* Saves the lookup value.
*
* @param name lookup name
* @param value lookup value
* @return updated lookup
*/
@Nullable
default Lookup setValue(final String name, final String value) {
return null;
}
}
| 9,842 |
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/usermetadata/DefaultAliasService.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.usermetadata;
/**
* Alias Service API.
*
* @author rveeramacheneni
* @since 1.3.0
*/
public class DefaultAliasService implements AliasService {
}
| 9,843 |
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/usermetadata/MetadataInterceptor.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.usermetadata;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.netflix.metacat.common.QualifiedName;
import com.netflix.metacat.common.server.connectors.exception.InvalidMetadataException;
import javax.annotation.Nullable;
/**
* Business Metadata Manager.
*
* @author zhenl
* @since 1.2.0
*/
public interface MetadataInterceptor {
/**
* apply business rules before retrieving back. These rules may change or overriding existing
* business metadata.
*
* @param userMetadataService user metadata service
* @param name qualified name
* @param objectNode input metadata object node
* @param getMetadataInterceptorParameters get Metadata Interceptor Parameters
*/
default void onRead(final UserMetadataService userMetadataService,
final QualifiedName name, @Nullable final ObjectNode objectNode,
final GetMetadataInterceptorParameters getMetadataInterceptorParameters) {
}
/**
* Valide ObjectNode before storing it.
* @param userMetadataService user metadata service
* @param name qualified name
* @param objectNode input metadata object node
* @throws InvalidMetadataException business validation exception
*/
default void onWrite(final UserMetadataService userMetadataService,
final QualifiedName name, final ObjectNode objectNode)
throws InvalidMetadataException {
}
}
| 9,844 |
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/usermetadata/DefaultAuthorizationService.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.usermetadata;
import com.netflix.metacat.common.QualifiedName;
import com.netflix.metacat.common.exception.MetacatUnAuthorizedException;
import com.netflix.metacat.common.server.properties.Config;
import java.util.Map;
import java.util.Set;
/**
* Config based authorization service implementation.
*
* @author zhenl
* @since 1.2.0
*/
public class DefaultAuthorizationService implements AuthorizationService {
private final Config config;
/**
* Constructor.
*
* @param config metacat config
*/
public DefaultAuthorizationService(
final Config config
) {
this.config = config;
}
/**
* {@inheritDoc}
*/
@Override
public void checkPermission(final String userName,
final QualifiedName name,
final MetacatOperation op) {
if (config.isAuthorizationEnabled()) {
switch (op) {
case CREATE:
checkPermit(config.getMetacatCreateAcl(), userName, name, op);
break;
case RENAME:
case DELETE:
checkPermit(config.getMetacatDeleteAcl(), userName, name, op);
break;
default:
}
}
}
/**
* Check at database level.
*/
private void checkPermit(final Map<QualifiedName, Set<String>> accessACL,
final String userName,
final QualifiedName name,
final MetacatOperation op) {
final Set<String> users =
accessACL.get(QualifiedName.ofDatabase(name.getCatalogName(), name.getDatabaseName()));
if ((users != null) && !users.isEmpty() && !users.contains(userName)) {
throw new MetacatUnAuthorizedException(String.format("%s is not permitted for %s %s",
userName, op.name(), name
));
}
}
}
| 9,845 |
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/usermetadata/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 classes used in user metadata service.
*
* @author amajumdar
*/
@ParametersAreNonnullByDefault
package com.netflix.metacat.common.server.usermetadata;
import javax.annotation.ParametersAreNonnullByDefault;
| 9,846 |
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/spi/MetacatCatalogConfig.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.spi;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.netflix.metacat.common.QualifiedName;
import com.netflix.metacat.common.server.connectors.model.CatalogInfo;
import com.netflix.metacat.common.server.connectors.model.ClusterInfo;
import lombok.Getter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Catalog config.
*/
@Getter
public final class MetacatCatalogConfig {
private static final Splitter COMMA_LIST_SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings();
private final boolean includeViewsWithTables;
private final List<String> schemaBlacklist;
private final List<String> schemaWhitelist;
private final int thriftPort;
private final String type;
private final String catalogName;
private final ClusterInfo clusterInfo;
private boolean cacheEnabled;
private boolean interceptorEnabled;
private boolean hasDataExternal;
private MetacatCatalogConfig(
final String type,
final String catalogName,
final ClusterInfo clusterInfo,
final boolean includeViewsWithTables,
final List<String> schemaWhitelist,
final List<String> schemaBlacklist,
final int thriftPort,
final boolean cacheEnabled,
final boolean interceptorEnabled,
final boolean hasDataExternal) {
this.type = type;
this.catalogName = catalogName;
this.clusterInfo = clusterInfo;
this.includeViewsWithTables = includeViewsWithTables;
this.schemaBlacklist = schemaBlacklist;
this.schemaWhitelist = schemaWhitelist;
this.thriftPort = thriftPort;
this.cacheEnabled = cacheEnabled;
this.interceptorEnabled = interceptorEnabled;
this.hasDataExternal = hasDataExternal;
}
/**
* Creates the config.
*
* @param type type
* @param catalogName catalog name
* @param properties properties
* @return config
*/
public static MetacatCatalogConfig createFromMapAndRemoveProperties(
final String type,
final String catalogName,
final Map<String, String> properties) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(type), "type is required");
final String catalogType =
properties.containsKey(Keys.CATALOG_TYPE) ? properties.remove(Keys.CATALOG_TYPE) : type;
final List<String> schemaWhitelist = properties.containsKey(Keys.SCHEMA_WHITELIST)
? COMMA_LIST_SPLITTER.splitToList(properties.remove(Keys.SCHEMA_WHITELIST))
: Collections.EMPTY_LIST;
final List<String> schemaBlacklist = properties.containsKey(Keys.SCHEMA_BLACKLIST)
? COMMA_LIST_SPLITTER.splitToList(properties.remove(Keys.SCHEMA_BLACKLIST))
: Collections.EMPTY_LIST;
final boolean includeViewsWithTables = Boolean.parseBoolean(properties.remove(Keys.INCLUDE_VIEWS_WITH_TABLES));
int thriftPort = 0;
if (properties.containsKey(Keys.THRIFT_PORT)) {
thriftPort = Integer.parseInt(properties.remove(Keys.THRIFT_PORT));
}
// Cache properties
final boolean cacheEnabled =
Boolean.parseBoolean(properties.getOrDefault(Keys.CATALOG_CACHE_ENABLED, "false"));
// Interceptor properties
final boolean interceptorEnabled =
Boolean.parseBoolean(properties.getOrDefault(Keys.CATALOG_INTERCEPTOR_ENABLED, "true"));
// Has data external
final boolean hasDataExternal =
Boolean.parseBoolean(properties.getOrDefault(Keys.CATALOG_HAS_DATA_EXTERNAL, "false"));
// Cluster information
final String clusterName = properties.get(Keys.CLUSTER_NAME);
final String clusterAccount = properties.get(Keys.CLUSTER_ACCOUNT);
final String clusterAccountId = properties.get(Keys.CLUSTER_ACCOUNT_ID);
final String clusterEnv = properties.get(Keys.CLUSTER_ENV);
final String clusterRegion = properties.get(Keys.CLUSTER_REGION);
final ClusterInfo clusterInfo =
new ClusterInfo(clusterName, type, clusterAccount, clusterAccountId, clusterEnv, clusterRegion);
return new MetacatCatalogConfig(catalogType, catalogName, clusterInfo, includeViewsWithTables, schemaWhitelist,
schemaBlacklist, thriftPort, cacheEnabled, interceptorEnabled, hasDataExternal);
}
public boolean isThriftInterfaceRequested() {
return thriftPort != 0;
}
/**
* Returns true if catalog is a proxy one.
* @return Returns true if catalog is a proxy one.
*/
public boolean isProxy() {
return type.equalsIgnoreCase("proxy");
}
/**
* Creates the catalog info.
* @return catalog info
*/
public CatalogInfo toCatalogInfo() {
return CatalogInfo.builder().name(QualifiedName.ofCatalog(catalogName)).clusterInfo(clusterInfo).build();
}
/**
* Properties in the catalog.
*/
public static class Keys {
/**
* Catalog name. Usually catalog name is derived from the name of the catalog properties file.
* One could also specify it in the properties under the property name <code>catalog.name</code>.
* For example, if a catalog has two shards with catalog defined in two property files,
* then we can have the <code>catalog.name</code> set to one name.
*/
public static final String CATALOG_NAME = "catalog.name";
/**
* Connector type.
*/
public static final String CONNECTOR_NAME = "connector.name";
/**
* Catalog type.
*/
public static final String CATALOG_TYPE = "metacat.type";
/**
* True, if catalog cache is enabled.
*/
public static final String CATALOG_CACHE_ENABLED = "metacat.cache.enabled";
/**
* True, if catalog interceptor needs to be enabled.
*/
public static final String CATALOG_INTERCEPTOR_ENABLED = "metacat.interceptor.enabled";
/**
* True, if catalog stores data externally. Ex: Hive.
*/
public static final String CATALOG_HAS_DATA_EXTERNAL = "metacat.has-data-external";
/**
* List views with tables.
*/
public static final String INCLUDE_VIEWS_WITH_TABLES = "metacat.schema.list-views-with-tables";
/**
* Schemas that are black listed.
*/
public static final String SCHEMA_BLACKLIST = "metacat.schema.blacklist";
/**
* Schemas that are white listed.
*/
public static final String SCHEMA_WHITELIST = "metacat.schema.whitelist";
/**
* Thrift port.
*/
public static final String THRIFT_PORT = "metacat.thrift.port";
/**
* Cluster name.
*/
public static final String CLUSTER_NAME = "metacat.cluster.name";
/**
* Cluster account.
*/
public static final String CLUSTER_ACCOUNT = "metacat.cluster.account";
/**
* Cluster account id.
*/
public static final String CLUSTER_ACCOUNT_ID = "metacat.cluster.account-id";
/**
* Cluster region.
*/
public static final String CLUSTER_REGION = "metacat.cluster.region";
/**
* Cluster environment.
*/
public static final String CLUSTER_ENV = "metacat.cluster.env";
}
}
| 9,847 |
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/spi/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.
*/
/**
* This package includes spi config.
*
* @author amajumdar
*/
@ParametersAreNonnullByDefault
package com.netflix.metacat.common.server.spi;
import javax.annotation.ParametersAreNonnullByDefault;
| 9,848 |
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/Definition.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.fasterxml.jackson.annotation.JsonIgnore;
import com.netflix.metacat.common.QualifiedName;
import lombok.NonNull;
import java.util.Set;
/**
* Definition metadata related properties.
*
* @author amajumdar
* @since 1.2.0
*/
@lombok.Data
public class Definition {
@NonNull
private Metadata metadata = new Metadata();
/**
* Metadata related properties.
*
* @author amajumdar
* @since 1.2.0
*/
@lombok.Data
public static class Metadata {
@NonNull
private Delete delete = new Delete();
private boolean disablePartitionDefinitionMetadata;
/**
* Delete related properties.
*
* @author amajumdar
* @since 1.2.0
*/
@lombok.Data
public static class Delete {
private boolean enableForTable = true;
private String enableDeleteForQualifiedNames;
private Set<QualifiedName> enableDeleteForQualifiedNamesSet;
/**
* Get the names stored in the variable as a List of fully qualified names.
*
* @return The names as a list or empty list if {@code enableDeleteForQualifiedNames} is null or empty
*/
@JsonIgnore
public Set<QualifiedName> getQualifiedNamesEnabledForDelete() {
if (enableDeleteForQualifiedNamesSet == null) {
enableDeleteForQualifiedNamesSet =
PropertyUtils.delimitedStringsToQualifiedNamesSet(this.enableDeleteForQualifiedNames, ',');
}
return enableDeleteForQualifiedNamesSet;
}
}
}
}
| 9,849 |
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/NotificationsProperties.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;
/**
* Properties related to notifications.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class NotificationsProperties {
@NonNull
private Sns sns = new Sns();
/**
* SNS Properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Sns {
private boolean enabled; // false is default in Java no need to initialize
private int threadCount = 50;
private Topic topic = new Topic();
private AttachPartitionIds attachPartitionIds = new AttachPartitionIds();
/**
* SNS Topic settings.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Topic {
@NonNull
private Table table = new Table();
@NonNull
private Partition partition = new Partition();
/**
* Table notification settings.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Table {
private String arn; // Default to null
private String fallbackArn; // Default to null
}
/**
* Partition notification settings.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Partition {
private String arn; // Default to null
private String fallbackArn; // Default to null
private boolean enabled = true;
}
}
/**
* SNS Table PartitionUpdate payload setting.
*
* @author zhenl
* @since 1.2.1
*/
@Data
public static class AttachPartitionIds {
private boolean enabled = true; //default to true
private int maxPartitionIdNumber = 200;
}
}
}
| 9,850 |
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/HiveProperties.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;
/**
* Hive related properties for Metacat.
*
* @author tgianos
* @since 1.0.0
*/
@Data
//TODO: This shouldn't be in the common module. This should be in the Hive connector
public class HiveProperties {
@NonNull
private Metastore metastore = new Metastore();
@NonNull
private Iceberg iceberg = new Iceberg();
@NonNull
private CommonView commonview = new CommonView();
/**
* Metastore related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Metastore {
@NonNull
private Partition partition = new Partition();
private int fetchSize = 2500;
private int batchSize = 2500;
/**
* Metastore partition related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Partition {
@NonNull
private Name name = new Name();
private boolean escapeNameOnFilter = true;
/**
* Metastore partition name related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Name {
@NonNull
private Whitelist whitelist = new Whitelist();
/**
* Metastore partition name whitelist related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Whitelist {
@NonNull
private String pattern = "";
}
}
}
}
/**
* Iceberg related properties.
*
* @author zhenl
* @since 1.2.0
*/
@Data
public static class Iceberg {
@NonNull
private IcebergCacheProperties cache = new IcebergCacheProperties();
private boolean enabled;
private int fetchSizeInTableSummary = 100;
/* each retry needs a s3 access, default to 0 as no retry */
private int refreshFromMetadataLocationRetryNumber;
/* loading metadata consumes memory, cap to 500m as default */
private long maxMetadataFileSizeBytes = 500 * 1024 * 1024; //500m
/*iceberg://<db-name.table-name>/<partition>/snapshot_time=<dateCreated> */
private String partitionUriScheme = "iceberg";
private boolean isIcebergPreviousMetadataLocationCheckEnabled = true;
private boolean isShouldFetchOnlyMetadataLocationEnabled = true;
}
/**
* Iceberg cache related properties.
*
* @author amajumdar
* @since 1.3.0
*/
@Data
public static class IcebergCacheProperties {
private boolean enabled;
@NonNull
private TableMetadata metadata = new TableMetadata();
}
/**
* TableMetadata properties.
*
* @author amajumdar
*/
@Data
public static class TableMetadata {
private boolean enabled;
}
/**
* CommonView related properties.
*
* @author zhenl
* @since 1.3.0
*/
@Data
public static class CommonView {
private boolean enabled;
private boolean deleteStorageTable;
}
}
| 9,851 |
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/RateLimiterProperties.java
|
package com.netflix.metacat.common.server.properties;
import lombok.Data;
/**
* RateLimiter service properties.
*
* @author rveeramacheneni
*/
@Data
public class RateLimiterProperties {
private boolean enabled;
private boolean enforced;
}
| 9,852 |
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/PluginProperties.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;
/**
* Plugin related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class PluginProperties {
@NonNull
private Config config = new Config();
/**
* Plugin config related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Config {
private String location;
}
}
| 9,853 |
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/ElasticsearchProperties.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.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.netflix.metacat.common.QualifiedName;
import lombok.Data;
import lombok.NonNull;
import java.util.List;
/**
* Properties related to Elasticsearch configuration.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class ElasticsearchProperties {
private boolean enabled;
private long timeout = 30;
private long bulkTimeout = 120;
@NonNull
private Index index = new Index();
@NonNull
private MergeIndex mergeIndex = new MergeIndex();
@NonNull
private Cluster cluster = new Cluster();
@NonNull
private Refresh refresh = new Refresh();
@NonNull
private Scroll scroll = new Scroll();
@NonNull
private Publish publish = new Publish();
/**
* Elasticsearch index related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Index {
private String name = "metacat";
}
/**
* Elasticsearch merge index related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class MergeIndex {
private String name;
}
/**
* Elasticsearch cluster related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Cluster {
private String name;
private String nodes;
private int port = 7102;
@NonNull
private Discovery discovery = new Discovery();
/**
* Whether to use discovery or the lookup service to find Elasticsearch nodes.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Discovery {
private boolean useLookup;
}
}
/**
* Elasticsearch refresh related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Refresh {
@NonNull
private Include include = new Include();
@NonNull
private Exclude exclude = new Exclude();
@NonNull
private Partitions partitions = new Partitions();
@NonNull
private Threshold threshold = new Threshold();
/**
* Elasticsearch refresh inclusion related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Include {
private String catalogs;
private String databases;
private List<QualifiedName> databasesList;
/**
* Get the databases stored in the variable as a List of fully qualified names.
*
* @return The databases as a list or empty list if {@code names} is null or empty
*/
@JsonIgnore
public List<QualifiedName> getDatabasesAsListOfQualfiedNames() {
if (databasesList == null) {
databasesList = this.databases == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.databases, ',');
}
return databasesList;
}
}
/**
* Elasticsearch refresh exclusion related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Exclude {
@NonNull
private Qualified qualified = new Qualified();
/**
* Elasticsearch refresh exclusion qualified related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Qualified {
private String names;
private List<QualifiedName> namesList;
/**
* Get the names stored in the variable as a List of fully qualified names.
*
* @return The names as a list or empty list if {@code names} is null or empty
*/
@JsonIgnore
public List<QualifiedName> getNamesAsListOfQualifiedNames() {
if (namesList == null) {
namesList = this.names == null
? Lists.newArrayList()
: PropertyUtils.delimitedStringsToQualifiedNamesList(this.names, ',');
}
return namesList;
}
}
}
/**
* Elasticsearch refresh partition related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Partitions {
@NonNull
private Include include = new Include();
/**
* Elasticsearch refresh partitions inclusion related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Include {
private String catalogs = "prodhive,testhive,s3,aegisthus";
}
}
/**
* Elasticsearch refresh threshold related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Threshold {
@NonNull
private Unmarked unmarked = new Unmarked();
/**
* Elasticsearch refresh threshold unmarked related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Unmarked {
@NonNull
private Databases databases = new Databases();
@NonNull
private Tables tables = new Tables();
/**
* Elasticsearch refresh threshold unmarked databases related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Databases {
private int delete = 100;
}
/**
* Elasticsearch refresh threshold unmarked tables related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Tables {
private int delete = 1000;
}
}
}
}
/**
* Elasticsearch scroll related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Scroll {
@NonNull
private Fetch fetch = new Fetch();
@NonNull
private Timeout timeout = new Timeout();
/**
* Elasticsearch scroll fetch related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Fetch {
private int size = 50000;
}
/**
* Elasticsearch scroll timeout related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Timeout {
private int ms = 600000;
}
}
/**
* Elasticsearch publish properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Publish {
private boolean partitionEnabled;
private boolean updateTablesWithSameUriEnabled;
private boolean metacatLogEnabled;
}
}
| 9,854 |
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/TypeProperties.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;
/**
* Properties related to canonical types in Metacat.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class TypeProperties {
private String converter = "com.netflix.metacat.common.server.converter.DefaultTypeConverter";
private boolean epochInSeconds = true;
}
| 9,855 |
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/ThriftProperties.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;
/**
* Properties related to Thrift.
*
* @author tgianos
* @since 1.1.0
*/
@Data
//TODO: This should be in the Thrift module
public class ThriftProperties {
private int serverMaxWorkerThreads = 100;
private int serverSocketClientTimeoutInSeconds = 60;
}
| 9,856 |
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/MetacatProperties.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.NonNull;
/**
* Entry point to entire property tree of Metacat namespace.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public class MetacatProperties {
@NonNull
private Data data = new Data();
@NonNull
private Definition definition = new Definition();
@NonNull
private ElasticsearchProperties elasticsearch = new ElasticsearchProperties();
@NonNull
private EventProperties event = new EventProperties();
@NonNull
private FranklinProperties franklin = new FranklinProperties();
@NonNull
private HiveProperties hive = new HiveProperties();
@NonNull
private LookupServiceProperties lookupService = new LookupServiceProperties();
@NonNull
private NotificationsProperties notifications = new NotificationsProperties();
@NonNull
private PluginProperties plugin = new PluginProperties();
@NonNull
private ServiceProperties service = new ServiceProperties();
@NonNull
private Table table = new Table();
@NonNull
private TagServiceProperties tagService = new TagServiceProperties();
@NonNull
private ThriftProperties thrift = new ThriftProperties();
@NonNull
private TypeProperties type = new TypeProperties();
@NonNull
private User user = new User();
@NonNull
private UserMetadata usermetadata = new UserMetadata();
@NonNull
private CacheProperties cache = new CacheProperties();
@NonNull
private AuthorizationServiceProperties authorization = new AuthorizationServiceProperties();
@NonNull
private AliasServiceProperties aliasServiceProperties = new AliasServiceProperties();
@NonNull
private RateLimiterProperties rateLimiterProperties = new RateLimiterProperties();
}
| 9,857 |
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/Table.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.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Splitter;
import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;
import java.util.HashSet;
import java.util.Set;
/**
* Table related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public class Table {
@NonNull
private Delete delete = new Delete();
@NonNull
private Rename rename = new Rename();
@NonNull
private Update update = new Update();
/**
* Delete related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Delete {
@NonNull
private Cascade cascade = new Cascade();
private String noDeleteOnTags;
private Set<String> noDeleteOnTagsSet;
/**
* Get the tags that disable table deletes.
*
* @return Set of tags
*/
@JsonIgnore
public Set<String> getNoDeleteOnTagsSet() {
if (noDeleteOnTagsSet == null) {
if (StringUtils.isNotBlank(noDeleteOnTags)) {
noDeleteOnTagsSet = new HashSet<>(Splitter.on(',')
.omitEmptyStrings()
.splitToList(noDeleteOnTags));
} else {
noDeleteOnTagsSet = new HashSet<>();
}
}
return noDeleteOnTagsSet;
}
/**
* Cascade related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Cascade {
@NonNull
private Views views = new Views();
/**
* Views related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Views {
private boolean metadata = true;
}
}
}
/**
* Rename related properties.
*
* @author amajumdar
* @since 1.3.0
*/
@lombok.Data
public static class Rename {
private String noRenameOnTags;
private Set<String> noRenameOnTagsSet;
/**
* Get the tags that disable table renames.
*
* @return Set of tags
*/
@JsonIgnore
public Set<String> getNoRenameOnTagsSet() {
if (noRenameOnTagsSet == null) {
if (StringUtils.isNotBlank(noRenameOnTags)) {
noRenameOnTagsSet = new HashSet<>(Splitter.on(',')
.omitEmptyStrings()
.splitToList(noRenameOnTags));
} else {
noRenameOnTagsSet = new HashSet<>();
}
}
return noRenameOnTagsSet;
}
}
/**
* Update related properties.
*/
@lombok.Data
public static class Update {
private String noUpdateOnTags;
private Set<String> noUpdateOnTagsSet;
/**
* Get the tags that disable table updates.
*
* @return Set of tags
*/
@JsonIgnore
public Set<String> getNoUpdateOnTagsSet() {
if (noUpdateOnTagsSet == null) {
if (StringUtils.isNotBlank(noUpdateOnTags)) {
noUpdateOnTagsSet = new HashSet<>(Splitter.on(',')
.omitEmptyStrings()
.trimResults()
.splitToList(noUpdateOnTags));
} else {
noUpdateOnTagsSet = new HashSet<>();
}
}
return noUpdateOnTagsSet;
}
}
}
| 9,858 |
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/User.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;
/**
* User related properties for metacat.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class User {
@NonNull
private Metadata metadata = new Metadata();
/**
* Metadata related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Metadata {
private boolean softDelete = true;
private int maxInClauseItems = 2500;
}
}
| 9,859 |
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/EventProperties.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;
/**
* Properties related to Metacat internal Events.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class EventProperties {
private boolean updateIcebergTableAsyncPostEventEnabled;
@NonNull
private Thread thread = new Thread();
@NonNull
private Bus bus = new Bus();
/**
* Properties related to event threads.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Thread {
private int count = 10;
}
/**
* Properties related to the event bus.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Bus {
@NonNull
private Executor executor = new Executor();
/**
* Properties related to bus executor.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Executor {
@NonNull
private Thread thread = new Thread();
/**
* Properties related to event bus executor threads.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Thread {
private int count = 10;
}
}
}
}
| 9,860 |
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/Data.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.NonNull;
/**
* Data related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public class Data {
@NonNull
private Metadata metadata = new Metadata();
/**
* Metadata related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Metadata {
@NonNull
private Delete delete = new Delete();
/**
* Delete related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Delete {
private boolean enable;
@NonNull
private Marker marker = new Marker();
/**
* Marker related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Marker {
@NonNull
private Lifetime lifetime = new Lifetime();
/**
* Lifetime related properties.
*
* @author tgianos
* @since 1.1.0
*/
@lombok.Data
public static class Lifetime {
private int days = 15;
}
}
}
}
}
| 9,861 |
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/FranklinProperties.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;
/**
* Franklin related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public class FranklinProperties {
@NonNull
private Connector connector = new Connector();
/**
* Connector related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Connector {
@NonNull
private Use use = new Use();
/**
* Connector use related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Use {
@NonNull
private Pig pig = new Pig();
/**
* Connector use pig related properties.
*
* @author tgianos
* @since 1.1.0
*/
@Data
public static class Pig {
private boolean type = true;
}
}
}
}
| 9,862 |
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/DefaultConfigImpl.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.netflix.metacat.common.QualifiedName;
import lombok.NonNull;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* A default implementation of the config interface.
*
* @author tgianos
* @since 1.1.0
*/
public class DefaultConfigImpl implements Config {
private final MetacatProperties metacatProperties;
/**
* Constructor.
*
* @param metacatProperties The metacat properties to use
*/
public DefaultConfigImpl(@Nonnull @NonNull final MetacatProperties metacatProperties) {
this.metacatProperties = metacatProperties;
}
/**
* {@inheritDoc}
*/
@Override
public String getDefaultTypeConverter() {
return this.metacatProperties.getType().getConverter();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isElasticSearchEnabled() {
return this.metacatProperties.getElasticsearch().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isElasticSearchUpdateTablesWithSameUriEnabled() {
return this.metacatProperties.getElasticsearch().getPublish().isUpdateTablesWithSameUriEnabled();
}
@Override
public boolean isElasticSearchPublishPartitionEnabled() {
return this.metacatProperties.getElasticsearch().getPublish().isPartitionEnabled();
}
@Override
public boolean isElasticSearchPublishMetacatLogEnabled() {
return this.metacatProperties.getElasticsearch().getPublish().isMetacatLogEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public String getElasticSearchClusterName() {
return this.metacatProperties.getElasticsearch().getCluster().getName();
}
/**
* {@inheritDoc}
*/
@Override
public String getElasticSearchClusterNodes() {
return this.metacatProperties.getElasticsearch().getCluster().getNodes();
}
/**
* {@inheritDoc}
*/
@Override
public int getElasticSearchClusterPort() {
return this.metacatProperties.getElasticsearch().getCluster().getPort();
}
/**
* {@inheritDoc}
*/
@Override
public int getElasticSearchScrollFetchSize() {
return this.metacatProperties.getElasticsearch().getScroll().getFetch().getSize();
}
/**
* {@inheritDoc}
*/
@Override
public int getElasticSearchScrollTimeout() {
return this.metacatProperties.getElasticsearch().getScroll().getTimeout().getMs();
}
/**
* {@inheritDoc}
*/
@Override
public long getElasticSearchCallTimeout() {
return this.metacatProperties.getElasticsearch().getTimeout();
}
/**
* {@inheritDoc}
*/
@Override
public long getElasticSearchBulkCallTimeout() {
return this.metacatProperties.getElasticsearch().getBulkTimeout();
}
/**
* {@inheritDoc}
*/
@Override
public List<QualifiedName> getElasticSearchRefreshExcludeQualifiedNames() {
return this.metacatProperties
.getElasticsearch()
.getRefresh()
.getExclude()
.getQualified()
.getNamesAsListOfQualifiedNames();
}
/**
* {@inheritDoc}
*/
@Override
public String getElasticSearchRefreshIncludeCatalogs() {
return this.metacatProperties.getElasticsearch().getRefresh().getInclude().getCatalogs();
}
/**
* {@inheritDoc}
*/
@Override
public List<QualifiedName> getElasticSearchRefreshIncludeDatabases() {
return this.metacatProperties.getElasticsearch().getRefresh().getInclude().getDatabasesAsListOfQualfiedNames();
}
/**
* {@inheritDoc}
*/
@Override
public String getElasticSearchRefreshPartitionsIncludeCatalogs() {
return this.metacatProperties.getElasticsearch().getRefresh().getPartitions().getInclude().getCatalogs();
}
/**
* {@inheritDoc}
*/
@Override
public int getElasticSearchThresholdUnmarkedDatabasesDelete() {
return this.metacatProperties
.getElasticsearch()
.getRefresh()
.getThreshold()
.getUnmarked()
.getDatabases()
.getDelete();
}
/**
* {@inheritDoc}
*/
@Override
public int getElasticSearchThresholdUnmarkedTablesDelete() {
return this.metacatProperties
.getElasticsearch()
.getRefresh()
.getThreshold()
.getUnmarked()
.getTables()
.getDelete();
}
/**
* {@inheritDoc}
*/
@Override
public int getEventBusExecutorThreadCount() {
return this.metacatProperties.getEvent().getBus().getExecutor().getThread().getCount();
}
/**
* {@inheritDoc}
*/
@Override
public int getEventBusThreadCount() {
return this.metacatProperties.getEvent().getThread().getCount();
}
/**
* {@inheritDoc}
*/
@Override
public String getHivePartitionWhitelistPattern() {
return this.metacatProperties.getHive().getMetastore().getPartition().getName().getWhitelist().getPattern();
}
/**
* {@inheritDoc}
*/
@Override
public boolean escapePartitionNameOnFilter() {
return this.metacatProperties.getHive().getMetastore().getPartition().isEscapeNameOnFilter();
}
/**
* {@inheritDoc}
*/
@Override
public int getHiveMetastoreFetchSize() {
return this.metacatProperties.getHive().getMetastore().getFetchSize();
}
/**
* {@inheritDoc}
*/
@Override
public int getHiveMetastoreBatchSize() {
return this.metacatProperties.getHive().getMetastore().getBatchSize();
}
/**
* {@inheritDoc}
*/
@Override
public String getLookupServiceUserAdmin() {
return this.metacatProperties.getLookupService().getUserAdmin();
}
/**
* {@inheritDoc}
*/
@Override
public String getMetacatVersion() {
// TODO
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* {@inheritDoc}
*/
@Override
public String getPluginConfigLocation() {
return this.metacatProperties.getPlugin().getConfig().getLocation();
}
/**
* {@inheritDoc}
*/
@Override
public String getTagServiceUserAdmin() {
return this.metacatProperties.getTagService().getUserAdmin();
}
/**
* {@inheritDoc}
*/
@Override
public int getThriftServerMaxWorkerThreads() {
return this.metacatProperties.getThrift().getServerMaxWorkerThreads();
}
/**
* {@inheritDoc}
*/
@Override
public int getThriftServerSocketClientTimeoutInSeconds() {
return this.metacatProperties.getThrift().getServerSocketClientTimeoutInSeconds();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isEpochInSeconds() {
return this.metacatProperties.getType().isEpochInSeconds();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isUsePigTypes() {
return this.metacatProperties.getFranklin().getConnector().getUse().getPig().isType();
}
/**
* {@inheritDoc}
*/
@Override
public int getServiceMaxNumberOfThreads() {
return this.metacatProperties.getService().getMax().getNumber().getThreads();
}
/**
* {@inheritDoc}
*/
@Override
public List<QualifiedName> getNamesToThrowErrorOnListPartitionsWithNoFilter() {
return this.metacatProperties
.getService()
.getTables()
.getError()
.getList()
.getPartitions()
.getNo()
.getFilterAsListOfQualifiedNames();
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxPartitionsThreshold() {
return this.metacatProperties
.getService()
.getTables()
.getError()
.getList()
.getPartitions()
.getThreshold();
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxAddedPartitionsThreshold() {
return this.metacatProperties
.getService()
.getTables()
.getError()
.getList()
.getPartitions()
.getAddThreshold();
}
/**
* {@inheritDoc}
*/
@Override
public int getMaxDeletedPartitionsThreshold() {
return this.metacatProperties
.getService()
.getTables()
.getError()
.getList()
.getPartitions()
.getDeleteThreshold();
}
/**
* {@inheritDoc}
*/
@Override
public String getEsIndex() {
return this.metacatProperties.getElasticsearch().getIndex().getName();
}
/**
* {@inheritDoc}
*/
@Override
public String getMergeEsIndex() {
return this.metacatProperties.getElasticsearch().getMergeIndex().getName();
}
/**
* {@inheritDoc}
*/
@Override
public int getDataMetadataDeleteMarkerLifetimeInDays() {
return this.metacatProperties.getData().getMetadata().getDelete().getMarker().getLifetime().getDays();
}
/**
* {@inheritDoc}
*/
@Override
public boolean canSoftDeleteDataMetadata() {
return this.metacatProperties.getUser().getMetadata().isSoftDelete();
}
/**
* {@inheritDoc}
*/
@Override
public boolean canCascadeViewsMetadataOnTableDelete() {
return this.metacatProperties.getTable().getDelete().getCascade().getViews().isMetadata();
}
/**
* {@inheritDoc}
*/
@Override
public int getUserMetadataMaxInClauseItems() {
return this.metacatProperties.getUser().getMetadata().getMaxInClauseItems();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isSnsNotificationEnabled() {
return this.metacatProperties.getNotifications().getSns().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public String getSnsTopicTableArn() {
return this.metacatProperties.getNotifications().getSns().getTopic().getTable().getArn();
}
/**
* {@inheritDoc}
*/
@Override
public String getSnsTopicPartitionArn() {
return this.metacatProperties.getNotifications().getSns().getTopic().getPartition().getArn();
}
@Override
public String getFallbackSnsTopicTableArn() {
return this.metacatProperties.getNotifications().getSns().getTopic().getTable().getFallbackArn();
}
@Override
public String getFallbackSnsTopicPartitionArn() {
return this.metacatProperties.getNotifications().getSns().getTopic().getPartition().getFallbackArn();
}
@Override
public boolean isSnsNotificationTopicPartitionEnabled() {
return this.metacatProperties.getNotifications().getSns().getTopic().getPartition().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isSnsNotificationAttachPartitionIdsEnabled() {
return this.metacatProperties.getNotifications().getSns().getAttachPartitionIds().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public int getSnsNotificationAttachPartitionIdMax() {
return this.metacatProperties.getNotifications().getSns().getAttachPartitionIds().getMaxPartitionIdNumber();
}
@Override
public boolean canDeleteTableDefinitionMetadata() {
return this.metacatProperties.getDefinition().getMetadata().getDelete().isEnableForTable();
}
@Override
public Set<QualifiedName> getNamesEnabledForDefinitionMetadataDelete() {
return this.metacatProperties.getDefinition().getMetadata().getDelete().getQualifiedNamesEnabledForDelete();
}
@Override
public boolean isCacheEnabled() {
return this.metacatProperties.getCache().isEnabled();
}
@Override
public boolean isAuthorizationEnabled() {
return this.metacatProperties.getAuthorization().isEnabled();
}
@Override
public Map<QualifiedName, Set<String>> getMetacatCreateAcl() {
return this.metacatProperties.getAuthorization().getCreateAcl().getCreateAclMap();
}
@Override
public Map<QualifiedName, Set<String>> getMetacatDeleteAcl() {
return this.metacatProperties.getAuthorization().getDeleteAcl().getDeleteAclMap();
}
/**
* {@inheritDoc}
*/
@Override
public int getIcebergTableSummaryFetchSize() {
return this.metacatProperties.getHive().getIceberg().getFetchSizeInTableSummary();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isIcebergEnabled() {
return this.metacatProperties.getHive().getIceberg().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isIcebergCacheEnabled() {
return this.metacatProperties.getHive().getIceberg().getCache().isEnabled();
}
@Override
public boolean isIcebergTableMetadataCacheEnabled() {
return this.metacatProperties.getHive().getIceberg().getCache().getMetadata().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCommonViewEnabled() {
return this.metacatProperties.getHive().getCommonview().isEnabled();
}
/**
* {@inheritDoc}
*/
@Override
public boolean deleteCommonViewStorageTable() {
return this.metacatProperties.getHive().getCommonview().isDeleteStorageTable();
}
/**
* {@inheritDoc}
*/
@Override
public int getIcebergRefreshFromMetadataLocationRetryNumber() {
return this.metacatProperties.getHive().getIceberg().getRefreshFromMetadataLocationRetryNumber();
}
/**
* {@inheritDoc}
*/
@Override
public long getIcebergMaxMetadataFileSize() {
return this.metacatProperties.getHive().getIceberg().getMaxMetadataFileSizeBytes();
}
/**
* {@inheritDoc}
*/
@Override
public String getIcebergPartitionUriScheme() {
return this.metacatProperties.getHive().getIceberg().getPartitionUriScheme();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isTableAliasEnabled() {
return this.metacatProperties.getAliasServiceProperties().isEnabled();
}
@Override
public Set<String> getNoTableDeleteOnTags() {
return this.metacatProperties.getTable().getDelete().getNoDeleteOnTagsSet();
}
@Override
public Set<String> getNoTableRenameOnTags() {
return this.metacatProperties.getTable().getRename().getNoRenameOnTagsSet();
}
@Override
public Set<String> getNoTableUpdateOnTags() {
return this.metacatProperties.getTable().getUpdate().getNoUpdateOnTagsSet();
}
/**
* Whether the rate limiter is enabled.
*
* @return True if it is.
*/
@Override
public boolean isRateLimiterEnabled() {
return this.metacatProperties.getRateLimiterProperties().isEnabled();
}
/**
* Whether the rate limiter is being enforced
* and rejecting requests.
*
* @return True if it is.
*/
public boolean isRateLimiterEnforced() {
return this.metacatProperties.getRateLimiterProperties().isEnforced();
}
@Override
public boolean isUpdateIcebergTableAsyncPostEventEnabled() {
return this.metacatProperties.getEvent().isUpdateIcebergTableAsyncPostEventEnabled();
}
@Override
public boolean listTableNamesByDefaultOnGetDatabase() {
return this.metacatProperties.getService().isListTableNamesByDefaultOnGetDatabase();
}
@Override
public boolean listDatabaseNameByDefaultOnGetCatalog() {
return this.metacatProperties.getService().isListDatabaseNameByDefaultOnGetCatalog();
}
@Override
public int getMetadataQueryTimeout() {
return this.metacatProperties.getUsermetadata().getQueryTimeoutInSeconds();
}
@Override
public boolean isIcebergPreviousMetadataLocationCheckEnabled() {
return this.metacatProperties.getHive().getIceberg().isIcebergPreviousMetadataLocationCheckEnabled();
}
@Override
public boolean disablePartitionDefinitionMetadata() {
return this.metacatProperties.getDefinition().getMetadata().isDisablePartitionDefinitionMetadata();
}
@Override
public boolean shouldFetchOnlyMetadataLocationEnabled() {
return this.metacatProperties.getHive().getIceberg().isShouldFetchOnlyMetadataLocationEnabled();
}
}
| 9,863 |
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;
}
| 9,864 |
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;
}
| 9,865 |
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";
}
}
| 9,866 |
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;
}
}
| 9,867 |
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();
}
| 9,868 |
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();
}
}
}
| 9,869 |
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";
}
| 9,870 |
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;
}
}
}
}
}
}
}
| 9,871 |
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";
}
| 9,872 |
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;
| 9,873 |
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";
}
| 9,874 |
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";
}
| 9,875 |
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;
| 9,876 |
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;
| 9,877 |
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
);
}
| 9,878 |
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);
}
| 9,879 |
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;
| 9,880 |
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 {
}
| 9,881 |
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;
}
| 9,882 |
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;
}
}
| 9,883 |
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;
| 9,884 |
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);
}
| 9,885 |
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;
| 9,886 |
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
}
}
| 9,887 |
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;
| 9,888 |
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));
}
}
}
}
| 9,889 |
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;
| 9,890 |
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);
}
}
| 9,891 |
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) */
| 9,892 |
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) */
| 9,893 |
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) */
| 9,894 |
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) */
| 9,895 |
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;
}
| 9,896 |
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) */
| 9,897 |
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) */
| 9,898 |
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) */
| 9,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.