You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Michael Dick <mi...@gmail.com> on 2009/02/04 22:02:40 UTC

Re: [jira] Updated: (OPENJPA-896) Several doc files include Windows EoL chars

This issue came up a few years ago while we were in the incubator. At the
time (if memory serves) we decided not to fix existing code due to the noise
on SVN.

I'm happy to commit the changes Donald has graciously provided if folks
agree the noise is acceptable, but I'd prefer to make sure since there's
precedent against cleaning up eol chars.

Any agreement / dissent to committing the patch?

-mike

On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Donald Woods updated OPENJPA-896:
> ---------------------------------
>
>    Attachment: OPENJPA-896-trunk.patch
>
> Patch file which removes the Windows Ctrl+M EOL chars.
> For Windows users, you can use a program like SlickEdit to resave the files
> in Unix format (and fix your svn config.)
> For Unix/Linux users, use the "dos2unix *.xml" command.
> For Mac users, you need to provide a dos2unix script that uses the tr
> command -
> {noformat}
> #! /bin/sh
> for x
> do
> echo "Converting $x"
> tr -d '\015' < "$x" > "$x.tmp"
> mv "$x.tmp" "$x"
> done
> {noformat}
>
> > Several doc files include Windows EoL chars
> > -------------------------------------------
> >
> >                 Key: OPENJPA-896
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-896
> >             Project: OpenJPA
> >          Issue Type: Bug
> >          Components: docs
> >            Reporter: Donald Woods
> >            Priority: Trivial
> >             Fix For: 2.0.0
> >
> >         Attachments: OPENJPA-896-trunk.patch
> >
> >
> > Several of the doc files include the Windows Ctrl+M chars at the end of
> lines when checked out to non-Windows platforms (like MacOSX and Linux), due
> to the committer not using the ASF suggested svn config values -
> http://www.apache.org/dev/svn-eol-style.txt
> > From http://www.apache.org/dev/version-control.html -
> > Configuring the Subversion client
> > Committers will need to properly configure their svn client. One
> particular issue is OS-specific line-endings for text files. When you add a
> new text file, especially when applying patches from Bugzilla, first ensure
> that the line-endings are appropriate for your system, then do ...
> > svn add test.txt
> > svn propset svn:eol-style native test.txt
> > Your svn client can be configured to do that automatically for some
> common file types. Add the contents of the file
> http://www.apache.org/dev/svn-eol-style.txt to your ~/.subversion/config
> file. [Note: for Windows this is normally found at C:\Documents and
> Settings\{username}\Application Data\Subversion\config]
> > Some files may need additional properties to be set, for example
> svn:executable=* should be applied to those script files (e.g. .bat, .cgi,
> .cmd, .sh) that are intended to be executed. Since not all such files are
> necessarily intended to be executed, the executable property should not be
> made an automatic default.
> > However, you should still pay attention to the messages from your svn
> client when you do 'svn commit'.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Re: [jira] Updated: (OPENJPA-896) Several doc files include Windows EoL chars

Posted by Donald Woods <dw...@apache.org>.
The only way to really fix it, is if everyone remembers to update their 
svn config....  We *ask* everyone to do so on Geronimo and as we find 
problems (like missing svn props) we'll fix them and remind the 
committer to update their config, but no one scans the source before 
every release to fix them.

I have seen issues before on Linux with Windows files, but so far my Mac 
tools have been able to handle them, so this is not an urgent fix by any 
means.


-Donald


Kevin Sutter wrote:
> Mike,
> I remember those conversations...  :-)  What's the advantage of making or
> not making these changes?  This is a huge change.  And, other than totally
> tilting our doc change history, does it really buy us anything?  I thought
> that as the document gets updated, then the sections would be converted
> appropriately.  And, even if we do this change, what prevents us from
> corrupting it again?  It seems that this is just an on-going situation.  Or,
> are there some controls that can be put in place to ensure that these
> incorrect EOL characters stay out once they are removed?
> 
> Kevin
> 
> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <mi...@gmail.com>wrote:
> 
>> This issue came up a few years ago while we were in the incubator. At the
>> time (if memory serves) we decided not to fix existing code due to the
>> noise
>> on SVN.
>>
>> I'm happy to commit the changes Donald has graciously provided if folks
>> agree the noise is acceptable, but I'd prefer to make sure since there's
>> precedent against cleaning up eol chars.
>>
>> Any agreement / dissent to committing the patch?
>>
>> -mike
>>
>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>> wrote:
>>
>>>     [
>>>
>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>> ]
>>> Donald Woods updated OPENJPA-896:
>>> ---------------------------------
>>>
>>>    Attachment: OPENJPA-896-trunk.patch
>>>
>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>> For Windows users, you can use a program like SlickEdit to resave the
>> files
>>> in Unix format (and fix your svn config.)
>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>> command -
>>> {noformat}
>>> #! /bin/sh
>>> for x
>>> do
>>> echo "Converting $x"
>>> tr -d '\015' < "$x" > "$x.tmp"
>>> mv "$x.tmp" "$x"
>>> done
>>> {noformat}
>>>
>>>> Several doc files include Windows EoL chars
>>>> -------------------------------------------
>>>>
>>>>                 Key: OPENJPA-896
>>>>                 URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>             Project: OpenJPA
>>>>          Issue Type: Bug
>>>>          Components: docs
>>>>            Reporter: Donald Woods
>>>>            Priority: Trivial
>>>>             Fix For: 2.0.0
>>>>
>>>>         Attachments: OPENJPA-896-trunk.patch
>>>>
>>>>
>>>> Several of the doc files include the Windows Ctrl+M chars at the end of
>>> lines when checked out to non-Windows platforms (like MacOSX and Linux),
>> due
>>> to the committer not using the ASF suggested svn config values -
>>> http://www.apache.org/dev/svn-eol-style.txt
>>>> From http://www.apache.org/dev/version-control.html -
>>>> Configuring the Subversion client
>>>> Committers will need to properly configure their svn client. One
>>> particular issue is OS-specific line-endings for text files. When you add
>> a
>>> new text file, especially when applying patches from Bugzilla, first
>> ensure
>>> that the line-endings are appropriate for your system, then do ...
>>>> svn add test.txt
>>>> svn propset svn:eol-style native test.txt
>>>> Your svn client can be configured to do that automatically for some
>>> common file types. Add the contents of the file
>>> http://www.apache.org/dev/svn-eol-style.txt to your ~/.subversion/config
>>> file. [Note: for Windows this is normally found at C:\Documents and
>>> Settings\{username}\Application Data\Subversion\config]
>>>> Some files may need additional properties to be set, for example
>>> svn:executable=* should be applied to those script files (e.g. .bat,
>> .cgi,
>>> .cmd, .sh) that are intended to be executed. Since not all such files are
>>> necessarily intended to be executed, the executable property should not
>> be
>>> made an automatic default.
>>>> However, you should still pay attention to the messages from your svn
>>> client when you do 'svn commit'.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> -
>>> You can reply to this email to add a comment to the issue online.
>>>
>>>
> 

Re: [jira] Updated: (OPENJPA-896) Several doc files include Windows EoL chars

Posted by Fernando Padilla <fe...@alum.mit.edu>.
This is a script that I run in my company every so often:

it goes through and finds files through standard extensions, and add 
appropriate svn properties ( native eolstyle, nice mime-type for images ).

The only issue, is that if while running this script, svn determines 
that the line-endings don't match ( run the script in linux, and a file 
has windows eol ), it complains and doesn't apply the property.  Not 
sure if it has a force option.  I guess you can run this script 
repeatedly from linux/windows/mac to progressively cover more files..

but once the svn:eol-style=native property has been set, then everyone 
will see the files with their local machine's appropriate line-ending. 
And I guess revisions/commits/diff ignore line-ending..



Kevin Sutter wrote:
> Mike,
> I remember those conversations...  :-)  What's the advantage of making or
> not making these changes?  This is a huge change.  And, other than totally
> tilting our doc change history, does it really buy us anything?  I thought
> that as the document gets updated, then the sections would be converted
> appropriately.  And, even if we do this change, what prevents us from
> corrupting it again?  It seems that this is just an on-going situation.  Or,
> are there some controls that can be put in place to ensure that these
> incorrect EOL characters stay out once they are removed?
> 
> Kevin
> 
> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <mi...@gmail.com>wrote:
> 
>> This issue came up a few years ago while we were in the incubator. At the
>> time (if memory serves) we decided not to fix existing code due to the
>> noise
>> on SVN.
>>
>> I'm happy to commit the changes Donald has graciously provided if folks
>> agree the noise is acceptable, but I'd prefer to make sure since there's
>> precedent against cleaning up eol chars.
>>
>> Any agreement / dissent to committing the patch?
>>
>> -mike
>>
>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>> wrote:
>>
>>>     [
>>>
>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>> ]
>>> Donald Woods updated OPENJPA-896:
>>> ---------------------------------
>>>
>>>    Attachment: OPENJPA-896-trunk.patch
>>>
>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>> For Windows users, you can use a program like SlickEdit to resave the
>> files
>>> in Unix format (and fix your svn config.)
>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>> command -
>>> {noformat}
>>> #! /bin/sh
>>> for x
>>> do
>>> echo "Converting $x"
>>> tr -d '\015' < "$x" > "$x.tmp"
>>> mv "$x.tmp" "$x"
>>> done
>>> {noformat}
>>>
>>>> Several doc files include Windows EoL chars
>>>> -------------------------------------------
>>>>
>>>>                 Key: OPENJPA-896
>>>>                 URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>             Project: OpenJPA
>>>>          Issue Type: Bug
>>>>          Components: docs
>>>>            Reporter: Donald Woods
>>>>            Priority: Trivial
>>>>             Fix For: 2.0.0
>>>>
>>>>         Attachments: OPENJPA-896-trunk.patch
>>>>
>>>>
>>>> Several of the doc files include the Windows Ctrl+M chars at the end of
>>> lines when checked out to non-Windows platforms (like MacOSX and Linux),
>> due
>>> to the committer not using the ASF suggested svn config values -
>>> http://www.apache.org/dev/svn-eol-style.txt
>>>> From http://www.apache.org/dev/version-control.html -
>>>> Configuring the Subversion client
>>>> Committers will need to properly configure their svn client. One
>>> particular issue is OS-specific line-endings for text files. When you add
>> a
>>> new text file, especially when applying patches from Bugzilla, first
>> ensure
>>> that the line-endings are appropriate for your system, then do ...
>>>> svn add test.txt
>>>> svn propset svn:eol-style native test.txt
>>>> Your svn client can be configured to do that automatically for some
>>> common file types. Add the contents of the file
>>> http://www.apache.org/dev/svn-eol-style.txt to your ~/.subversion/config
>>> file. [Note: for Windows this is normally found at C:\Documents and
>>> Settings\{username}\Application Data\Subversion\config]
>>>> Some files may need additional properties to be set, for example
>>> svn:executable=* should be applied to those script files (e.g. .bat,
>> .cgi,
>>> .cmd, .sh) that are intended to be executed. Since not all such files are
>>> necessarily intended to be executed, the executable property should not
>> be
>>> made an automatic default.
>>>> However, you should still pay attention to the messages from your svn
>>> client when you do 'svn commit'.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> -
>>> You can reply to this email to add a comment to the issue online.
>>>
>>>
> 

Re: Is it time to fix the svn:eol-style properties?

Posted by Donald Woods <dw...@apache.org>.
Then can we please document on the OpenJPA wiki the correct settings for 
Eclipse users?  I never use Eclipse for generating patches, so I'll need 
someone else to doc it... :-)

I'll add the info for svn client users, which I always perform on my 
machines....


-Donald


Michael Dick wrote:
> I've been using svn diff and I haven't hit the problem on Linux. Maybe
> that's because I have configured my client the "right" way. Potential
> contributors might not know they need to do that though.
> 
> AIUI the changes to svn props will prevent windows eol characters from being
> inserted for the files that currently exist. The end line policy for new
> files will depend the committer to configure their svn client correctly or
> to manually set the property on the file.
> 
> The potential commit is rather large svn diff results in 379,000 lines for
> trunk. I suppose I could make it worse by converting tabs to spaces too ;-)
> 
> -mike
> 
> On Fri, Feb 27, 2009 at 3:39 PM, Kevin Sutter <kw...@gmail.com> wrote:
> 
>> Hi Don,
>> Yes, we've seen this before, but only with Eclipse patch creators.  And,
>> with the proper Eclipse settings, the patches are created just fine.  Mike
>> creates his patches via the svn diff command line and he doesn't hit this
>> problem (that I know of).
>>
>> That's why I am scratching my head on this request and string of notes.
>>  I'm
>> just not clear on what the problem is that we're trying to resolve.  And,
>> will these proposed changes prevent users from accidentally committing
>> changes that would cause the problem again?
>>
>> Kevin
>>
>> On Fri, Feb 27, 2009 at 3:27 PM, Donald Woods <dw...@apache.org> wrote:
>>
> 
> <snip>
> 

Re: Is it time to fix the svn:eol-style properties?

Posted by Michael Dick <mi...@gmail.com>.
I've been using svn diff and I haven't hit the problem on Linux. Maybe
that's because I have configured my client the "right" way. Potential
contributors might not know they need to do that though.

AIUI the changes to svn props will prevent windows eol characters from being
inserted for the files that currently exist. The end line policy for new
files will depend the committer to configure their svn client correctly or
to manually set the property on the file.

The potential commit is rather large svn diff results in 379,000 lines for
trunk. I suppose I could make it worse by converting tabs to spaces too ;-)

-mike

On Fri, Feb 27, 2009 at 3:39 PM, Kevin Sutter <kw...@gmail.com> wrote:

> Hi Don,
> Yes, we've seen this before, but only with Eclipse patch creators.  And,
> with the proper Eclipse settings, the patches are created just fine.  Mike
> creates his patches via the svn diff command line and he doesn't hit this
> problem (that I know of).
>
> That's why I am scratching my head on this request and string of notes.
>  I'm
> just not clear on what the problem is that we're trying to resolve.  And,
> will these proposed changes prevent users from accidentally committing
> changes that would cause the problem again?
>
> Kevin
>
> On Fri, Feb 27, 2009 at 3:27 PM, Donald Woods <dw...@apache.org> wrote:
>

<snip>

Re: Is it time to fix the svn:eol-style properties?

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Don,
Yes, we've seen this before, but only with Eclipse patch creators.  And,
with the proper Eclipse settings, the patches are created just fine.  Mike
creates his patches via the svn diff command line and he doesn't hit this
problem (that I know of).

That's why I am scratching my head on this request and string of notes.  I'm
just not clear on what the problem is that we're trying to resolve.  And,
will these proposed changes prevent users from accidentally committing
changes that would cause the problem again?

Kevin

On Fri, Feb 27, 2009 at 3:27 PM, Donald Woods <dw...@apache.org> wrote:

