Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
joram
joram
Commits
15b92267
Commit
15b92267
authored
Feb 26, 2021
by
Andre Freyssinet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes MySqlDB[Transaction|Repository] and frees dependency to Apache
commons-dbcp.
parent
a59f87d2
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
717 deletions
+0
-717
joram/a3/rt/src/main/java/fr/dyade/aaa/util/MySQLDBTransaction.java
...t/src/main/java/fr/dyade/aaa/util/MySQLDBTransaction.java
+0
-122
joram/a3/rt/src/main/java/fr/dyade/aaa/util/MySqlDBRepository.java
...rt/src/main/java/fr/dyade/aaa/util/MySqlDBRepository.java
+0
-595
No files found.
joram/a3/rt/src/main/java/fr/dyade/aaa/util/MySQLDBTransaction.java
deleted
100644 → 0
View file @
a59f87d2
/*
* Copyright (C) 2007 - 2019 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package
fr.dyade.aaa.util
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.util.Enumeration
;
import
java.util.Properties
;
import
org.objectweb.util.monolog.api.BasicLevel
;
import
fr.dyade.aaa.agent.AgentServer
;
/**
* The MySQLDBTransaction class implements an atomic storage through a MySQL database.
* This class is now deprecated and should be replaced by JDBCTransaction that implements a generic
* Transaction component on top of JDBC.
*
* @see Transaction
*/
@Deprecated
public
final
class
MySQLDBTransaction
extends
DBTransaction
{
private
String
driver
=
"com.mysql.jdbc.Driver"
;
private
String
connurl
=
"jdbc:mysql:"
;
protected
void
initDB
()
throws
IOException
{
String
configFile
=
AgentServer
.
getProperty
(
"MySQLDBTransactionConfigFile"
,
"MySQL.properties"
);
Properties
prop
=
new
Properties
();
try
{
prop
.
load
(
new
FileInputStream
(
configFile
));
}
catch
(
FileNotFoundException
e
)
{
if
(
logmon
.
isLoggable
(
BasicLevel
.
INFO
))
{
logmon
.
log
(
BasicLevel
.
INFO
,
"File "
+
configFile
+
" not found, using default parameters"
);
}
}
String
dbHost
=
prop
.
getProperty
(
"host"
,
"localhost"
);
String
dbPort
=
prop
.
getProperty
(
"port"
,
"3306"
);
String
dbName
=
prop
.
getProperty
(
"database"
,
"joramdb"
);
String
dbUser
=
prop
.
getProperty
(
"user"
,
"joram"
);
String
dbPass
=
prop
.
getProperty
(
"password"
,
"joram"
);
try
{
Class
.
forName
(
driver
).
newInstance
();
StringBuffer
sb
=
new
StringBuffer
(
connurl
);
sb
.
append
(
"//"
);
sb
.
append
(
dbHost
);
sb
.
append
(
':'
);
sb
.
append
(
dbPort
);
sb
.
append
(
'/'
);
sb
.
append
(
dbName
);
sb
.
append
(
"?user="
);
sb
.
append
(
dbUser
);
sb
.
append
(
"&password="
);
sb
.
append
(
dbPass
);
Enumeration
enu
=
prop
.
keys
();
while
(
enu
.
hasMoreElements
())
{
String
key
=
(
String
)
enu
.
nextElement
();
if
(
key
.
equals
(
"host"
)
||
key
.
equals
(
"port"
)
||
key
.
equals
(
"database"
)
||
key
.
equals
(
"user"
)
||
key
.
equals
(
"password"
))
{
continue
;
}
sb
.
append
(
'&'
);
sb
.
append
(
key
);
sb
.
append
(
'='
);
sb
.
append
(
prop
.
get
(
key
));
}
conn
=
DriverManager
.
getConnection
(
sb
.
toString
());
conn
.
setAutoCommit
(
false
);
}
catch
(
SQLException
e
)
{
throw
new
IOException
(
e
.
getMessage
());
}
catch
(
InstantiationException
e
)
{
throw
new
IOException
(
e
.
getMessage
());
}
catch
(
IllegalAccessException
e
)
{
throw
new
IOException
(
e
.
getMessage
());
}
catch
(
ClassNotFoundException
e
)
{
throw
new
IOException
(
e
.
getMessage
());
}
try
{
// Creating a statement lets us issue commands against the connection.
Statement
s
=
conn
.
createStatement
();
// We create the table.
s
.
execute
(
"CREATE TABLE "
+
dbtable
+
" (name VARCHAR(255), content LONGBLOB, PRIMARY KEY(name))"
);
s
.
close
();
conn
.
commit
();
}
catch
(
SQLException
sqle
)
{
if
(
logmon
.
isLoggable
(
BasicLevel
.
INFO
))
logmon
.
log
(
BasicLevel
.
INFO
,
"DBTransaction, init() DB already exists"
);
}
}
@Override
protected
void
connectDB
()
throws
IOException
{
throw
new
IOException
(
"JDBC reconnection is not implemented"
);
}
}
joram/a3/rt/src/main/java/fr/dyade/aaa/util/MySqlDBRepository.java
deleted
100644 → 0
View file @
a59f87d2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment