Posted  by  admin

Download MediaType Converter For Mac 2.2.1

April 11, 2014, FFmpeg 2.2.1. We have made a new point releases. It contains bug fixes for Tickets #2893, #3432, #3469, #3486, #3495 and #3540 as well as several other fixes. See the git log for details. March 24, 2014, FFmpeg 2.2. LAV Filters 0.75.1-10. LAV Filters (formerly LAVFSplitter) is a collection of DirectShow media splitters and audio/video decoders that allow you to play a wide range of media formats. They are based on libavformat and libavcodec libraries from the ffmpeg project, which means that you can play almost any format as long as you use a DirectShow. Restlet Framework 2.1.7 and 2.2 RC1 released February 13, 2014 Posted by Swann Vichot in Restlet Releases, Uncategorized. We are happy to release two new Restlet Framework versions: 2.2 RC1 and 2.1.7, quickly moving forward towards version 2.2.0 and beginning work on the 3.0 branch. Check out the updated road map for details. Don’t forget to download A Field Guide to Web. This site uses cookies. Some are essential to the operation of the site; others help us improve the user experience. By continuing to use the site, you consent to the use of these cookies. Download the latest version of ffWorks for Mac for free. Read 377 user reviews and compare with similar apps on MacUpdate.

  • Solution 1: using the active record pattern
  • Solution 2: using the repository pattern
  • Advanced Query
  • Lock management
  • Mocking

Hibernate ORM is the de facto JPA implementation and offers you the full breadth of an Object Relational Mapper.It makes complex mappings possible, but it does not make simple and common mappings trivial.Hibernate ORM with Panache focuses on making your entities trivial and fun to write in Quarkus.

First: an example

What we’re doing in Panache is allow you to write your Hibernate ORM entities like this:

You have noticed how much more compact and readable the code is?Does this look interesting? Read on!

the list() method might be surprising at first. It takes fragments of HQL (JP-QL) queries and contextualizes the rest. That makes for very concise but yet readable code.
what was described above is essentially the active record pattern, sometimes just called the entity pattern.Hibernate with Panache also allows for the use of the more classical repository pattern via PanacheRepository.

Solution

We recommend that you follow the instructions in the next sections and create the application step by step.However, you can go right to the completed example.

Clone the Git repository: git clone https://github.com/quarkusio/quarkus-quickstarts.git, or download an archive.

The solution is located in the hibernate-orm-panache-quickstartdirectory.

Setting up and configuring Hibernate ORM with Panache

  • add your settings in application.properties

  • annotate your entities with @Entity

  • make your entities extend PanacheEntity (optional if you are using the repository pattern)

Follow the Hibernate set-up guide for all configuration.

  • the Panache JPA extension

  • your JDBC driver extension (quarkus-jdbc-postgresql, quarkus-jdbc-h2, quarkus-jdbc-mariadb, …​)

Then add the relevant configuration properties in application.properties.

Solution 1: using the active record pattern

Defining your entity

To define a Panache entity, simply extend PanacheEntity, annotate it with @Entity and add yourcolumns as public fields:

You can put all your JPA column annotations on the public fields. If you need a field to not be persisted, use the@Transient annotation on it. If you need to write accessors, you can:

And thanks to our field access rewrite, when your users read person.name they will actually call your getName() accessor,and similarly for field writes and the setter.This allows for proper encapsulation at runtime as all fields calls will be replaced by the corresponding getter/setter calls.

Most useful operations

Once you have written your entity, here are the most common operations you will be able to perform:

All list methods have equivalent stream versions.

The stream methods require a transaction to work.
As they perform I/O operations, they should be closed via the close() method or via a try-with-resource to close the underlying ResultSet.If not, you will see warnings from Agroal that will close the underlying ResultSet for you.

Adding entity methods

Add custom queries on your entities inside the entities themselves.That way, you and your co-workers can find them easily, and queries are co-located with the object they operate on.Adding them as static methods in your entity class is the Panache Active Record way.

Solution 2: using the repository pattern

Defining your entity

When using the repository pattern, you can define your entities as regular JPA entities.

