Skip to content

Commit

Permalink
SVN layout migration for core/trunk
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@11724 1b8cb986-b30d-0410-93ca-fae66ebed9b2
  • Loading branch information
sebersole committed Jun 29, 2007
1 parent 6eee4be commit defd7e7
Show file tree
Hide file tree
Showing 10 changed files with 1,723 additions and 0 deletions.
116 changes: 116 additions & 0 deletions etc/CacheSequences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
An example of enabling support for sequences in Intersystems' Cache SQL 2007.1 database.
-->

<Export generator="Cache" version="9" zv="Cache for Windows NT (Intel) 5.0.17 (Build 6006U)" ts="2005-09-29 14:10:54">
<Project name="Hibernate_Sequences" LastModified="2005-09-29 14:10:54">
<Items>
<ProjectItem name="InterSystems.Sequences" type="CLS"/>
</Items>
</Project>
<Class name="InterSystems.Sequences">
<Description><![CDATA[
Class to maintain a table of counters for Oracle sequence or MSSql identity columns
<br><br>Counters can be incremented by calling the stored procedure BEFORE the insert
using syntax like: call InterSystems.Sequences_GetNext("Name"), or using standard SQL,
or part of an SQL select like:
<br><br>select InterSystems.Sequences_GetNext(sequencename) from InterSystems.Sequences where Name='sequencename'
<br>
<br>Can also be queried as table InterSystems.Sequences, but that data is actually stored
in ^InterSystems.Sequences. Note use of %CacheSqlStorage to speed incrementing.
<br>
<br> Note: to make the Sequences system-wide, simply map ^InterSystems.Sequences* to a
common location
<br>
<br> Note: counter names are case-insensitive and force to uppercase on disk.
<br><br> Merge of ideas by JSL and APC 09/2005
]]></Description>
<ClassType>persistent</ClassType>
<SqlRowIdPrivate>1</SqlRowIdPrivate>
<StorageStrategy>custom</StorageStrategy>
<Super>%Persistent</Super>
<TimeChanged>60172,44404.735854</TimeChanged>
<TimeCreated>60137,56752.747989</TimeCreated>
<ClassDefinitionError>0</ClassDefinitionError>

<Index name="UniqueIndex1">
<IdKey>1</IdKey>
<PrimaryKey>1</PrimaryKey>
<Properties>Name</Properties>
<Unique>1</Unique>
</Index>

<Property name="Name">
<Description>
The name of the sequence or identity, forced to uppercase. Typically a tablename
(MSSQL identities) or an Oracle-like Sequence name</Description>
<Type>%String</Type>
<Parameter name="MAXLEN" value="64"/>
</Property>

<Property name="Counter">
<Description>
Last assigned value for this Name. Initial </Description>
<Type>%Integer</Type>
<InitialExpression>0</InitialExpression>
</Property>

<Method name="GetNext">
<Description>
Returns an integer value with next assigned counter.</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>name:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[ quit $increment(^InterSystems.Sequences($zcvt(name,"U"))) //force name to uppercase to be safe
]]></Implementation>
</Method>

<Method name="Init">
<Description>
Hibernate procedure to intialise a sequence, but can be used at any time</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>SequenceName:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
set ^InterSystems.Sequences($zcvt(SequenceName,"U"))=0
quit 0
]]></Implementation>
</Method>

<Method name="Drop">
<Description>
Hibernate procedure to kill a sequence, but can be used at any time</Description>
<ClassMethod>1</ClassMethod>
<FormalSpec>SequenceName:%String</FormalSpec>
<ReturnType>%Integer</ReturnType>
<SqlProc>1</SqlProc>
<Implementation><![CDATA[
kill ^InterSystems.Sequences($zcvt(SequenceName,"U"))
quit 0
]]></Implementation>
</Method>

<Storage name="custom">
<Type>%CacheSQLStorage</Type>
<StreamLocation>^InterSystems.SequencesS</StreamLocation>
<Property name="Counter"/>
<Property name="Name">
<Selectivity>1</Selectivity>
</Property>
<SQLMap name="datamap">
<Type>data</Type>
<Global>^InterSystems.Sequences</Global>
<Structure>delimited</Structure>
<Subscript name="1">
<Expression>{Name}</Expression>
</Subscript>
<Data name="Counter"/>
</SQLMap>
</Storage>
</Class>
<Checksum value="3603995477"/>
</Export>
119 changes: 119 additions & 0 deletions etc/cvs-dup-eol-fixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!perl -w
###############################################################################
#
# Name: cvs-dup-eol-fixer
# Author: Steve Ebersole
#
# Description:
# Script to fix the bad end-of-line issues that sometimes occur after checking
# out Hibernate source from the sourceforge CVS where everything is essentially
# double-spaced. What I found however, at least on my environment, was that
# this was actually caused by two carriage-return characters (i.e., \r\r) being
# substituted for all line endings. This script works under that assumption
# and fixes only that issue.
#
###############################################################################


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This subroutine is essentially a recursive directory searcher. It does also
# filter out anything from the CVS local admin dirs.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub parsedir($) {
my @results = ();
my $dir = shift@_;
opendir(DIRHANDLE, $dir) or die("Unable to open dir [$dir] for parsing");
my @dir_contents = readdir(DIRHANDLE);
closedir(DIRHANDLE) or warn("Unable to close dir [$dir]");

