Commit Graph

1153 Commits

Author SHA1 Message Date
Michael Bayne abfcfc9707 Javadoc fixes. 2025-07-03 13:06:05 -07:00
Michael Bayne f413bac5fc Use result index instead of name.
For whatever reason name is not working. But we only get back one value, so we
can just get it by index (which used SQL's 1-based indexing, whee!).
2025-02-21 14:38:02 -08:00
Michael Bayne 5f4b9f699d Use DriverManager.getConnection().
This is the preferred way to obtain a JDBC connection in this millenium. No
longer does one manually instantiate the JDBC driver by name. The JDBC driver
jar file will have a mapping that indicates that it handles a particular type
of JDBC URL and the JDBC infrastructure will handle instantiating the driver.
2025-02-21 14:18:54 -08:00
Michael Bayne 87c68f2f1c Bump servlet-api to 3.1.0, make cookies http only.
This makes them invisible to JavaScript (which we don't use) to avoid the
danger of someone injecting JavaScript somehow and stealing auth cookies. It's
a dangerous world out there.
2025-02-20 11:41:00 -08:00
Michael Bayne a05da202af Add mechanism to get auto-generated key to JORA.
This assumes that the JDBC driver supports getGeneratedKeys(), which is a safe
bet in these rarified modern times.
2025-02-20 10:32:16 -08:00
Michael Bayne e9efe7ca49 Use type parameters. 2025-01-30 13:52:22 -08:00
Michael Bayne d91abf6649 Auto-create the sites and domains tables. 2025-01-20 22:10:50 -08:00
Michael Bayne f18af0cfd0 Actually we do want a specific catalog.
The Connection will be connected to a particular "database" and we want to
restrict the metadata only to things in that database.
2025-01-20 22:10:36 -08:00
Michael Bayne fad635b54b Let's fix all these other spots too. 2025-01-20 14:55:46 -08:00
Michael Bayne 5396a98410 Don't narrow search by catalog or schema.
Apparently null is different from "" and that started to matter some time in
the last twenty five years.
2025-01-20 14:48:54 -08:00
Michael Bayne c490ad0bc1 Don't depend on hash ordering. 2025-01-20 14:29:41 -08:00
Michael Bayne a2cc8ec450 Use replacement for Class.newInstance().
It is deprecated as of Java 9, and the replacement is valid for older JVMs.
2019-03-18 19:30:04 -07:00
Michael Bayne b1a418eaa9 Fix some raw types. 2016-11-26 09:27:15 -08:00
Ray J. Greenwell 0436d95cea Logging improvements for WeakObserverList.
- De-static checkedApply(). It should be overrideable and know
  other things about the ObserverList that it belongs to.
- Created an overrideable observerForLog().
- Have the DerefOp include the original Op's toString() in its own.
2015-05-04 17:48:00 -07:00
Michael Bayne 258e27dac4 Get rid of TestUtil and related hackery.
The SiteResourceLoader is some ancient stuff that's not used anywhere any more,
and there's no use in keeping this crufty crap around to test it. I'd nix it
too but I don't want to cause yet more trouble.

TestUtil was weird and a bad idea and good riddance to it as well.
2014-11-17 14:23:41 -08:00
Michael Bayne c066cbf044 Specify test_dir in the unit test.
Now that it's consistent, we can avoid extra build shenanigans.
2014-11-17 14:07:38 -08:00
Jamie Doornbos 5c57d34d16 Minor javadoc fixes. 2014-11-17 12:33:57 -08:00
Michael Bayne d83760bb39 No auto-commit for tx connections. 2014-10-01 14:44:16 -07:00
Michael Bayne 1a822593fb Tx connections are always read-write. 2014-10-01 11:29:45 -07:00
Michael Bayne 90e45a4ad1 Some infrastructure for transaction support.
ConnectionProvider may normally return the same connection for a call to
getConnection(), so we add a separate getTxConnection() which is guaranteed to
always return a connection that's not in use by anyone else.

The DataSourceConnectionProvider already meets that requirement because it
returns connections from a pool, but the StaticConnectionProvider does not. In
the latter case, we just open a new connection to the database every time you
do a transaction. Since StaticConnectionProvider is only used for testing (in
conjunction with Depot anyway, Yohoho uses it in production IIRC), this is not
a big deal.
2014-10-01 10:36:33 -07:00
Michael Bayne fafb6c8fd6 Merge branch 'master' of https://github.com/threerings/samskivert 2014-09-30 15:37:06 -07:00
Michael Bayne 7c9d4456d6 Omit public from interface method decls. 2014-09-30 15:36:38 -07:00
Ray J. Greenwell a9dc20ce14 Stop supporting Invoker.setDefaultLongThreshold(). 2014-06-25 15:49:46 -07:00
Michael Bayne 8d6f9c216f A bunch more Javadoc fixes.
Wow, the 1.8 javadoc tool is much stricter. For the best I suppose, though
requiring a <caption> for a <table> seems a bit excessive.
2014-06-25 13:16:45 -07:00
Michael Bayne a9de4b243d Javadoc tweak.
1.8 javadoc now freaks out about bare < and > in Javadoc. Yay!
2014-06-25 12:59:07 -07:00
Ray J. Greenwell a225726f8c Parse booleans like Config does.
Incorrectly.
2014-06-04 10:48:39 -07:00
Ray J. Greenwell 1e7934d9c8 Fix some NPEs and other exceptions in property change handling.
For the 'IntAdjust' and 'BooleanAdjust' classes, handle
PropertyChangeEvents where the values are null or Strings instead of
the expected Integer or Boolean types, respectively.

It's kinda amazing that this has never come up before.
Each Adjust stores to a PrefsConfig, which is backed by a Properties,
which stores all values as Strings. Not only that, but it does not
store in any way what the expected type of a property is.
It is determined by which getter you call:
_cfg.setValue("foo", "2");
_cfg.getValue("foo", (String)null); // returns "2"
_cfg.getValue("foo", 0);            // returns 2
_cfg.getValue("foo", 3.0f);         // returns 2.0f

If a property is removed, then null is the new value, and it also
doesn't know what type the old value was. These runtime adjusts
need to be able to revert to their default value and they will
always need to be able to potentially parse a String. And since
someone can legally change the type of a property, they need
to be able to recover if the property is a type they don't even
expect.

The real problem here is using shitty Properties for backing,
and/or not storing something more complex than the simple toString()
representation of the value.

Don't interpret this fix as a blessing to use these old, old things.
I'm supporting legacy code.

The other adjust subclasses weren't ...adjusted... because my project
doesn't use them and I'm not going to dig in and test them.
2014-06-04 10:23:44 -07:00
Jamie Doornbos 1c4c379627 Support log4j 2.x.
This is an RC dependency. We can update that when log4j 2.0 is release, but that shouldn't be
necessary.
2014-05-27 14:42:44 -07:00
Michael Bayne 93109a004f Yet more lastInsertedId revamping. Third time's the charm. 2014-05-02 13:45:10 -07:00
Michael Bayne 4efae53621 Handle null uniqueColumns. 2014-05-02 13:13:11 -07:00
Michael Bayne d870dd2fac Merge branch 'master' of https://github.com/threerings/samskivert 2014-05-02 13:10:32 -07:00
Michael Bayne 5356672130 Make lastInsertedId return null on failure.
Since we're rejiggering, we'll take this opportunity to eliminate the use of -1
as a sentinel id. Maybe your database id generator returns -1. Unlikely, but
not impossible.
2014-05-02 13:07:05 -07:00
Ray J. Greenwell a641e6c502 Fix. 2014-05-02 11:50:41 -07:00
Michael Bayne a473ff2ef1 Make use of getGeneratedKeys in lastInsertedId.
This allows us to do the necessary hackery for MySQL which reports the
generated key as GENERATED_KEY instead of via its actual column name.
2014-05-02 11:15:11 -07:00
Ray J. Greenwell 66e0874633 Added Weigher interface, and a pick(Iterable, Weigher).
I wanted something like this before, but with guava's Function,
and samskivert doesn't depend have dependencies.
But with Java 8 coming, functional interfaces make the distinction
between different interfaces less important.
2014-04-23 10:08:18 -07:00
Ray J. Greenwell 2f4bdb961b Fixed a longstanding issue with long thresholds.
There was no way to set the "long threshold" per-Invoker.
A Unit could override getLongThreshold(), or you could set a static
jvm-wide long threshold for all Invokers.

That doesn't make sense. Set the long threshold you need on each invoker.

All existing behavior is preserved for the time being, but I've deprecated
the static method.

Units return 0 now to indicate that they don't have their own setting.
I'm pretty sure nobody out there is doing anything kooky like
"return 500 + super.getLongThreshold();" at least in the code I've scanned.
2014-04-23 09:50:16 -07:00
Ray J. Greenwell df44ea16f1 Use the NOOP class to implement the NOOP constant.
Really, they should both be deprecated. Log your exceptions.
If there's a special place where you have to hack it to not log
an exception, that special place can damn well create its own no-op
listener. Or be fixed!

Having an abstract class that only implements a blank requestCompleted()
would make sense, as would a sharable singleton instance that does
nothing on success and always logs on failure. Hmm.
2014-04-23 09:42:22 -07:00
Michael Bayne d570f60ac3 Unused import. 2014-01-20 14:26:55 -08:00
Michael Bayne 6bc9ba32db Formatting, no @Override iface for 1.5, etc. 2014-01-20 14:23:34 -08:00
Michael Bayne 278112f4b6 Nix unused import. 2014-01-20 14:18:26 -08:00
Ray J. Greenwell 241fd0824d Protect from stupid null usage by javax.mail.
If you add no addresses to a message, getting the recipient array
returns null rather than an empty array. So fucking dumb.
2014-01-14 11:30:08 -08:00
Ray J. Greenwell 82a55291bc Commenting, cleanup, close our Transport.
This works, I'm shipping it and hopefully I'll get some answers.
2014-01-14 10:45:43 -08:00
Ray J. Greenwell 851999aa78 Try using a TransportListener to listen for delivery errors.
This is somewhat temporary code to try something out...
In our production environment there are mails getting lost.
I'd like to find out why.
Try using a TransportListener. This is more complicated.
Also the listener may be getting added many times. We shall see.
2014-01-13 14:44:50 -08:00
Michael Bayne 92b6e743ab Accept null uConCols and pKeyCols as advertised. 2013-10-08 11:57:12 -07:00
Ray J. Greenwell 35beb02b95 Use Arrays.fill(). 2013-10-01 16:08:08 -07:00
Michael Bayne 74ab7c6319 Some tidying. 2013-05-28 17:10:45 -07:00
Michael Bayne e3ea2ce0a5 Merge branch 'master' of https://github.com/KolonelKustard/samskivert 2013-05-28 17:07:17 -07:00
Michael Bayne d173ca5ecd Provide per-package loggers.
I also made them package private where possible. It's too easy for code that
depends on samskivert to accidentally import com.samskivert.Log rather than
define its own logger.

Unfortunately Java doesn't have "this package and subpackages" protection, so
some of the package loggers have to be public to allow sub-packages to access
them. I didn't really want to have to define loggers for half a dozen
subpackages as well.
2013-05-24 11:25:51 -07:00
Michael Bayne 3442a51457 Added a Log for JDBC code; info -> debug for HSQL liaison. 2013-05-24 10:43:37 -07:00
Michael Bayne 58736e2e8b A bunch of Eclipse appeasement. 2013-05-24 08:08:52 -07:00