If you don’t want to bother defining getters/setters for your entities, you can make them extend PanacheEntityBase andQuarkus will generate them for you. You can even extend PanacheEntity and take advantage of the default ID it provides.

Defining your repository

When using Repositories, you get the exact same convenient methods as with the active record pattern, injected in your Repository,by making them implements PanacheRepository:

All the operations that are defined on PanacheEntityBase are available on your repository, so using itis exactly the same as using the active record pattern, except you need to inject it:

Most useful operations

Once you have written your repository, here are the most common operations you will be able to perform:

All list methods have equivalent stream versions.

The stream methods require a transaction to work.
The rest of the documentation show usages based on the active record pattern only,but keep in mind that they can be performed with the repository pattern as well.The repository pattern examples have been omitted for brevity.

Writing a JAX-RS resource

First, include one of the RESTEasy extensions to enable JAX-RS endpoints, for example, add the io.quarkus:quarkus-resteasy-jackson dependency for JAX-RS and JSON support.

Then, you can create the following resource to create/read/update/delete your Person entity:

Be careful to use the @Transactional annotation on the operations that modify the database,you can add the annotation at the class level for simplicity purpose.

Advanced Query

Paging

You should only use list and stream methods if your table contains small enough data sets. For larger datasets you can use the find method equivalents, which return a PanacheQuery on which you can do paging:

The PanacheQuery type has many other methods to deal with paging and returning streams.

Using a range instead of pages

You cannot mix ranges and pages: if you use a range, all methods that depend on having a current page will throw an UnsupportedOperationException;you can switch back to paging using page(Page) or page(int, int).

Sorting

All methods accepting a query string also accept the following simplified query form:

But these methods also accept an optional Sort parameter, which allows your to abstract your sorting:

The Sort class has plenty of methods for adding columns and specifying sort direction.

Simplified queries

Normally, HQL queries are of this form: from EntityName [where …​] [order by …​], with optional elementsat the end.

If your select query does not start with from, we support the following additional forms:

  • order by …​ which will expand to from EntityName order by …​

  • <singleColumnName> (and single parameter) which will expand to from EntityName where <singleColumnName> = ?

  • <query> will expand to from EntityName where <query>

If your update query does not start with update, we support the following additional forms:

  • from EntityName …​ which will expand to update from EntityName …​

  • set? <singleColumnName> (and single parameter) which will expand to update from EntityName set <singleColumnName> = ?

  • set? <update-query> will expand to update from EntityName set <update-query>

If your delete query does not start with delete, we support the following additional forms:

  • from EntityName …​ which will expand to delete from EntityName …​

  • <singleColumnName> (and single parameter) which will expand to delete from EntityName where <singleColumnName> = ?

  • <query> will expand to delete from EntityName where <query>

Named queries

You can reference a named query instead of a (simplified) HQL query by prefixing its name with the '#' character. You can also use named queries for count, update and delete queries.

Named queries can only be defined inside your JPA entity classes (being the Panache entity class, or the repository parameterized type),or on one of its super classes.

Query parameters

You can pass query parameters by index (1-based) as shown below:

Or by name using a Map:

Or using the convenience class Parameters either as is or to build a Map:

Every query operation accepts passing parameters by index (Object…​), or by name (Map<String,Object> or Parameters).

Query projection

Query projection can be done with the project(Class) method on the PanacheQuery object that is returned by the find() methods.

You can use it to restrict which fields will be returned by the database.

Hibernate will use DTO projection and generate a SELECT clause with the attributes from the projection class.This is also called dynamic instantiation or constructor expression, more info can be found on the Hibernate guide:hql select clause

The projection class needs to be a valid Java Bean and have a constructor that contains all its attributes, this constructor will be used toinstantiate the projection DTO instead of using the entity class. This class must have a matching constructor with all the class attributes as parameters.

  1. The @RegisterForReflection annotation instructs Quarkus to keep the class and its members during the native compilation. More details about the @RegisterForReflection annotation can be found on the native application tips page.

  2. We use public fields here, but you can use private fields and getters/setters if you prefer.

  3. This constructor will be used by Hibernate, it must be the only constructor in your class and have all the class attributes as parameters.

