about deprecated method ParquetFileReader.readFooter - hadoop

I see ParquetFileReader.readFooter was deprecated in parquet-hadoop-1.11.0.jar. What class or which method should be used instead?

Based on code comments, you should use ParquetFileReader#open(InputFile, ParquetReadOptions).
/**
* Reads the meta data block in the footer of the file
* #param configuration a configuration
* #param file the parquet File
* #return the metadata blocks in the footer
* #throws IOException if an error occurs while reading the file
* #deprecated will be removed in 2.0.0;
* use {#link ParquetFileReader#open(InputFile, ParquetReadOptions)}
*/
#Deprecated
public static final ParquetMetadata readFooter(Configuration configuration, Path file) throws IOException {

Related

How to access the payload when implementing the validator interface?

I have to validate the incoming json payload and throw custom errors if the json is not valid. I tried implementing the validator interface as shown in the above image. But how should I access the payload now?In earlier versions the method accepted a mule event through which we could easily get the payload:
public interface Validator
{
/**
* Performs the validation and generates a
* {#link ValidationResult} back.
*
* #param event the current {#link MuleEvent}
* #return a {#link ValidationResult}
*/
ValidationResult validate(MuleEvent event);
}

RepositoryConfigurationExtensionSupport => useRepositoryConfiguration => "Reactive Repositories are not supported by %s. Offending repository is %s!"

with org.springframework.boot update from 2.0.4.RELEASE to 2.0.5.RELEASE start to get exception:
RepositoryConfigurationExtensionSupport
=> useRepositoryConfiguration
=> InvalidDataAccessApiUsageException: "Reactive Repositories are not supported by %s. Offending repository is %s!"
what is the best/simplest Spring Data workaround for this? Could someone provide example? if it is possible without redefinition of #EnableJpaRepositories and JpaRepositoriesRegistrar...
This is solution, but I don't like it.. +3 new classes..
EnableXxxJpaRepositories is practically exact copy of EnableJpaRepositories..
EnableXxxJpaRepositories:
#Target(ElementType.TYPE)
#Retention(RetentionPolicy.RUNTIME)
#Documented
#Inherited
#Import(XxxJpaRepositoriesRegistrar.class)
public #interface EnableXxxJpaRepositories {
/**
* Alias for the {#link #basePackages()} attribute. Allows for more concise annotation
* declarations e.g.: {#code #EnableXxxJpaRepositories("org.my.pkg")} instead of {#code
*
* #EnableXxxJpaRepositories(basePackages="org.my.pkg")}.
*/
String[] value() default {};
/**
* Base packages to scan for annotated components. {#link #value()} is an alias for (and mutually
* exclusive with) this attribute. Use {#link #basePackageClasses()} for a type-safe alternative
* to String-based package names.
*/
String[] basePackages() default {};
/**
* Type-safe alternative to {#link #basePackages()} for specifying the packages to scan for
* annotated components. The package of each class specified will be scanned. Consider creating a
* special no-op marker class or interface in each package that serves no purpose other than being
* referenced by this attribute.
*/
Class<?>[] basePackageClasses() default {};
/**
* Specifies which types are eligible for component scanning. Further narrows the set of candidate
* components from everything in {#link #basePackages()} to everything in the base packages that
* matches the given filter or filters.
*/
Filter[] includeFilters() default {};
/**
* Specifies which types are not eligible for component scanning.
*/
Filter[] excludeFilters() default {};
/**
* Returns the postfix to be used when looking up custom repository implementations. Defaults to
* {#literal Impl}. So for a repository named {#code PersonRepository} the corresponding
* implementation class will be looked up scanning for {#code PersonRepositoryImpl}.
*/
String repositoryImplementationPostfix() default "Impl";
/**
* Configures the location of where to find the Spring Data named queries properties file. Will
* default to {#code META-INF/jpa-named-queries.properties}.
*/
String namedQueriesLocation() default "";
/**
* Returns the key of the {#link QueryLookupStrategy} to be used for lookup queries for query
* methods. Defaults to {#link Key#CREATE_IF_NOT_FOUND}.
*/
Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND;
/**
* Returns the {#link FactoryBean} class to be used for each repository instance. Defaults to
* {#link JpaRepositoryFactoryBean}.
*/
Class<?> repositoryFactoryBeanClass() default JpaRepositoryFactoryBean.class;
/**
* Configure the repository base class to be used to create repository proxies for this particular
* configuration.
*
* #since 1.9
*/
Class<?> repositoryBaseClass() default DefaultRepositoryBaseClass.class;
// JPA specific configuration
/**
* Configures the name of the {#link EntityManagerFactory} bean definition to be used to create
* repositories discovered through this annotation. Defaults to {#code entityManagerFactory}.
*/
String entityManagerFactoryRef() default "entityManagerFactory";
/**
* Configures the name of the {#link PlatformTransactionManager} bean definition to be used to
* create repositories discovered through this annotation. Defaults to {#code
* transactionManager}.
*/
String transactionManagerRef() default "transactionManager";
/**
* Configures whether nested repository-interfaces (e.g. defined as inner classes) should be
* discovered by the repositories infrastructure.
*/
boolean considerNestedRepositories() default false;
/**
* Configures whether to enable default transactions for Spring Data JPA repositories. Defaults to
* {#literal true}. If disabled, repositories must be used behind a facade that's configuring
* transactions (e.g. using Spring's annotation driven transaction facilities) or repository
* methods have to be used to demarcate transactions.
*
* #return whether to enable default transactions, defaults to {#literal true}.
*/
boolean enableDefaultTransactions() default true;
}
XxxJpaRepositoriesRegistrar:
#Configuration
public class XxxJpaRepositoriesRegistrar extends RepositoryBeanDefinitionRegistrarSupport {
#Override
protected Class<? extends Annotation> getAnnotation() {
return EnableXxxJpaRepositories.class;
}
#Override
protected RepositoryConfigurationExtension getExtension() {
return new XxxJpaRepositoryConfigExtension();
}
}
XxxJpaRepositoryConfigExtension:
#Component
public class XxxJpaRepositoryConfigExtension extends JpaRepositoryConfigExtension {
#Override
protected boolean useRepositoryConfiguration(RepositoryMetadata metadata) {
//return super.useRepositoryConfiguration(metadata);
//return metadata.isReactiveRepository();
return true;
}
}

