java

XML instance generation from XML schema (xsd)

I was wondering if there's a way I can automate the generation of XML files from XSD schemas given that I have the data and the labels. I'd like to do this in python/java. It seems very possible, yet I can't find any library that allows me to do this. I'm looking for a fairly quick solution.. Any ideas? See also: how-to-generate-samp...

What is the Best method to http transfer a file from the client to a server, in Java 1.5?

What is the Best method to http transfer a file from the client to a server, in Java 1.5? ...

ejb3-persistence.jar source

Well, I must be brain-damaged, because I can't find the java source for Sun's persistence.jar or JBoss's ejb3-persistence.jar JPA package. They are open-source aren't they? I looked all over the java.sun.com site as well as the GlassFish wiki, but came up empty. I'd like a src.zip or folder like Sun delivers with Java JDKs. Of course...

Cayenne null pointer error when trying to commit changes

I'm running the following code that errors when I try to commit my changes using Cayenne as my ORM. The code is pasted below and errors out on the context.commitChanges();line. The output messages are pasted below the code. Any help on figuring this out would be appreciated. import org.apache.cayenne.access.DataContext; import java...

Learning Java?

Hello, I'm looking to learn Java in the next few weeks and was wondering on a good book to buy. I have little programming experience. I'm looking for something that can give me lots of examples, and at the same time explain concepts well. So I'll throw it out there to the experts, what is the best book to learn java? Thanks in advance....

Does file.delete() return true or false for non-existent file?

In java, does file.delete() return true or false where File file refers to a non-existent file? I realize this is kind of a basic question, and easy to very through test, but I'm getting strange results and would appreciate confirmation. ...

help me translate Java code making use of bytes into jython code

how do I translate this code into jython? ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file + ".zip")); byte[] buf = new byte[1024]; int len; //Create a new Zip entry with the file's name. ZipEntry zipEntry = new ZipEntry(file.toString()); //Create a buffered input stream out of the file ...

Configurable values to MDB annotations

I'm trying to use this method for receiving mail in our EJB3 app. In short, that means creating an MDB with the following annotations: @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "mailServer", propertyValue = "imap.company.com"), @ActivationConfigProperty(propertyName = "mailFolder", propertyValue = ...

Concrete vs. Bounded Parameterized Type when designing a typesafe API

Hi people, I would like to hear from you guys on how do you decide when you should be using concrete parameterized type vs. bounded parameterized type when designing API, esp. (that I care most) of defining a class/interface. For instance, public interface Event<S>{ void setSource(S s); } public interface UserEvent extends EVent<Us...

Java and switch case

Does any one know as to why Java does not allow you to switch on numbers larger than integers? Is there any technical reason behind this? ...

What column type in Oracle can take full range of java double values

What column type in Oracle 10g can be used to store any value of java double up to and including Double.MAX_VALUE and Double.MIN_VALUE? ...

struts property tag to retrieve Object

Is it possible to get an Object's attribute through the property tag in struts? For example, if I have a user object that consist of user name and email, is it possible to modify the code below to have it return the user name and email instead of the whole object? print("<s:iterator value="UserObjects"><tr><td><s:property/></td> </tr><...

Why can't maven find a plugin?

If I type the command: mvn dependency:list The docs suggest that I'll get a list of my project's dependencies. Instead though, I get this: [INFO] Searching repository for plugin with prefix: 'dependency'. [INFO] ----------------------------------------------------------- [ERROR] BUILD FAILURE [INFO] ----------------------------------...

I need help with this error: java.lang.NoSuchMethodError...

I have this Java code (JPA): String queryString = "SELECT b , sum(v.votedPoints) as votedPoint " + " FROM Bookmarks b " + " LEFT OUTER JOIN Votes v " + " on (v.organizationId = b.organizationId) " + "WHERE b.userId = 101 " + ...

How to programatically encrypt/decrypt plain text credentials in JSP?

As as part of my daily routine, I have the misfortune of administering an ancient, once "just internal" JSP web application that relies on the following authentication schema: ... // Validate the user name and password. if ((user != null) && (password != null) && ( (user.equals("brianmay") && password.equals("queen")) || (user....

Which opensource java or .net project has best unit test coverage?

I want to dive more into the unit testing concepts. An open source project which will illustrate the best practices in unit testing is required. ...

How can I get the current date and time in UTC or GMT in Java?

When I create a new Date object, it is initialized to current time but in the local timezone. How can I get a simply the cuurent date and time in the GMT timezone? ...

How to specify the exact number of occurance of a token in ANTLR?

I have to define the grammar of a file like the one shown below. //Sample file NameCount = 4 Name = a Name = b Name = c Name = d //End of file Now I am able to define tokens for NameCount and Name. But i have to define the file structure including the valid number of instances of token Name , which is the value after NameCount. I have ...

SOAP Message Envelope

Hi Guys, Does anybody know if there is a way using java to pass all the XML content of SOAP Envelope to a String? Thanks, ...

Compiling ANTLRWorks generated class files

I am using ANTLRWorks to create ANTLR grammars. I have a valid grammar and the parser and lexer source files are generated as well. I have also tried debugging the generated code and the output is as expected in the debugger output. But when I try to invoke the __Test__ class generated by the debugger nothing is coming up in the conso...