The implementation of the project(Class) method uses the constructor’s parameter names to build the select clause of the query,so the compiler must be configured to store parameter names inside the compiled class.This is enabled by default if you are using the Quarkus Maven archetype. If you are not using it, add the property <maven.compiler.parameters>true</maven.compiler.parameters> to your pom.xml.

If in the DTO projection object you have a field from a referenced entity, you can use the @ProjectedFieldName annotation to provide the path for the SELECT statement.

  1. The ownerName DTO constructor’s parameter will be loaded from the owner.name HQL property.

Multiple Persistence Units

The support for multiple persistence units is described in detail in the Hibernate ORM guide.

  • A given Panache entity can be attached to only a single persistence unit.

  • Given that, Panache already provides the necessary plumbing to transparently find the appropriate EntityManager associated to a Panache entity.

Transactions

Make sure to wrap methods modifying your database (e.g. entity.persist()) within a transaction. Marking aCDI bean method @Transactional will do that for you and make that method a transaction boundary. We recommend doingso at your application entry point boundaries like your REST endpoint controllers.

JPA batches changes you make to your entities and sends changes (it’s called flush) at the end of the transaction or before a query.This is usually a good thing as it’s more efficient.But if you want to check optimistic locking failures, do object validation right away or generally want to get immediate feedback, you can force the flush operation by calling entity.flush() or even use entity.persistAndFlush() to make it a single method call. This will allow you to catch any PersistenceException that could occur when JPA send those changes to the database.Remember, this is less efficient so don’t abuse it.And your transaction still has to be committed.

Here is an example of the usage of the flush method to allow making a specific action in case of PersistenceException:

Lock management

Panache provides direct support for database locking with your entity/repository, using findById(Object, LockModeType) or find().withLock(LockModeType).

The following examples are for the active record pattern, but the same can be used with repositories.

First: Locking using findById().

Second: Locking in a find().

Be careful that locks are released when the transaction ends, so the method that invokes the lock query must be annotated with the @Transactional annotation.

Custom IDs

IDs are often a touchy subject, and not everyone’s up for letting them handled by the framework, once again wehave you covered.

You can specify your own ID strategy by extending PanacheEntityBase instead of PanacheEntity. Thenyou just declare whatever ID you want as a public field:

If you’re using repositories, then you will want to extend PanacheRepositoryBase instead of PanacheRepositoryand specify your ID type as an extra type parameter:

Mocking

Using the active record pattern

If you are using the active record pattern you cannot use Mockito directly as it does not support mocking static methods,but you can use the quarkus-panache-mock module which allows you to use Mockito to mock all provided staticmethods, including your own.

Given this simple entity:

You can write your mocking test like this:

1Be sure to call your verify and do* methods on PanacheMock rather than Mockito, otherwise you won’t knowwhat mock object to pass.

Mocking EntityManager, Session and entity instance methods

If you need to mock entity instance methods, such as persist() you can do it by mocking the Hibernate ORM Session object:

Using the repository pattern

If you are using the repository pattern you can use Mockito directly, using the quarkus-junit5-mockito module,which makes mocking beans much easier:

Given this simple entity:

And this repository:

You can write your mocking test like this:

How and why we simplify Hibernate ORM mappings

When it comes to writing Hibernate ORM entities, there are a number of annoying things that users have grown used toreluctantly deal with, such as:

  • Duplicating ID logic: most entities need an ID, most people don’t care how it’s set, because it’s not reallyrelevant to your model.

  • Dumb getters and setters: since Java lacks support for properties in the language, we have to create fields,then generate getters and setters for those fields, even if they don’t actually do anything more than read/writethe fields.

  • Traditional EE patterns advise to split entity definition (the model) from the operations you can do on them(DAOs, Repositories), but really that requires an unnatural split between the state and its operations even thoughwe would never do something like that for regular objects in the Object Oriented architecture, where state and methodsare in the same class. Moreover, this requires two classes per entity, and requires injection of the DAO or Repositorywhere you need to do entity operations, which breaks your edit flow and requires you to get out of the code you’rewriting to set up an injection point before coming back to use it.

  • Hibernate queries are super powerful, but overly verbose for common operations, requiring you to write queries evenwhen you don’t need all the parts.

  • Hibernate is very general-purpose, but does not make it trivial to do trivial operations that make up 90% of ourmodel usage.

