cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Version API
Date Mon, 27 Jul 2015 12:13:47 GMT
No, I was answering your question. I thought you'd be able to figure it out from the information
that I shared already. But no worries, here are more details:

1. Download cayenne-project.jar from http://search.maven.org/#artifactdetails|org.apache.cayenne|cayenne-project|4.0.M2|jar
and add it to your dependencies. Or if you are using Maven, simply include cayenne-project
in your pom.

2. Add CayenneProjectModule to your runtime on startup. You are using CayenneFilter, so that
would look something like this:

<filter>
   <filter-name>cayenne-project</filter-name>
        <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
    <init-param>
      <param-name>extra-modules</param-name>
      <param-value>org.apache.cayenne.project.CayenneProjectModule</param-value>
    </init-param>    
  </filter>

This would ensure CayenneProjectModule is loaded.

3. Use the API:

CayenneRuntime r = WebUtil.getCayenneRuntime(servletContext);
ProjectUpgrader u = r.getInjector().getInstance(ProjectUpgrader.class);
String version = u.getUpgradeHandler().getUpgradeMetaData().getSupportedVersion();

Andrus


> On Jul 27, 2015, at 2:15 PM, Joe Baldwin <jfbaldwin@earthlink.net> wrote:
> 
> Andrus,
> 
> I am really not following what you are trying to say.  Let ask again:
> 
> 1. I am looking for an easy replacement to 
> 
>>>>> 	org.apache.cayenne.project.Project.CURRENT_PROJECT_VERSION
> 
> since it *appears* to be eliminated from your 4.0 API.
> 
> You then claim that there is a replacement in 
> 
>>>> Not sure in what context you are using that, but "cayenne-project" DI module
now has a service org.apache.cayenne.project.ProjectUpgrader that gives you access to UpgradeHandler
that gives you access to UpgradeMetaData. UpgradeMetaData has the version supported by a given
runtime.
> 
> 
> I could find none of these classes you mention in your online documentation 
> 
> 	http://cayenne.apache.org/docs/4.0/api/index.html
> 
> So then you provide me with what appears to be a link to a Maven 4.0 repository.
> 
> I am not sure how this is answering my question as to how to programmatically obtain
the current Cayenne project version from the Cayenne runtime.  Is it possible you don’t
understand my question?   I am looking for a simple replacement for a runtime project version,
so I can print is on a webpage.  This is a *simple* method call  I am looking for.
> 
> 
> 
> 
> 
>> On Jul 27, 2015, at 6:59 AM, Andrus Adamchik <andrus@objectstyle.org> wrote:
>> 
>> http://search.maven.org/#artifactdetails|org.apache.cayenne|cayenne-project|4.0.M2|jar
>> 
>> This has sources, javadocs, etc.
>> 
>>> On Jul 27, 2015, at 1:55 PM, Joe Baldwin <jfbaldwin@earthlink.net> wrote:
>>> 
>>> I am looking for a simple replacement for version 3.0 API 
>>> 
>>>>> 	org.apache.cayenne.project.Project.CURRENT_PROJECT_VERSION
>>> 
>>> 
>>> since it appears to be missing in 4.0.
>>> 
>>> I could find no reference to any of the classes you mention in your 4.0 API.
Do you have a url reference?
>>> 
>>> 
>>> 
>>>> On Jul 27, 2015, at 5:06 AM, Andrus Adamchik <andrus@objectstyle.org>
wrote:
>>>> 
>>>> Not sure in what context you are using that, but "cayenne-project" DI module
now has a service org.apache.cayenne.project.ProjectUpgrader that gives you access to UpgradeHandler
that gives you access to UpgradeMetaData. UpgradeMetaData has the version supported by a given
runtime.
>>>> 
>>>> Andrus
>>>> 
>>>>> On Jul 26, 2015, at 8:41 PM, Joe Baldwin <jfbaldwin@earthlink.net>
wrote:
>>>>> 
>>>>> Migration 3.0 => 4.0
>>>>> 
>>>>> 	org.apache.cayenne.project.Project.CURRENT_PROJECT_VERSION
>>>>> 
>>>>> appears to be no longer supported in 4.0.
>>>>> 
>>>>> Is there a substitute (as easy to access)?
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 
> 
> 


Mime
View raw message