doInTable(HTableInterface table) is Deprecated

What can I use instead of doInTable(HTableInterface table) which is deprecated.
Below is the code.
hbaseTemplate.execute(tableName, new TableCallback<User>() {
public User doInTable(HTableInterface table) throws Throwable {
Put p = new Put(Bytes.toBytes(KEY),timestamp);
p.addColumn(FAMILY, XXX, Bytes.toBytes(user.getUserId()));
table.put(p);
}
});
I am using Spring Boot with Hbase.
Thank you in advance.
The source code mentioned using org.apache.hadoop.hbase.client.Table instead of HTableInterface.
/**
* Used to communicate with a single HBase table.
* Obtain an instance from an {#link HConnection}.
*
* #since 0.21.0
* #deprecated use {#link org.apache.hadoop.hbase.client.Table} instead
*/
#Deprecated
#InterfaceAudience.Private
#InterfaceStability.Stable
public interface HTableInterface extends Table ...

Javadoc shows Error "reference not found" although reference cleary exists

With Java8 the javadoc checks became stricter. The common solution is to disable the strict javadoc checking. Nevertheless, I started trying to fix the errors in some projects.
But there is one error I don't get fixed.
The corresponding class:
package foo;
import com.google.gwt.user.client.ui.TextArea;
[...]
public class MyClass {
[...]
/**
* #see TextArea#getValue()
*/
public String getValue() {
[...]
}
/**
* #see TextArea#setValue(String value)
*/
public void setValue(String value) {
[...]
}
/**
* #see TextArea#setValue(String, boolean)
*/
public void setValue(String value, boolean fireEvents) {
[...]
}
}
And the error message:
[ERROR] ...\MyClass.java:44: error: reference not found
[ERROR] * #see TextArea#setValue(String value)
[ERROR] ^
[ERROR] ...\MyClass.java:51: error: reference not found
[ERROR] * #see TextArea#setValue(String, boolean)
The error message states that it cannot find TextArea in the Javadoc of the setValue-Methods - but on the other hand has no problems to find TextArea on the getValue-Method.
As far as I can say, I followed How to specify a name as well as #see reference.
Any clues? Thanks a lot!
Okay, I got the answer now, it's a bit tricky!
TextArea extends ValueBoxBase<String>
TextArea#getValue() has no Parameters, so everything is fine
The Method TextArea#setValue(String value) does not exist in TextArea, it is rather defined in the superclass: ValueBoxBase#setValue(Object, boolean).
But there it is! There is "technically" no method setValue(String). It's rather setValue(Object). There is either no way for javadoc to resolve this on its own or it's just a bug.
Thus, the only was I found to solve this is using the reference to the superclass.
/**
* #see com.google.gwt.user.client.ui.ValueBoxBase#setValue(Object, boolean)
*/
Instead of:
/**
* #see TextArea#getValue()
*/
Try:
/**
* #see com.google.gwt.user.client.ui.TextArea#getValue()
*/
I had the sameproblem.
But I solved without () of method.
#see ClassTest.method

How can I call Maven programmatically from within a plugin without using a process invocation?

I'd like to call Maven goals from within a plugin and am reluctant to accept the cost of forking a process as the initialisation. Is there any way of doing this?
I doubt this is a supported approach but it worked for me.
/**
* #parameter expression="${session}"
* #required
* #readonly
*/
private MavenSession session;
/**
* #component
* #readonly
*/
private Maven maven;
/**
* #parameter default-value="${project.remoteArtifactRepositories}"
* #readonly
**/
protected List<ArtifactRepository> remoteArtifactRepositories;
/**
* The project's remote repositories to use for the resolution of plugins
* and their dependencies.
*
* #parameter default-value="${project.pluginArtifactRepositories}"
* #readonly
*/
private List<ArtifactRepository> pluginArtifactRepositories;
/**
* #parameter default-value="${localRepository}"
* #readonly
* */
private ArtifactRepository localRepository;
...
List<String> goals = ...
File pomFile = ...
MavenExecutionRequest req = new DefaultMavenExecutionRequest();
req.setPom(pomFile);
req.setBaseDirectory(pomFile.getParentFile());
req.setGoals(goals);
req.setProxies(session.getSettings().getProxies());
req.setMirrors(session.getSettings().getMirrors());
req.setLocalRepository(localRepository);
req.setRemoteRepositories(remoteArtifactRepositories);
req.setPluginArtifactRepositories(pluginArtifactRepositories);
MavenExecutionResult result = session.execute(req);
To introspect the processing, you can subclass AbstractExecutionListener and use req.setExecutionListener() to apply it.
What i missed to mentioned was this:
http://timmoore.github.com/mojo-executor/

Resources