With Panache, we took an opinionated approach to tackle all these problems:

  • Make your entities extend PanacheEntity: it has an ID field that is auto-generated. If you requirea custom ID strategy, you can extend PanacheEntityBase instead and handle the ID yourself.

  • Use public fields. Get rid of dumb getter and setters. Under the hood, we will generate all getters and settersthat are missing, and rewrite every access to these fields to use the accessor methods. This way you can stillwrite useful accessors when you need them, which will be used even though your entity users still use field accesses.

  • With the active record pattern: put all your entity logic in static methods in your entity class and don’t create DAOs.Your entity superclass comes with lots of super useful static methods, and you can add your own in your entity class.Users can just start using your entity Person by typing Person. and getting completion for all the operations in a single place.

  • Don’t write parts of the query that you don’t need: write Person.find('order by name') orPerson.find('name = ?1 and status = ?2', 'stef', Status.Alive) or even betterPerson.find('name', 'stef').

That’s all there is to it: with Panache, Hibernate ORM has never looked so trim and neat.

Defining entities in external projects or jars

Hibernate ORM with Panache relies on compile-time bytecode enhancements to your entities.

It attempts to identify archives with Panache entities (and consumers of Panache entities)by the presence of the marker file META-INF/panache-archive.marker. Panache includes anannotation processor that will automatically create this file in archives that depend onPanache (even indirectly). If you have disabled annotation processors you may need to createthis file manually in some cases.

If you include the jpa-modelgen annotation processor this will exclude the Panacheannotation processor by default. If you do this you should either create the marker fileyourself, or add the quarkus-panache-common as well, as shown below:

Key Quotes from Java API Copyright Case between Oracle and GoogleMay 17, 2014

Posted by Jerome Louvel in Android, Ecosystem, Google, Oracle, Restlet General.
1 comment so far

After the shock wave following the recent legal decision at Federal level on the Java copyright case between Oracle and Google, I decided to read the 69 pages of the court decision and extract the most interesting quotes, from a Java technologist point of view.

Quote 1 – Scope

This copyright dispute involves 37 packages of computer source code. The parties have often referred to these groups of computer programs, individually or collectively, as “application programming interfaces,” or API packages, but it is their content, not their name, that matters.”

Quote 2 – On patents

The jury found no patent infringement, and the patent claims are not at issue in this appeal.

Quote 3 – Java definition

Download MediaType Converter For Mac 2.2.1 Free

The Java platform includes the “Java development kit (JDK), javac compiler, tools and utilities, runtime programs, class libraries (API packages), and the Java virtual machine.

Mp3 Converter For Mac

Quote 4 – API analogy with a books library

The parties have not disputed the district court’s analogy: Oracle’s collection of API packages is like a library, each package is like a bookshelf in the library, each class is like a book on the shelf, and each method is like a how-to chapter in a book.

Quote 5 – Core Java packages

The district court found, and Oracle concedes to some extent, that three of those packages—java.lang, java.io, and java.util—were “core” packages, meaning that programmers using the Java language had to use them “in order to make any worthwhile use of the language.”

Quote 6 – Two types of source code

Every package consists of two types of source code— what the parties call (1) declaring code; and (2) implementing code. Declaring code is the expression that identifies the prewritten function and is sometimes referred to as the “declaration” or “header.” As the district court explained, the “main point is that this header line of code introduces the method body and specifies very precisely the inputs, name and other functionality.”

Quote 7 – Android history with Java

Google acquired Android, Inc. in 2005 as part of a plan to develop a smartphone platform. Later that same year, Google and Sun began discussing the possibility of Google “taking a license to use and to adapt the entire Java platform for mobile devices.” Copyrightability Decision, 872 F. Supp. 2d at 978. They also discussed a “possible co-development partnership deal with Sun under which Java technology would become an open-source part of the Android platform, adapted for mobile devices.” Id. The parties negotiated for months but were unable to reach an agreement. The point of contention between the parties was Google’s refusal to make the implementation of its programs compatible with the Java virtual machine or interoperable with other Java programs. Because Sun/Oracle found that position to be anathema to the “write once, run anywhere” philosophy, it did not grant Google a license to use the Java API packages.

When the parties’ negotiations reached an impasse, Google decided to use the Java programming language to design its own virtual machine—the Dalvik virtual machine (“Dalvik VM”)—and “to write its own implementations for the functions in the Java API that were key to mobile devices.” Id. Google developed the Android platform, which grew to include 168 API packages—37 of which correspond to the Java API packages at issue in this appeal.

Quote 8 – SSO and the 37 Java packages at issue

With respect to the 37 packages at issue, “Google believed Java application programmers would want to find the same 37 sets of functionalities in the new Android system callable by the same names as used in Java.” Id. To achieve this result, Google copied the declaring source code from the 37 Java API packages verbatim, inserting that code into parts of its Android software. In doing so, Google copied the elaborately organized taxonomy of all the names of methods, classes, interfaces, and packages— the “overall system of organized names—covering 37 packages, with over six hundred classes, with over six thousand methods.” Copyrightability Decision, 872 F. Supp. 2d at 999. The parties and district court referred to this taxonomy of expressions as the “structure, sequence, and organization” or “SSO” of the 37 packages. It is undisputed, however, that Google wrote its own implementing code, except with respect to: (1) the rangeCheck function, which consisted of nine lines of code; and (2) eight decompiled security files.

Quote 9 – Android incompatibility with Java

Although Android uses the Java programming language, it is undisputed that Android is not generally Java compatible. As Oracle explains, “Google ultimately designed Android to be incompatible with the Java platform, so that apps written for one will not work on the other.”

Quote 10 – Java interoperability and command structure

According to Google, however, the district court correctly determined that: (1) there was only one way to write the Java method declarations and remain “interoperable” with Java; and (2) the organization and structure of the 37 Java API packages is a “command structure” excluded from copyright protection under Section 102(b). Google also argues that, if we reverse the district court’s copyrightability determination, we should direct the district court to retry its fair use defense.

Quote 11 – Decision on copyrightability

The court also erred by importing fair use principles, including interoperability concerns, into its copyrightability analysis. For the reasons that follow, we conclude that the declaring code and the structure, sequence, and organization of the 37 Java API packages are entitled to copyright protection.

Quote 12 – Java API design was a creative process

Converter for mac free

The testimony at trial revealed that designing the Java API packages was a creative process and that the Sun/Oracle developers had a vast range of options for the structure and organization. In its copyrightability decision, the district court specifically found that the API packages are both creative and original, and Google concedes on appeal that the originality requirements are met.

Quote 13 – Is an API just an idea and the implementation its expression?

In its analysis, the court identified the method declaration as the idea and found that the implementation is the expression. Id. (“The method specification is the idea. The method implementation is the expression. No one may monopolize the idea.”) (emphases in original). The court explained that, under the rules of Java, a programmer must use the identical “declaration or method header lines” to “declare a method specifying the same functionality.”

Quote 14 – Two years to write the core Java packages

it took years to write some of the Java packages and that Sun/Oracle developers had to “wrestle with what functions to include in the package, which to put in other packages, and which to omit entirely”).

Quote 15 – Interoperability doesn’t relate to copyrightability, but to fair user

Oracle also argues that the district court erred in invoking interoperability in its copyrightability analysis. Specifically, Oracle argues that Google’s interoperability arguments are only relevant, if at all, to fair use—not to the question of whether the API packages are copyrightable. We agree.

Quote 16 – Java interoperability was not the real aim of Google with Android

Download MediaType Converter For Mac 2.2.1 Torrent

Google maintains on appeal that its use of the “Java class and method names and declarations was ‘the only and essential means’ of achieving a degree of interoperability with existing programs written in the [Java language].” Appellee Br. 49. Indeed, given the record evidence that Google designed Android so that it would not be compatible with the Java platform, or the JVM specifically, we find Google’s interoperability argument confusing. While Google repeatedly cites to the district court’s finding that Google had to copy the packages so that an app written in Java could run on Android, it cites to no evidence in the record that any such app exists and points to no Java apps that either pre-dated or post-dated Android that could run on the Android platform.

