java

JAXBContext initialization speedup?

Is there any way to speed up the initialization of javax.xml.bind.JAXBContexts with a large (>1000) number of classes? In our XML heavy application the startup time is some 10 minutes and consists mainly of the initialization time of the JAXBContexts. :-( We are using Sun's JAXB implementation in the JDK 1.5 and the org.jvnet.jaxb2.mave...

How to find files that match a wildcard string in Java?

This should be really simple. If I have a String like this: ../Test?/sample*.txt then what is a generally-accepted way to get a list of files that match this pattern? (e.g. it should match ../Test1/sample22b.txt and ../Test4/sample-spiffy.txt but not ../Test3/sample2.blah or ../Test44/sample2.txt) I've taken a look at org.apache.comm...

How can I define multiple sessionfactory instances in Spring?

I would like to have multiple Hibernate SessionFactories in a spring application, all of them with identical configurations except for the DataSource. Ideally, I would acquire a particular SessionFactory by name. I need to be able to do this based on runtime state, and it isn't possible to determine which session factories I will need ...

General Question on Large J2EE web application, clearly separate application by modules. Possible use of business delegate pattern

Before I ask my "general" question, I wanted to present some quotes to my high-level general understanding of the business delegate pattern: "You want to hide clients from the complexity of remote communication with business service components." "You want to access the business-tier components from your presentation-tier components and...

What's your experience with adding SSL to Tomcat 6?

Over the weekend we added SSL security to a Tomcat 6 instance that has been running for awhile without error. This morning, after the number of sessions increased on the machine, Tomcat began throwing 500 errors to users. I checked the logs and found an instance of OutOfMemory, followed by dozens of errors related to Google Guice attem...

Java Cross Hatching Texture

Any know how to recreate a cross hashing texture in Java? The C# code belows shows how to accomplish this for the .NET framework. The Java snippet is close, but I've been unable to correctly rotate the lines by 45 degrees. C# HatchBrush crossHatch = new HatchBrush(HatchStyle.Cross, somecolor, somecolor); Java BufferedImage b...

GWT 1.6 project war layout- mixing source code & compiler-generated artifacts?

Having just wrapped up a GWT-1.5 based project, I'm taking a look at what we'll have to do to migrate to 1.6. I'm very surprised to see that GWT seems to want to write its compiled output to the war directory, where you would normally have items under source control. What's the reason behind this? Did Google really think this was a go...

Model shared between two objects

I have three classes interacting in an interesting way. One is a model class, and it has to be accessed by both of the other classes, so a single instance of it is kept as a member of each. Both of these classes interact with the model in different ways. There are a couple of instances where the model object has to be completely throw...

How do I create a mock object for Spring's WebServiceTemplate?

I have a class which calls out to an existing web service. My class properly handles valid results as well as fault strings generated by the web service. The basic call to the web service looks something like this (although this is simplified). public String callWebService(final String inputXml) { String result = null; try { ...

Does it make sense for equals and compareTo to be inconsistent?

Hello! I want to make a class usable in SortedSet | SortedMap. class MyClass implements Comparable<MyClass>{ // the only thing relevant to comparisons: private final String name; //... } The class' instances must be sorted by their name property. However, I don't want equally named instances to be considered as equal. So a So...

How do I get results from Matlab in Java?

I can call a .m file in Matlab from Java and that works fine, but I want to retrieve the results from Matlab and display them in Java. How can I do this? ...

Java is NEVER pass-by-reference, right?...right???

I found an unusual Java method today: private void addShortenedName(ArrayList<String> voiceSetList, String vsName) { if (null == vsName) vsName = ""; else vsName = vsName.trim(); String shortenedVoiceSetName = vsName.substring(0, Math.min(8, vsName.length())); //SCR10638 - Prevent export of empty rows. ...

python versus java runtime footprint

Can anyone point to serious comparison of Python runtime footprint versus Java? Thanks, Avraham ...

Context Sensitive Menus - Java ME

Hello, I'm trying to build a context sensitive based command list. I set the command.ITEM option for all my command buttons. But I couldn't find a way how to provide the following functionality: I have a list of values say A, B,C For A, my command menu should contain 2,4 When I move the selection (cursor) to B, my commands menu should h...

How do you build a simple Eclipse editor with a select set of plugins?

Does anyone have a tutorial for building a custom Eclipse IDE with only a select set of plugins? I am assuming I would need: eclipse.exe some plugins from the plugins directory, some folders from the features directory. My goal is to only include the basic text editor and maybe a couple of other utilities. (Yes, I could just use notep...

Problem with inserting rows into JTable

Hello people. I have problems on inserting rows into a JTable and I don't know what the problem is. I do exactly like this: ((DefaultTableModel)myJTable.getModel()).insertRow(0,webSiteDownloader.getWebSites().toArray()); The webSiteDownloader is one object that have an ArrayList. I can get that array calling the method getWebSites. ...

How to deserialize an object persited in a db now when the obect has different serialVersionUID

My client has an oracle data base and an object was persisted as a blob field via objOutStream.writeObject, the object now has a different serialVersionUID (even though the object has no change, maybe different jvm version) and when they try to de-serialize an exception is thrown: java.io.InvalidClassException: CommissionResult; local c...

Difference between class(java) and closure(javascript)?

I don't understand how closure is more powerful than class. It looks like I can achieve the same behavior of closure using class. Any help would be appreciated ...

What's the best 3D graphics library for Java web apps?

I'm looking for a 3D graphics library for a Java web app. Could use some recommendations - only open source, though. Edit: I don't really care how the graphics are output - Javascript/applets/canvas/flash but I want to write the graphics logic in Java. ...

A Simulator for a non-deterministic Push-Down Automaton

Well, i need to make simulator for non-deterministic Push-Down Automaton. Everything is okey, i know i need to do recursion or something similar. But i do not know how to make that function which would simulate automaton. I got everything else under control, automaton generator, stack ... I am doing it in java, so this is maybe only is...