Jay Olsen

+ Follow
since Jan 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jay Olsen


I have an ArrayList of objects which I would like to split into sublists for some processing. My object schema is simple. The ArrayList contains 1-n objects. Each object had the following fields
* id
* value
I would like to split the arrayList into a group of sublists based on the value attribute which can be the same across multiple objects. The result should be something like the following
List value1 = new ArrayList; - which contains
Id1, value1
Id2, value1
Id3, value1
List value2 = new ArrayList; - which contains
Id4, value2
Id5, value2
Id6, value2
Can this be easily achieved in Java? I’ve looked at List.subLists but that does not give me the required functionality because I do not know the indexes beforehand.

Thanks in advance.
13 years ago
That is exactly it. The following syntax works for me

<xsl:value-of select="preceding-sibling::*[number($index)]/@VAL"/>

where $index is the value passed into the style sheet.

Thank you very much.

I run into a strange problem with preceding-sibling in xslt. The issue occurs when I pass in parameters to an xsl style sheet and try to use it with the preceding-sibling expression.

So we have the following xsl fragment

<td ><xsl:value-of select="preceding-sibling::*[$2]/@VAL"/></td>

which steps back 2 and retrieves the VAL node at that line. This works fine however I now want to pass in the value to step back as a parameter to the xsl style sheet. So the xsl fragment changes to the following with the $index value passed when the script is called.

<td ><xsl:value-of select="preceding-sibling::*[$index]/@VAL"/></td>

and call the style sheet as follows

<param name="index" expression="2"/>

However, the preceding-sibling statement does not work when the value is passed in like this and no step back takes place.

If I print out the value of index in the xsl templates using the following

<xsl:value-of select='$index' />

I get the correct value.

If I declare the index variable in the xsl style sheet itself as follows

<xsl:variable name="index" select="2"/>

it works fine when passed to the preceding-sibling.

What is different between the passed in variable and the global variable declared in the style sheet?

Any help greatly appreciated.

I've previously used JMS with Websphere for messaging between application. I now however use Tomcat as my runtime environment. I got my application to work using documentation available here http://wiki.apache.org/tomcat/HowTo#head-b45c4c0b8c57d9efa1e9c5342650d5e534f55cfa. However, my question is, when using tomcat, I do not have managed connection & session pools. Is this something I would need to code in my application to optimize performance?

Another option would be to take the security creditionals out of the code and specify them using JAAS which can then be applied to the QCF.
15 years ago

I have a wsdl which imports another wsdl using <wsdl:import…/>. I want to customize package declarations for generated artifacts differently for each wsdl when I run wsimport.

I can do this both inline and external customization for the primary wsdl but not for the imported wsdl. The customizations on the primary wsdl result in customizations for the import wsdl being ignore.

Is it possible to do such customizations on an imported wsdl?

Any help greatly appreciated.
15 years ago
Thanks for your reply. I managed to resolve the issue using a combination of both JAX-WS and JAXB binding files when using wsimport. The implementation above only used jaxb customizations which generated schema types artifacts. However, the generated artifacts for the service endpoint interface and the port accessor methods where being generated in a package structure relating to their target namespace in the wsdl. To override/customize this behavior, a JAX-WS binding file is required. This bindings file is basic, specifying the wsdl location and the package where the generated artifacts should be placed.
15 years ago

Apologies if this is a novice question, I’m new to this area. I’m using wsimport to generate java artifacts from wsdl. I got a simple wsdl from a netbeans tutorial at the following link. http://www.netbeans.org/images/articles/jaxws/CreditReportSimple.wsdl. Using the following wsimport command, the artifacts are generated successfully.

The artifacts are created in the org.netbeans.j2ee.wsdl.creditreport which is the target namespace for the wsdl file. If I want to customize the package, I can use the following wsimport command

Running this command outputs all the java artifacts in the com.test package. However, my ultimate goal is to use a jaxb binding file to customize the wsimport output. Therefore, I created a binding file to do the package customization. That file contains the following

Then, I run the following command

For some reason, this only partially works. Some of the artifacts are generated in com.test package and more are generated in the org.netbeans.j2ee.wsdl.creditreport. Can someone explain what is wrong with my jaxb bindings file? Why does the customization not apply to all the generated artifacts?

Thanks in advance
15 years ago

I set up a connection to my datasource in Websphere. This is then configured in my application using the spring config below. As you can see it uses JNDI to look up the resource.

When I use Oracle, the above configuration works beautifully and when I do a database insert, the data is committed to the database. However, when I change to MS SQL Server using the OPTA driver, the code executes successfully, however, the data never appears in the database. It looks like commit is never called on the datasource.

How can I get my datasource to commit the changes following completion of the task?

Any help greatly appreciated.

I'm just wondering if any method exists in Java where I can pass a value of type object and it will check to see if the type is primitive or String. Basically I want to avoid other objects such as collections, reference objects etc. Currently I have the following code

which will only use the value if it is a String or primitive. However, I also have to check if the value is null because a String could be null etc. This is not ideal.

Does anyone know of a method/utility class which could be used to check if the type of the object is of String or primitive. E.g. something like the following

15 years ago