> I can view/edit them fine on MacOSX and Linux fine (no Windows chars.)
>
> The problem, is when you create a patch for such a file, it tries to
> correct the EoL chars in addition to the changed source, like the attached
> OPENJPA-927-trunk.patch file which should only contain -
>
> #P openjpa-persistence
> Index: src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
> ===================================================================
> --- src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
> (revision 743431)
> +++ src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
> (working copy)
> @@ -1421,8 +1421,8 @@
>     }
>
>     public void clear(Object entity) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> +        assertNotCloseInvoked();
> +//        _broker.detach(entity, this, false);
>     }
>
>     public Query createQuery(QueryDefinition qdef) {
> @@ -1454,10 +1454,6 @@
>         Map<String, Object> finalMap =
>             new HashMap<String, Object>(currentProperties);
>
> -        // Remove the password property
> -        finalMap.remove("javax.persistence.jdbc.password");
> -        finalMap.remove("openjpa.ConnectionPassword");
> -
>         return finalMap;
>     }
>
>
>
> -Donald
>
>
>
>
> Michael Dick wrote:
>
>> Hi Donald,
>>
>> For some reason I don't see the same problem when editing
>> EntityManagerImpl
>> on linux. I thought that the svn client configuration properties from the
>> Apache version control guide are taking care of the conversion for me [1].
>> Maybe that doesn't work for all clients.
>>
>> In any event I don't see any harm in doing a single bulk update of the svn
>> props if no one minds a massive commit email.
>>
>> -mike
>>
>> [1] http://www.apache.org/dev/version-control.html#https-svn-config
>>
>> On Thu, Feb 26, 2009 at 9:04 AM, Donald Woods <dw...@apache.org> wrote:
>>
>>  Yes.  I was just trying to point out that there are Java files, in
>>> addition
>>> to the earlier reported doc files, that are missing the expected
>>> svnprops.
>>>
>>>
>>>
>>> -Donald
>>>
>>>
>>> Craig L Russell wrote:
>>>
>>>  Hi Donald,
>>>>
>>>> On Feb 24, 2009, at 11:44 AM, Donald Woods wrote:
>>>>
>>>>  Reviving this thread, as I'm also finding source files, like -
>>>>
>>>>>
>>>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
>>>>>
>>>>> that are using the Windows EOL chars, which causes patches generated by
>>>>> "svn diff" on Linux/Mac to replace the content of the whole file to fix
>>>>> the
>>>>> EOL chars...
>>>>>
>>>>> Still don't see why there is such a concern about SVN commit noise or
>>>>> that it adds one svn log entry per file.  The benefits outweigh the svn
>>>>> commit email and log history addition.
>>>>>
>>>>>  I'm not parsing this paragraph correctly, as it sounds
>>>> self-contradictory.
>>>> Could you review and make sure it's what you mean?
>>>>
>>>> My position is that we should adopt a uniform line end policy and change
>>>> all of the svn line endings properties in the project separate from any
>>>> code
>>>> changes. Is this also what you are proposing?
>>>>
>>>> Thanks,
>>>>
>>>> Craig
>>>>
>>>>
>>>>> There are perl scripts floating around to recursively fix source
>>>>> branches
>>>>> (can't find one right now), or you can do it for every subdir -
>>>>> svn propset svn:eol-style native -R
>>>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/*.java
>>>>>
>>>>>
>>>>> -Donald
>>>>>
>>>>>
>>>>> Craig L Russell wrote:
>>>>>
>>>>>  I'd agree to these changes if the svn eol property were checked in at
>>>>>> the same time. That solves the long term problem. See
>>>>>> http://svnbook.red-bean.com/en/1.1/ch07s02.html for details on
>>>>>> svn:eol-style.
>>>>>> For the project, we need to decide which eol style to use. Both/either
>>>>>> LF and native work fine for most people.
>>>>>> Craig
>>>>>> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
>>>>>>
>>>>>>  Mike,
>>>>>>> I remember those conversations...  :-)  What's the advantage of
>>>>>>> making
>>>>>>> or
>>>>>>> not making these changes?  This is a huge change.  And, other than
>>>>>>> totally
>>>>>>> tilting our doc change history, does it really buy us anything?  I
>>>>>>> thought
>>>>>>> that as the document gets updated, then the sections would be
>>>>>>> converted
>>>>>>> appropriately.  And, even if we do this change, what prevents us from
>>>>>>> corrupting it again?  It seems that this is just an on-going
>>>>>>> situation.
>>>>>>>  Or,
>>>>>>> are there some controls that can be put in place to ensure that these
>>>>>>> incorrect EOL characters stay out once they are removed?
>>>>>>>
>>>>>>> Kevin
>>>>>>>
>>>>>>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <
>>>>>>> michael.d.dick@gmail.com
>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>  This issue came up a few years ago while we were in the incubator.
>>>>>>> At
>>>>>>>
>>>>>>>> the
>>>>>>>> time (if memory serves) we decided not to fix existing code due to
>>>>>>>> the
>>>>>>>> noise
>>>>>>>> on SVN.
>>>>>>>>
>>>>>>>> I'm happy to commit the changes Donald has graciously provided if
>>>>>>>> folks
>>>>>>>> agree the noise is acceptable, but I'd prefer to make sure since
>>>>>>>> there's
>>>>>>>> precedent against cleaning up eol chars.
>>>>>>>>
>>>>>>>> Any agreement / dissent to committing the patch?
>>>>>>>>
>>>>>>>> -mike
>>>>>>>>
>>>>>>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <
>>>>>>>> jira@apache.org>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>   [
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>>>>>>>> ]
>>>>>>>>
>>>>>>>>  Donald Woods updated OPENJPA-896:
>>>>>>>>> ---------------------------------
>>>>>>>>>
>>>>>>>>>  Attachment: OPENJPA-896-trunk.patch
>>>>>>>>>
>>>>>>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>>>>>>> For Windows users, you can use a program like SlickEdit to resave
>>>>>>>>> the
>>>>>>>>>
>>>>>>>>>  files
>>>>>>>>
>>>>>>>>  in Unix format (and fix your svn config.)
>>>>>>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>>>>>>> For Mac users, you need to provide a dos2unix script that uses the
>>>>>>>>> tr
>>>>>>>>> command -
>>>>>>>>> {noformat}
>>>>>>>>> #! /bin/sh
>>>>>>>>> for x
>>>>>>>>> do
>>>>>>>>> echo "Converting $x"
>>>>>>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>>>>>>> mv "$x.tmp" "$x"
>>>>>>>>> done
>>>>>>>>> {noformat}
>>>>>>>>>
>>>>>>>>>  Several doc files include Windows EoL chars
>>>>>>>>>
>>>>>>>>>> -------------------------------------------
>>>>>>>>>>
>>>>>>>>>>             Key: OPENJPA-896
>>>>>>>>>>             URL:
>>>>>>>>>> https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>>>>>>         Project: OpenJPA
>>>>>>>>>>      Issue Type: Bug
>>>>>>>>>>      Components: docs
>>>>>>>>>>        Reporter: Donald Woods
>>>>>>>>>>        Priority: Trivial
>>>>>>>>>>         Fix For: 2.0.0
>>>>>>>>>>
>>>>>>>>>>     Attachments: OPENJPA-896-trunk.patch
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Several of the doc files include the Windows Ctrl+M chars at the
>>>>>>>>>> end
>>>>>>>>>> of
>>>>>>>>>>
>>>>>>>>>>  lines when checked out to non-Windows platforms (like MacOSX and
>>>>>>>>> Linux),
>>>>>>>>>
>>>>>>>>>  due
>>>>>>>>
>>>>>>>>  to the committer not using the ASF suggested svn config values -
>>>>>>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>>>>>>
>>>>>>>>>  From http://www.apache.org/dev/version-control.html -
>>>>>>>>>> Configuring the Subversion client
>>>>>>>>>> Committers will need to properly configure their svn client. One
>>>>>>>>>>
>>>>>>>>>>  particular issue is OS-specific line-endings for text files. When
>>>>>>>>> you
>>>>>>>>> add
>>>>>>>>>
>>>>>>>>>  a
>>>>>>>>
>>>>>>>>  new text file, especially when applying patches from Bugzilla,
>>>>>>>>> first
>>>>>>>>>
>>>>>>>>>  ensure
>>>>>>>>
>>>>>>>>  that the line-endings are appropriate for your system, then do ...
>>>>>>>>>
>>>>>>>>>  svn add test.txt
>>>>>>>>>> svn propset svn:eol-style native test.txt
>>>>>>>>>> Your svn client can be configured to do that automatically for
>>>>>>>>>> some
>>>>>>>>>>
>>>>>>>>>>  common file types. Add the contents of the file
>>>>>>>>> http://www.apache.org/dev/svn-eol-style.txt to your
>>>>>>>>> ~/.subversion/config
>>>>>>>>> file. [Note: for Windows this is normally found at C:\Documents and
>>>>>>>>> Settings\{username}\Application Data\Subversion\config]
>>>>>>>>>
>>>>>>>>>  Some files may need additional properties to be set, for example
>>>>>>>>>>
>>>>>>>>>>  svn:executable=* should be applied to those script files (e.g.
>>>>>>>>> .bat,
>>>>>>>>>
>>>>>>>>>  .cgi,
>>>>>>>>
>>>>>>>>  .cmd, .sh) that are intended to be executed. Since not all such
>>>>>>>>> files
>>>>>>>>> are
>>>>>>>>> necessarily intended to be executed, the executable property should
>>>>>>>>> not
>>>>>>>>>
>>>>>>>>>  be
>>>>>>>>
>>>>>>>>  made an automatic default.
>>>>>>>>>
>>>>>>>>>  However, you should still pay attention to the messages from your
>>>>>>>>>> svn
>>>>>>>>>>
>>>>>>>>>>  client when you do 'svn commit'.
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> This message is automatically generated by JIRA.
>>>>>>>>> -
>>>>>>>>> You can reply to this email to add a comment to the issue online.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   Craig L Russell
>>>>>>>>
>>>>>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>>>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>>>>> P.S. A good JDO? O, Gasp!
>>>>>>
>>>>>>  Craig L Russell
>>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>>> P.S. A good JDO? O, Gasp!
>>>>
>>>>
>>>>
>>
> Index: openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Value.java
> ===================================================================
> --- openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Value.java
>  (revision 747095)
> +++ openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Value.java
>  (working copy)
> @@ -52,6 +52,7 @@
>     private boolean isDynamic = false;
>     private String originalValue = null;
>     private Set<String> otherNames = null;
> +    private boolean visible = true;
>
>     /**
>      * Default constructor.
> @@ -550,4 +551,12 @@
>             return null;
>         }
>     }
> +
> +    public boolean isVisible() {
> +        return visible;
> +    }
> +
> +    public void setVisible(boolean visible) {
> +        this.visible = visible;
> +    }
>  }
> Index:
> openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
> ===================================================================
> ---
> openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
>        (revision 747095)
> +++
> openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
>        (working copy)
> @@ -53,6 +53,7 @@
>  import java.util.MissingResourceException;
>  import java.util.Properties;
>  import java.util.Set;
> +import java.util.TreeMap;
>  import java.util.TreeSet;
>
>  import org.apache.commons.lang.StringUtils;
> @@ -125,6 +126,8 @@
>     // cache descriptors
>     private PropertyDescriptor[] _pds = null;
>     private MethodDescriptor[] _mds = null;
> +
> +    private boolean getVisibleOnly = false;
>
>     /**
>      * Default constructor. Attempts to load default properties through
> @@ -589,11 +592,11 @@
>         // hashcode contracts
>         Map<String, String> clone;
>         if (_props == null)
> -            clone = new HashMap<String, String>();
> +            clone = new TreeMap<String, String>();
>         else if (_props instanceof Properties)
>             clone = (Map) ((Properties) _props).clone();
>         else
> -            clone = new HashMap<String, String>(_props);
> +            clone = new TreeMap<String, String>(_props);
>
>         // if no existing properties or the properties should contain
> entries
>         // with default values, add values to properties
> @@ -613,13 +616,17 @@
>                     setValue(clone, val, str);
>             }
>             if (_props == null)
> -                _props = new HashMap(clone);
> +                _props = new TreeMap(clone);
>         }
>         return clone;
>     }
>
>     public Map<String, String> getAllProperties() {
> -        return toProperties(true, true);
> +        boolean saveGetVisibleOnly = getVisibleOnly;
> +        getVisibleOnly = true;
> +        Map<String, String> properties = toProperties(true, true);
> +        getVisibleOnly = saveGetVisibleOnly;
> +        return properties;
>     }
>
>     public Map<String, String> toProperties(boolean storeDefaults) {
> @@ -725,6 +732,9 @@
>                 }
>             }
>         }
> +        if (getVisibleOnly && !val.isVisible()) {
> +            return;
> +        }
>         map.put(key, o);
>     }
>
> Index:
> openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
> ===================================================================
> ---
> openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
>  (revision 747095)
> +++
> openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
>  (working copy)
> @@ -340,6 +340,7 @@
>
>         connectionPassword = addString("ConnectionPassword");
>
> connectionPassword.addEquivalentKey("javax.persistence.jdbc.password");
> +        connectionPassword.setVisible(false);
>
>         connectionURL = addString("ConnectionURL");
>         connectionURL.addEquivalentKey("javax.persistence.jdbc.url");
> @@ -352,6 +353,7 @@
>         connectionFactoryProperties =
> addString("ConnectionFactoryProperties");
>         connection2UserName = addString("Connection2UserName");
>         connection2Password = addString("Connection2Password");
> +        connection2Password.setVisible(false);
>         connection2URL = addString("Connection2URL");
>         connection2DriverName = addString("Connection2DriverName");
>         connection2Properties = addString("Connection2Properties");
> @@ -446,7 +448,6 @@
>         lockTimeout = addInt("LockTimeout");
>         lockTimeout.addEquivalentKey("javax.persistence.lock.timeout");
>         lockTimeout.setDefault("-1");
> -        lockTimeout.set(-1);
>         lockTimeout.setDynamic(true);
>
>         readLockLevel = addInt("ReadLockLevel");
> @@ -549,9 +550,8 @@
>         specification.setInstantiatingGetter("getSpecificationInstance");
>
>         queryTimeout = addInt("javax.persistence.query.timeout");
> -        queryTimeout.setLoadKey("javax.persistence.query.timeout");
> +        queryTimeout.addEquivalentKey("javax.persistence.query.timeout");
>         queryTimeout.setDefault("-1");
> -        queryTimeout.set(-1);
>         queryTimeout.setDynamic(true);
>
>         // initialize supported options that some runtimes may not support
> Index:
> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
> ===================================================================
> ---
> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
>     (revision 747095)
> +++
> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
>     (working copy)
> @@ -1,1507 +1,1503 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements.  See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership.  The ASF licenses this file
> - * to you 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 org.apache.openjpa.persistence;
> -
> -import java.io.ByteArrayInputStream;
> -import java.io.ByteArrayOutputStream;
> -import java.io.Externalizable;
> -import java.io.IOException;
> -import java.io.ObjectInput;
> -import java.io.ObjectInputStream;
> -import java.io.ObjectOutput;
> -import java.io.ObjectOutputStream;
> -import java.io.ObjectStreamClass;
> -import java.lang.reflect.Array;
> -import java.util.Arrays;
> -import java.util.Collection;
> -import java.util.EnumSet;
> -import java.util.HashMap;
> -import java.util.IdentityHashMap;
> -import java.util.Map;
> -import java.util.Set;
> -
> -import javax.persistence.EntityManager;
> -import javax.persistence.FlushModeType;
> -import javax.persistence.LockModeType;
> -import javax.persistence.Query;
> -import javax.persistence.QueryDefinition;
> -
> -import org.apache.commons.lang.StringUtils;
> -import org.apache.openjpa.conf.OpenJPAConfiguration;
> -import org.apache.openjpa.ee.ManagedRuntime;
> -import org.apache.openjpa.enhance.PCEnhancer;
> -import org.apache.openjpa.enhance.PCRegistry;
> -import org.apache.openjpa.kernel.AbstractBrokerFactory;
> -import org.apache.openjpa.kernel.Broker;
> -import org.apache.openjpa.kernel.DelegatingBroker;
> -import org.apache.openjpa.kernel.FetchConfiguration;
> -import org.apache.openjpa.kernel.FindCallbacks;
> -import org.apache.openjpa.kernel.LockLevels;
> -import org.apache.openjpa.kernel.OpCallbacks;
> -import org.apache.openjpa.kernel.OpenJPAStateManager;
> -import org.apache.openjpa.kernel.PreparedQuery;
> -import org.apache.openjpa.kernel.PreparedQueryCache;
> -import org.apache.openjpa.kernel.QueryFlushModes;
> -import org.apache.openjpa.kernel.QueryLanguages;
> -import org.apache.openjpa.kernel.Seq;
> -import org.apache.openjpa.kernel.jpql.JPQLParser;
> -import org.apache.openjpa.lib.util.Closeable;
> -import org.apache.openjpa.lib.util.Localizer;
> -import org.apache.openjpa.meta.ClassMetaData;
> -import org.apache.openjpa.meta.FieldMetaData;
> -import org.apache.openjpa.meta.QueryMetaData;
> -import org.apache.openjpa.meta.SequenceMetaData;
> -import org.apache.openjpa.persistence.query.OpenJPAQueryBuilder;
> -import org.apache.openjpa.persistence.query.QueryBuilderImpl;
> -import org.apache.openjpa.util.Exceptions;
> -import org.apache.openjpa.util.ImplHelper;
> -import org.apache.openjpa.util.RuntimeExceptionTranslator;
> -import org.apache.openjpa.util.UserException;
> -
> -/**
> - * Implementation of {@link EntityManager} interface.
> - *
> - * @author Patrick Linskey
> - * @author Abe White
> - * @nojavadoc
> - */
> -public class EntityManagerImpl
> -    implements OpenJPAEntityManagerSPI, Externalizable,
> -    FindCallbacks, OpCallbacks, Closeable, OpenJPAEntityTransaction {
> -
> -    private static final Localizer _loc = Localizer.forPackage
> -        (EntityManagerImpl.class);
> -    private static final Object[] EMPTY_OBJECTS = new Object[0];
> -
> -    private DelegatingBroker _broker;
> -    private EntityManagerFactoryImpl _emf;
> -    private Map<FetchConfiguration,FetchPlan> _plans =
> -        new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
> -
> -    private RuntimeExceptionTranslator _ret =
> -        PersistenceExceptions.getRollbackTranslator(this);
> -
> -    public EntityManagerImpl() {
> -        // for Externalizable
> -    }
> -
> -    /**
> -     * Constructor; supply factory and delegate.
> -     */
> -    public EntityManagerImpl(EntityManagerFactoryImpl factory,
> -        Broker broker) {
> -        initialize(factory, broker);
> -    }
> -
> -    private void initialize(EntityManagerFactoryImpl factory, Broker
> broker) {
> -        _emf = factory;
> -        _broker = new DelegatingBroker(broker, _ret);
> -        _broker.setImplicitBehavior(this, _ret);
> -    }
> -
> -    /**
> -     * Broker delegate.
> -     */
> -    public Broker getBroker() {
> -        return _broker.getDelegate();
> -    }
> -
> -    public OpenJPAEntityManagerFactory getEntityManagerFactory() {
> -        return _emf;
> -    }
> -
> -    public OpenJPAConfiguration getConfiguration() {
> -        return _broker.getConfiguration();
> -    }
> -
> -    public FetchPlan getFetchPlan() {
> -        assertNotCloseInvoked();
> -        _broker.lock();
> -        try {
> -            FetchConfiguration fc = _broker.getFetchConfiguration();
> -            FetchPlan fp = _plans.get(fc);
> -            if (fp == null) {
> -                fp = _emf.toFetchPlan(_broker, fc);
> -                _plans.put(fc, fp);
> -            }
> -            return fp;
> -        } finally {
> -            _broker.unlock();
> -        }
> -    }
> -
> -    public FetchPlan pushFetchPlan() {
> -        assertNotCloseInvoked();
> -        _broker.lock();
> -        try {
> -            _broker.pushFetchConfiguration();
> -            return getFetchPlan();
> -        } finally {
> -            _broker.unlock();
> -        }
> -    }
> -
> -    public void popFetchPlan() {
> -        assertNotCloseInvoked();
> -        _broker.lock();
> -        try {
> -            _broker.popFetchConfiguration();
> -        } finally {
> -            _broker.unlock();
> -        }
> -    }
> -
> -    public ConnectionRetainMode getConnectionRetainMode() {
> -        return ConnectionRetainMode.fromKernelConstant(
> -            _broker.getConnectionRetainMode());
> -    }
> -
> -    public boolean isTransactionManaged() {
> -        return _broker.isManaged();
> -    }
> -
> -    public boolean isManaged() {
> -        return _broker.isManaged();
> -    }
> -
> -    public ManagedRuntime getManagedRuntime() {
> -        return _broker.getManagedRuntime();
> -    }
> -
> -    public boolean getSyncWithManagedTransactions() {
> -        return _broker.getSyncWithManagedTransactions();
> -    }
> -
> -    public void setSyncWithManagedTransactions(boolean sync) {
> -        assertNotCloseInvoked();
> -        _broker.setSyncWithManagedTransactions(sync);
> -    }
> -
> -    public ClassLoader getClassLoader() {
> -        return _broker.getClassLoader();
> -    }
> -
> -    public String getConnectionUserName() {
> -        return _broker.getConnectionUserName();
> -    }
> -
> -    public String getConnectionPassword() {
> -        return _broker.getConnectionPassword();
> -    }
> -
> -    public boolean getMultithreaded() {
> -        return _broker.getMultithreaded();
> -    }
> -
> -    public void setMultithreaded(boolean multithreaded) {
> -        assertNotCloseInvoked();
> -        _broker.setMultithreaded(multithreaded);
> -    }
> -
> -    public boolean getIgnoreChanges() {
> -        return _broker.getIgnoreChanges();
> -    }
> -
> -    public void setIgnoreChanges(boolean val) {
> -        assertNotCloseInvoked();
> -        _broker.setIgnoreChanges(val);
> -    }
> -
> -    public boolean getNontransactionalRead() {
> -        return _broker.getNontransactionalRead();
> -    }
> -
> -    public void setNontransactionalRead(boolean val) {
> -        assertNotCloseInvoked();
> -        _broker.setNontransactionalRead(val);
> -    }
> -
> -    public boolean getNontransactionalWrite() {
> -        return _broker.getNontransactionalWrite();
> -    }
> -
> -    public void setNontransactionalWrite(boolean val) {
> -        assertNotCloseInvoked();
> -        _broker.setNontransactionalWrite(val);
> -    }
> -
> -    public boolean getOptimistic() {
> -        return _broker.getOptimistic();
> -    }
> -
> -    public void setOptimistic(boolean val) {
> -        assertNotCloseInvoked();
> -        _broker.setOptimistic(val);
> -    }
> -
> -    public RestoreStateType getRestoreState() {
> -        return
> RestoreStateType.fromKernelConstant(_broker.getRestoreState());
> -    }
> -
> -    public void setRestoreState(RestoreStateType val) {
> -        assertNotCloseInvoked();
> -        _broker.setRestoreState(val.toKernelConstant());
> -    }
> -
> -    public void setRestoreState(int restore) {
> -        assertNotCloseInvoked();
> -        _broker.setRestoreState(restore);
> -    }
> -
> -    public boolean getRetainState() {
> -        return _broker.getRetainState();
> -    }
> -
> -    public void setRetainState(boolean val) {
> -        assertNotCloseInvoked();
> -        _broker.setRetainState(val);
> -    }
> -
> -    public AutoClearType getAutoClear() {
> -        return AutoClearType.fromKernelConstant(_broker.getAutoClear());
> -    }
> -
> -    public void setAutoClear(AutoClearType val) {
> -        assertNotCloseInvoked();
> -        _broker.setAutoClear(val.toKernelConstant());
> -    }
> -
> -    public void setAutoClear(int autoClear) {
> -        assertNotCloseInvoked();
> -        _broker.setAutoClear(autoClear);
> -    }
> -
> -    public DetachStateType getDetachState() {
> -        return
> DetachStateType.fromKernelConstant(_broker.getDetachState());
> -    }
> -
> -    public void setDetachState(DetachStateType type) {
> -        assertNotCloseInvoked();
> -        _broker.setDetachState(type.toKernelConstant());
> -    }
> -
> -    public void setDetachState(int detach) {
> -        assertNotCloseInvoked();
> -        _broker.setDetachState(detach);
> -    }
> -
> -    public EnumSet<AutoDetachType> getAutoDetach() {
> -        return AutoDetachType.toEnumSet(_broker.getAutoDetach());
> -    }
> -
> -    public void setAutoDetach(AutoDetachType flag) {
> -        assertNotCloseInvoked();
> -
>  _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(flag)));
> -    }
> -
> -    public void setAutoDetach(EnumSet<AutoDetachType> flags) {
> -        assertNotCloseInvoked();
> -        _broker.setAutoDetach(AutoDetachType.fromEnumSet(flags));
> -    }
> -
> -    public void setAutoDetach(int autoDetachFlags) {
> -        assertNotCloseInvoked();
> -        _broker.setAutoDetach(autoDetachFlags);
> -    }
> -
> -    public void setAutoDetach(AutoDetachType value, boolean on) {
> -        assertNotCloseInvoked();
> -
>  _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(value)),on);
> -    }
> -
> -    public void setAutoDetach(int flag, boolean on) {
> -        assertNotCloseInvoked();
> -        _broker.setAutoDetach(flag, on);
> -    }
> -
> -    public boolean getEvictFromStoreCache() {
> -        return _broker.getEvictFromDataCache();
> -    }
> -
> -    public void setEvictFromStoreCache(boolean evict) {
> -        assertNotCloseInvoked();
> -        _broker.setEvictFromDataCache(evict);
> -    }
> -
> -    public boolean getPopulateStoreCache() {
> -        return _broker.getPopulateDataCache();
> -    }
> -
> -    public void setPopulateStoreCache(boolean cache) {
> -        assertNotCloseInvoked();
> -        _broker.setPopulateDataCache(cache);
> -    }
> -
> -    public boolean isTrackChangesByType() {
> -        return _broker.isTrackChangesByType();
> -    }
> -
> -    public void setTrackChangesByType(boolean trackByType) {
> -        assertNotCloseInvoked();
> -        _broker.setTrackChangesByType(trackByType);
> -    }
> -
> -    public boolean isLargeTransaction() {
> -        return isTrackChangesByType();
> -    }
> -
> -    public void setLargeTransaction(boolean value) {
> -        setTrackChangesByType(value);
> -    }
> -
> -    public Object getUserObject(Object key) {
> -        return _broker.getUserObject(key);
> -    }
> -
> -    public Object putUserObject(Object key, Object val) {
> -        assertNotCloseInvoked();
> -        return _broker.putUserObject(key, val);
> -    }
> -
> -    public void addTransactionListener(Object listener) {
> -        assertNotCloseInvoked();
> -        _broker.addTransactionListener(listener);
> -    }
> -
> -    public void removeTransactionListener(Object listener) {
> -        assertNotCloseInvoked();
> -        _broker.removeTransactionListener(listener);
> -    }
> -
> -    public EnumSet<CallbackMode> getTransactionListenerCallbackModes() {
> -        return CallbackMode.toEnumSet(
> -            _broker.getTransactionListenerCallbackMode());
> -    }
> -
> -    public void setTransactionListenerCallbackMode(CallbackMode mode) {
> -        assertNotCloseInvoked();
> -        _broker.setTransactionListenerCallbackMode(
> -            CallbackMode.fromEnumSet(EnumSet.of(mode)));
> -    }
> -
> -    public void setTransactionListenerCallbackMode(EnumSet<CallbackMode>
> modes){
> -        assertNotCloseInvoked();
> -        _broker.setTransactionListenerCallbackMode(
> -            CallbackMode.fromEnumSet(modes));
> -    }
> -
> -    public int getTransactionListenerCallbackMode() {
> -        return _broker.getTransactionListenerCallbackMode();
> -    }
> -
> -    public void setTransactionListenerCallbackMode(int callbackMode) {
> -        throw new UnsupportedOperationException();
> -    }
> -
> -    public void addLifecycleListener(Object listener, Class... classes) {
> -        assertNotCloseInvoked();
> -        _broker.addLifecycleListener(listener, classes);
> -    }
> -
> -    public void removeLifecycleListener(Object listener) {
> -        assertNotCloseInvoked();
> -        _broker.removeLifecycleListener(listener);
> -    }
> -
> -    public EnumSet<CallbackMode> getLifecycleListenerCallbackModes() {
> -        return CallbackMode.toEnumSet(
> -            _broker.getLifecycleListenerCallbackMode());
> -    }
> -
> -    public void setLifecycleListenerCallbackMode(CallbackMode mode) {
> -        assertNotCloseInvoked();
> -        _broker.setLifecycleListenerCallbackMode(
> -            CallbackMode.fromEnumSet(EnumSet.of(mode)));
> -    }
> -
> -    public void setLifecycleListenerCallbackMode(EnumSet<CallbackMode>
> modes) {
> -        assertNotCloseInvoked();
> -        _broker.setLifecycleListenerCallbackMode(
> -            CallbackMode.fromEnumSet(modes));
> -    }
> -
> -    public int getLifecycleListenerCallbackMode() {
> -        return _broker.getLifecycleListenerCallbackMode();
> -    }
> -
> -    public void setLifecycleListenerCallbackMode(int callbackMode) {
> -        assertNotCloseInvoked();
> -        _broker.setLifecycleListenerCallbackMode(callbackMode);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T getReference(Class<T> cls, Object oid) {
> -        assertNotCloseInvoked();
> -        oid = _broker.newObjectId(cls, oid);
> -        return (T) _broker.find(oid, false, this);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T find(Class<T> cls, Object oid) {
> -        assertNotCloseInvoked();
> -        oid = _broker.newObjectId(cls, oid);
> -        return (T) _broker.find(oid, true, this);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T[] findAll(Class<T> cls, Object... oids) {
> -        if (oids.length == 0)
> -            return (T[]) Array.newInstance(cls, 0);
> -        Collection<T> ret = findAll(cls, Arrays.asList(oids));
> -        return ret.toArray((T[]) Array.newInstance(cls, ret.size()));
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> Collection<T> findAll(final Class<T> cls, Collection oids)
> {
> -        assertNotCloseInvoked();
> -        Object[] objs = _broker.findAll(oids, true, new FindCallbacks() {
> -            public Object processArgument(Object oid) {
> -                return _broker.newObjectId(cls, oid);
> -            }
> -
> -            public Object processReturn(Object oid, OpenJPAStateManager
> sm) {
> -                return EntityManagerImpl.this.processReturn(oid, sm);
> -            }
> -        });
> -        return (Collection<T>) Arrays.asList(objs);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T findCached(Class<T> cls, Object oid) {
> -        assertNotCloseInvoked();
> -        return (T) _broker.findCached(_broker.newObjectId(cls, oid),
> this);
> -    }
> -
> -    public Class getObjectIdClass(Class cls) {
> -        assertNotCloseInvoked();
> -        if (cls == null)
> -            return null;
> -        return JPAFacadeHelper.fromOpenJPAObjectIdClass
> -                (_broker.getObjectIdType(cls));
> -    }
> -
> -    public OpenJPAEntityTransaction getTransaction() {
> -        if (_broker.isManaged())
> -            throw new InvalidStateException(_loc.get("get-managed-trans"),
> -                null, null, false);
> -        return this;
> -    }
> -
> -    public void joinTransaction() {
> -        assertNotCloseInvoked();
> -        if (!_broker.syncWithManagedTransaction())
> -            throw new TransactionRequiredException(_loc.get
> -                ("no-managed-trans"), null, null, false);
> -    }
> -
> -    public void begin() {
> -        _broker.begin();
> -    }
> -
> -    public void commit() {
> -        try {
> -            _broker.commit();
> -        } catch (RollbackException e) {
> -            throw e;
> -        } catch (IllegalStateException e) {
> -            throw e;
> -        } catch (Exception e) {
> -            // RollbackExceptions are special and aren't handled by the
> -            // normal exception translator, since the spec says they
> -            // should be thrown whenever the commit fails for any reason
> at
> -            // all, wheras the exception translator handles exceptions
> that
> -            // are caused for specific reasons
> -            throw new RollbackException(e);
> -        }
> -    }
> -
> -    public void rollback() {
> -        _broker.rollback();
> -    }
> -
> -    public void commitAndResume() {
> -        _broker.commitAndResume();
> -    }
> -
> -    public void rollbackAndResume() {
> -        _broker.rollbackAndResume();
> -    }
> -
> -    public Throwable getRollbackCause() {
> -        if (!isActive())
> -            throw new IllegalStateException(_loc.get("no-transaction")
> -                .getMessage());
> -
> -        return _broker.getRollbackCause();
> -    }
> -
> -    public boolean getRollbackOnly() {
> -        if (!isActive())
> -            throw new IllegalStateException(_loc.get("no-transaction")
> -                .getMessage());
> -
> -        return _broker.getRollbackOnly();
> -    }
> -
> -    public void setRollbackOnly() {
> -        _broker.setRollbackOnly();
> -    }
> -
> -    public void setRollbackOnly(Throwable cause) {
> -        _broker.setRollbackOnly(cause);
> -    }
> -
> -    public void setSavepoint(String name) {
> -        assertNotCloseInvoked();
> -        _broker.setSavepoint(name);
> -    }
> -
> -    public void rollbackToSavepoint() {
> -        assertNotCloseInvoked();
> -        _broker.rollbackToSavepoint();
> -    }
> -
> -    public void rollbackToSavepoint(String name) {
> -        assertNotCloseInvoked();
> -        _broker.rollbackToSavepoint(name);
> -    }
> -
> -    public void releaseSavepoint() {
> -        assertNotCloseInvoked();
> -        _broker.releaseSavepoint();
> -    }
> -
> -    public void releaseSavepoint(String name) {
> -        assertNotCloseInvoked();
> -        _broker.releaseSavepoint(name);
> -    }
> -
> -    public void flush() {
> -        assertNotCloseInvoked();
> -        _broker.assertOpen();
> -        _broker.assertActiveTransaction();
> -        _broker.flush();
> -    }
> -
> -    public void preFlush() {
> -        assertNotCloseInvoked();
> -        _broker.preFlush();
> -    }
> -
> -    public void validateChanges() {
> -        assertNotCloseInvoked();
> -        _broker.validateChanges();
> -    }
> -
> -    public boolean isActive() {
> -        return isOpen() && _broker.isActive();
> -    }
> -
> -    public boolean isStoreActive() {
> -        return _broker.isStoreActive();
> -    }
> -
> -    public void beginStore() {
> -        _broker.beginStore();
> -    }
> -
> -    public boolean contains(Object entity) {
> -        assertNotCloseInvoked();
> -        if (entity == null)
> -            return false;
> -        OpenJPAStateManager sm = _broker.getStateManager(entity);
> -        if (sm == null
> -            && !ImplHelper.isManagedType(getConfiguration(),
> entity.getClass()))
> -            throw new ArgumentException(_loc.get("not-entity",
> -                entity.getClass()), null, null, true);
> -        return sm != null && !sm.isDeleted();
> -    }
> -
> -    public boolean containsAll(Object... entities) {
> -        for (Object entity : entities)
> -            if (!contains(entity))
> -                return false;
> -        return true;
> -    }
> -
> -    public boolean containsAll(Collection entities) {
> -        for (Object entity : entities)
> -            if (!contains(entity))
> -                return false;
> -        return true;
> -    }
> -
> -    public void persist(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.persist(entity, this);
> -    }
> -
> -    public void persistAll(Object... entities) {
> -        persistAll(Arrays.asList(entities));
> -    }
> -
> -    public void persistAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.persistAll(entities, this);
> -    }
> -
> -    public void remove(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.delete(entity, this);
> -    }
> -
> -    public void removeAll(Object... entities) {
> -        removeAll(Arrays.asList(entities));
> -    }
> -
> -    public void removeAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.deleteAll(entities, this);
> -    }
> -
> -    public void release(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.release(entity, this);
> -    }
> -
> -    public void releaseAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.releaseAll(entities, this);
> -    }
> -
> -    public void releaseAll(Object... entities) {
> -        releaseAll(Arrays.asList(entities));
> -    }
> -
> -    public void refresh(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.assertWriteOperation();
> -        _broker.refresh(entity, this);
> -    }
> -
> -    public void refreshAll() {
> -        assertNotCloseInvoked();
> -        _broker.assertWriteOperation();
> -        _broker.refreshAll(_broker.getTransactionalObjects(), this);
> -    }
> -
> -    public void refreshAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.assertWriteOperation();
> -        _broker.refreshAll(entities, this);
> -    }
> -
> -    public void refreshAll(Object... entities) {
> -        refreshAll(Arrays.asList(entities));
> -    }
> -
> -    public void retrieve(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.retrieve(entity, true, this);
> -    }
> -
> -    public void retrieveAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.retrieveAll(entities, true, this);
> -    }
> -
> -    public void retrieveAll(Object... entities) {
> -        retrieveAll(Arrays.asList(entities));
> -    }
> -
> -    public void evict(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.evict(entity, this);
> -    }
> -
> -    public void evictAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.evictAll(entities, this);
> -    }
> -
> -    public void evictAll(Object... entities) {
> -        evictAll(Arrays.asList(entities));
> -    }
> -
> -    public void evictAll() {
> -        assertNotCloseInvoked();
> -        _broker.evictAll(this);
> -    }
> -
> -    public void evictAll(Class cls) {
> -        assertNotCloseInvoked();
> -        _broker.evictAll(_broker.newExtent(cls, true), this);
> -    }
> -
> -    public void evictAll(Extent extent) {
> -        assertNotCloseInvoked();
> -        _broker.evictAll(((ExtentImpl) extent).getDelegate(), this);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T detach(T entity) {
> -        assertNotCloseInvoked();
> -        return (T) _broker.detach(entity, this);
> -    }
> -
> -    public Object[] detachAll(Object... entities) {
> -        assertNotCloseInvoked();
> -        return _broker.detachAll(Arrays.asList(entities), this);
> -    }
> -
> -    public Collection detachAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        return Arrays.asList(_broker.detachAll(entities, this));
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public <T> T merge(T entity) {
> -        assertNotCloseInvoked();
> -        return (T) _broker.attach(entity, true, this);
> -    }
> -
> -    public Object[] mergeAll(Object... entities) {
> -        if (entities.length == 0)
> -            return EMPTY_OBJECTS;
> -        return mergeAll(Arrays.asList(entities)).toArray();
> -    }
> -
> -    public Collection mergeAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        return Arrays.asList(_broker.attachAll(entities, true, this));
> -    }
> -
> -    public void transactional(Object entity, boolean updateVersion) {
> -        assertNotCloseInvoked();
> -        _broker.transactional(entity, updateVersion, this);
> -    }
> -
> -    public void transactionalAll(Collection objs, boolean updateVersion) {
> -        assertNotCloseInvoked();
> -        _broker.transactionalAll(objs, updateVersion, this);
> -    }
> -
> -    public void transactionalAll(Object[] objs, boolean updateVersion) {
> -        assertNotCloseInvoked();
> -        _broker.transactionalAll(Arrays.asList(objs), updateVersion,
> this);
> -    }
> -
> -    public void nontransactional(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.nontransactional(entity, this);
> -    }
> -
> -    public void nontransactionalAll(Collection objs) {
> -        assertNotCloseInvoked();
> -        _broker.nontransactionalAll(objs, this);
> -    }
> -
> -    public void nontransactionalAll(Object[] objs) {
> -        assertNotCloseInvoked();
> -        _broker.nontransactionalAll(Arrays.asList(objs), this);
> -    }
> -
> -    public Generator getNamedGenerator(String name) {
> -        assertNotCloseInvoked();
> -        try {
> -            SequenceMetaData meta = _broker.getConfiguration().
> -                getMetaDataRepositoryInstance().getSequenceMetaData(name,
> -                _broker.getClassLoader(), true);
> -            Seq seq = meta.getInstance(_broker.getClassLoader());
> -            return new GeneratorImpl(seq, name, _broker, null);
> -        } catch (RuntimeException re) {
> -            throw PersistenceExceptions.toPersistenceException(re);
> -        }
> -    }
> -
> -    public Generator getIdGenerator(Class forClass) {
> -        assertNotCloseInvoked();
> -        try {
> -            ClassMetaData meta = _broker.getConfiguration().
> -                getMetaDataRepositoryInstance().getMetaData(forClass,
> -                _broker.getClassLoader(), true);
> -            Seq seq = _broker.getIdentitySequence(meta);
> -            return (seq == null) ? null : new GeneratorImpl(seq, null,
> _broker,
> -                meta);
> -        } catch (Exception e) {
> -            throw PersistenceExceptions.toPersistenceException(e);
> -        }
> -    }
> -
> -    public Generator getFieldGenerator(Class forClass, String fieldName) {
> -        assertNotCloseInvoked();
> -        try {
> -            ClassMetaData meta = _broker.getConfiguration().
> -                getMetaDataRepositoryInstance().getMetaData(forClass,
> -                _broker.getClassLoader(), true);
> -            FieldMetaData fmd = meta.getField(fieldName);
> -            if (fmd == null)
> -                throw new ArgumentException(_loc.get("no-named-field",
> -                    forClass, fieldName), null, null, false);
> -
> -            Seq seq = _broker.getValueSequence(fmd);
> -            return (seq == null) ? null : new GeneratorImpl(seq, null,
> _broker,
> -                meta);
> -        } catch (Exception e) {
> -            throw PersistenceExceptions.toPersistenceException(e);
> -        }
> -    }
> -
> -    public <T> Extent<T> createExtent(Class<T> cls, boolean subclasses) {
> -        assertNotCloseInvoked();
> -        return new ExtentImpl<T>(this, _broker.newExtent(cls,
> subclasses));
> -    }
> -
> -    public OpenJPAQuery createQuery(String query) {
> -        return createQuery(JPQLParser.LANG_JPQL, query);
> -    }
> -
> -    public OpenJPAQuery createQuery(String language, String query) {
> -        assertNotCloseInvoked();
> -        try {
> -            String qid = query;
> -            PreparedQuery pq = JPQLParser.LANG_JPQL.equals(language)
> -                ? getPreparedQuery(qid) : null;
> -            org.apache.openjpa.kernel.Query q = (pq == null)
> -                ? _broker.newQuery(language, query)
> -                : _broker.newQuery(pq.getLanguage(), pq);
> -            // have to validate JPQL according to spec
> -            if (pq == null && JPQLParser.LANG_JPQL.equals(language))
> -                q.compile();
> -            if (pq != null) {
> -                pq.setInto(q);
> -            }
> -            return new QueryImpl(this, _ret, q).setId(qid);
> -        } catch (RuntimeException re) {
> -            throw PersistenceExceptions.toPersistenceException(re);
> -        }
> -    }
> -
> -    public OpenJPAQuery createQuery(Query query) {
> -        if (query == null)
> -            return createQuery((String) null);
> -        assertNotCloseInvoked();
> -        org.apache.openjpa.kernel.Query q = ((QueryImpl)
> query).getDelegate();
> -        return new QueryImpl(this, _ret, _broker.newQuery(q.getLanguage(),
> -            q));
> -    }
> -
> -    public OpenJPAQuery createNamedQuery(String name) {
> -        assertNotCloseInvoked();
> -        _broker.assertOpen();
> -        try {
> -            QueryMetaData meta = _broker.getConfiguration().
> -                getMetaDataRepositoryInstance().getQueryMetaData(null,
> name,
> -                _broker.getClassLoader(), true);
> -            String qid = meta.getQueryString();
> -
> -            PreparedQuery pq =
> JPQLParser.LANG_JPQL.equals(meta.getLanguage())
> -                ? getPreparedQuery(qid) : null;
> -            org.apache.openjpa.kernel.Query del = (pq == null)
> -                ? _broker.newQuery(meta.getLanguage(),
> meta.getQueryString())
> -                : _broker.newQuery(pq.getLanguage(), pq);
> -
> -            if (pq != null) {
> -                pq.setInto(del);
> -            } else {
> -                meta.setInto(del);
> -                del.compile();
> -            }
> -
> -            OpenJPAQuery q = new QueryImpl(this, _ret, del).setId(qid);
> -            String[] hints = meta.getHintKeys();
> -            Object[] values = meta.getHintValues();
> -            for (int i = 0; i < hints.length; i++)
> -                q.setHint(hints[i], values[i]);
> -            return q;
> -        } catch (RuntimeException re) {
> -            throw PersistenceExceptions.toPersistenceException(re);
> -        }
> -    }
> -
> -    public OpenJPAQuery createNativeQuery(String query) {
> -        validateSQL(query);
> -        return createQuery(QueryLanguages.LANG_SQL, query);
> -    }
> -
> -    public OpenJPAQuery createNativeQuery(String query, Class cls) {
> -        return createNativeQuery(query).setResultClass(cls);
> -    }
> -
> -    public OpenJPAQuery createNativeQuery(String query, String
> mappingName) {
> -        assertNotCloseInvoked();
> -        validateSQL(query);
> -        org.apache.openjpa.kernel.Query kernelQuery = _broker.newQuery(
> -            QueryLanguages.LANG_SQL, query);
> -        kernelQuery.setResultMapping(null, mappingName);
> -        return new QueryImpl(this, _ret, kernelQuery);
> -    }
> -
> -    /**
> -     * Validate that the user provided SQL.
> -     */
> -    private static void validateSQL(String query) {
> -        if (StringUtils.trimToNull(query) == null)
> -            throw new ArgumentException(_loc.get("no-sql"), null, null,
> false);
> -    }
> -
> -    PreparedQueryCache getPreparedQueryCache() {
> -        return _broker.getCachePreparedQuery() ?
> -            getConfiguration().getQuerySQLCacheInstance() : null;
> -    }
> -
> -    /**
> -     * Gets the prepared query cached by the given key.
> -     *
> -     * @return the cached PreparedQuery or null if none exists.
> -     */
> -    PreparedQuery getPreparedQuery(String id) {
> -        PreparedQueryCache cache = getPreparedQueryCache();
> -        return (cache == null) ? null : cache.get(id);
> -    }
> -
> -    public void setFlushMode(FlushModeType flushMode) {
> -        assertNotCloseInvoked();
> -        _broker.assertOpen();
> -        _broker.getFetchConfiguration().setFlushBeforeQueries
> -            (toFlushBeforeQueries(flushMode));
> -    }
> -
> -    public FlushModeType getFlushMode() {
> -        assertNotCloseInvoked();
> -        _broker.assertOpen();
> -        return fromFlushBeforeQueries(_broker.getFetchConfiguration().
> -            getFlushBeforeQueries());
> -    }
> -
> -    /**
> -     * Translate our internal flush constant to a flush mode enum value.
> -     */
> -    static FlushModeType fromFlushBeforeQueries(int flush) {
> -        switch (flush) {
> -            case QueryFlushModes.FLUSH_TRUE:
> -                return FlushModeType.AUTO;
> -            case QueryFlushModes.FLUSH_FALSE:
> -                return FlushModeType.COMMIT;
> -            default:
> -                return null;
> -        }
> -    }
> -
> -    /**
> -     * Translate a flush mode enum value to our internal flush constant.
> -     */
> -    static int toFlushBeforeQueries(FlushModeType flushMode) {
> -        // choose default for null
> -        if (flushMode == null)
> -            return QueryFlushModes.FLUSH_WITH_CONNECTION;
> -        if (flushMode == FlushModeType.AUTO)
> -            return QueryFlushModes.FLUSH_TRUE;
> -        if (flushMode == FlushModeType.COMMIT)
> -            return QueryFlushModes.FLUSH_FALSE;
> -        throw new ArgumentException(flushMode.toString(), null, null,
> false);
> -    }
> -
> -    public void clear() {
> -        assertNotCloseInvoked();
> -        _broker.detachAll(this, false);
> -    }
> -
> -    public Object getDelegate() {
> -        _broker.assertOpen();
> -        assertNotCloseInvoked();
> -        return this;
> -    }
> -
> -    public LockModeType getLockMode(Object entity) {
> -        assertNotCloseInvoked();
> -        return fromLockLevel(_broker.getLockLevel(entity));
> -    }
> -
> -    public void lock(Object entity, LockModeType mode) {
> -        assertNotCloseInvoked();
> -        _broker.lock(entity, toLockLevel(mode), -1, this);
> -    }
> -
> -    public void lock(Object entity) {
> -        assertNotCloseInvoked();
> -        _broker.lock(entity, this);
> -    }
> -
> -    public void lock(Object entity, LockModeType mode, int timeout) {
> -        assertNotCloseInvoked();
> -        _broker.lock(entity, toLockLevel(mode), timeout, this);
> -    }
> -
> -    public void lockAll(Collection entities) {
> -        assertNotCloseInvoked();
> -        _broker.lockAll(entities, this);
> -    }
> -
> -    public void lockAll(Collection entities, LockModeType mode, int
> timeout) {
> -        assertNotCloseInvoked();
> -        _broker.lockAll(entities, toLockLevel(mode), timeout, this);
> -    }
> -
> -    public void lockAll(Object... entities) {
> -        lockAll(Arrays.asList(entities));
> -    }
> -
> -    public void lockAll(Object[] entities, LockModeType mode, int timeout)
> {
> -        lockAll(Arrays.asList(entities), mode, timeout);
> -    }
> -
> -    /**
> -     * Translate our internal lock level to a javax.persistence enum
> value.
> -     */
> -    static LockModeType fromLockLevel(int level) {
> -        if (level < LockLevels.LOCK_READ)
> -            return null;
> -        if (level < LockLevels.LOCK_WRITE)
> -            return LockModeType.READ;
> -        return LockModeType.WRITE;
> -    }
> -
> -    /**
> -     * Translate the javax.persistence enum value to our internal lock
> level.
> -     */
> -    static int toLockLevel(LockModeType mode) {
> -        if (mode == null)
> -            return LockLevels.LOCK_NONE;
> -        if (mode == LockModeType.READ)
> -            return LockLevels.LOCK_READ;
> -        if (mode == LockModeType.WRITE)
> -            return LockLevels.LOCK_WRITE;
> -        throw new ArgumentException(mode.toString(), null, null, true);
> -    }
> -
> -    public boolean cancelAll() {
> -        return _broker.cancelAll();
> -    }
> -
> -    public Object getConnection() {
> -        return _broker.getConnection();
> -    }
> -
> -    public Collection getManagedObjects() {
> -        return _broker.getManagedObjects();
> -    }
> -
> -    public Collection getTransactionalObjects() {
> -        return _broker.getTransactionalObjects();
> -    }
> -
> -    public Collection getPendingTransactionalObjects() {
> -        return _broker.getPendingTransactionalObjects();
> -    }
> -
> -    public Collection getDirtyObjects() {
> -        return _broker.getDirtyObjects();
> -    }
> -
> -    public boolean getOrderDirtyObjects() {
> -        return _broker.getOrderDirtyObjects();
> -    }
> -
> -    public void setOrderDirtyObjects(boolean order) {
> -        assertNotCloseInvoked();
> -        _broker.setOrderDirtyObjects(order);
> -    }
> -
> -    public void dirtyClass(Class cls) {
> -        assertNotCloseInvoked();
> -        _broker.dirtyType(cls);
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public Collection<Class> getPersistedClasses() {
> -        return (Collection<Class>) _broker.getPersistedTypes();
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public Collection<Class> getUpdatedClasses() {
> -        return (Collection<Class>) _broker.getUpdatedTypes();
> -    }
> -
> -    @SuppressWarnings("unchecked")
> -    public Collection<Class> getRemovedClasses() {
> -        return (Collection<Class>) _broker.getDeletedTypes();
> -    }
> -
> -    public <T> T createInstance(Class<T> cls) {
> -        assertNotCloseInvoked();
> -        return (T) _broker.newInstance(cls);
> -    }
> -
> -    public void close() {
> -        assertNotCloseInvoked();
> -        _broker.close();
> -    }
> -
> -    public boolean isOpen() {
> -        return !_broker.isCloseInvoked();
> -    }
> -
> -    public void dirty(Object o, String field) {
> -        assertNotCloseInvoked();
> -        OpenJPAStateManager sm = _broker.getStateManager(o);
> -        try {
> -            if (sm != null)
> -                sm.dirty(field);
> -        } catch (Exception e) {
> -            throw PersistenceExceptions.toPersistenceException(e);
> -        }
> -    }
> -
> -    public Object getObjectId(Object o) {
> -        assertNotCloseInvoked();
> -        return
> JPAFacadeHelper.fromOpenJPAObjectId(_broker.getObjectId(o));
> -    }
> -
> -    public boolean isDirty(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.isDirty(o);
> -    }
> -
> -    public boolean isTransactional(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.isTransactional(o);
> -    }
> -
> -    public boolean isPersistent(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.isPersistent(o);
> -    }
> -
> -    public boolean isNewlyPersistent(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.isNew(o);
> -    }
> -
> -    public boolean isRemoved(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.isDeleted(o);
> -    }
> -
> -    public boolean isDetached(Object entity) {
> -        assertNotCloseInvoked();
> -        return _broker.isDetached(entity);
> -    }
> -
> -    public Object getVersion(Object o) {
> -        assertNotCloseInvoked();
> -        return _broker.getVersion(o);
> -    }
> -
> -    /**
> -     * Throw appropriate exception if close has been invoked but the
> broker
> -     * is still open.  We test only for this because if the broker is
> already
> -     * closed, it will throw its own more informative exception when we
> -     * delegate the pending operation to it.
> -     */
> -    void assertNotCloseInvoked() {
> -        if (!_broker.isClosed() && _broker.isCloseInvoked())
> -            throw new InvalidStateException(_loc.get("close-invoked"),
> null,
> -                null, true);
> -    }
> -
> -    ////////////////////////////////
> -    // FindCallbacks implementation
> -    ////////////////////////////////
> -
> -    public Object processArgument(Object arg) {
> -        return arg;
> -    }
> -
> -    public Object processReturn(Object oid, OpenJPAStateManager sm) {
> -        return (sm == null || sm.isDeleted()) ? null :
> sm.getManagedInstance();
> -    }
> -
> -    //////////////////////////////
> -    // OpCallbacks implementation
> -    //////////////////////////////
> -
> -    public int processArgument(int op, Object obj, OpenJPAStateManager sm)
> {
> -        switch (op) {
> -            case OP_DELETE:
> -                // cascade through non-persistent non-detached instances
> -                if (sm == null && !_broker.isDetached(obj))
> -                    return ACT_CASCADE;
> -                if (sm != null && !sm.isDetached() && !sm.isPersistent())
> -                    return ACT_CASCADE;
> -                // ignore deleted instances
> -                if (sm != null && sm.isDeleted())
> -                    return ACT_NONE;
> -                break;
> -            case OP_ATTACH:
> -                // die on removed
> -                if (sm != null && sm.isDeleted())
> -                    throw new UserException(_loc.get("removed",
> -                        Exceptions.toString(obj))).setFailedObject(obj);
> -                // cascade through managed instances
> -                if (sm != null && !sm.isDetached())
> -                    return ACT_CASCADE;
> -                break;
> -            case OP_REFRESH:
> -                // die on unmanaged instances
> -                if (sm == null)
> -                    throw new UserException(_loc.get("not-managed",
> -                        Exceptions.toString(obj))).setFailedObject(obj);
> -                break;
> -        }
> -        return ACT_RUN | ACT_CASCADE;
> -    }
> -
> -    public int hashCode() {
> -        return _broker.hashCode();
> -    }
> -
> -    public boolean equals(Object other) {
> -        if (other == this)
> -            return true;
> -        if (!(other instanceof EntityManagerImpl))
> -            return false;
> -        return _broker.equals(((EntityManagerImpl) other)._broker);
> -    }
> -
> -    public void readExternal(ObjectInput in)
> -        throws IOException, ClassNotFoundException {
> -        try {
> -            _ret = PersistenceExceptions.getRollbackTranslator(this);
> -
> -            // this assumes that serialized Brokers are from something
> -            // that extends AbstractBrokerFactory.
> -            Object factoryKey = in.readObject();
> -            AbstractBrokerFactory factory =
> -                AbstractBrokerFactory.getPooledFactoryForKey(factoryKey);
> -            byte[] brokerBytes = (byte[]) in.readObject();
> -            ObjectInputStream innerIn = new
> BrokerBytesInputStream(brokerBytes,
> -                factory.getConfiguration());
> -
> -            Broker broker = (Broker) innerIn.readObject();
> -            EntityManagerFactoryImpl emf = (EntityManagerFactoryImpl)
> -                JPAFacadeHelper.toEntityManagerFactory(
> -                    broker.getBrokerFactory());
> -            broker.putUserObject(JPAFacadeHelper.EM_KEY, this);
> -            initialize(emf, broker);
> -        } catch (RuntimeException re) {
> -            try {
> -                re = _ret.translate(re);
> -            } catch (Exception e) {
> -                // ignore
> -            }
> -            throw re;
> -        }
> -    }
> -
> -    public void writeExternal(ObjectOutput out) throws IOException {
> -        try {
> -            // this requires that only AbstractBrokerFactory-sourced
> -            // brokers can be serialized
> -            Object factoryKey = ((AbstractBrokerFactory) _broker
> -                .getBrokerFactory()).getPoolKey();
> -            out.writeObject(factoryKey);
> -            ByteArrayOutputStream baos = new ByteArrayOutputStream();
> -            ObjectOutputStream innerOut = new ObjectOutputStream(baos);
> -            innerOut.writeObject(_broker.getDelegate());
> -            innerOut.flush();
> -            out.writeObject(baos.toByteArray());
> -        } catch (RuntimeException re) {
> -            try {
> -                re = _ret.translate(re);
> -            } catch (Exception e) {
> -                // ignore
> -            }
> -            throw re;
> -        }
> -    }
> -
> -    private static class BrokerBytesInputStream extends ObjectInputStream
> {
> -
> -        private OpenJPAConfiguration conf;
> -
> -        BrokerBytesInputStream(byte[] bytes, OpenJPAConfiguration conf)
> -            throws IOException {
> -            super(new ByteArrayInputStream(bytes));
> -            if (conf == null)
> -                throw new IllegalArgumentException(
> -                    "Illegal null argument to
> ObjectInputStreamWithLoader");
> -            this.conf = conf;
> -        }
> -
> -        /**
> -         * Make a primitive array class
> -         */
> -        private Class primitiveType(char type) {
> -            switch (type) {
> -                case 'B': return byte.class;
> -                case 'C': return char.class;
> -                case 'D': return double.class;
> -                case 'F': return float.class;
> -                case 'I': return int.class;
> -                case 'J': return long.class;
> -                case 'S': return short.class;
> -                case 'Z': return boolean.class;
> -                default: return null;
> -            }
> -        }
> -
> -        protected Class resolveClass(ObjectStreamClass classDesc)
> -            throws IOException, ClassNotFoundException {
> -
> -            String cname = classDesc.getName();
> -            if (cname.startsWith("[")) {
> -                // An array
> -                Class component;               // component class
> -                int dcount;                        // dimension
> -                for (dcount=1; cname.charAt(dcount)=='['; dcount++) ;
> -                if (cname.charAt(dcount) == 'L') {
> -                    component = lookupClass(cname.substring(dcount+1,
> -                        cname.length()-1));
> -                } else {
> -                    if (cname.length() != dcount+1) {
> -                        throw new ClassNotFoundException(cname);//
> malformed
> -                    }
> -                    component = primitiveType(cname.charAt(dcount));
> -                }
> -                int dim[] = new int[dcount];
> -                for (int i=0; i<dcount; i++) {
> -                    dim[i]=0;
> -                }
> -                return Array.newInstance(component, dim).getClass();
> -            } else {
> -                return lookupClass(cname);
> -            }
> -        }
> -
> -        /**
> -         * If this is a generated subclass, look up the corresponding
> Class
> -         * object via metadata.
> -         */
> -        private Class lookupClass(String className)
> -            throws ClassNotFoundException {
> -            try {
> -                return Class.forName(className);
> -            } catch (ClassNotFoundException e) {
> -                if (PCEnhancer.isPCSubclassName(className)) {
> -                    String superName =
> PCEnhancer.toManagedTypeName(className);
> -                    ClassMetaData[] metas =
> conf.getMetaDataRepositoryInstance()
> -                        .getMetaDatas();
> -                    for (int i = 0; i < metas.length; i++) {
> -                        if (superName.equals(
> -                            metas[i].getDescribedType().getName())) {
> -                            return PCRegistry.getPCType(
> -                                metas[i].getDescribedType());
> -                        }
> -                    }
> -
> -                    // if it's not found, try to look for it anyways
> -                    return Class.forName(className);
> -                } else {
> -                    throw e;
> -                }
> -            }
> -        }
> -    }
> -
> -    public void clear(Object entity) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    public Query createQuery(QueryDefinition qdef) {
> -        String jpql = getQueryBuilder().toJPQL(qdef);
> -        return createQuery(jpql);
> -    }
> -
> -    public <T> T find(Class<T> entityClass, Object primaryKey,
> -       LockModeType lockMode) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    public <T> T find(Class<T> entityClass, Object primaryKey,
> -       LockModeType lockMode, Map<String, Object> properties) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    /*
> -     * @see javax.persistence.EntityManager#getProperties()
> -     *
> -     * This does not return the password property.
> -     */
> -    public Map<String, Object> getProperties() {
> -        Map<String, String> currentProperties = _broker.getProperties();
> -
> -        // Convert the <String, String> map into a <String, Object> map
> -        Map<String, Object> finalMap =
> -            new HashMap<String, Object>(currentProperties);
> -
> -        // Remove the password property
> -        finalMap.remove("javax.persistence.jdbc.password");
> -        finalMap.remove("openjpa.ConnectionPassword");
> -
> -        return finalMap;
> -    }
> -
> -    public OpenJPAQueryBuilder getQueryBuilder() {
> -        return new QueryBuilderImpl(_emf);
> -    }
> -
> -    public Set<String> getSupportedProperties() {
> -        return _broker.getSupportedProperties();
> -    }
> -
> -    public void lock(Object entity, LockModeType lockMode, Map<String,
> -       Object> properties) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    public void refresh(Object entity, LockModeType lockMode) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    public void refresh(Object entity, LockModeType lockMode, Map<String,
> -       Object> properties) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -    public <T> T unwrap(Class<T> cls) {
> -        throw new UnsupportedOperationException(
> -            "JPA 2.0 - Method not yet implemented");
> -    }
> -
> -
> -    public void setQuerySQLCache(boolean flag) {
> -        _broker.setCachePreparedQuery(flag);
> -    }
> -
> -    public boolean getQuerySQLCache() {
> -        return _broker.getCachePreparedQuery();
> -    }
> -
> -    RuntimeExceptionTranslator getExceptionTranslator() {
> -        return _ret;
> -    }
> -
> -}
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you 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 org.apache.openjpa.persistence;
> +
> +import java.io.ByteArrayInputStream;
> +import java.io.ByteArrayOutputStream;
> +import java.io.Externalizable;
> +import java.io.IOException;
> +import java.io.ObjectInput;
> +import java.io.ObjectInputStream;
> +import java.io.ObjectOutput;
> +import java.io.ObjectOutputStream;
> +import java.io.ObjectStreamClass;
> +import java.lang.reflect.Array;
> +import java.util.Arrays;
> +import java.util.Collection;
> +import java.util.EnumSet;
> +import java.util.HashMap;
> +import java.util.IdentityHashMap;
> +import java.util.Map;
> +import java.util.Set;
> +
> +import javax.persistence.EntityManager;
> +import javax.persistence.FlushModeType;
> +import javax.persistence.LockModeType;
> +import javax.persistence.Query;
> +import javax.persistence.QueryDefinition;
> +
> +import org.apache.commons.lang.StringUtils;
> +import org.apache.openjpa.conf.OpenJPAConfiguration;
> +import org.apache.openjpa.ee.ManagedRuntime;
> +import org.apache.openjpa.enhance.PCEnhancer;
> +import org.apache.openjpa.enhance.PCRegistry;
> +import org.apache.openjpa.kernel.AbstractBrokerFactory;
> +import org.apache.openjpa.kernel.Broker;
> +import org.apache.openjpa.kernel.DelegatingBroker;
> +import org.apache.openjpa.kernel.FetchConfiguration;
> +import org.apache.openjpa.kernel.FindCallbacks;
> +import org.apache.openjpa.kernel.LockLevels;
> +import org.apache.openjpa.kernel.OpCallbacks;
> +import org.apache.openjpa.kernel.OpenJPAStateManager;
> +import org.apache.openjpa.kernel.PreparedQuery;
> +import org.apache.openjpa.kernel.PreparedQueryCache;
> +import org.apache.openjpa.kernel.QueryFlushModes;
> +import org.apache.openjpa.kernel.QueryLanguages;
> +import org.apache.openjpa.kernel.Seq;
> +import org.apache.openjpa.kernel.jpql.JPQLParser;
> +import org.apache.openjpa.lib.util.Closeable;
> +import org.apache.openjpa.lib.util.Localizer;
> +import org.apache.openjpa.meta.ClassMetaData;
> +import org.apache.openjpa.meta.FieldMetaData;
> +import org.apache.openjpa.meta.QueryMetaData;
> +import org.apache.openjpa.meta.SequenceMetaData;
> +import org.apache.openjpa.persistence.query.OpenJPAQueryBuilder;
> +import org.apache.openjpa.persistence.query.QueryBuilderImpl;
> +import org.apache.openjpa.util.Exceptions;
> +import org.apache.openjpa.util.ImplHelper;
> +import org.apache.openjpa.util.RuntimeExceptionTranslator;
> +import org.apache.openjpa.util.UserException;
> +
> +/**
> + * Implementation of {@link EntityManager} interface.
> + *
> + * @author Patrick Linskey
> + * @author Abe White
> + * @nojavadoc
> + */
> +public class EntityManagerImpl
> +    implements OpenJPAEntityManagerSPI, Externalizable,
> +    FindCallbacks, OpCallbacks, Closeable, OpenJPAEntityTransaction {
> +
> +    private static final Localizer _loc = Localizer.forPackage
> +        (EntityManagerImpl.class);
> +    private static final Object[] EMPTY_OBJECTS = new Object[0];
> +
> +    private DelegatingBroker _broker;
> +    private EntityManagerFactoryImpl _emf;
> +    private Map<FetchConfiguration,FetchPlan> _plans =
> +        new IdentityHashMap<FetchConfiguration,FetchPlan>(1);
> +
> +    private RuntimeExceptionTranslator _ret =
> +        PersistenceExceptions.getRollbackTranslator(this);
> +
> +    public EntityManagerImpl() {
> +        // for Externalizable
> +    }
> +
> +    /**
> +     * Constructor; supply factory and delegate.
> +     */
> +    public EntityManagerImpl(EntityManagerFactoryImpl factory,
> +        Broker broker) {
> +        initialize(factory, broker);
> +    }
> +
> +    private void initialize(EntityManagerFactoryImpl factory, Broker
> broker) {
> +        _emf = factory;
> +        _broker = new DelegatingBroker(broker, _ret);
> +        _broker.setImplicitBehavior(this, _ret);
> +    }
> +
> +    /**
> +     * Broker delegate.
> +     */
> +    public Broker getBroker() {
> +        return _broker.getDelegate();
> +    }
> +
> +    public OpenJPAEntityManagerFactory getEntityManagerFactory() {
> +        return _emf;
> +    }
> +
> +    public OpenJPAConfiguration getConfiguration() {
> +        return _broker.getConfiguration();
> +    }
> +
> +    public FetchPlan getFetchPlan() {
> +        assertNotCloseInvoked();
> +        _broker.lock();
> +        try {
> +            FetchConfiguration fc = _broker.getFetchConfiguration();
> +            FetchPlan fp = _plans.get(fc);
> +            if (fp == null) {
> +                fp = _emf.toFetchPlan(_broker, fc);
> +                _plans.put(fc, fp);
> +            }
> +            return fp;
> +        } finally {
> +            _broker.unlock();
> +        }
> +    }
> +
> +    public FetchPlan pushFetchPlan() {
> +        assertNotCloseInvoked();
> +        _broker.lock();
> +        try {
> +            _broker.pushFetchConfiguration();
> +            return getFetchPlan();
> +        } finally {
> +            _broker.unlock();
> +        }
> +    }
> +
> +    public void popFetchPlan() {
> +        assertNotCloseInvoked();
> +        _broker.lock();
> +        try {
> +            _broker.popFetchConfiguration();
> +        } finally {
> +            _broker.unlock();
> +        }
> +    }
> +
> +    public ConnectionRetainMode getConnectionRetainMode() {
> +        return ConnectionRetainMode.fromKernelConstant(
> +            _broker.getConnectionRetainMode());
> +    }
> +
> +    public boolean isTransactionManaged() {
> +        return _broker.isManaged();
> +    }
> +
> +    public boolean isManaged() {
> +        return _broker.isManaged();
> +    }
> +
> +    public ManagedRuntime getManagedRuntime() {
> +        return _broker.getManagedRuntime();
> +    }
> +
> +    public boolean getSyncWithManagedTransactions() {
> +        return _broker.getSyncWithManagedTransactions();
> +    }
> +
> +    public void setSyncWithManagedTransactions(boolean sync) {
> +        assertNotCloseInvoked();
> +        _broker.setSyncWithManagedTransactions(sync);
> +    }
> +
> +    public ClassLoader getClassLoader() {
> +        return _broker.getClassLoader();
> +    }
> +
> +    public String getConnectionUserName() {
> +        return _broker.getConnectionUserName();
> +    }
> +
> +    public String getConnectionPassword() {
> +        return _broker.getConnectionPassword();
> +    }
> +
> +    public boolean getMultithreaded() {
> +        return _broker.getMultithreaded();
> +    }
> +
> +    public void setMultithreaded(boolean multithreaded) {
> +        assertNotCloseInvoked();
> +        _broker.setMultithreaded(multithreaded);
> +    }
> +
> +    public boolean getIgnoreChanges() {
> +        return _broker.getIgnoreChanges();
> +    }
> +
> +    public void setIgnoreChanges(boolean val) {
> +        assertNotCloseInvoked();
> +        _broker.setIgnoreChanges(val);
> +    }
> +
> +    public boolean getNontransactionalRead() {
> +        return _broker.getNontransactionalRead();
> +    }
> +
> +    public void setNontransactionalRead(boolean val) {
> +        assertNotCloseInvoked();
> +        _broker.setNontransactionalRead(val);
> +    }
> +
> +    public boolean getNontransactionalWrite() {
> +        return _broker.getNontransactionalWrite();
> +    }
> +
> +    public void setNontransactionalWrite(boolean val) {
> +        assertNotCloseInvoked();
> +        _broker.setNontransactionalWrite(val);
> +    }
> +
> +    public boolean getOptimistic() {
> +        return _broker.getOptimistic();
> +    }
> +
> +    public void setOptimistic(boolean val) {
> +        assertNotCloseInvoked();
> +        _broker.setOptimistic(val);
> +    }
> +
> +    public RestoreStateType getRestoreState() {
> +        return
> RestoreStateType.fromKernelConstant(_broker.getRestoreState());
> +    }
> +
> +    public void setRestoreState(RestoreStateType val) {
> +        assertNotCloseInvoked();
> +        _broker.setRestoreState(val.toKernelConstant());
> +    }
> +
> +    public void setRestoreState(int restore) {
> +        assertNotCloseInvoked();
> +        _broker.setRestoreState(restore);
> +    }
> +
> +    public boolean getRetainState() {
> +        return _broker.getRetainState();
> +    }
> +
> +    public void setRetainState(boolean val) {
> +        assertNotCloseInvoked();
> +        _broker.setRetainState(val);
> +    }
> +
> +    public AutoClearType getAutoClear() {
> +        return AutoClearType.fromKernelConstant(_broker.getAutoClear());
> +    }
> +
> +    public void setAutoClear(AutoClearType val) {
> +        assertNotCloseInvoked();
> +        _broker.setAutoClear(val.toKernelConstant());
> +    }
> +
> +    public void setAutoClear(int autoClear) {
> +        assertNotCloseInvoked();
> +        _broker.setAutoClear(autoClear);
> +    }
> +
> +    public DetachStateType getDetachState() {
> +        return
> DetachStateType.fromKernelConstant(_broker.getDetachState());
> +    }
> +
> +    public void setDetachState(DetachStateType type) {
> +        assertNotCloseInvoked();
> +        _broker.setDetachState(type.toKernelConstant());
> +    }
> +
> +    public void setDetachState(int detach) {
> +        assertNotCloseInvoked();
> +        _broker.setDetachState(detach);
> +    }
> +
> +    public EnumSet<AutoDetachType> getAutoDetach() {
> +        return AutoDetachType.toEnumSet(_broker.getAutoDetach());
> +    }
> +
> +    public void setAutoDetach(AutoDetachType flag) {
> +        assertNotCloseInvoked();
> +
>  _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(flag)));
> +    }
> +
> +    public void setAutoDetach(EnumSet<AutoDetachType> flags) {
> +        assertNotCloseInvoked();
> +        _broker.setAutoDetach(AutoDetachType.fromEnumSet(flags));
> +    }
> +
> +    public void setAutoDetach(int autoDetachFlags) {
> +        assertNotCloseInvoked();
> +        _broker.setAutoDetach(autoDetachFlags);
> +    }
> +
> +    public void setAutoDetach(AutoDetachType value, boolean on) {
> +        assertNotCloseInvoked();
> +
>  _broker.setAutoDetach(AutoDetachType.fromEnumSet(EnumSet.of(value)),on);
> +    }
> +
> +    public void setAutoDetach(int flag, boolean on) {
> +        assertNotCloseInvoked();
> +        _broker.setAutoDetach(flag, on);
> +    }
> +
> +    public boolean getEvictFromStoreCache() {
> +        return _broker.getEvictFromDataCache();
> +    }
> +
> +    public void setEvictFromStoreCache(boolean evict) {
> +        assertNotCloseInvoked();
> +        _broker.setEvictFromDataCache(evict);
> +    }
> +
> +    public boolean getPopulateStoreCache() {
> +        return _broker.getPopulateDataCache();
> +    }
> +
> +    public void setPopulateStoreCache(boolean cache) {
> +        assertNotCloseInvoked();
> +        _broker.setPopulateDataCache(cache);
> +    }
> +
> +    public boolean isTrackChangesByType() {
> +        return _broker.isTrackChangesByType();
> +    }
> +
> +    public void setTrackChangesByType(boolean trackByType) {
> +        assertNotCloseInvoked();
> +        _broker.setTrackChangesByType(trackByType);
> +    }
> +
> +    public boolean isLargeTransaction() {
> +        return isTrackChangesByType();
> +    }
> +
> +    public void setLargeTransaction(boolean value) {
> +        setTrackChangesByType(value);
> +    }
> +
> +    public Object getUserObject(Object key) {
> +        return _broker.getUserObject(key);
> +    }
> +
> +    public Object putUserObject(Object key, Object val) {
> +        assertNotCloseInvoked();
> +        return _broker.putUserObject(key, val);
> +    }
> +
> +    public void addTransactionListener(Object listener) {
> +        assertNotCloseInvoked();
> +        _broker.addTransactionListener(listener);
> +    }
> +
> +    public void removeTransactionListener(Object listener) {
> +        assertNotCloseInvoked();
> +        _broker.removeTransactionListener(listener);
> +    }
> +
> +    public EnumSet<CallbackMode> getTransactionListenerCallbackModes() {
> +        return CallbackMode.toEnumSet(
> +            _broker.getTransactionListenerCallbackMode());
> +    }
> +
> +    public void setTransactionListenerCallbackMode(CallbackMode mode) {
> +        assertNotCloseInvoked();
> +        _broker.setTransactionListenerCallbackMode(
> +            CallbackMode.fromEnumSet(EnumSet.of(mode)));
> +    }
> +
> +    public void setTransactionListenerCallbackMode(EnumSet<CallbackMode>
> modes){
> +        assertNotCloseInvoked();
> +        _broker.setTransactionListenerCallbackMode(
> +            CallbackMode.fromEnumSet(modes));
> +    }
> +
> +    public int getTransactionListenerCallbackMode() {
> +        return _broker.getTransactionListenerCallbackMode();
> +    }
> +
> +    public void setTransactionListenerCallbackMode(int callbackMode) {
> +        throw new UnsupportedOperationException();
> +    }
> +
> +    public void addLifecycleListener(Object listener, Class... classes) {
> +        assertNotCloseInvoked();
> +        _broker.addLifecycleListener(listener, classes);
> +    }
> +
> +    public void removeLifecycleListener(Object listener) {
> +        assertNotCloseInvoked();
> +        _broker.removeLifecycleListener(listener);
> +    }
> +
> +    public EnumSet<CallbackMode> getLifecycleListenerCallbackModes() {
> +        return CallbackMode.toEnumSet(
> +            _broker.getLifecycleListenerCallbackMode());
> +    }
> +
> +    public void setLifecycleListenerCallbackMode(CallbackMode mode) {
> +        assertNotCloseInvoked();
> +        _broker.setLifecycleListenerCallbackMode(
> +            CallbackMode.fromEnumSet(EnumSet.of(mode)));
> +    }
> +
> +    public void setLifecycleListenerCallbackMode(EnumSet<CallbackMode>
> modes) {
> +        assertNotCloseInvoked();
> +        _broker.setLifecycleListenerCallbackMode(
> +            CallbackMode.fromEnumSet(modes));
> +    }
> +
> +    public int getLifecycleListenerCallbackMode() {
> +        return _broker.getLifecycleListenerCallbackMode();
> +    }
> +
> +    public void setLifecycleListenerCallbackMode(int callbackMode) {
> +        assertNotCloseInvoked();
> +        _broker.setLifecycleListenerCallbackMode(callbackMode);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T getReference(Class<T> cls, Object oid) {
> +        assertNotCloseInvoked();
> +        oid = _broker.newObjectId(cls, oid);
> +        return (T) _broker.find(oid, false, this);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T find(Class<T> cls, Object oid) {
> +        assertNotCloseInvoked();
> +        oid = _broker.newObjectId(cls, oid);
> +        return (T) _broker.find(oid, true, this);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T[] findAll(Class<T> cls, Object... oids) {
> +        if (oids.length == 0)
> +            return (T[]) Array.newInstance(cls, 0);
> +        Collection<T> ret = findAll(cls, Arrays.asList(oids));
> +        return ret.toArray((T[]) Array.newInstance(cls, ret.size()));
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> Collection<T> findAll(final Class<T> cls, Collection oids)
> {
> +        assertNotCloseInvoked();
> +        Object[] objs = _broker.findAll(oids, true, new FindCallbacks() {
> +            public Object processArgument(Object oid) {
> +                return _broker.newObjectId(cls, oid);
> +            }
> +
> +            public Object processReturn(Object oid, OpenJPAStateManager
> sm) {
> +                return EntityManagerImpl.this.processReturn(oid, sm);
> +            }
> +        });
> +        return (Collection<T>) Arrays.asList(objs);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T findCached(Class<T> cls, Object oid) {
> +        assertNotCloseInvoked();
> +        return (T) _broker.findCached(_broker.newObjectId(cls, oid),
> this);
> +    }
> +
> +    public Class getObjectIdClass(Class cls) {
> +        assertNotCloseInvoked();
> +        if (cls == null)
> +            return null;
> +        return JPAFacadeHelper.fromOpenJPAObjectIdClass
> +                (_broker.getObjectIdType(cls));
> +    }
> +
> +    public OpenJPAEntityTransaction getTransaction() {
> +        if (_broker.isManaged())
> +            throw new InvalidStateException(_loc.get("get-managed-trans"),
> +                null, null, false);
> +        return this;
> +    }
> +
> +    public void joinTransaction() {
> +        assertNotCloseInvoked();
> +        if (!_broker.syncWithManagedTransaction())
> +            throw new TransactionRequiredException(_loc.get
> +                ("no-managed-trans"), null, null, false);
> +    }
> +
> +    public void begin() {
> +        _broker.begin();
> +    }
> +
> +    public void commit() {
> +        try {
> +            _broker.commit();
> +        } catch (RollbackException e) {
> +            throw e;
> +        } catch (IllegalStateException e) {
> +            throw e;
> +        } catch (Exception e) {
> +            // RollbackExceptions are special and aren't handled by the
> +            // normal exception translator, since the spec says they
> +            // should be thrown whenever the commit fails for any reason
> at
> +            // all, wheras the exception translator handles exceptions
> that
> +            // are caused for specific reasons
> +            throw new RollbackException(e);
> +        }
> +    }
> +
> +    public void rollback() {
> +        _broker.rollback();
> +    }
> +
> +    public void commitAndResume() {
> +        _broker.commitAndResume();
> +    }
> +
> +    public void rollbackAndResume() {
> +        _broker.rollbackAndResume();
> +    }
> +
> +    public Throwable getRollbackCause() {
> +        if (!isActive())
> +            throw new IllegalStateException(_loc.get("no-transaction")
> +                .getMessage());
> +
> +        return _broker.getRollbackCause();
> +    }
> +
> +    public boolean getRollbackOnly() {
> +        if (!isActive())
> +            throw new IllegalStateException(_loc.get("no-transaction")
> +                .getMessage());
> +
> +        return _broker.getRollbackOnly();
> +    }
> +
> +    public void setRollbackOnly() {
> +        _broker.setRollbackOnly();
> +    }
> +
> +    public void setRollbackOnly(Throwable cause) {
> +        _broker.setRollbackOnly(cause);
> +    }
> +
> +    public void setSavepoint(String name) {
> +        assertNotCloseInvoked();
> +        _broker.setSavepoint(name);
> +    }
> +
> +    public void rollbackToSavepoint() {
> +        assertNotCloseInvoked();
> +        _broker.rollbackToSavepoint();
> +    }
> +
> +    public void rollbackToSavepoint(String name) {
> +        assertNotCloseInvoked();
> +        _broker.rollbackToSavepoint(name);
> +    }
> +
> +    public void releaseSavepoint() {
> +        assertNotCloseInvoked();
> +        _broker.releaseSavepoint();
> +    }
> +
> +    public void releaseSavepoint(String name) {
> +        assertNotCloseInvoked();
> +        _broker.releaseSavepoint(name);
> +    }
> +
> +    public void flush() {
> +        assertNotCloseInvoked();
> +        _broker.assertOpen();
> +        _broker.assertActiveTransaction();
> +        _broker.flush();
> +    }
> +
> +    public void preFlush() {
> +        assertNotCloseInvoked();
> +        _broker.preFlush();
> +    }
> +
> +    public void validateChanges() {
> +        assertNotCloseInvoked();
> +        _broker.validateChanges();
> +    }
> +
> +    public boolean isActive() {
> +        return isOpen() && _broker.isActive();
> +    }
> +
> +    public boolean isStoreActive() {
> +        return _broker.isStoreActive();
> +    }
> +
> +    public void beginStore() {
> +        _broker.beginStore();
> +    }
> +
> +    public boolean contains(Object entity) {
> +        assertNotCloseInvoked();
> +        if (entity == null)
> +            return false;
> +        OpenJPAStateManager sm = _broker.getStateManager(entity);
> +        if (sm == null
> +            && !ImplHelper.isManagedType(getConfiguration(),
> entity.getClass()))
> +            throw new ArgumentException(_loc.get("not-entity",
> +                entity.getClass()), null, null, true);
> +        return sm != null && !sm.isDeleted();
> +    }
> +
> +    public boolean containsAll(Object... entities) {
> +        for (Object entity : entities)
> +            if (!contains(entity))
> +                return false;
> +        return true;
> +    }
> +
> +    public boolean containsAll(Collection entities) {
> +        for (Object entity : entities)
> +            if (!contains(entity))
> +                return false;
> +        return true;
> +    }
> +
> +    public void persist(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.persist(entity, this);
> +    }
> +
> +    public void persistAll(Object... entities) {
> +        persistAll(Arrays.asList(entities));
> +    }
> +
> +    public void persistAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.persistAll(entities, this);
> +    }
> +
> +    public void remove(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.delete(entity, this);
> +    }
> +
> +    public void removeAll(Object... entities) {
> +        removeAll(Arrays.asList(entities));
> +    }
> +
> +    public void removeAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.deleteAll(entities, this);
> +    }
> +
> +    public void release(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.release(entity, this);
> +    }
> +
> +    public void releaseAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.releaseAll(entities, this);
> +    }
> +
> +    public void releaseAll(Object... entities) {
> +        releaseAll(Arrays.asList(entities));
> +    }
> +
> +    public void refresh(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.assertWriteOperation();
> +        _broker.refresh(entity, this);
> +    }
> +
> +    public void refreshAll() {
> +        assertNotCloseInvoked();
> +        _broker.assertWriteOperation();
> +        _broker.refreshAll(_broker.getTransactionalObjects(), this);
> +    }
> +
> +    public void refreshAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.assertWriteOperation();
> +        _broker.refreshAll(entities, this);
> +    }
> +
> +    public void refreshAll(Object... entities) {
> +        refreshAll(Arrays.asList(entities));
> +    }
> +
> +    public void retrieve(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.retrieve(entity, true, this);
> +    }
> +
> +    public void retrieveAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.retrieveAll(entities, true, this);
> +    }
> +
> +    public void retrieveAll(Object... entities) {
> +        retrieveAll(Arrays.asList(entities));
> +    }
> +
> +    public void evict(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.evict(entity, this);
> +    }
> +
> +    public void evictAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.evictAll(entities, this);
> +    }
> +
> +    public void evictAll(Object... entities) {
> +        evictAll(Arrays.asList(entities));
> +    }
> +
> +    public void evictAll() {
> +        assertNotCloseInvoked();
> +        _broker.evictAll(this);
> +    }
> +
> +    public void evictAll(Class cls) {
> +        assertNotCloseInvoked();
> +        _broker.evictAll(_broker.newExtent(cls, true), this);
> +    }
> +
> +    public void evictAll(Extent extent) {
> +        assertNotCloseInvoked();
> +        _broker.evictAll(((ExtentImpl) extent).getDelegate(), this);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T detach(T entity) {
> +        assertNotCloseInvoked();
> +        return (T) _broker.detach(entity, this);
> +    }
> +
> +    public Object[] detachAll(Object... entities) {
> +        assertNotCloseInvoked();
> +        return _broker.detachAll(Arrays.asList(entities), this);
> +    }
> +
> +    public Collection detachAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        return Arrays.asList(_broker.detachAll(entities, this));
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public <T> T merge(T entity) {
> +        assertNotCloseInvoked();
> +        return (T) _broker.attach(entity, true, this);
> +    }
> +
> +    public Object[] mergeAll(Object... entities) {
> +        if (entities.length == 0)
> +            return EMPTY_OBJECTS;
> +        return mergeAll(Arrays.asList(entities)).toArray();
> +    }
> +
> +    public Collection mergeAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        return Arrays.asList(_broker.attachAll(entities, true, this));
> +    }
> +
> +    public void transactional(Object entity, boolean updateVersion) {
> +        assertNotCloseInvoked();
> +        _broker.transactional(entity, updateVersion, this);
> +    }
> +
> +    public void transactionalAll(Collection objs, boolean updateVersion) {
> +        assertNotCloseInvoked();
> +        _broker.transactionalAll(objs, updateVersion, this);
> +    }
> +
> +    public void transactionalAll(Object[] objs, boolean updateVersion) {
> +        assertNotCloseInvoked();
> +        _broker.transactionalAll(Arrays.asList(objs), updateVersion,
> this);
> +    }
> +
> +    public void nontransactional(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.nontransactional(entity, this);
> +    }
> +
> +    public void nontransactionalAll(Collection objs) {
> +        assertNotCloseInvoked();
> +        _broker.nontransactionalAll(objs, this);
> +    }
> +
> +    public void nontransactionalAll(Object[] objs) {
> +        assertNotCloseInvoked();
> +        _broker.nontransactionalAll(Arrays.asList(objs), this);
> +    }
> +
> +    public Generator getNamedGenerator(String name) {
> +        assertNotCloseInvoked();
> +        try {
> +            SequenceMetaData meta = _broker.getConfiguration().
> +                getMetaDataRepositoryInstance().getSequenceMetaData(name,
> +                _broker.getClassLoader(), true);
> +            Seq seq = meta.getInstance(_broker.getClassLoader());
> +            return new GeneratorImpl(seq, name, _broker, null);
> +        } catch (RuntimeException re) {
> +            throw PersistenceExceptions.toPersistenceException(re);
> +        }
> +    }
> +
> +    public Generator getIdGenerator(Class forClass) {
> +        assertNotCloseInvoked();
> +        try {
> +            ClassMetaData meta = _broker.getConfiguration().
> +                getMetaDataRepositoryInstance().getMetaData(forClass,
> +                _broker.getClassLoader(), true);
> +            Seq seq = _broker.getIdentitySequence(meta);
> +            return (seq == null) ? null : new GeneratorImpl(seq, null,
> _broker,
> +                meta);
> +        } catch (Exception e) {
> +            throw PersistenceExceptions.toPersistenceException(e);
> +        }
> +    }
> +
> +    public Generator getFieldGenerator(Class forClass, String fieldName) {
> +        assertNotCloseInvoked();
> +        try {
> +            ClassMetaData meta = _broker.getConfiguration().
> +                getMetaDataRepositoryInstance().getMetaData(forClass,
> +                _broker.getClassLoader(), true);
> +            FieldMetaData fmd = meta.getField(fieldName);
> +            if (fmd == null)
> +                throw new ArgumentException(_loc.get("no-named-field",
> +                    forClass, fieldName), null, null, false);
> +
> +            Seq seq = _broker.getValueSequence(fmd);
> +            return (seq == null) ? null : new GeneratorImpl(seq, null,
> _broker,
> +                meta);
> +        } catch (Exception e) {
> +            throw PersistenceExceptions.toPersistenceException(e);
> +        }
> +    }
> +
> +    public <T> Extent<T> createExtent(Class<T> cls, boolean subclasses) {
> +        assertNotCloseInvoked();
> +        return new ExtentImpl<T>(this, _broker.newExtent(cls,
> subclasses));
> +    }
> +
> +    public OpenJPAQuery createQuery(String query) {
> +        return createQuery(JPQLParser.LANG_JPQL, query);
> +    }
> +
> +    public OpenJPAQuery createQuery(String language, String query) {
> +        assertNotCloseInvoked();
> +        try {
> +            String qid = query;
> +            PreparedQuery pq = JPQLParser.LANG_JPQL.equals(language)
> +                ? getPreparedQuery(qid) : null;
> +            org.apache.openjpa.kernel.Query q = (pq == null)
> +                ? _broker.newQuery(language, query)
> +                : _broker.newQuery(pq.getLanguage(), pq);
> +            // have to validate JPQL according to spec
> +            if (pq == null && JPQLParser.LANG_JPQL.equals(language))
> +                q.compile();
> +            if (pq != null) {
> +                pq.setInto(q);
> +            }
> +            return new QueryImpl(this, _ret, q).setId(qid);
> +        } catch (RuntimeException re) {
> +            throw PersistenceExceptions.toPersistenceException(re);
> +        }
> +    }
> +
> +    public OpenJPAQuery createQuery(Query query) {
> +        if (query == null)
> +            return createQuery((String) null);
> +        assertNotCloseInvoked();
> +        org.apache.openjpa.kernel.Query q = ((QueryImpl)
> query).getDelegate();
> +        return new QueryImpl(this, _ret, _broker.newQuery(q.getLanguage(),
> +            q));
> +    }
> +
> +    public OpenJPAQuery createNamedQuery(String name) {
> +        assertNotCloseInvoked();
> +        _broker.assertOpen();
> +        try {
> +            QueryMetaData meta = _broker.getConfiguration().
> +                getMetaDataRepositoryInstance().getQueryMetaData(null,
> name,
> +                _broker.getClassLoader(), true);
> +            String qid = meta.getQueryString();
> +
> +            PreparedQuery pq =
> JPQLParser.LANG_JPQL.equals(meta.getLanguage())
> +                ? getPreparedQuery(qid) : null;
> +            org.apache.openjpa.kernel.Query del = (pq == null)
> +                ? _broker.newQuery(meta.getLanguage(),
> meta.getQueryString())
> +                : _broker.newQuery(pq.getLanguage(), pq);
> +
> +            if (pq != null) {
> +                pq.setInto(del);
> +            } else {
> +                meta.setInto(del);
> +                del.compile();
> +            }
> +
> +            OpenJPAQuery q = new QueryImpl(this, _ret, del).setId(qid);
> +            String[] hints = meta.getHintKeys();
> +            Object[] values = meta.getHintValues();
> +            for (int i = 0; i < hints.length; i++)
> +                q.setHint(hints[i], values[i]);
> +            return q;
> +        } catch (RuntimeException re) {
> +            throw PersistenceExceptions.toPersistenceException(re);
> +        }
> +    }
> +
> +    public OpenJPAQuery createNativeQuery(String query) {
> +        validateSQL(query);
> +        return createQuery(QueryLanguages.LANG_SQL, query);
> +    }
> +
> +    public OpenJPAQuery createNativeQuery(String query, Class cls) {
> +        return createNativeQuery(query).setResultClass(cls);
> +    }
> +
> +    public OpenJPAQuery createNativeQuery(String query, String
> mappingName) {
> +        assertNotCloseInvoked();
> +        validateSQL(query);
> +        org.apache.openjpa.kernel.Query kernelQuery = _broker.newQuery(
> +            QueryLanguages.LANG_SQL, query);
> +        kernelQuery.setResultMapping(null, mappingName);
> +        return new QueryImpl(this, _ret, kernelQuery);
> +    }
> +
> +    /**
> +     * Validate that the user provided SQL.
> +     */
> +    private static void validateSQL(String query) {
> +        if (StringUtils.trimToNull(query) == null)
> +            throw new ArgumentException(_loc.get("no-sql"), null, null,
> false);
> +    }
> +
> +    PreparedQueryCache getPreparedQueryCache() {
> +        return _broker.getCachePreparedQuery() ?
> +            getConfiguration().getQuerySQLCacheInstance() : null;
> +    }
> +
> +    /**
> +     * Gets the prepared query cached by the given key.
> +     *
> +     * @return the cached PreparedQuery or null if none exists.
> +     */
> +    PreparedQuery getPreparedQuery(String id) {
> +        PreparedQueryCache cache = getPreparedQueryCache();
> +        return (cache == null) ? null : cache.get(id);
> +    }
> +
> +    public void setFlushMode(FlushModeType flushMode) {
> +        assertNotCloseInvoked();
> +        _broker.assertOpen();
> +        _broker.getFetchConfiguration().setFlushBeforeQueries
> +            (toFlushBeforeQueries(flushMode));
> +    }
> +
> +    public FlushModeType getFlushMode() {
> +        assertNotCloseInvoked();
> +        _broker.assertOpen();
> +        return fromFlushBeforeQueries(_broker.getFetchConfiguration().
> +            getFlushBeforeQueries());
> +    }
> +
> +    /**
> +     * Translate our internal flush constant to a flush mode enum value.
> +     */
> +    static FlushModeType fromFlushBeforeQueries(int flush) {
> +        switch (flush) {
> +            case QueryFlushModes.FLUSH_TRUE:
> +                return FlushModeType.AUTO;
> +            case QueryFlushModes.FLUSH_FALSE:
> +                return FlushModeType.COMMIT;
> +            default:
> +                return null;
> +        }
> +    }
> +
> +    /**
> +     * Translate a flush mode enum value to our internal flush constant.
> +     */
> +    static int toFlushBeforeQueries(FlushModeType flushMode) {
> +        // choose default for null
> +        if (flushMode == null)
> +            return QueryFlushModes.FLUSH_WITH_CONNECTION;
> +        if (flushMode == FlushModeType.AUTO)
> +            return QueryFlushModes.FLUSH_TRUE;
> +        if (flushMode == FlushModeType.COMMIT)
> +            return QueryFlushModes.FLUSH_FALSE;
> +        throw new ArgumentException(flushMode.toString(), null, null,
> false);
> +    }
> +
> +    public void clear() {
> +        assertNotCloseInvoked();
> +        _broker.detachAll(this, false);
> +    }
> +
> +    public Object getDelegate() {
> +        _broker.assertOpen();
> +        assertNotCloseInvoked();
> +        return this;
> +    }
> +
> +    public LockModeType getLockMode(Object entity) {
> +        assertNotCloseInvoked();
> +        return fromLockLevel(_broker.getLockLevel(entity));
> +    }
> +
> +    public void lock(Object entity, LockModeType mode) {
> +        assertNotCloseInvoked();
> +        _broker.lock(entity, toLockLevel(mode), -1, this);
> +    }
> +
> +    public void lock(Object entity) {
> +        assertNotCloseInvoked();
> +        _broker.lock(entity, this);
> +    }
> +
> +    public void lock(Object entity, LockModeType mode, int timeout) {
> +        assertNotCloseInvoked();
> +        _broker.lock(entity, toLockLevel(mode), timeout, this);
> +    }
> +
> +    public void lockAll(Collection entities) {
> +        assertNotCloseInvoked();
> +        _broker.lockAll(entities, this);
> +    }
> +
> +    public void lockAll(Collection entities, LockModeType mode, int
> timeout) {
> +        assertNotCloseInvoked();
> +        _broker.lockAll(entities, toLockLevel(mode), timeout, this);
> +    }
> +
> +    public void lockAll(Object... entities) {
> +        lockAll(Arrays.asList(entities));
> +    }
> +
> +    public void lockAll(Object[] entities, LockModeType mode, int timeout)
> {
> +        lockAll(Arrays.asList(entities), mode, timeout);
> +    }
> +
> +    /**
> +     * Translate our internal lock level to a javax.persistence enum
> value.
> +     */
> +    static LockModeType fromLockLevel(int level) {
> +        if (level < LockLevels.LOCK_READ)
> +            return null;
> +        if (level < LockLevels.LOCK_WRITE)
> +            return LockModeType.READ;
> +        return LockModeType.WRITE;
> +    }
> +
> +    /**
> +     * Translate the javax.persistence enum value to our internal lock
> level.
> +     */
> +    static int toLockLevel(LockModeType mode) {
> +        if (mode == null)
> +            return LockLevels.LOCK_NONE;
> +        if (mode == LockModeType.READ)
> +            return LockLevels.LOCK_READ;
> +        if (mode == LockModeType.WRITE)
> +            return LockLevels.LOCK_WRITE;
> +        throw new ArgumentException(mode.toString(), null, null, true);
> +    }
> +
> +    public boolean cancelAll() {
> +        return _broker.cancelAll();
> +    }
> +
> +    public Object getConnection() {
> +        return _broker.getConnection();
> +    }
> +
> +    public Collection getManagedObjects() {
> +        return _broker.getManagedObjects();
> +    }
> +
> +    public Collection getTransactionalObjects() {
> +        return _broker.getTransactionalObjects();
> +    }
> +
> +    public Collection getPendingTransactionalObjects() {
> +        return _broker.getPendingTransactionalObjects();
> +    }
> +
> +    public Collection getDirtyObjects() {
> +        return _broker.getDirtyObjects();
> +    }
> +
> +    public boolean getOrderDirtyObjects() {
> +        return _broker.getOrderDirtyObjects();
> +    }
> +
> +    public void setOrderDirtyObjects(boolean order) {
> +        assertNotCloseInvoked();
> +        _broker.setOrderDirtyObjects(order);
> +    }
> +
> +    public void dirtyClass(Class cls) {
> +        assertNotCloseInvoked();
> +        _broker.dirtyType(cls);
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public Collection<Class> getPersistedClasses() {
> +        return (Collection<Class>) _broker.getPersistedTypes();
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public Collection<Class> getUpdatedClasses() {
> +        return (Collection<Class>) _broker.getUpdatedTypes();
> +    }
> +
> +    @SuppressWarnings("unchecked")
> +    public Collection<Class> getRemovedClasses() {
> +        return (Collection<Class>) _broker.getDeletedTypes();
> +    }
> +
> +    public <T> T createInstance(Class<T> cls) {
> +        assertNotCloseInvoked();
> +        return (T) _broker.newInstance(cls);
> +    }
> +
> +    public void close() {
> +        assertNotCloseInvoked();
> +        _broker.close();
> +    }
> +
> +    public boolean isOpen() {
> +        return !_broker.isCloseInvoked();
> +    }
> +
> +    public void dirty(Object o, String field) {
> +        assertNotCloseInvoked();
> +        OpenJPAStateManager sm = _broker.getStateManager(o);
> +        try {
> +            if (sm != null)
> +                sm.dirty(field);
> +        } catch (Exception e) {
> +            throw PersistenceExceptions.toPersistenceException(e);
> +        }
> +    }
> +
> +    public Object getObjectId(Object o) {
> +        assertNotCloseInvoked();
> +        return
> JPAFacadeHelper.fromOpenJPAObjectId(_broker.getObjectId(o));
> +    }
> +
> +    public boolean isDirty(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.isDirty(o);
> +    }
> +
> +    public boolean isTransactional(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.isTransactional(o);
> +    }
> +
> +    public boolean isPersistent(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.isPersistent(o);
> +    }
> +
> +    public boolean isNewlyPersistent(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.isNew(o);
> +    }
> +
> +    public boolean isRemoved(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.isDeleted(o);
> +    }
> +
> +    public boolean isDetached(Object entity) {
> +        assertNotCloseInvoked();
> +        return _broker.isDetached(entity);
> +    }
> +
> +    public Object getVersion(Object o) {
> +        assertNotCloseInvoked();
> +        return _broker.getVersion(o);
> +    }
> +
> +    /**
> +     * Throw appropriate exception if close has been invoked but the
> broker
> +     * is still open.  We test only for this because if the broker is
> already
> +     * closed, it will throw its own more informative exception when we
> +     * delegate the pending operation to it.
> +     */
> +    void assertNotCloseInvoked() {
> +        if (!_broker.isClosed() && _broker.isCloseInvoked())
> +            throw new InvalidStateException(_loc.get("close-invoked"),
> null,
> +                null, true);
> +    }
> +
> +    ////////////////////////////////
> +    // FindCallbacks implementation
> +    ////////////////////////////////
> +
> +    public Object processArgument(Object arg) {
> +        return arg;
> +    }
> +
> +    public Object processReturn(Object oid, OpenJPAStateManager sm) {
> +        return (sm == null || sm.isDeleted()) ? null :
> sm.getManagedInstance();
> +    }
> +
> +    //////////////////////////////
> +    // OpCallbacks implementation
> +    //////////////////////////////
> +
> +    public int processArgument(int op, Object obj, OpenJPAStateManager sm)
> {
> +        switch (op) {
> +            case OP_DELETE:
> +                // cascade through non-persistent non-detached instances
> +                if (sm == null && !_broker.isDetached(obj))
> +                    return ACT_CASCADE;
> +                if (sm != null && !sm.isDetached() && !sm.isPersistent())
> +                    return ACT_CASCADE;
> +                // ignore deleted instances
> +                if (sm != null && sm.isDeleted())
> +                    return ACT_NONE;
> +                break;
> +            case OP_ATTACH:
> +                // die on removed
> +                if (sm != null && sm.isDeleted())
> +                    throw new UserException(_loc.get("removed",
> +                        Exceptions.toString(obj))).setFailedObject(obj);
> +                // cascade through managed instances
> +                if (sm != null && !sm.isDetached())
> +                    return ACT_CASCADE;
> +                break;
> +            case OP_REFRESH:
> +                // die on unmanaged instances
> +                if (sm == null)
> +                    throw new UserException(_loc.get("not-managed",
> +                        Exceptions.toString(obj))).setFailedObject(obj);
> +                break;
> +        }
> +        return ACT_RUN | ACT_CASCADE;
> +    }
> +
> +    public int hashCode() {
> +        return _broker.hashCode();
> +    }
> +
> +    public boolean equals(Object other) {
> +        if (other == this)
> +            return true;
> +        if (!(other instanceof EntityManagerImpl))
> +            return false;
> +        return _broker.equals(((EntityManagerImpl) other)._broker);
> +    }
> +
> +    public void readExternal(ObjectInput in)
> +        throws IOException, ClassNotFoundException {
> +        try {
> +            _ret = PersistenceExceptions.getRollbackTranslator(this);
> +
> +            // this assumes that serialized Brokers are from something
> +            // that extends AbstractBrokerFactory.
> +            Object factoryKey = in.readObject();
> +            AbstractBrokerFactory factory =
> +                AbstractBrokerFactory.getPooledFactoryForKey(factoryKey);
> +            byte[] brokerBytes = (byte[]) in.readObject();
> +            ObjectInputStream innerIn = new
> BrokerBytesInputStream(brokerBytes,
> +                factory.getConfiguration());
> +
> +            Broker broker = (Broker) innerIn.readObject();
> +            EntityManagerFactoryImpl emf = (EntityManagerFactoryImpl)
> +                JPAFacadeHelper.toEntityManagerFactory(
> +                    broker.getBrokerFactory());
> +            broker.putUserObject(JPAFacadeHelper.EM_KEY, this);
> +            initialize(emf, broker);
> +        } catch (RuntimeException re) {
> +            try {
> +                re = _ret.translate(re);
> +            } catch (Exception e) {
> +                // ignore
> +            }
> +            throw re;
> +        }
> +    }
> +
> +    public void writeExternal(ObjectOutput out) throws IOException {
> +        try {
> +            // this requires that only AbstractBrokerFactory-sourced
> +            // brokers can be serialized
> +            Object factoryKey = ((AbstractBrokerFactory) _broker
> +                .getBrokerFactory()).getPoolKey();
> +            out.writeObject(factoryKey);
> +            ByteArrayOutputStream baos = new ByteArrayOutputStream();
> +            ObjectOutputStream innerOut = new ObjectOutputStream(baos);
> +            innerOut.writeObject(_broker.getDelegate());
> +            innerOut.flush();
> +            out.writeObject(baos.toByteArray());
> +        } catch (RuntimeException re) {
> +            try {
> +                re = _ret.translate(re);
> +            } catch (Exception e) {
> +                // ignore
> +            }
> +            throw re;
> +        }
> +    }
> +
> +    private static class BrokerBytesInputStream extends ObjectInputStream
> {
> +
> +        private OpenJPAConfiguration conf;
> +
> +        BrokerBytesInputStream(byte[] bytes, OpenJPAConfiguration conf)
> +            throws IOException {
> +            super(new ByteArrayInputStream(bytes));
> +            if (conf == null)
> +                throw new IllegalArgumentException(
> +                    "Illegal null argument to
> ObjectInputStreamWithLoader");
> +            this.conf = conf;
> +        }
> +
> +        /**
> +         * Make a primitive array class
> +         */
> +        private Class primitiveType(char type) {
> +            switch (type) {
> +                case 'B': return byte.class;
> +                case 'C': return char.class;
> +                case 'D': return double.class;
> +                case 'F': return float.class;
> +                case 'I': return int.class;
> +                case 'J': return long.class;
> +                case 'S': return short.class;
> +                case 'Z': return boolean.class;
> +                default: return null;
> +            }
> +        }
> +
> +        protected Class resolveClass(ObjectStreamClass classDesc)
> +            throws IOException, ClassNotFoundException {
> +
> +            String cname = classDesc.getName();
> +            if (cname.startsWith("[")) {
> +                // An array
> +                Class component;               // component class
> +                int dcount;                        // dimension
> +                for (dcount=1; cname.charAt(dcount)=='['; dcount++) ;
> +                if (cname.charAt(dcount) == 'L') {
> +                    component = lookupClass(cname.substring(dcount+1,
> +                        cname.length()-1));
> +                } else {
> +                    if (cname.length() != dcount+1) {
> +                        throw new ClassNotFoundException(cname);//
> malformed
> +                    }
> +                    component = primitiveType(cname.charAt(dcount));
> +                }
> +                int dim[] = new int[dcount];
> +                for (int i=0; i<dcount; i++) {
> +                    dim[i]=0;
> +                }
> +                return Array.newInstance(component, dim).getClass();
> +            } else {
> +                return lookupClass(cname);
> +            }
> +        }
> +
> +        /**
> +         * If this is a generated subclass, look up the corresponding
> Class
> +         * object via metadata.
> +         */
> +        private Class lookupClass(String className)
> +            throws ClassNotFoundException {
> +            try {
> +                return Class.forName(className);
> +            } catch (ClassNotFoundException e) {
> +                if (PCEnhancer.isPCSubclassName(className)) {
> +                    String superName =
> PCEnhancer.toManagedTypeName(className);
> +                    ClassMetaData[] metas =
> conf.getMetaDataRepositoryInstance()
> +                        .getMetaDatas();
> +                    for (int i = 0; i < metas.length; i++) {
> +                        if (superName.equals(
> +                            metas[i].getDescribedType().getName())) {
> +                            return PCRegistry.getPCType(
> +                                metas[i].getDescribedType());
> +                        }
> +                    }
> +
> +                    // if it's not found, try to look for it anyways
> +                    return Class.forName(className);
> +                } else {
> +                    throw e;
> +                }
> +            }
> +        }
> +    }
> +
> +    public void clear(Object entity) {
> +
>

Re: Is it time to fix the svn:eol-style properties?

Posted by Donald Woods <dw...@apache.org>.
I can view/edit them fine on MacOSX and Linux fine (no Windows chars.)

The problem, is when you create a patch for such a file, it tries to 
correct the EoL chars in addition to the changed source, like the 
attached OPENJPA-927-trunk.patch file which should only contain -

#P openjpa-persistence
Index: src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
===================================================================
--- src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java 
(revision 743431)
+++ src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java 
(working copy)
@@ -1421,8 +1421,8 @@
      }

      public void clear(Object entity) {
-        throw new UnsupportedOperationException(
-            "JPA 2.0 - Method not yet implemented");
+        assertNotCloseInvoked();
+//        _broker.detach(entity, this, false);
      }

      public Query createQuery(QueryDefinition qdef) {
@@ -1454,10 +1454,6 @@
          Map<String, Object> finalMap =
              new HashMap<String, Object>(currentProperties);

-        // Remove the password property
-        finalMap.remove("javax.persistence.jdbc.password");
-        finalMap.remove("openjpa.ConnectionPassword");
-
          return finalMap;
      }



-Donald



Michael Dick wrote:
> Hi Donald,
> 
> For some reason I don't see the same problem when editing EntityManagerImpl
> on linux. I thought that the svn client configuration properties from the
> Apache version control guide are taking care of the conversion for me [1].
> Maybe that doesn't work for all clients.
> 
> In any event I don't see any harm in doing a single bulk update of the svn
> props if no one minds a massive commit email.
> 
> -mike
> 
> [1] http://www.apache.org/dev/version-control.html#https-svn-config
> 
> On Thu, Feb 26, 2009 at 9:04 AM, Donald Woods <dw...@apache.org> wrote:
> 
>> Yes.  I was just trying to point out that there are Java files, in addition
>> to the earlier reported doc files, that are missing the expected svnprops.
>>
>>
>>
>> -Donald
>>
>>
>> Craig L Russell wrote:
>>
>>> Hi Donald,
>>>
>>> On Feb 24, 2009, at 11:44 AM, Donald Woods wrote:
>>>
>>>  Reviving this thread, as I'm also finding source files, like -
>>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
>>>>
>>>> that are using the Windows EOL chars, which causes patches generated by
>>>> "svn diff" on Linux/Mac to replace the content of the whole file to fix the
>>>> EOL chars...
>>>>
>>>> Still don't see why there is such a concern about SVN commit noise or
>>>> that it adds one svn log entry per file.  The benefits outweigh the svn
>>>> commit email and log history addition.
>>>>
>>> I'm not parsing this paragraph correctly, as it sounds self-contradictory.
>>> Could you review and make sure it's what you mean?
>>>
>>> My position is that we should adopt a uniform line end policy and change
>>> all of the svn line endings properties in the project separate from any code
>>> changes. Is this also what you are proposing?
>>>
>>> Thanks,
>>>
>>> Craig
>>>
>>>>
>>>> There are perl scripts floating around to recursively fix source branches
>>>> (can't find one right now), or you can do it for every subdir -
>>>> svn propset svn:eol-style native -R
>>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/*.java
>>>>
>>>>
>>>> -Donald
>>>>
>>>>
>>>> Craig L Russell wrote:
>>>>
>>>>> I'd agree to these changes if the svn eol property were checked in at
>>>>> the same time. That solves the long term problem. See
>>>>> http://svnbook.red-bean.com/en/1.1/ch07s02.html for details on
>>>>> svn:eol-style.
>>>>> For the project, we need to decide which eol style to use. Both/either
>>>>> LF and native work fine for most people.
>>>>> Craig
>>>>> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
>>>>>
>>>>>> Mike,
>>>>>> I remember those conversations...  :-)  What's the advantage of making
>>>>>> or
>>>>>> not making these changes?  This is a huge change.  And, other than
>>>>>> totally
>>>>>> tilting our doc change history, does it really buy us anything?  I
>>>>>> thought
>>>>>> that as the document gets updated, then the sections would be converted
>>>>>> appropriately.  And, even if we do this change, what prevents us from
>>>>>> corrupting it again?  It seems that this is just an on-going situation.
>>>>>>  Or,
>>>>>> are there some controls that can be put in place to ensure that these
>>>>>> incorrect EOL characters stay out once they are removed?
>>>>>>
>>>>>> Kevin
>>>>>>
>>>>>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <michael.d.dick@gmail.com
>>>>>>> wrote:
>>>>>>  This issue came up a few years ago while we were in the incubator. At
>>>>>>> the
>>>>>>> time (if memory serves) we decided not to fix existing code due to the
>>>>>>> noise
>>>>>>> on SVN.
>>>>>>>
>>>>>>> I'm happy to commit the changes Donald has graciously provided if
>>>>>>> folks
>>>>>>> agree the noise is acceptable, but I'd prefer to make sure since
>>>>>>> there's
>>>>>>> precedent against cleaning up eol chars.
>>>>>>>
>>>>>>> Any agreement / dissent to committing the patch?
>>>>>>>
>>>>>>> -mike
>>>>>>>
>>>>>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>>  [
>>>>>>>>
>>>>>>>>
>>>>>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>>>>>>> ]
>>>>>>>
>>>>>>>> Donald Woods updated OPENJPA-896:
>>>>>>>> ---------------------------------
>>>>>>>>
>>>>>>>>  Attachment: OPENJPA-896-trunk.patch
>>>>>>>>
>>>>>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>>>>>> For Windows users, you can use a program like SlickEdit to resave the
>>>>>>>>
>>>>>>> files
>>>>>>>
>>>>>>>> in Unix format (and fix your svn config.)
>>>>>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>>>>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>>>>>>> command -
>>>>>>>> {noformat}
>>>>>>>> #! /bin/sh
>>>>>>>> for x
>>>>>>>> do
>>>>>>>> echo "Converting $x"
>>>>>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>>>>>> mv "$x.tmp" "$x"
>>>>>>>> done
>>>>>>>> {noformat}
>>>>>>>>
>>>>>>>>  Several doc files include Windows EoL chars
>>>>>>>>> -------------------------------------------
>>>>>>>>>
>>>>>>>>>              Key: OPENJPA-896
>>>>>>>>>              URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>>>>>          Project: OpenJPA
>>>>>>>>>       Issue Type: Bug
>>>>>>>>>       Components: docs
>>>>>>>>>         Reporter: Donald Woods
>>>>>>>>>         Priority: Trivial
>>>>>>>>>          Fix For: 2.0.0
>>>>>>>>>
>>>>>>>>>      Attachments: OPENJPA-896-trunk.patch
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Several of the doc files include the Windows Ctrl+M chars at the end
>>>>>>>>> of
>>>>>>>>>
>>>>>>>> lines when checked out to non-Windows platforms (like MacOSX and
>>>>>>>> Linux),
>>>>>>>>
>>>>>>> due
>>>>>>>
>>>>>>>> to the committer not using the ASF suggested svn config values -
>>>>>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>>>>>
>>>>>>>>> From http://www.apache.org/dev/version-control.html -
>>>>>>>>> Configuring the Subversion client
>>>>>>>>> Committers will need to properly configure their svn client. One
>>>>>>>>>
>>>>>>>> particular issue is OS-specific line-endings for text files. When you
>>>>>>>> add
>>>>>>>>
>>>>>>> a
>>>>>>>
>>>>>>>> new text file, especially when applying patches from Bugzilla, first
>>>>>>>>
>>>>>>> ensure
>>>>>>>
>>>>>>>> that the line-endings are appropriate for your system, then do ...
>>>>>>>>
>>>>>>>>> svn add test.txt
>>>>>>>>> svn propset svn:eol-style native test.txt
>>>>>>>>> Your svn client can be configured to do that automatically for some
>>>>>>>>>
>>>>>>>> common file types. Add the contents of the file
>>>>>>>> http://www.apache.org/dev/svn-eol-style.txt to your
>>>>>>>> ~/.subversion/config
>>>>>>>> file. [Note: for Windows this is normally found at C:\Documents and
>>>>>>>> Settings\{username}\Application Data\Subversion\config]
>>>>>>>>
>>>>>>>>> Some files may need additional properties to be set, for example
>>>>>>>>>
>>>>>>>> svn:executable=* should be applied to those script files (e.g. .bat,
>>>>>>>>
>>>>>>> .cgi,
>>>>>>>
>>>>>>>> .cmd, .sh) that are intended to be executed. Since not all such files
>>>>>>>> are
>>>>>>>> necessarily intended to be executed, the executable property should
>>>>>>>> not
>>>>>>>>
>>>>>>> be
>>>>>>>
>>>>>>>> made an automatic default.
>>>>>>>>
>>>>>>>>> However, you should still pay attention to the messages from your
>>>>>>>>> svn
>>>>>>>>>
>>>>>>>> client when you do 'svn commit'.
>>>>>>>>
>>>>>>>> --
>>>>>>>> This message is automatically generated by JIRA.
>>>>>>>> -
>>>>>>>> You can reply to this email to add a comment to the issue online.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>  Craig L Russell
>>>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>>>> P.S. A good JDO? O, Gasp!
>>>>>
>>> Craig L Russell
>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>> P.S. A good JDO? O, Gasp!
>>>
>>>
> 

Re: Is it time to fix the svn:eol-style properties?

Posted by Michael Dick <mi...@gmail.com>.
Hi Donald,

For some reason I don't see the same problem when editing EntityManagerImpl
on linux. I thought that the svn client configuration properties from the
Apache version control guide are taking care of the conversion for me [1].
Maybe that doesn't work for all clients.

In any event I don't see any harm in doing a single bulk update of the svn
props if no one minds a massive commit email.

-mike

[1] http://www.apache.org/dev/version-control.html#https-svn-config

On Thu, Feb 26, 2009 at 9:04 AM, Donald Woods <dw...@apache.org> wrote:

> Yes.  I was just trying to point out that there are Java files, in addition
> to the earlier reported doc files, that are missing the expected svnprops.
>
>
>
> -Donald
>
>
> Craig L Russell wrote:
>
>> Hi Donald,
>>
>> On Feb 24, 2009, at 11:44 AM, Donald Woods wrote:
>>
>>  Reviving this thread, as I'm also finding source files, like -
>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
>>>
>>> that are using the Windows EOL chars, which causes patches generated by
>>> "svn diff" on Linux/Mac to replace the content of the whole file to fix the
>>> EOL chars...
>>>
>>> Still don't see why there is such a concern about SVN commit noise or
>>> that it adds one svn log entry per file.  The benefits outweigh the svn
>>> commit email and log history addition.
>>>
>>
>> I'm not parsing this paragraph correctly, as it sounds self-contradictory.
>> Could you review and make sure it's what you mean?
>>
>> My position is that we should adopt a uniform line end policy and change
>> all of the svn line endings properties in the project separate from any code
>> changes. Is this also what you are proposing?
>>
>> Thanks,
>>
>> Craig
>>
>>>
>>>
>>> There are perl scripts floating around to recursively fix source branches
>>> (can't find one right now), or you can do it for every subdir -
>>> svn propset svn:eol-style native -R
>>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/*.java
>>>
>>>
>>> -Donald
>>>
>>>
>>> Craig L Russell wrote:
>>>
>>>> I'd agree to these changes if the svn eol property were checked in at
>>>> the same time. That solves the long term problem. See
>>>> http://svnbook.red-bean.com/en/1.1/ch07s02.html for details on
>>>> svn:eol-style.
>>>> For the project, we need to decide which eol style to use. Both/either
>>>> LF and native work fine for most people.
>>>> Craig
>>>> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
>>>>
>>>>> Mike,
>>>>> I remember those conversations...  :-)  What's the advantage of making
>>>>> or
>>>>> not making these changes?  This is a huge change.  And, other than
>>>>> totally
>>>>> tilting our doc change history, does it really buy us anything?  I
>>>>> thought
>>>>> that as the document gets updated, then the sections would be converted
>>>>> appropriately.  And, even if we do this change, what prevents us from
>>>>> corrupting it again?  It seems that this is just an on-going situation.
>>>>>  Or,
>>>>> are there some controls that can be put in place to ensure that these
>>>>> incorrect EOL characters stay out once they are removed?
>>>>>
>>>>> Kevin
>>>>>
>>>>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <michael.d.dick@gmail.com
>>>>> >wrote:
>>>>>
>>>>>  This issue came up a few years ago while we were in the incubator. At
>>>>>> the
>>>>>> time (if memory serves) we decided not to fix existing code due to the
>>>>>> noise
>>>>>> on SVN.
>>>>>>
>>>>>> I'm happy to commit the changes Donald has graciously provided if
>>>>>> folks
>>>>>> agree the noise is acceptable, but I'd prefer to make sure since
>>>>>> there's
>>>>>> precedent against cleaning up eol chars.
>>>>>>
>>>>>> Any agreement / dissent to committing the patch?
>>>>>>
>>>>>> -mike
>>>>>>
>>>>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>>  [
>>>>>>>
>>>>>>>
>>>>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>>>>>> ]
>>>>>>
>>>>>>>
>>>>>>> Donald Woods updated OPENJPA-896:
>>>>>>> ---------------------------------
>>>>>>>
>>>>>>>  Attachment: OPENJPA-896-trunk.patch
>>>>>>>
>>>>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>>>>> For Windows users, you can use a program like SlickEdit to resave the
>>>>>>>
>>>>>> files
>>>>>>
>>>>>>> in Unix format (and fix your svn config.)
>>>>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>>>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>>>>>> command -
>>>>>>> {noformat}
>>>>>>> #! /bin/sh
>>>>>>> for x
>>>>>>> do
>>>>>>> echo "Converting $x"
>>>>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>>>>> mv "$x.tmp" "$x"
>>>>>>> done
>>>>>>> {noformat}
>>>>>>>
>>>>>>>  Several doc files include Windows EoL chars
>>>>>>>> -------------------------------------------
>>>>>>>>
>>>>>>>>              Key: OPENJPA-896
>>>>>>>>              URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>>>>          Project: OpenJPA
>>>>>>>>       Issue Type: Bug
>>>>>>>>       Components: docs
>>>>>>>>         Reporter: Donald Woods
>>>>>>>>         Priority: Trivial
>>>>>>>>          Fix For: 2.0.0
>>>>>>>>
>>>>>>>>      Attachments: OPENJPA-896-trunk.patch
>>>>>>>>
>>>>>>>>
>>>>>>>> Several of the doc files include the Windows Ctrl+M chars at the end
>>>>>>>> of
>>>>>>>>
>>>>>>> lines when checked out to non-Windows platforms (like MacOSX and
>>>>>>> Linux),
>>>>>>>
>>>>>> due
>>>>>>
>>>>>>> to the committer not using the ASF suggested svn config values -
>>>>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>>>>
>>>>>>>> From http://www.apache.org/dev/version-control.html -
>>>>>>>> Configuring the Subversion client
>>>>>>>> Committers will need to properly configure their svn client. One
>>>>>>>>
>>>>>>> particular issue is OS-specific line-endings for text files. When you
>>>>>>> add
>>>>>>>
>>>>>> a
>>>>>>
>>>>>>> new text file, especially when applying patches from Bugzilla, first
>>>>>>>
>>>>>> ensure
>>>>>>
>>>>>>> that the line-endings are appropriate for your system, then do ...
>>>>>>>
>>>>>>>> svn add test.txt
>>>>>>>> svn propset svn:eol-style native test.txt
>>>>>>>> Your svn client can be configured to do that automatically for some
>>>>>>>>
>>>>>>> common file types. Add the contents of the file
>>>>>>> http://www.apache.org/dev/svn-eol-style.txt to your
>>>>>>> ~/.subversion/config
>>>>>>> file. [Note: for Windows this is normally found at C:\Documents and
>>>>>>> Settings\{username}\Application Data\Subversion\config]
>>>>>>>
>>>>>>>> Some files may need additional properties to be set, for example
>>>>>>>>
>>>>>>> svn:executable=* should be applied to those script files (e.g. .bat,
>>>>>>>
>>>>>> .cgi,
>>>>>>
>>>>>>> .cmd, .sh) that are intended to be executed. Since not all such files
>>>>>>> are
>>>>>>> necessarily intended to be executed, the executable property should
>>>>>>> not
>>>>>>>
>>>>>> be
>>>>>>
>>>>>>> made an automatic default.
>>>>>>>
>>>>>>>> However, you should still pay attention to the messages from your
>>>>>>>> svn
>>>>>>>>
>>>>>>> client when you do 'svn commit'.
>>>>>>>
>>>>>>> --
>>>>>>> This message is automatically generated by JIRA.
>>>>>>> -
>>>>>>> You can reply to this email to add a comment to the issue online.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>  Craig L Russell
>>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>>> P.S. A good JDO? O, Gasp!
>>>>
>>>
>> Craig L Russell
>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>>

Re: Is it time to fix the svn:eol-style properties?

Posted by Donald Woods <dw...@apache.org>.
Yes.  I was just trying to point out that there are Java files, in 
addition to the earlier reported doc files, that are missing the 
expected svnprops.


-Donald


Craig L Russell wrote:
> Hi Donald,
> 
> On Feb 24, 2009, at 11:44 AM, Donald Woods wrote:
> 
>> Reviving this thread, as I'm also finding source files, like -
>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java 
>>
>> that are using the Windows EOL chars, which causes patches generated 
>> by "svn diff" on Linux/Mac to replace the content of the whole file to 
>> fix the EOL chars...
>>
>> Still don't see why there is such a concern about SVN commit noise or 
>> that it adds one svn log entry per file.  The benefits outweigh the 
>> svn commit email and log history addition.
> 
> I'm not parsing this paragraph correctly, as it sounds 
> self-contradictory. Could you review and make sure it's what you mean?
> 
> My position is that we should adopt a uniform line end policy and change 
> all of the svn line endings properties in the project separate from any 
> code changes. Is this also what you are proposing?
> 
> Thanks,
> 
> Craig
>>
>>
>> There are perl scripts floating around to recursively fix source 
>> branches (can't find one right now), or you can do it for every subdir -
>> svn propset svn:eol-style native -R 
>> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/*.java
>>
>>
>> -Donald
>>
>>
>> Craig L Russell wrote:
>>> I'd agree to these changes if the svn eol property were checked in at 
>>> the same time. That solves the long term problem. See 
>>> http://svnbook.red-bean.com/en/1.1/ch07s02.html for details on 
>>> svn:eol-style.
>>> For the project, we need to decide which eol style to use. 
>>> Both/either LF and native work fine for most people.
>>> Craig
>>> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
>>>> Mike,
>>>> I remember those conversations...  :-)  What's the advantage of 
>>>> making or
>>>> not making these changes?  This is a huge change.  And, other than 
>>>> totally
>>>> tilting our doc change history, does it really buy us anything?  I 
>>>> thought
>>>> that as the document gets updated, then the sections would be converted
>>>> appropriately.  And, even if we do this change, what prevents us from
>>>> corrupting it again?  It seems that this is just an on-going 
>>>> situation.  Or,
>>>> are there some controls that can be put in place to ensure that these
>>>> incorrect EOL characters stay out once they are removed?
>>>>
>>>> Kevin
>>>>
>>>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick 
>>>> <mi...@gmail.com>wrote:
>>>>
>>>>> This issue came up a few years ago while we were in the incubator. 
>>>>> At the
>>>>> time (if memory serves) we decided not to fix existing code due to the
>>>>> noise
>>>>> on SVN.
>>>>>
>>>>> I'm happy to commit the changes Donald has graciously provided if 
>>>>> folks
>>>>> agree the noise is acceptable, but I'd prefer to make sure since 
>>>>> there's
>>>>> precedent against cleaning up eol chars.
>>>>>
>>>>> Any agreement / dissent to committing the patch?
>>>>>
>>>>> -mike
>>>>>
>>>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>   [
>>>>>>
>>>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>>>>>
>>>>> ]
>>>>>>
>>>>>> Donald Woods updated OPENJPA-896:
>>>>>> ---------------------------------
>>>>>>
>>>>>>  Attachment: OPENJPA-896-trunk.patch
>>>>>>
>>>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>>>> For Windows users, you can use a program like SlickEdit to resave the
>>>>> files
>>>>>> in Unix format (and fix your svn config.)
>>>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>>>>> command -
>>>>>> {noformat}
>>>>>> #! /bin/sh
>>>>>> for x
>>>>>> do
>>>>>> echo "Converting $x"
>>>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>>>> mv "$x.tmp" "$x"
>>>>>> done
>>>>>> {noformat}
>>>>>>
>>>>>>> Several doc files include Windows EoL chars
>>>>>>> -------------------------------------------
>>>>>>>
>>>>>>>               Key: OPENJPA-896
>>>>>>>               URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>>>           Project: OpenJPA
>>>>>>>        Issue Type: Bug
>>>>>>>        Components: docs
>>>>>>>          Reporter: Donald Woods
>>>>>>>          Priority: Trivial
>>>>>>>           Fix For: 2.0.0
>>>>>>>
>>>>>>>       Attachments: OPENJPA-896-trunk.patch
>>>>>>>
>>>>>>>
>>>>>>> Several of the doc files include the Windows Ctrl+M chars at the 
>>>>>>> end of
>>>>>> lines when checked out to non-Windows platforms (like MacOSX and 
>>>>>> Linux),
>>>>> due
>>>>>> to the committer not using the ASF suggested svn config values -
>>>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>>>> From http://www.apache.org/dev/version-control.html -
>>>>>>> Configuring the Subversion client
>>>>>>> Committers will need to properly configure their svn client. One
>>>>>> particular issue is OS-specific line-endings for text files. When 
>>>>>> you add
>>>>> a
>>>>>> new text file, especially when applying patches from Bugzilla, first
>>>>> ensure
>>>>>> that the line-endings are appropriate for your system, then do ...
>>>>>>> svn add test.txt
>>>>>>> svn propset svn:eol-style native test.txt
>>>>>>> Your svn client can be configured to do that automatically for some
>>>>>> common file types. Add the contents of the file
>>>>>> http://www.apache.org/dev/svn-eol-style.txt to your 
>>>>>> ~/.subversion/config
>>>>>> file. [Note: for Windows this is normally found at C:\Documents and
>>>>>> Settings\{username}\Application Data\Subversion\config]
>>>>>>> Some files may need additional properties to be set, for example
>>>>>> svn:executable=* should be applied to those script files (e.g. .bat,
>>>>> .cgi,
>>>>>> .cmd, .sh) that are intended to be executed. Since not all such 
>>>>>> files are
>>>>>> necessarily intended to be executed, the executable property 
>>>>>> should not
>>>>> be
>>>>>> made an automatic default.
>>>>>>> However, you should still pay attention to the messages from your 
>>>>>>> svn
>>>>>> client when you do 'svn commit'.
>>>>>>
>>>>>> -- 
>>>>>> This message is automatically generated by JIRA.
>>>>>> -
>>>>>> You can reply to this email to add a comment to the issue online.
>>>>>>
>>>>>>
>>>>>
>>> Craig L Russell
>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>> P.S. A good JDO? O, Gasp!
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
> 

Re: Is it time to fix the svn:eol-style properties?

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Donald,

On Feb 24, 2009, at 11:44 AM, Donald Woods wrote:

> Reviving this thread, as I'm also finding source files, like -
> openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ 
> EntityManagerImpl.java
> that are using the Windows EOL chars, which causes patches generated  
> by "svn diff" on Linux/Mac to replace the content of the whole file  
> to fix the EOL chars...
>
> Still don't see why there is such a concern about SVN commit noise  
> or that it adds one svn log entry per file.  The benefits outweigh  
> the svn commit email and log history addition.

I'm not parsing this paragraph correctly, as it sounds self- 
contradictory. Could you review and make sure it's what you mean?

My position is that we should adopt a uniform line end policy and  
change all of the svn line endings properties in the project separate  
from any code changes. Is this also what you are proposing?

Thanks,

Craig
>
>
> There are perl scripts floating around to recursively fix source  
> branches (can't find one right now), or you can do it for every  
> subdir -
> svn propset svn:eol-style native -R openjpa-persistence/src/main/ 
> java/org/apache/openjpa/persistence/*.java
>
>
> -Donald
>
>
> Craig L Russell wrote:
>> I'd agree to these changes if the svn eol property were checked in  
>> at the same time. That solves the long term problem. See http://svnbook.red-bean.com/en/1.1/ch07s02.html 
>>  for details on svn:eol-style.
>> For the project, we need to decide which eol style to use. Both/ 
>> either LF and native work fine for most people.
>> Craig
>> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
>>> Mike,
>>> I remember those conversations...  :-)  What's the advantage of  
>>> making or
>>> not making these changes?  This is a huge change.  And, other than  
>>> totally
>>> tilting our doc change history, does it really buy us anything?  I  
>>> thought
>>> that as the document gets updated, then the sections would be  
>>> converted
>>> appropriately.  And, even if we do this change, what prevents us  
>>> from
>>> corrupting it again?  It seems that this is just an on-going  
>>> situation.  Or,
>>> are there some controls that can be put in place to ensure that  
>>> these
>>> incorrect EOL characters stay out once they are removed?
>>>
>>> Kevin
>>>
>>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <michael.d.dick@gmail.com 
>>> >wrote:
>>>
>>>> This issue came up a few years ago while we were in the  
>>>> incubator. At the
>>>> time (if memory serves) we decided not to fix existing code due  
>>>> to the
>>>> noise
>>>> on SVN.
>>>>
>>>> I'm happy to commit the changes Donald has graciously provided if  
>>>> folks
>>>> agree the noise is acceptable, but I'd prefer to make sure since  
>>>> there's
>>>> precedent against cleaning up eol chars.
>>>>
>>>> Any agreement / dissent to committing the patch?
>>>>
>>>> -mike
>>>>
>>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <jira@apache.org 
>>>> >
>>>> wrote:
>>>>
>>>>>
>>>>>   [
>>>>>
>>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>>>> ]
>>>>>
>>>>> Donald Woods updated OPENJPA-896:
>>>>> ---------------------------------
>>>>>
>>>>>  Attachment: OPENJPA-896-trunk.patch
>>>>>
>>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>>> For Windows users, you can use a program like SlickEdit to  
>>>>> resave the
>>>> files
>>>>> in Unix format (and fix your svn config.)
>>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>>> For Mac users, you need to provide a dos2unix script that uses  
>>>>> the tr
>>>>> command -
>>>>> {noformat}
>>>>> #! /bin/sh
>>>>> for x
>>>>> do
>>>>> echo "Converting $x"
>>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>>> mv "$x.tmp" "$x"
>>>>> done
>>>>> {noformat}
>>>>>
>>>>>> Several doc files include Windows EoL chars
>>>>>> -------------------------------------------
>>>>>>
>>>>>>               Key: OPENJPA-896
>>>>>>               URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>>           Project: OpenJPA
>>>>>>        Issue Type: Bug
>>>>>>        Components: docs
>>>>>>          Reporter: Donald Woods
>>>>>>          Priority: Trivial
>>>>>>           Fix For: 2.0.0
>>>>>>
>>>>>>       Attachments: OPENJPA-896-trunk.patch
>>>>>>
>>>>>>
>>>>>> Several of the doc files include the Windows Ctrl+M chars at  
>>>>>> the end of
>>>>> lines when checked out to non-Windows platforms (like MacOSX and  
>>>>> Linux),
>>>> due
>>>>> to the committer not using the ASF suggested svn config values -
>>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>>> From http://www.apache.org/dev/version-control.html -
>>>>>> Configuring the Subversion client
>>>>>> Committers will need to properly configure their svn client. One
>>>>> particular issue is OS-specific line-endings for text files.  
>>>>> When you add
>>>> a
>>>>> new text file, especially when applying patches from Bugzilla,  
>>>>> first
>>>> ensure
>>>>> that the line-endings are appropriate for your system, then do ...
>>>>>> svn add test.txt
>>>>>> svn propset svn:eol-style native test.txt
>>>>>> Your svn client can be configured to do that automatically for  
>>>>>> some
>>>>> common file types. Add the contents of the file
>>>>> http://www.apache.org/dev/svn-eol-style.txt to your  
>>>>> ~/.subversion/config
>>>>> file. [Note: for Windows this is normally found at C:\Documents  
>>>>> and
>>>>> Settings\{username}\Application Data\Subversion\config]
>>>>>> Some files may need additional properties to be set, for example
>>>>> svn:executable=* should be applied to those script files  
>>>>> (e.g. .bat,
>>>> .cgi,
>>>>> .cmd, .sh) that are intended to be executed. Since not all such  
>>>>> files are
>>>>> necessarily intended to be executed, the executable property  
>>>>> should not
>>>> be
>>>>> made an automatic default.
>>>>>> However, you should still pay attention to the messages from  
>>>>>> your svn
>>>>> client when you do 'svn commit'.
>>>>>
>>>>> -- 
>>>>> This message is automatically generated by JIRA.
>>>>> -
>>>>> You can reply to this email to add a comment to the issue online.
>>>>>
>>>>>
>>>>
>> Craig L Russell
>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Is it time to fix the svn:eol-style properties?

Posted by Donald Woods <dw...@apache.org>.
Reviving this thread, as I'm also finding source files, like -
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
that are using the Windows EOL chars, which causes patches generated by 
"svn diff" on Linux/Mac to replace the content of the whole file to fix 
the EOL chars...

Still don't see why there is such a concern about SVN commit noise or 
that it adds one svn log entry per file.  The benefits outweigh the svn 
commit email and log history addition.

There are perl scripts floating around to recursively fix source 
branches (can't find one right now), or you can do it for every subdir -
svn propset svn:eol-style native -R 
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/*.java


-Donald


Craig L Russell wrote:
> I'd agree to these changes if the svn eol property were checked in at 
> the same time. That solves the long term problem. See 
> http://svnbook.red-bean.com/en/1.1/ch07s02.html for details on 
> svn:eol-style.
> 
> For the project, we need to decide which eol style to use. Both/either 
> LF and native work fine for most people.
> 
> Craig
> 
> On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:
> 
>> Mike,
>> I remember those conversations...  :-)  What's the advantage of making or
>> not making these changes?  This is a huge change.  And, other than 
>> totally
>> tilting our doc change history, does it really buy us anything?  I 
>> thought
>> that as the document gets updated, then the sections would be converted
>> appropriately.  And, even if we do this change, what prevents us from
>> corrupting it again?  It seems that this is just an on-going 
>> situation.  Or,
>> are there some controls that can be put in place to ensure that these
>> incorrect EOL characters stay out once they are removed?
>>
>> Kevin
>>
>> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick 
>> <mi...@gmail.com>wrote:
>>
>>> This issue came up a few years ago while we were in the incubator. At 
>>> the
>>> time (if memory serves) we decided not to fix existing code due to the
>>> noise
>>> on SVN.
>>>
>>> I'm happy to commit the changes Donald has graciously provided if folks
>>> agree the noise is acceptable, but I'd prefer to make sure since there's
>>> precedent against cleaning up eol chars.
>>>
>>> Any agreement / dissent to committing the patch?
>>>
>>> -mike
>>>
>>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>>> wrote:
>>>
>>>>
>>>>    [
>>>>
>>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>>>
>>> ]
>>>>
>>>> Donald Woods updated OPENJPA-896:
>>>> ---------------------------------
>>>>
>>>>   Attachment: OPENJPA-896-trunk.patch
>>>>
>>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>>> For Windows users, you can use a program like SlickEdit to resave the
>>> files
>>>> in Unix format (and fix your svn config.)
>>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>>> For Mac users, you need to provide a dos2unix script that uses the tr
>>>> command -
>>>> {noformat}
>>>> #! /bin/sh
>>>> for x
>>>> do
>>>> echo "Converting $x"
>>>> tr -d '\015' < "$x" > "$x.tmp"
>>>> mv "$x.tmp" "$x"
>>>> done
>>>> {noformat}
>>>>
>>>>> Several doc files include Windows EoL chars
>>>>> -------------------------------------------
>>>>>
>>>>>                Key: OPENJPA-896
>>>>>                URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>>            Project: OpenJPA
>>>>>         Issue Type: Bug
>>>>>         Components: docs
>>>>>           Reporter: Donald Woods
>>>>>           Priority: Trivial
>>>>>            Fix For: 2.0.0
>>>>>
>>>>>        Attachments: OPENJPA-896-trunk.patch
>>>>>
>>>>>
>>>>> Several of the doc files include the Windows Ctrl+M chars at the 
>>>>> end of
>>>> lines when checked out to non-Windows platforms (like MacOSX and 
>>>> Linux),
>>> due
>>>> to the committer not using the ASF suggested svn config values -
>>>> http://www.apache.org/dev/svn-eol-style.txt
>>>>> From http://www.apache.org/dev/version-control.html -
>>>>> Configuring the Subversion client
>>>>> Committers will need to properly configure their svn client. One
>>>> particular issue is OS-specific line-endings for text files. When 
>>>> you add
>>> a
>>>> new text file, especially when applying patches from Bugzilla, first
>>> ensure
>>>> that the line-endings are appropriate for your system, then do ...
>>>>> svn add test.txt
>>>>> svn propset svn:eol-style native test.txt
>>>>> Your svn client can be configured to do that automatically for some
>>>> common file types. Add the contents of the file
>>>> http://www.apache.org/dev/svn-eol-style.txt to your 
>>>> ~/.subversion/config
>>>> file. [Note: for Windows this is normally found at C:\Documents and
>>>> Settings\{username}\Application Data\Subversion\config]
>>>>> Some files may need additional properties to be set, for example
>>>> svn:executable=* should be applied to those script files (e.g. .bat,
>>> .cgi,
>>>> .cmd, .sh) that are intended to be executed. Since not all such 
>>>> files are
>>>> necessarily intended to be executed, the executable property should not
>>> be
>>>> made an automatic default.
>>>>> However, you should still pay attention to the messages from your svn
>>>> client when you do 'svn commit'.
>>>>
>>>> -- 
>>>> This message is automatically generated by JIRA.
>>>> -
>>>> You can reply to this email to add a comment to the issue online.
>>>>
>>>>
>>>
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
> 
> 

Re: [jira] Updated: (OPENJPA-896) Several doc files include Windows EoL chars

Posted by Craig L Russell <Cr...@Sun.COM>.
I'd agree to these changes if the svn eol property were checked in at  
the same time. That solves the long term problem. See http://svnbook.red-bean.com/en/1.1/ch07s02.html 
  for details on svn:eol-style.

For the project, we need to decide which eol style to use. Both/either  
LF and native work fine for most people.

Craig

On Feb 4, 2009, at 1:44 PM, Kevin Sutter wrote:

> Mike,
> I remember those conversations...  :-)  What's the advantage of  
> making or
> not making these changes?  This is a huge change.  And, other than  
> totally
> tilting our doc change history, does it really buy us anything?  I  
> thought
> that as the document gets updated, then the sections would be  
> converted
> appropriately.  And, even if we do this change, what prevents us from
> corrupting it again?  It seems that this is just an on-going  
> situation.  Or,
> are there some controls that can be put in place to ensure that these
> incorrect EOL characters stay out once they are removed?
>
> Kevin
>
> On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick  
> <mi...@gmail.com>wrote:
>
>> This issue came up a few years ago while we were in the incubator.  
>> At the
>> time (if memory serves) we decided not to fix existing code due to  
>> the
>> noise
>> on SVN.
>>
>> I'm happy to commit the changes Donald has graciously provided if  
>> folks
>> agree the noise is acceptable, but I'd prefer to make sure since  
>> there's
>> precedent against cleaning up eol chars.
>>
>> Any agreement / dissent to committing the patch?
>>
>> -mike
>>
>> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
>> wrote:
>>
>>>
>>>    [
>>>
>> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>> ]
>>>
>>> Donald Woods updated OPENJPA-896:
>>> ---------------------------------
>>>
>>>   Attachment: OPENJPA-896-trunk.patch
>>>
>>> Patch file which removes the Windows Ctrl+M EOL chars.
>>> For Windows users, you can use a program like SlickEdit to resave  
>>> the
>> files
>>> in Unix format (and fix your svn config.)
>>> For Unix/Linux users, use the "dos2unix *.xml" command.
>>> For Mac users, you need to provide a dos2unix script that uses the  
>>> tr
>>> command -
>>> {noformat}
>>> #! /bin/sh
>>> for x
>>> do
>>> echo "Converting $x"
>>> tr -d '\015' < "$x" > "$x.tmp"
>>> mv "$x.tmp" "$x"
>>> done
>>> {noformat}
>>>
>>>> Several doc files include Windows EoL chars
>>>> -------------------------------------------
>>>>
>>>>                Key: OPENJPA-896
>>>>                URL: https://issues.apache.org/jira/browse/OPENJPA-896
>>>>            Project: OpenJPA
>>>>         Issue Type: Bug
>>>>         Components: docs
>>>>           Reporter: Donald Woods
>>>>           Priority: Trivial
>>>>            Fix For: 2.0.0
>>>>
>>>>        Attachments: OPENJPA-896-trunk.patch
>>>>
>>>>
>>>> Several of the doc files include the Windows Ctrl+M chars at the  
>>>> end of
>>> lines when checked out to non-Windows platforms (like MacOSX and  
>>> Linux),
>> due
>>> to the committer not using the ASF suggested svn config values -
>>> http://www.apache.org/dev/svn-eol-style.txt
>>>> From http://www.apache.org/dev/version-control.html -
>>>> Configuring the Subversion client
>>>> Committers will need to properly configure their svn client. One
>>> particular issue is OS-specific line-endings for text files. When  
>>> you add
>> a
>>> new text file, especially when applying patches from Bugzilla, first
>> ensure
>>> that the line-endings are appropriate for your system, then do ...
>>>> svn add test.txt
>>>> svn propset svn:eol-style native test.txt
>>>> Your svn client can be configured to do that automatically for some
>>> common file types. Add the contents of the file
>>> http://www.apache.org/dev/svn-eol-style.txt to your ~/.subversion/ 
>>> config
>>> file. [Note: for Windows this is normally found at C:\Documents and
>>> Settings\{username}\Application Data\Subversion\config]
>>>> Some files may need additional properties to be set, for example
>>> svn:executable=* should be applied to those script files (e.g. .bat,
>> .cgi,
>>> .cmd, .sh) that are intended to be executed. Since not all such  
>>> files are
>>> necessarily intended to be executed, the executable property  
>>> should not
>> be
>>> made an automatic default.
>>>> However, you should still pay attention to the messages from your  
>>>> svn
>>> client when you do 'svn commit'.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> -
>>> You can reply to this email to add a comment to the issue online.
>>>
>>>
>>

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: [jira] Updated: (OPENJPA-896) Several doc files include Windows EoL chars

Posted by Kevin Sutter <kw...@gmail.com>.
Mike,
I remember those conversations...  :-)  What's the advantage of making or
not making these changes?  This is a huge change.  And, other than totally
tilting our doc change history, does it really buy us anything?  I thought
that as the document gets updated, then the sections would be converted
appropriately.  And, even if we do this change, what prevents us from
corrupting it again?  It seems that this is just an on-going situation.  Or,
are there some controls that can be put in place to ensure that these
incorrect EOL characters stay out once they are removed?

Kevin

On Wed, Feb 4, 2009 at 3:02 PM, Michael Dick <mi...@gmail.com>wrote:

> This issue came up a few years ago while we were in the incubator. At the
> time (if memory serves) we decided not to fix existing code due to the
> noise
> on SVN.
>
> I'm happy to commit the changes Donald has graciously provided if folks
> agree the noise is acceptable, but I'd prefer to make sure since there's
> precedent against cleaning up eol chars.
>
> Any agreement / dissent to committing the patch?
>
> -mike
>
> On Wed, Feb 4, 2009 at 1:01 PM, Donald Woods (JIRA) <ji...@apache.org>
> wrote:
>
> >
> >     [
> >
> https://issues.apache.org/jira/browse/OPENJPA-896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> >
> > Donald Woods updated OPENJPA-896:
> > ---------------------------------
> >
> >    Attachment: OPENJPA-896-trunk.patch
> >
> > Patch file which removes the Windows Ctrl+M EOL chars.
> > For Windows users, you can use a program like SlickEdit to resave the
> files
> > in Unix format (and fix your svn config.)
> > For Unix/Linux users, use the "dos2unix *.xml" command.
> > For Mac users, you need to provide a dos2unix script that uses the tr
> > command -
> > {noformat}
> > #! /bin/sh
> > for x
> > do
> > echo "Converting $x"
> > tr -d '\015' < "$x" > "$x.tmp"
> > mv "$x.tmp" "$x"
> > done
> > {noformat}
> >
> > > Several doc files include Windows EoL chars
> > > -------------------------------------------
> > >
> > >                 Key: OPENJPA-896
> > >                 URL: https://issues.apache.org/jira/browse/OPENJPA-896
> > >             Project: OpenJPA
> > >          Issue Type: Bug
> > >          Components: docs
> > >            Reporter: Donald Woods
> > >            Priority: Trivial
> > >             Fix For: 2.0.0
> > >
> > >         Attachments: OPENJPA-896-trunk.patch
> > >
> > >
> > > Several of the doc files include the Windows Ctrl+M chars at the end of
> > lines when checked out to non-Windows platforms (like MacOSX and Linux),
> due
> > to the committer not using the ASF suggested svn config values -
> > http://www.apache.org/dev/svn-eol-style.txt
> > > From http://www.apache.org/dev/version-control.html -
> > > Configuring the Subversion client
> > > Committers will need to properly configure their svn client. One
> > particular issue is OS-specific line-endings for text files. When you add
> a
> > new text file, especially when applying patches from Bugzilla, first
> ensure
> > that the line-endings are appropriate for your system, then do ...
> > > svn add test.txt
> > > svn propset svn:eol-style native test.txt
> > > Your svn client can be configured to do that automatically for some
> > common file types. Add the contents of the file
> > http://www.apache.org/dev/svn-eol-style.txt to your ~/.subversion/config
> > file. [Note: for Windows this is normally found at C:\Documents and
> > Settings\{username}\Application Data\Subversion\config]
> > > Some files may need additional properties to be set, for example
> > svn:executable=* should be applied to those script files (e.g. .bat,
> .cgi,
> > .cmd, .sh) that are intended to be executed. Since not all such files are
> > necessarily intended to be executed, the executable property should not
> be
> > made an automatic default.
> > > However, you should still pay attention to the messages from your svn
> > client when you do 'svn commit'.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>