foreach $element (@dir_contents) {
if ( $element eq "." || $element eq ".." ) {
# Nothing to do here...
}
elsif ($element =~ /CVS/) {
# nothing to do here...
}
# assume no extension means a directory
elsif ($element =~ /\./) {
if ($element =~ /\.java/) {
push( @results, "$dir/$element" );
}
}
else {
push( @results, parsedir("$dir/$element") );
}
}

return @results;
}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This subroutine basically checks to see if the file needs to be fixed, based
# mainly on the number of adjacent (i.e., repeating) cariage-return characters.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub checkfile($) {
my $file_name = shift @_;
my $loop_count = 0;
my $adj_cr_count = 0;
my $line_count = 0;

open( INFILEHANDLE, "<$file_name" ) or die( "Unable to open file [$file_name] for check" );
while (<INFILEHANDLE>) {
$loop_count++;

@matches = m/\r\r/g;
$adj_cr_count = $adj_cr_count + $#matches + 1;

$line_count = $line_count + tr/\r\n/\r\n/;
}
close( INFILEHANDLE );

my $half_line_count = $line_count / 2;
return $loop_count == 1 && int($half_line_count) <= $adj_cr_count && $adj_cr_count <= int($half_line_count + 1);
}

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This is the subroutine where the file actually gets fixed. It is also
# responsible for making sure files get backed up before doing the fix.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub fixfile($) {
my $file_name = shift @_;
my $file_text = "";

open( INFILEHANDLE, "<$file_name" ) or die( "Unable to open file [$file_name] for fix input" );
while (<INFILEHANDLE>) {
s/\r\r/\n/g;
$file_text .= $_;
}
close( INFILEHANDLE );

my $new_file_name = $file_name . ".old";
rename( $file_name, $new_file_name );

open( OUTFILEHANDLE, ">$file_name" ) or die( "Unable to open file [$file_name] for fix output" );
print( OUTFILEHANDLE $file_text );
close( OUTFILEHANDLE );
}


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Start main process
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
open( REPORTFILEHANDLE, ">cvs-dup-eol-fixer.report" ) or die( "Unable to open report file" );

my $basedir = shift @ARGV;
print( REPORTFILEHANDLE "Using basedir : $basedir\n");

my @file_list = parsedir($basedir);

foreach $file_name (@file_list) {
print( REPORTFILEHANDLE "Checking file [$file_name]\n" );
if ( checkfile($file_name) ) {
print( REPORTFILEHANDLE " Need to fix file : $file_name\n" );
fixfile($file_name);
}
}

close(REPORTFILEHANDLE) or warn("Unable to close report file");

__END__
88 changes: 88 additions & 0 deletions etc/ehcache.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<ehcache>

<!-- Sets the path to the directory where cache .data files are created.
If the path is a Java System Property it is replaced by
its value in the running VM.
The following properties are translated:
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->
<diskStore path="java.io.tmpdir"/>


<!--Default Cache configuration. These will applied to caches programmatically created through
the CacheManager.
The following attributes are required for defaultCache:
maxInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
is never expired.
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
if the element is not eternal. Idle time is now - last accessed time
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
if the element is not eternal. TTL is now - creation time
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>

<!--Predefined caches. Add your cache configuration settings here.
If you do not have a configuration for your cache a WARNING will be issued when the
CacheManager starts
The following attributes are required for defaultCache:
name - Sets the name of the cache. This is used to identify the cache. It must be unique.
maxInMemory - Sets the maximum number of objects that will be created in memory
eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
is never expired.
timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
if the element is not eternal. Idle time is now - last accessed time
timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
if the element is not eternal. TTL is now - creation time
overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
has reached the maxInMemory limit.
-->

<!-- Sample cache named sampleCache1
This cache contains a maximum in memory of 10000 elements, and will expire
an element if it is idle for more than 5 minutes and lives for more than
10 minutes.
If there are more than 10000 elements it will overflow to the
disk cache, which in this configuration will go to wherever java.io.tmp is
defined on your system. On a standard Linux system this will be /tmp"
-->
<cache name="sampleCache1"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
overflowToDisk="true"
/>

<!-- Sample cache named sampleCache2
This cache contains 1000 elements. Elements will always be held in memory.
They are not expired. -->
<cache name="sampleCache2"
maxElementsInMemory="1000"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
/> -->

<!-- Place configuration for your caches following -->

</ehcache>
Loading

0 comments on commit defd7e7

Please sign in to comment.