Quote 17 – Google wanted to capitalize on trained Java developers

The compatibility Google sought to foster was not with Oracle’s Java platform or with the JVM central to that platform. Instead, Google wanted to capitalize on the fact that software developers were already trained and experienced in using the Java API packages at issue. The district court agreed, finding that, as to the 37 Java API packages, “Google believed Java application programmers would want to find the same 37 sets of functionalities in the new Android system callable by the same names as used in Java.”

Quote 18 – Irrelevant argument of Java as an industry standard

Download MediaType Converter For Mac 2.2.1 Full

Google was free to develop its own API packages and to “lobby” programmers to adopt them. Instead, it chose to copy Oracle’s declaring code and the SSO to capitalize on the preexisting community of programmers who were accustomed to using the Java API packages. That desire has nothing to do with copyrightability. For these reasons, we find that Google’s industry standard argument has no bearing on the copyrightability of Oracle’s work.

Quote 19 – Fair use factors

“Section 107 requires a case-by-case determination whether a particular use is fair, and the statute notes four nonexclusive factors to be considered.” […] Those factors are: (1) “the purpose and character of the use, including whether such use is of a commercial nature or is for nonprofit educational purposes;” (2) “the nature of the copyrighted work;” (3) “the amount and substantiality of the portion used in relation to the copyrighted work as a whole;” and (4) “the effect of the use upon the potential market for or value of the copyrighted work.”

Quote 19 – Fair use defense from Google

Google contends, however, that, although it admittedly copied portions of the API packages and did so for what were purely commercial purposes, a reasonable juror still could find that: (1) Google’s use was transformative; (2) the Java API packages are entitled only to weak protection; (3) Google’s use was necessary to work within a language that had become an industry standard; and (4) the market impact on Oracle was not substantial.

Quote 20 – New trial on fair use question

On balance, we find that due respect for the limit of our appellate function requires that we remand the fair use question for a new trial. First, although it is undisputed that Google’s use of the API packages is commercial, the parties disagree on whether its use is “transformative.”

Quote 21 – Google transformative argument and Oracle’s defense

Google argues that it is, because it wrote its own implementing code, created its own virtual machine, and incorporated the packages into a smartphone platform. For its part, Oracle maintains that Google’s use is not transformative because: (1) “[t]he same code in Android . . . enables programmers to invoke the same pre-programmed functions in exactly the same way;” and (2) Google’s use of the declaring code and packages does not serve a different function from Java.

Quote 22 – Inability to decide on fair use

While Google overstates what activities can be deemed transformative under a correct application of the law, we cannot say that there are no material facts in dispute on the question of whether Google’s use is “transformative,” even under a correct reading of the law. As such, we are unable to resolve this issue on appeal.

Quote 23 – Importance of Java core packages for fair use retrial

Download MediaType Converter For Mac 2.2.1 Crack

We find this particularly true with respect to those core packages which it seems may be necessary for anyone to copy if they are to write programs in the Java language. And, it may be that others of the packages were similarly essential components of any Java language-based program. So far, that type of filtration analysis has not occurred.

Additional references

  • EFF – Dangerous Decision in Oracle vs Google
  • EFF – Coders’ Rights Project Reverse Engineering FAQ
  • Florian Muller – Refresher Q&A on Oracle v. Google after appellate ruling
  • Florian Muller – Important Oracle wins Android-Java copyright appeal
  • InfoQ – Kin Lane on How API Commons Will Shape the Future of Web APIs
  • Kin Lane – Where Will Your API Stand In The Oracle v Google API Copyright Debate?
  • Kin Lane –U.S. Precedent for API Copyright Hinges on Oracle v Google
  • ProgrammableWeb – Oracle vs Google judgement will send API lawyers scrambling
  • Stanford – Copyright and Fair Use center
  • US Governement – Copyright Act – Article 102 (b) : “In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work.”