You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/10/25 19:10:56 UTC
svn commit: r588283 [2/18] - in /incubator/cxf/branches/jliu: ./ api/
api/src/main/java/org/apache/cxf/databinding/
api/src/main/java/org/apache/cxf/io/
api/src/main/java/org/apache/cxf/message/
api/src/main/java/org/apache/cxf/phase/ api/src/main/java...
Modified: incubator/cxf/branches/jliu/api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/pom.xml (original)
+++ incubator/cxf/branches/jliu/api/pom.xml Thu Oct 25 10:09:20 2007
@@ -80,7 +80,6 @@
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
- <version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/databinding/DataBinding.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/databinding/DataBinding.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/databinding/DataBinding.java Thu Oct 25 10:09:20 2007
@@ -19,6 +19,8 @@
package org.apache.cxf.databinding;
+import java.util.Map;
+
import org.apache.cxf.service.Service;
public interface DataBinding {
@@ -37,5 +39,12 @@
* @param service
*/
void initialize(Service service);
+
+ /**
+ * Return a set of mappings from namespace to prefix to allow bindings to control
+ * the prefixes.
+ * @return the map, or null if there are none.
+ */
+ Map<String, String> getDeclaredNamespaceMappings();
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Thu Oct 25 10:09:20 2007
@@ -29,20 +29,44 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
public class CachedOutputStream extends OutputStream {
+ private static final File DEFAULT_TEMP_DIR;
+ private static final int DEFAULT_THRESHOLD;
+ static {
+ String s = System.getProperty("org.apache.cxf.io.CachedOutputStream.Threshold",
+ "-1");
+ int i = Integer.parseInt(s);
+ if (i <= 0) {
+ i = 64 * 1024;
+ }
+ DEFAULT_THRESHOLD = i;
+
+ s = System.getProperty("org.apache.cxf.io.CachedOutputStream.OutputDirectory");
+ if (s != null) {
+ File f = new File(s);
+ if (f.exists() && f.isDirectory()) {
+ DEFAULT_TEMP_DIR = f;
+ } else {
+ DEFAULT_TEMP_DIR = null;
+ }
+ } else {
+ DEFAULT_TEMP_DIR = null;
+ }
+ }
protected OutputStream currentStream;
- private long threshold = 64 * 1024;
+ private long threshold = DEFAULT_THRESHOLD;
private int totalLength;
@@ -50,7 +74,7 @@
private File tempFile;
- private File outputDir;
+ private File outputDir = DEFAULT_TEMP_DIR;
private List<CachedOutputStreamCallback> callbacks;
@@ -60,7 +84,13 @@
}
public CachedOutputStream() {
- currentStream = new ByteArrayOutputStream(2048);
+ currentStream = new LoadingByteArrayOutputStream(2048);
+ inmem = true;
+ }
+
+ public CachedOutputStream(long threshold) {
+ this.threshold = threshold;
+ currentStream = new LoadingByteArrayOutputStream(2048);
inmem = true;
}
@@ -105,6 +135,13 @@
protected void doClose() throws IOException {
}
+
+ /**
+ * Perform any actions required after stream closure (close the other related stream etc.)
+ */
+ protected void postClose() throws IOException {
+
+ }
public void close() throws IOException {
currentStream.flush();
@@ -114,9 +151,11 @@
}
}
+ doClose();
currentStream.close();
dispose();
- doClose();
+ postClose();
+
}
public boolean equals(Object obj) {
@@ -138,7 +177,7 @@
if (currentStream instanceof CachedOutputStream) {
CachedOutputStream ac = (CachedOutputStream) currentStream;
InputStream in = ac.getInputStream();
- copyStream(in, out, (int) threshold);
+ IOUtils.copyAndCloseInput(in, out);
} else {
if (inmem) {
if (currentStream instanceof ByteArrayOutputStream) {
@@ -148,7 +187,7 @@
}
} else if (currentStream instanceof PipedOutputStream) {
PipedOutputStream pipeOut = (PipedOutputStream) currentStream;
- copyStream(new PipedInputStream(pipeOut), out, (int) threshold);
+ IOUtils.copyAndCloseInput(new PipedInputStream(pipeOut), out);
} else {
throw new IOException("Unknown format of currentStream");
}
@@ -157,40 +196,111 @@
currentStream.close();
FileInputStream fin = new FileInputStream(tempFile);
if (copyOldContent) {
- copyStream(fin, out, (int) threshold);
+ IOUtils.copyAndCloseInput(fin, out);
}
+ tempFile.delete();
+ tempFile = null;
+ inmem = true;
}
}
currentStream = out;
}
public static void copyStream(InputStream in, OutputStream out, int bufferSize) throws IOException {
- byte[] buffer = new byte[bufferSize];
- try {
- int n = in.read(buffer);
- while (n > 0) {
- out.write(buffer, 0, n);
- n = in.read(buffer);
+ IOUtils.copyAndCloseInput(in, out, bufferSize);
+ }
+
+ public int size() {
+ return totalLength;
+ }
+
+ public byte[] getBytes() throws IOException {
+ flush();
+ if (inmem) {
+ if (currentStream instanceof ByteArrayOutputStream) {
+ return ((ByteArrayOutputStream)currentStream).toByteArray();
+ } else {
+ throw new IOException("Unknown format of currentStream");
}
- } finally {
- in.close();
+ } else {
+ // read the file
+ FileInputStream fin = new FileInputStream(tempFile);
+ return IOUtils.readBytesFromStream(fin);
}
}
-
- public static void copyStreamWithBase64Encoding(InputStream in, OutputStream out, int bufferSize)
- throws Exception {
- OutputStreamWriter osw = new OutputStreamWriter(out);
- byte[] buffer = new byte[bufferSize];
- try {
- int n = in.read(buffer, 0, bufferSize);
- while (n > 0) {
- Base64Utility.encode(buffer, 0, n, osw);
- n = in.read(buffer, 0, bufferSize);
+
+ public void writeCacheTo(OutputStream out) throws IOException {
+ flush();
+ if (inmem) {
+ if (currentStream instanceof ByteArrayOutputStream) {
+ ((ByteArrayOutputStream)currentStream).writeTo(out);
+ } else {
+ throw new IOException("Unknown format of currentStream");
}
- } finally {
- in.close();
+ } else {
+ // read the file
+ FileInputStream fin = new FileInputStream(tempFile);
+ IOUtils.copyAndCloseInput(fin, out);
}
}
+ public void writeCacheTo(StringBuilder out, int limit) throws IOException {
+ flush();
+ if (totalLength < limit
+ || limit == -1) {
+ writeCacheTo(out);
+ return;
+ }
+
+ int count = 0;
+ if (inmem) {
+ if (currentStream instanceof ByteArrayOutputStream) {
+ byte bytes[] = ((ByteArrayOutputStream)currentStream).toByteArray();
+ out.append(new String(bytes, 0, limit));
+ } else {
+ throw new IOException("Unknown format of currentStream");
+ }
+ } else {
+ // read the file
+ FileInputStream fin = new FileInputStream(tempFile);
+ byte bytes[] = new byte[1024];
+ int x = fin.read(bytes);
+ while (x != -1) {
+ if ((count + x) > limit) {
+ x = count - limit;
+ }
+ out.append(new String(bytes, 0, x));
+ count += x;
+
+ if (count >= limit) {
+ x = -1;
+ } else {
+ x = fin.read(bytes);
+ }
+ }
+ fin.close();
+ }
+ }
+ public void writeCacheTo(StringBuilder out) throws IOException {
+ flush();
+ if (inmem) {
+ if (currentStream instanceof ByteArrayOutputStream) {
+ out.append(((ByteArrayOutputStream)currentStream).toString());
+ } else {
+ throw new IOException("Unknown format of currentStream");
+ }
+ } else {
+ // read the file
+ FileInputStream fin = new FileInputStream(tempFile);
+ byte bytes[] = new byte[1024];
+ int x = fin.read(bytes);
+ while (x != -1) {
+ out.append(new String(bytes, 0, x));
+ x = fin.read(bytes);
+ }
+ fin.close();
+ }
+ }
+
/**
* @return the underlying output stream
@@ -204,11 +314,15 @@
}
public String toString() {
- return new StringBuilder().append("[")
- .append(super.toString())
- .append(" Content: ")
- .append(currentStream.toString())
- .append("]").toString();
+ StringBuilder builder = new StringBuilder().append("[")
+ .append(CachedOutputStream.class.getName())
+ .append(" Content: ");
+ try {
+ writeCacheTo(builder);
+ } catch (IOException e) {
+ //ignore
+ }
+ return builder.append("]").toString();
}
protected void onWrite() throws IOException {
@@ -243,26 +357,28 @@
}
private void createFileOutputStream() throws IOException {
- byte[] bytes = ((ByteArrayOutputStream) currentStream).toByteArray();
+ ByteArrayOutputStream bout = (ByteArrayOutputStream)currentStream;
if (outputDir == null) {
- tempFile = File.createTempFile("att", "tmp");
+ tempFile = FileUtils.createTempFile("cos", "tmp");
} else {
- tempFile = File.createTempFile("att", "tmp", outputDir);
+ tempFile = FileUtils.createTempFile("cos", "tmp", outputDir, false);
}
- tempFile.deleteOnExit();
+
currentStream = new BufferedOutputStream(new FileOutputStream(tempFile));
- currentStream.write(bytes);
+ bout.writeTo(currentStream);
inmem = false;
}
public File getTempFile() {
- return tempFile;
+ return tempFile != null && tempFile.exists() ? tempFile : null;
}
public InputStream getInputStream() throws IOException {
flush();
if (inmem) {
- if (currentStream instanceof ByteArrayOutputStream) {
+ if (currentStream instanceof LoadingByteArrayOutputStream) {
+ return ((LoadingByteArrayOutputStream) currentStream).createInputStream();
+ } else if (currentStream instanceof ByteArrayOutputStream) {
return new ByteArrayInputStream(((ByteArrayOutputStream) currentStream).toByteArray());
} else if (currentStream instanceof PipedOutputStream) {
return new PipedInputStream((PipedOutputStream) currentStream);
@@ -274,7 +390,10 @@
return new FileInputStream(tempFile) {
public void close() throws IOException {
super.close();
- tempFile.delete();
+ if (tempFile != null) {
+ tempFile.delete();
+ //tempFile = null;
+ }
currentStream = new ByteArrayOutputStream();
inmem = true;
}
@@ -286,8 +405,9 @@
}
public void dispose() {
- if (!inmem) {
+ if (!inmem && tempFile != null) {
tempFile.delete();
+ //tempFile = null;
}
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/message/MessageContentsList.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/message/MessageContentsList.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/message/MessageContentsList.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/message/MessageContentsList.java Thu Oct 25 10:09:20 2007
@@ -59,7 +59,7 @@
private void ensureSize(int idx) {
while (idx >= size()) {
- add(null);
+ add(REMOVED_MARKER);
}
}
@@ -69,6 +69,9 @@
}
public boolean hasValue(MessagePartInfo key) {
+ if (key.getIndex() >= size()) {
+ return false;
+ }
return super.get(key.getIndex()) != REMOVED_MARKER;
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Thu Oct 25 10:09:20 2007
@@ -47,13 +47,13 @@
* PhaseInterceptors can supply a Collection of IDs which they should run before
* or after, supplying fine grained ordering.
* <p>
- *
+ *
*/
public class PhaseInterceptorChain implements InterceptorChain {
- private static final Logger LOG = LogUtils.getL7dLogger(PhaseInterceptorChain.class);
+ private static final Logger LOG = LogUtils.getL7dLogger(PhaseInterceptorChain.class);
+
-
private final Map<String, Integer> nameMap;
private final Phase phases[];
@@ -61,32 +61,32 @@
private InterceptorHolder tails[];
private boolean hasAfters[];
-
+
private State state;
private Message pausedMessage;
private MessageObserver faultObserver;
private PhaseInterceptorIterator iterator;
-
+
// currently one chain for one request/response, use below as signal to avoid duplicate fault processing
// on nested calling of doIntercept(), which will throw same fault multi-times
private boolean faultOccurred;
-
-
+
+
private PhaseInterceptorChain(PhaseInterceptorChain src) {
//only used for clone
state = State.EXECUTING;
-
+
//immutable, just repoint
nameMap = src.nameMap;
phases = src.phases;
-
+
int length = phases.length;
hasAfters = new boolean[length];
System.arraycopy(src.hasAfters, 0, hasAfters, 0, length);
-
+
heads = new InterceptorHolder[length];
tails = new InterceptorHolder[length];
-
+
InterceptorHolder last = null;
for (int x = 0; x < length; x++) {
InterceptorHolder ih = src.heads[x];
@@ -106,10 +106,10 @@
}
}
}
-
+
public PhaseInterceptorChain(SortedSet<Phase> ps) {
state = State.EXECUTING;
-
+
int numPhases = ps.size();
phases = new Phase[numPhases];
nameMap = new HashMap<String, Integer>();
@@ -117,19 +117,19 @@
heads = new InterceptorHolder[numPhases];
tails = new InterceptorHolder[numPhases];
hasAfters = new boolean[numPhases];
-
+
int idx = 0;
for (Phase phase : ps) {
- phases[idx] = phase;
+ phases[idx] = phase;
nameMap.put(phase.getName(), idx);
++idx;
}
}
-
+
public PhaseInterceptorChain cloneChain() {
return new PhaseInterceptorChain(this);
}
-
+
private void updateIterator() {
if (iterator == null) {
iterator = new PhaseInterceptorIterator(heads);
@@ -137,7 +137,7 @@
//System.out.println(toString());
}
}
-
+
public void add(Collection<Interceptor> newhandlers) {
add(newhandlers, false);
}
@@ -155,7 +155,7 @@
public void add(Interceptor i) {
add(i, false);
}
-
+
public void add(Interceptor i, boolean force) {
PhaseInterceptor pi = (PhaseInterceptor)i;
@@ -164,12 +164,12 @@
}
String phaseName = pi.getPhase();
-
+
Integer phase = nameMap.get(phaseName);
if (phase == null) {
LOG.fine("Phase " + phaseName + " does not exist. Skipping handler "
+ i.getClass().getName());
- } else {
+ } else {
insertInterceptor(phase, pi, force);
}
}
@@ -187,28 +187,28 @@
/**
* Intercept a message, invoking each phase's handlers in turn.
- *
- * @param message the message
+ *
+ * @param message the message
* @throws Exception
*/
@SuppressWarnings("unchecked")
public synchronized boolean doIntercept(Message message) {
updateIterator();
-
+
pausedMessage = message;
while (state == State.EXECUTING && iterator.hasNext()) {
try {
Interceptor currentInterceptor = iterator.next();
-
+
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Invoking handleMessage on interceptor " + currentInterceptor);
}
//System.out.println("-----------" + currentInterceptor);
currentInterceptor.handleMessage(message);
-
+
} catch (RuntimeException ex) {
if (!faultOccurred) {
-
+
faultOccurred = true;
if (LOG.isLoggable(Level.INFO)) {
LogUtils.log(LOG, Level.INFO, "Interceptor has thrown exception, unwinding now", ex);
@@ -217,28 +217,28 @@
message.setContent(Exception.class, ex);
if (message.getExchange() != null) {
message.getExchange().put(Exception.class, ex);
- }
+ }
unwind(message);
-
+
if (faultObserver != null) {
faultObserver.onMessage(message);
}
}
state = State.ABORTED;
- }
+ }
}
if (state == State.EXECUTING) {
state = State.COMPLETE;
}
return state == State.COMPLETE;
}
-
+
/**
* Intercept a message, invoking each phase's handlers in turn,
* starting after the specified interceptor.
- *
+ *
* @param message the message
- * @param startingAfterInterceptorID the id of the interceptor
+ * @param startingAfterInterceptorID the id of the interceptor
* @throws Exception
*/
@SuppressWarnings("unchecked")
@@ -257,9 +257,9 @@
/**
* Intercept a message, invoking each phase's handlers in turn,
* starting at the specified interceptor.
- *
+ *
* @param message the message
- * @param startingAtInterceptorID the id of the interceptor
+ * @param startingAtInterceptorID the id of the interceptor
* @throws Exception
*/
@SuppressWarnings("unchecked")
@@ -285,7 +285,7 @@
iterator.reset();
}
}
-
+
@SuppressWarnings("unchecked")
private void unwind(Message message) {
while (iterator.hasPrevious()) {
@@ -346,13 +346,13 @@
}
}
}
-
+
private void insertInterceptor(int phase, PhaseInterceptor interc, boolean force) {
InterceptorHolder ih = new InterceptorHolder(interc, phase);
if (heads[phase] == null) {
heads[phase] = ih;
tails[phase] = ih;
-
+
int idx = phase - 1;
while (idx >= 0) {
if (tails[idx] != null) {
@@ -377,7 +377,7 @@
}
++idx;
}
-
+
if (idx != heads.length) {
//found something after us
ih.next = heads[idx];
@@ -386,16 +386,16 @@
}
hasAfters[phase] = !interc.getAfter().isEmpty();
} else {
-
+
Set beforeList = interc.getBefore();
Set afterList = interc.getAfter();
InterceptorHolder before = null;
InterceptorHolder after = null;
-
+
String id = interc.getId();
if (hasAfters[phase]
|| !beforeList.isEmpty()) {
-
+
InterceptorHolder ih2 = heads[phase];
while (ih2 != tails[phase].next) {
PhaseInterceptor cmp = ih2.interceptor;
@@ -406,8 +406,8 @@
|| cmp.getAfter().contains(id))) {
//first one we need to be before
before = ih2;
- }
- if (cmpId != null
+ }
+ if (cmpId != null
&& afterList.contains(cmpId)) {
after = ih2;
}
@@ -431,12 +431,12 @@
}
ih2 = ih2.next;
}
-
+
//System.out.print("Skipped: " + phase.toString());
//System.out.println(" " + interc.getId());
}
hasAfters[phase] |= !afterList.isEmpty();
-
+
if (before == null) {
//just add at the end
ih.prev = tails[phase];
@@ -455,7 +455,7 @@
}
ih.next = before;
before.prev = ih;
-
+
if (heads[phase] == before) {
heads[phase] = ih;
}
@@ -467,26 +467,26 @@
}
public String toString() {
- return toString("");
+ return toString("");
}
private String toString(String message) {
StringBuilder chain = new StringBuilder();
-
+
chain.append("Chain ")
.append(super.toString())
.append(message)
.append(". Current flow:\n");
-
+
for (int x = 0; x < phases.length; x++) {
if (heads[x] != null) {
chain.append(" ");
printPhase(x, chain);
- }
+ }
}
return chain.toString();
}
private void printPhase(int ph, StringBuilder chain) {
-
+
chain.append(phases[ph].getName())
.append(" [");
InterceptorHolder i = heads[ph];
@@ -502,7 +502,7 @@
}
chain.append("]\n");
}
-
+
private void outputChainToLog(boolean modified) {
if (LOG.isLoggable(Level.FINE)) {
if (modified) {
@@ -512,30 +512,30 @@
}
}
}
-
+
public MessageObserver getFaultObserver() {
return faultObserver;
}
-
+
public void setFaultObserver(MessageObserver faultObserver) {
this.faultObserver = faultObserver;
}
-
+
static final class PhaseInterceptorIterator implements ListIterator<Interceptor<? extends Message>> {
InterceptorHolder heads[];
InterceptorHolder prev;
InterceptorHolder first;
-
+
public PhaseInterceptorIterator(InterceptorHolder h[]) {
heads = h;
first = findFirst();
}
-
+
public void reset() {
prev = null;
first = findFirst();
}
-
+
private InterceptorHolder findFirst() {
for (int x = 0; x < heads.length; x++) {
if (heads[x] != null) {
@@ -544,8 +544,8 @@
}
return null;
}
-
-
+
+
public boolean hasNext() {
if (prev == null) {
return first != null;
@@ -582,7 +582,7 @@
}
return prev;
}
-
+
public boolean hasPrevious() {
return prev != null;
}
@@ -595,7 +595,7 @@
prev = prev.prev;
return tmp.interceptor;
}
-
+
public int nextIndex() {
throw new UnsupportedOperationException();
}
@@ -613,13 +613,13 @@
}
}
-
+
static final class InterceptorHolder {
PhaseInterceptor interceptor;
InterceptorHolder next;
InterceptorHolder prev;
int phaseIdx;
-
+
InterceptorHolder(PhaseInterceptor i, int p) {
interceptor = i;
phaseIdx = p;
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java Thu Oct 25 10:09:20 2007
@@ -75,7 +75,7 @@
}
public QName getMessagePartQName(String name) {
- return new QName(this.getOperation().getInterface().getService().getTargetNamespace(), name);
+ return new QName(this.getOperation().getInterface().getName().getNamespaceURI(), name);
}
public MessagePartInfo addMessagePart(String name) {
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/OperationInfo.java Thu Oct 25 10:09:20 2007
@@ -181,6 +181,10 @@
}
return null;
}
+
+ public boolean hasFaults() {
+ return faults != null && faults.size() > 0;
+ }
/**
* Returns all faults for this operation.
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Thu Oct 25 10:09:20 2007
@@ -21,8 +21,12 @@
import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaElement;
@@ -68,6 +72,31 @@
}
public Element getElement() {
+ if (element == null && getSchema() != null) {
+ CachedOutputStream cout = new CachedOutputStream();
+ getSchema().write(cout);
+ Document sdoc = null;
+ try {
+ sdoc = XMLUtils.parse(cout.getInputStream());
+ cout.close();
+ } catch (Exception e1) {
+ return null;
+ }
+
+ Element e = sdoc.getDocumentElement();
+ // XXX A problem can occur with the ibm jdk when the XmlSchema
+ // object is serialized. The xmlns declaration gets incorrectly
+ // set to the same value as the targetNamespace attribute.
+ // The aegis databinding tests demonstrate this particularly.
+ if (e.getPrefix() == null
+ && !WSDLConstants.NU_SCHEMA_XSD.equals(e.getAttributeNS(WSDLConstants.NU_XMLNS,
+ WSDLConstants.NP_XMLNS))) {
+ e.setAttributeNS(WSDLConstants.NU_XMLNS,
+ WSDLConstants.NP_XMLNS,
+ WSDLConstants.NU_SCHEMA_XSD);
+ }
+ setElement(e);
+ }
return element;
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java Thu Oct 25 10:09:20 2007
@@ -21,11 +21,14 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.service.Service;
import org.apache.ws.commons.schema.XmlSchemaAnnotated;
@@ -64,7 +67,39 @@
BindingInfo service = ep.getEndpointInfo().getBinding();
return service.getOperation(opName);
}
-
+ public static BindingOperationInfo getOperationForWrapperElement(Exchange exchange,
+ QName opName,
+ boolean output) {
+
+ Endpoint ep = exchange.get(Endpoint.class);
+ BindingInfo service = ep.getEndpointInfo().getBinding();
+ Map<QName, BindingOperationInfo> wrapperMap =
+ CastUtils.cast(service.getProperty("ServiceModel.WRAPPER.MAP"
+ + (output ? "" : "_OUT"), Map.class));
+
+
+ if (wrapperMap == null) {
+ wrapperMap = new HashMap<QName, BindingOperationInfo>();
+ for (BindingOperationInfo b : service.getOperations()) {
+ if (b.isUnwrappedCapable()) {
+ MessagePartInfo part = null;
+ if (output && b.getOutput() != null
+ && !b.getOutput().getMessageParts().isEmpty()) {
+ part = b.getOutput().getMessageParts().get(0);
+ } else if (!output
+ && !b.getInput().getMessageParts().isEmpty()) {
+ part = b.getInput().getMessageParts().get(0);
+ }
+ if (part != null) {
+ wrapperMap.put(part.getConcreteName(), b);
+ }
+ }
+ }
+ service.setProperty("ServiceModel.WRAPPER.MAP"
+ + (output ? "" : "_OUT"), wrapperMap);
+ }
+ return wrapperMap.get(opName);
+ }
public static SchemaInfo getSchema(ServiceInfo serviceInfo, MessagePartInfo messagePartInfo) {
SchemaInfo schemaInfo = null;
String tns = null;
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Thu Oct 25 10:09:20 2007
@@ -28,6 +28,11 @@
public static final String SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
public static final String WSDL_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/";
+
+ /**
+ * Tools permit caller to pass in additional bean definitions.
+ */
+ public static final String CFG_BEAN_CONFIG = "beans";
public static final String DEFAULT_TEMP_DIR = "gen_tmp";
public static final String CFG_OUTPUTDIR = "outputdir";
@@ -61,11 +66,12 @@
public static final String CFG_VALIDATE_WSDL = "validate";
public static final String CFG_CREATE_XSD_IMPORTS = "createxsdimports";
-
+ /**
+ * Front-end selection command-line option to java2ws.
+ */
public static final String CFG_FRONTEND = "frontend";
- public static final String CFG_DATABINDING = "db";
-
+ public static final String CFG_DATABINDING = "databinding";
// WSDL2Java Constants
@@ -213,9 +219,19 @@
//For java2ws tool
public static final String SERVICE_LIST = "serviceList";
public static final String GEN_FROM_SEI = "genFromSEI";
+ public static final String JAXWS_FRONTEND = "jaxws";
+ public static final String SIMPLE_FRONTEND = "simple";
+ public static final String JAXB_DATABINDING = "jaxb";
+ public static final String AEGIS_DATABINDING = "aegis";
//For Simple FrontEnd
public static final String SEI_CLASS = "seiClass";
public static final String IMPL_CLASS = "implClass";
public static final String SERVICE_NAME = "serviceName";
public static final String PORT_NAME = "portName";
+ public static final String DEFAULT_DATA_BINDING_NAME = "jaxb";
+ public static final String DATABIND_BEAN_NAME_SUFFIX = "DatabindingBean";
+
+
+ public static final String CLIENT_CLASS = "clientClass";
+ public static final String SERVER_CLASS = "serverClass";
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/transport/ConduitInitiator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/transport/ConduitInitiator.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/transport/ConduitInitiator.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/transport/ConduitInitiator.java Thu Oct 25 10:09:20 2007
@@ -20,6 +20,7 @@
package org.apache.cxf.transport;
import java.io.IOException;
+import java.util.List;
import java.util.Set;
import org.apache.cxf.service.model.EndpointInfo;
@@ -49,4 +50,5 @@
EndpointReferenceType target) throws IOException;
Set<String> getUriPrefixes();
+ List<String> getTransportIds();
}
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Thu Oct 25 10:09:20 2007
@@ -28,12 +28,16 @@
*/
public final class PolicyConstants implements BusExtension {
- public static final String NAMESPACE_XMLSOAP_200409
- = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+ public static final String NAMESPACE_WS_POLICY
+ = "http://www.w3.org/ns/ws-policy";
public static final String NAMESPACE_W3_200607
= "http://www.w3.org/2006/07/ws-policy";
+ public static final String NAMESPACE_XMLSOAP_200409
+ = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+
+
public static final String CLIENT_POLICY_OUT_INTERCEPTOR_ID
= "org.apache.cxf.ws.policy.ClientPolicyOutInterceptor";
public static final String CLIENT_POLICY_IN_INTERCEPTOR_ID
@@ -106,7 +110,7 @@
public PolicyConstants() {
- setNamespace(NAMESPACE_W3_200607);
+ setNamespace(NAMESPACE_WS_POLICY);
}
public Class<?> getRegistrationType() {
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/JAXBExtensionHelper.java Thu Oct 25 10:09:20 2007
@@ -73,7 +73,8 @@
JAXBExtensionHelper helper = new JAXBExtensionHelper(cls);
try {
- Class<?> objectFactory = Class.forName(PackageUtils.getPackageName(cls) + ".ObjectFactory");
+ Class<?> objectFactory = Class.forName(PackageUtils.getPackageName(cls) + ".ObjectFactory",
+ true, cls.getClassLoader());
Method methods[] = objectFactory.getDeclaredMethods();
for (Method method : methods) {
if (method.getParameterTypes().length == 1
@@ -85,15 +86,10 @@
registry.registerDeserializer(parentType, elementType, helper);
registry.registerSerializer(parentType, elementType, helper);
registry.mapExtensionTypes(parentType, elementType, cls);
- registry.createExtension(parentType, elementType);
}
}
}
- } catch (WSDLException we) {
- // TODO
- we.printStackTrace();
-
} catch (ClassNotFoundException ex) {
// TODO
ex.printStackTrace();
@@ -136,7 +132,9 @@
Object mObj = obj;
- Class<?> objectFactory = Class.forName(PackageUtils.getPackageName(typeClass) + ".ObjectFactory");
+ Class<?> objectFactory = Class.forName(PackageUtils.getPackageName(typeClass) + ".ObjectFactory",
+ true,
+ obj.getClass().getClassLoader());
Method methods[] = objectFactory.getDeclaredMethods();
for (Method method : methods) {
if (method.getParameterTypes().length == 1
Modified: incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/WSDLConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/WSDLConstants.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/WSDLConstants.java (original)
+++ incubator/cxf/branches/jliu/api/src/main/java/org/apache/cxf/wsdl/WSDLConstants.java Thu Oct 25 10:09:20 2007
@@ -123,6 +123,8 @@
public static final String ATTR_LOCATION = "location";
public static final String ATTR_NAME = "name";
public static final String ATTR_TNS = "targetNamespace";
+ // usual prefix for the targetNamespace.
+ public static final String CONVENTIONAL_TNS_PREFIX = "tns";
public static final String WSDL11 = "1.1";
public static final String WSDL20 = "2.0";
Modified: incubator/cxf/branches/jliu/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java (original)
+++ incubator/cxf/branches/jliu/api/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilderTest.java Thu Oct 25 10:09:20 2007
@@ -27,9 +27,11 @@
import org.w3c.dom.Element;
+import org.apache.cxf.Bus;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
import org.apache.cxf.ws.policy.PolicyException;
import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
@@ -67,7 +69,7 @@
}
@Test
- public void testBuildFail() throws Exception {
+ public void testBuildFailOlderNs() throws Exception {
String data =
"<wsam:Addressing wsp:Optional=\"true\""
+ " xmlns:wsp=\"http://www.w3.org/2006/07/ws-policy\""
@@ -82,7 +84,25 @@
}
@Test
- public void testBuild() throws Exception {
+ public void testBuildDefaultNs() throws Exception {
+ String data =
+ "<wsam:Addressing wsp:Optional=\"true\""
+ + " xmlns:wsp=\"http://www.w3.org/ns/ws-policy\""
+ + " xmlns:wsam=\"http://www.w3.org/2007/01/addressing/metadata\">"
+ + "<wsp:Policy/></wsam:Addressing>";
+
+ Policy nested = control.createMock(Policy.class);
+ EasyMock.expect(builder.getPolicy(EasyMock.isA(Element.class))).andReturn(nested);
+ control.replay();
+ NestedPrimitiveAssertion npc = (NestedPrimitiveAssertion)npab.build(getElement(data));
+ assertEquals(TEST_NAME1, npc.getName());
+ assertSame(nested, npc.getNested());
+ assertTrue(npc.isOptional());
+ control.verify();
+ }
+
+ @Test
+ public void testBuildOlderNs() throws Exception {
String data =
"<wsam:Addressing wsp:Optional=\"true\""
+ " xmlns:wsp=\"http://www.w3.org/2006/07/ws-policy\""
@@ -91,7 +111,14 @@
Policy nested = control.createMock(Policy.class);
EasyMock.expect(builder.getPolicy(EasyMock.isA(Element.class))).andReturn(nested);
+
+ PolicyConstants pc = new PolicyConstants();
+ pc.setNamespace(PolicyConstants.NAMESPACE_W3_200607);
+ Bus bus = control.createMock(Bus.class);
+ EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(pc);
control.replay();
+
+ npab.setBus(bus);
NestedPrimitiveAssertion npc = (NestedPrimitiveAssertion)npab.build(getElement(data));
assertEquals(TEST_NAME1, npc.getName());
assertSame(nested, npc.getNested());
Modified: incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server (original)
+++ incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server Thu Oct 25 10:09:20 2007
@@ -1,3 +1,21 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
cd ../
if [ -e /usr/lib/libumem.so.1 ]; then
Modified: incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server.bat
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server.bat?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server.bat (original)
+++ incubator/cxf/branches/jliu/benchmark/performance/soap_http_doc_lit/bin/run_server.bat Thu Oct 25 10:09:20 2007
@@ -1,2 +1,19 @@
+rem Licensed to the Apache Software Foundation (ASF) under one
+rem or more contributor license agreements. See the NOTICE file
+rem distributed with this work for additional information
+rem regarding copyright ownership. The ASF licenses this file
+rem to you under the Apache License, Version 2.0 (the
+rem "License"); you may not use this file except in compliance
+rem with the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing,
+rem software distributed under the License is distributed on an
+rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+rem KIND, either express or implied. See the License for the
+rem specific language governing permissions and limitations
+rem under the License.
+
cd ..
ant server
Modified: incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-checkstyle.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-checkstyle.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-checkstyle.xml (original)
+++ incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-checkstyle.xml Thu Oct 25 10:09:20 2007
@@ -1,287 +1,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
-Checks to make sure the code meets the CXF coding guidelines which
-are similar to the Sun guidelines at:
-http://java.sun.com/docs/codeconv/index.html
-
-It also enforces aa bunch of other "BestPractices like method
-lengths, if/try depths, etc...
+ Checks to make sure the code meets the CXF coding guidelines which
+ are similar to the Sun guidelines at:
+ http://java.sun.com/docs/codeconv/index.html
+
+ It also enforces aa bunch of other "BestPractices like method
+ lengths, if/try depths, etc...
-->
<module name="Checker">
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <!--
- <module name="NewlineAtEndOfFile"/>
- -->
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
-
- <!--<module name="StrictDuplicateCode"/>-->
-
- <module name="TreeWalker">
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <!--
- <module name="PackageHtml"/>
- <module name="JavadocMethod"/>
- <module name="JavadocType"/>
- <module name="JavadocVariable"/>
- <module name="JavadocStyle"/>
- -->
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MemberName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
-
- <!-- Header checks -->
- <module name="Header">
- <property name="header"
- value="/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n"/>
- </module>
- <!-- <module name="RegexpHeader"/> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport">
- <property name="excludes" value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/>
- </module>
- <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
- <module name="ImportOrder">
- <property name="groups" value="java,javax,org.w3c,org.xml,junit"/>
- <property name="ordered" value="true"/>
- </module>
- <!--
- <module name="ImportControl">
- <property name="file" value="etc/import-control.xml"/>
- </module>
- -->
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="AnonInnerLength">
- <property name="max" value="40"/>
- </module>
- <module name="ExecutableStatementCount">
- <property name="max" value="75"/>
- </module>
- <module name="FileLength">
- <property name="max" value="3000"/>
- </module>
- <module name="LineLength">
- <property name="max" value="110"/>
- </module>
- <module name="MethodLength">
- <property name="max" value="150"/>
- <property name="countEmpty" value="false"/>
- </module>
- <module name="ParameterNumber">
- <property name="max" value="7"/>
- </module>
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="EmptyForIteratorPad"/>
- <module name="EmptyForInitializerPad"/>
- <module name="MethodParamPad"/>
- <module name="NoWhitespaceAfter">
- <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
- </module>
- <module name="NoWhitespaceBefore"/>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="TypecastParenPad"/>
- <module name="TabCharacter"/>
- <module name="WhitespaceAfter">
- <property name="tokens" value="COMMA, SEMI"/>
- </module>
- <module name="WhitespaceAround">
- <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/>
- </module>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks">
- <property name="allowInSwitchCase" value="true"/>
- </module>
- <module name="EmptyBlock">
- <property name="option" value="text"/>
- </module>
- <module name="LeftCurly"/>
- <module name="NeedBraces"/>
- <module name="RightCurly"/>
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <!--<module name="ArrayTrailingComma"/>-->
- <!--<module name="AvoidInlineConditionals"/>-->
- <module name="CovariantEquals"/>
- <module name="DoubleCheckedLocking"/>
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
- <!--<module name="FinalLocalVariable"/>-->
- <module name="HiddenField">
- <property name="ignoreConstructorParameter" value="true"/>
- <property name="ignoreSetter" value="true"/>
- </module>
- <module name="IllegalInstantiation"/>
- <!--<module name="IllegalToken"/>-->
- <!--<module name="IllegalTokenText"/>-->
- <module name="InnerAssignment"/>
- <!--<module name="MagicNumber"/>-->
- <module name="MissingSwitchDefault"/>
- <!--module name="ModifiedControlVariable"/-->
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
- <module name="StringLiteralEquality"/>
- <module name="NestedIfDepth">
- <property name="max" value="3"/>
- </module>
- <module name="NestedTryDepth">
- <property name="max" value="3"/>
- </module>
- <module name="SuperClone"/>
- <module name="SuperFinalize"/>
- <!--<module name="IllegalCatch"/>-->
- <module name="IllegalThrows">
- <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/>
- </module>
- <!--<module name="RedundantThrows"/>-->
- <module name="PackageDeclaration"/>
- <module name="JUnitTestCase"/>
- <module name="ReturnCount">
- <property name="max" value="6"/>
- </module>
-
- <module name="IllegalType">
- <property name="format" value="^xxx$"/>
- <property name="illegalClassNames" value="java.util.GregorianCalendar, java.util.Hashtable, java.util.HashSet, java.util.HashMap, java.util.ArrayList, java.util.LinkedList, java.util.LinkedHashMap, java.util.LinkedHashSet, java.util.TreeSet, java.util.TreeMap"/>
- </module>
- <module name="DeclarationOrder"/>
- <!--<module name="ParameterAssignment"/>-->
- <module name="ExplicitInitialization"/>
- <module name="DefaultComesLast"/>
- <!--<module name="MissingCtor"/>-->
- <module name="FallThrough"/>
- <!--<module name="MultipleStringLiterals"/>-->
- <module name="MultipleVariableDeclarations"/>
- <!--<module name="RequireThis"/>-->
- <module name="UnnecessaryParentheses"/>
-
-
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <!--<module name="DesignForExtension"/>-->
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
- <!--<module name="MutableException"/>-->
- <module name="ThrowsCount">
- <property name="max" value="5"/>
- </module>
- <module name="VisibilityModifier">
- <property name="protectedAllowed" value="true"/>
- <property name="packageAllowed" value="true"/>
+ <!-- Checks whether files end with a new line. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+ <!--
+ <module name="NewlineAtEndOfFile"/>
+ -->
+
+ <!-- Checks that property files contain the same keys. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+ <module name="Translation" />
+
+ <!--<module name="StrictDuplicateCode"/>-->
+
+ <module name="TreeWalker">
+ <!-- Enable FileContentsHolder to allow us to in turn turn on suppression comments -->
+ <module name="FileContentsHolder" />
+ <!-- Checks for Javadoc comments. -->
+ <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+ <!--
+ <module name="PackageHtml"/>
+ <module name="JavadocMethod"/>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle"/>
+ -->
+
+
+ <!-- Checks for Naming Conventions. -->
+ <!-- See http://checkstyle.sf.net/config_naming.html -->
+ <module name="ConstantName" />
+ <module name="LocalFinalVariableName" />
+ <module name="LocalVariableName" />
+ <module name="MemberName" />
+ <module name="MethodName" />
+ <module name="PackageName" />
+ <module name="ParameterName" />
+ <module name="StaticVariableName" />
+ <module name="TypeName" />
+
+ <!-- Header checks -->
+ <module name="Header">
+ <property name="header"
+ value="/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n" />
+ </module>
+ <!-- <module name="RegexpHeader"/> -->
+
+
+ <!-- Checks for imports -->
+ <!-- See http://checkstyle.sf.net/config_import.html -->
+ <module name="AvoidStarImport">
+ <property name="excludes"
+ value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework" />
+ </module>
+ <module name="IllegalImport" /><!-- defaults to sun.* packages -->
+ <module name="RedundantImport" />
+ <module name="UnusedImports" />
+ <module name="ImportOrder">
+ <property name="groups"
+ value="java,javax,org.w3c,org.xml,junit" />
+ <property name="ordered" value="true" />
+ </module>
+ <!--
+ <module name="ImportControl">
+ <property name="file" value="etc/import-control.xml"/>
+ </module>
+ -->
+
+
+ <!-- Checks for Size Violations. -->
+ <!-- See http://checkstyle.sf.net/config_sizes.html -->
+ <module name="AnonInnerLength">
+ <property name="max" value="40" />
+ </module>
+ <module name="ExecutableStatementCount">
+ <property name="max" value="75" />
+ </module>
+ <module name="FileLength">
+ <property name="max" value="3000" />
+ </module>
+ <module name="LineLength">
+ <property name="max" value="110" />
+ </module>
+ <module name="MethodLength">
+ <property name="max" value="150" />
+ <property name="countEmpty" value="false" />
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="7" />
+ </module>
+
+ <!-- Checks for whitespace -->
+ <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+ <module name="EmptyForIteratorPad" />
+ <module name="EmptyForInitializerPad" />
+ <module name="MethodParamPad" />
+ <module name="NoWhitespaceAfter">
+ <property name="tokens"
+ value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS" />
+ </module>
+ <module name="NoWhitespaceBefore" />
+ <module name="OperatorWrap" />
+ <module name="ParenPad" />
+ <module name="TypecastParenPad" />
+ <module name="TabCharacter" />
+ <module name="WhitespaceAfter">
+ <property name="tokens" value="COMMA, SEMI" />
+ </module>
+ <module name="WhitespaceAround">
+ <property name="tokens"
+ value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND" />
+ </module>
+
+
+ <!-- Modifier Checks -->
+ <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+ <module name="ModifierOrder" />
+ <module name="RedundantModifier" />
+
+
+ <!-- Checks for blocks. You know, those {}'s -->
+ <!-- See http://checkstyle.sf.net/config_blocks.html -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true" />
+ </module>
+ <module name="EmptyBlock">
+ <property name="option" value="text" />
+ </module>
+ <module name="LeftCurly" />
+ <module name="NeedBraces" />
+ <module name="RightCurly" />
+
+
+ <!-- Checks for common coding problems -->
+ <!-- See http://checkstyle.sf.net/config_coding.html -->
+ <!--<module name="ArrayTrailingComma"/>-->
+ <!--<module name="AvoidInlineConditionals"/>-->
+ <module name="CovariantEquals" />
+ <module name="DoubleCheckedLocking" />
+ <module name="EmptyStatement" />
+ <module name="EqualsHashCode" />
+ <!--<module name="FinalLocalVariable"/>-->
+ <module name="HiddenField">
+ <property name="ignoreConstructorParameter" value="true" />
+ <property name="ignoreSetter" value="true" />
+ </module>
+ <module name="IllegalInstantiation" />
+ <!--<module name="IllegalToken"/>-->
+ <!--<module name="IllegalTokenText"/>-->
+ <module name="InnerAssignment" />
+ <!--<module name="MagicNumber"/>-->
+ <module name="MissingSwitchDefault" />
+ <!--module name="ModifiedControlVariable"/-->
+ <module name="SimplifyBooleanExpression" />
+ <module name="SimplifyBooleanReturn" />
+ <module name="StringLiteralEquality" />
+ <module name="NestedIfDepth">
+ <property name="max" value="3" />
+ </module>
+ <module name="NestedTryDepth">
+ <property name="max" value="3" />
+ </module>
+ <module name="SuperClone" />
+ <module name="SuperFinalize" />
+ <!--<module name="IllegalCatch"/>-->
+ <module name="IllegalThrows">
+ <property name="illegalClassNames"
+ value="java.lang.Error,java.lang.RuntimeException" />
+ </module>
+ <!--<module name="RedundantThrows"/>-->
+ <module name="PackageDeclaration" />
+ <module name="JUnitTestCase" />
+ <module name="ReturnCount">
+ <property name="max" value="6" />
+ </module>
+
+ <module name="IllegalType">
+ <property name="format" value="^xxx$" />
+ <property name="illegalClassNames"
+ value="java.util.GregorianCalendar, java.util.Hashtable, java.util.HashSet, java.util.HashMap, java.util.ArrayList, java.util.LinkedList, java.util.LinkedHashMap, java.util.LinkedHashSet, java.util.TreeSet, java.util.TreeMap" />
+ </module>
+ <module name="DeclarationOrder" />
+ <!--<module name="ParameterAssignment"/>-->
+ <module name="ExplicitInitialization" />
+ <module name="DefaultComesLast" />
+ <!--<module name="MissingCtor"/>-->
+ <module name="FallThrough" />
+ <!--<module name="MultipleStringLiterals"/>-->
+ <module name="MultipleVariableDeclarations" />
+ <!--<module name="RequireThis"/>-->
+ <module name="UnnecessaryParentheses" />
+
+
+
+ <!-- Checks for class design -->
+ <!-- See http://checkstyle.sf.net/config_design.html -->
+ <!--<module name="DesignForExtension"/>-->
+ <module name="FinalClass" />
+ <module name="HideUtilityClassConstructor" />
+ <module name="InterfaceIsType" />
+ <!--<module name="MutableException"/>-->
+ <module name="ThrowsCount">
+ <property name="max" value="5" />
+ </module>
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true" />
+ <property name="packageAllowed" value="true" />
<!-- this is needed for the resource injection unit tests. It will removed
- when private member inject is supported.
+ when private member inject is supported.
-->
- <property name="publicMemberPattern" value="resource[12].*"/>
- </module>
+ <property name="publicMemberPattern" value="resource[12].*" />
+ </module>
+
+
+
+ <!-- Metrics checks. -->
+ <!-- See http://checkstyle.sf.net/config_metrics.html -->
+ <module name="BooleanExpressionComplexity">
+ <property name="max" value="6" />
+ </module>
+ <!--<module name="ClassDataAbstractionCoupling"/>-->
+ <!--<module name="ClassFanOutComplexity"/>-->
+ <!--<module name="CyclomaticComplexity"/>-->
+ <!--<module name="NPathComplexity"/>-->
+ <module name="JavaNCSS">
+ <property name="methodMaximum" value="75" />
+ </module>
+
+ <!-- Miscellaneous other checks. -->
+ <!-- See http://checkstyle.sf.net/config_misc.html -->
+ <!--
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ -->
+ <!--
+ <module name="GenericIllegalRegexp">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ -->
+ <module name="TodoComment">
+ <property name="format" value="WARNING" />
+ </module>
+ <module name="UpperEll" />
- <!-- Metrics checks. -->
- <!-- See http://checkstyle.sf.net/config_metrics.html -->
- <module name="BooleanExpressionComplexity">
- <property name="max" value="6"/>
- </module>
- <!--<module name="ClassDataAbstractionCoupling"/>-->
- <!--<module name="ClassFanOutComplexity"/>-->
- <!--<module name="CyclomaticComplexity"/>-->
- <!--<module name="NPathComplexity"/>-->
- <module name="JavaNCSS">
- <property name="methodMaximum" value="75"/>
- </module>
-
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <!--
- <module name="ArrayTypeStyle"/>
- <module name="FinalParameters"/>
- -->
- <!--
- <module name="GenericIllegalRegexp">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- -->
- <module name="TodoComment">
- <property name="format" value="WARNING"/>
- </module>
-
- <module name="UpperEll"/>
-
- <!--Assert statement may have side effects:-->
+ <!--Assert statement may have side effects:-->
<module name="DescendantToken">
- <property name="tokens" value="LITERAL_ASSERT"/>
- <property name="limitedTokens" value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/>
- <property name="maximumNumber" value="0"/>
- </module>
-
- <!--<module name="UncommentedMain"/>-->
- <!--module name="TrailingComment"/-->
- <module name="Indentation">
- <property name="caseIndent" value="0"/>
- </module>
- <!--<module name="RequiredRegexp">-->
- </module>
+ <property name="tokens" value="LITERAL_ASSERT" />
+ <property name="limitedTokens"
+ value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN" />
+ <property name="maximumNumber" value="0" />
+ </module>
+ <!--<module name="UncommentedMain"/>-->
+ <!--module name="TrailingComment"/-->
+ <module name="Indentation">
+ <property name="caseIndent" value="0" />
+ </module>
+ <!--<module name="RequiredRegexp">-->
+ </module>
+ <module name="SuppressionCommentFilter"/>
</module>
Modified: incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-pmd-ruleset.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-pmd-ruleset.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-pmd-ruleset.xml (original)
+++ incubator/cxf/branches/jliu/buildtools/src/main/resources/cxf-pmd-ruleset.xml Thu Oct 25 10:09:20 2007
@@ -187,4 +187,20 @@
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>-->
+ <rule name="DontUseLoggerGetLogger"
+ message="Don't use Logger.getLogger(...), use LogUtils.getL7dLogger(....) instead"
+ class="net.sourceforge.pmd.rules.XPathRule">
+ <priority>2</priority>
+ <description>Don't use Logger.getLogger(...), use LogUtils.getL7dLogger(....) instead</description>
+ <properties>
+ <property name="xpath">
+ <value>
+<![CDATA[
+//PrimaryPrefix/Name[ends-with(@Image, 'Logger.getLogger') and //PackageDeclaration/Name[starts-with(@Image, 'org.apache.cxf')]]
+]]>
+ </value>
+ </property>
+ </properties>
+ </rule>
+
</ruleset>
Modified: incubator/cxf/branches/jliu/buildtools/src/main/resources/notice-supplements.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/buildtools/src/main/resources/notice-supplements.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/buildtools/src/main/resources/notice-supplements.xml (original)
+++ incubator/cxf/branches/jliu/buildtools/src/main/resources/notice-supplements.xml Thu Oct 25 10:09:20 2007
@@ -43,9 +43,48 @@
<name>Sun Microsystems</name>
<url>http://www.sun.com/</url>
</organization>
+ <licenses>
+ <license>
+ <name>COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0</name>
+ <url>http://www.sun.com/cddl/cddl.html</url>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>javax.xml.soap</groupId>
+ <artifactId>saaj-api</artifactId>
+ <name>Sun SAAJ API</name>
+ <organization>
+ <name>Sun Microsystems</name>
+ <url>http://www.sun.com/</url>
+ </organization>
+ <licenses>
+ <license>
+ <name>COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0</name>
+ <url>http://www.sun.com/cddl/cddl.html</url>
+ </license>
+ </licenses>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <name>Neethi</name>
+ <organization>
+ <name>The Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ </organization>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
</project>
</supplement>
-
<supplement>
<project>
<groupId>javax.xml.ws</groupId>
Modified: incubator/cxf/branches/jliu/common/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/pom.xml (original)
+++ incubator/cxf/branches/jliu/common/common/pom.xml Thu Oct 25 10:09:20 2007
@@ -113,6 +113,13 @@
</dependency>
<dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<scope>test</scope>
Modified: incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java (original)
+++ incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java Thu Oct 25 10:09:20 2007
@@ -26,7 +26,9 @@
import java.util.List;
public abstract class AbstractAnnotationVisitor implements AnnotationVisitor {
- protected Object target;
+ protected Object target;
+ protected Class<?> targetClass;
+
private final List<Class<? extends Annotation>> targetAnnotations =
new ArrayList<Class<? extends Annotation>>();
@@ -62,10 +64,18 @@
public void setTarget(Object object) {
target = object;
+ targetClass = object.getClass();
+ }
+ public void setTarget(Object object, Class<?> cls) {
+ target = object;
+ targetClass = cls;
}
public Object getTarget() {
return target;
+ }
+ public Class<?> getTargetClass() {
+ return targetClass;
}
}
Modified: incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java (original)
+++ incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java Thu Oct 25 10:09:20 2007
@@ -74,9 +74,9 @@
* Visits each of the annotated elements of the object.
*
* @param visitor a visitor
- *
+ * @param claz the Class of the targe object
*/
- public void accept(AnnotationVisitor visitor) {
+ public void accept(AnnotationVisitor visitor, Class<?> claz) {
if (visitor == null) {
throw new IllegalArgumentException();
@@ -85,10 +85,14 @@
annotationTypes = visitor.getTargetAnnotations();
visitor.setTarget(target);
//recursively check annotation in super class
- processClass(visitor, target.getClass());
- processFields(visitor, target.getClass());
- processMethods(visitor, target.getClass());
+ processClass(visitor, claz);
+ processFields(visitor, claz);
+ processMethods(visitor, claz);
}
+
+ public void accept(AnnotationVisitor visitor) {
+ accept(visitor, target.getClass());
+ }
private void processMethods(AnnotationVisitor visitor, Class<? extends Object> targetClass) {
Modified: incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java (original)
+++ incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java Thu Oct 25 10:09:20 2007
@@ -19,6 +19,8 @@
package org.apache.cxf.common.i18n;
+import java.util.Locale;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.apache.cxf.common.util.PackageUtils;
@@ -72,7 +74,17 @@
* @return an appropriate ResourceBundle
*/
public static ResourceBundle getBundle(Class<?> cls) {
- return ResourceBundle.getBundle(getBundleName(cls));
+
+ try {
+ return ResourceBundle.getBundle(getBundleName(cls),
+ Locale.getDefault(),
+ cls.getClassLoader());
+ } catch (MissingResourceException ex) {
+ return ResourceBundle.getBundle(getBundleName(cls),
+ Locale.getDefault(),
+ Thread.currentThread().getContextClassLoader());
+
+ }
}
/**
@@ -84,6 +96,15 @@
* @return an appropriate ResourceBundle
*/
public static ResourceBundle getBundle(Class<?> cls, String name) {
- return ResourceBundle.getBundle(getBundleName(cls, name));
+ try {
+ return ResourceBundle.getBundle(getBundleName(cls, name),
+ Locale.getDefault(),
+ cls.getClassLoader());
+ } catch (MissingResourceException ex) {
+ return ResourceBundle.getBundle(getBundleName(cls, name),
+ Locale.getDefault(),
+ Thread.currentThread().getContextClassLoader());
+
+ }
}
}
Modified: incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/Messages.properties?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/Messages.properties (original)
+++ incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/Messages.properties Thu Oct 25 10:09:20 2007
@@ -30,3 +30,4 @@
SETTER_INJECTION_WITH_INCORRECT_TYPE=setter for resource found but with wrong signature: {0}
RESOURCE_NAME_NOT_SPECIFIED=Resource annotation on {0} must specify resource name
NO_SETTER_OR_FIELD_FOR_RESOURCE=Resource annotation {0} on {0} but no field or setter found.
+INJECTION_SETTER_METHOD_NOT_FOUND = Can't find the injection setter method: {0}
\ No newline at end of file
Modified: incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java (original)
+++ incubator/cxf/branches/jliu/common/common/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java Thu Oct 25 10:09:20 2007
@@ -52,6 +52,7 @@
private static final List<Class<? extends Annotation>> ANNOTATIONS =
new ArrayList<Class<? extends Annotation>>();
+
static {
ANNOTATIONS.add(Resource.class);
ANNOTATIONS.add(Resources.class);
@@ -71,18 +72,23 @@
}
- public void inject(Object o) {
-
+ public void inject(Object o) {
+ inject(o, o.getClass());
+ }
+
+ public void inject(Object o, Class claz) {
AnnotationProcessor processor = new AnnotationProcessor(o);
- processor.accept(this);
-
- invokePostConstruct();
+ processor.accept(this, claz);
}
public void construct(Object o) {
setTarget(o);
invokePostConstruct();
}
+ public void construct(Object o, Class<?> cls) {
+ setTarget(o, cls);
+ invokePostConstruct();
+ }
public void destroy(Object o) {
@@ -235,11 +241,21 @@
private void invokeSetter(Method method, Object resource) {
try {
method.setAccessible(true);
- method.invoke(getTarget(), resource);
+ if (method.getDeclaringClass().isAssignableFrom(getTarget().getClass())) {
+ method.invoke(getTarget(), resource);
+ } else { // deal with the proxy setter method
+ Method targetMethod = getTarget().getClass().
+ getMethod(method.getName(), new Class[]{resource.getClass()});
+ targetMethod.invoke(getTarget(), resource);
+ }
} catch (IllegalAccessException e) {
LOG.log(Level.SEVERE, "INJECTION_SETTER_NOT_VISIBLE", method);
} catch (InvocationTargetException e) {
LogUtils.log(LOG, Level.SEVERE, "INJECTION_SETTER_RAISED_EXCEPTION", e, method);
+ } catch (SecurityException e) {
+ LogUtils.log(LOG, Level.SEVERE, "INJECTION_SETTER_RAISED_EXCEPTION", e, method);
+ } catch (NoSuchMethodException e) {
+ LOG.log(Level.SEVERE, "INJECTION_SETTER_METHOD_NOT_FOUND", new Object[] {method.getName()});
}
}
@@ -332,6 +348,10 @@
Collection<Method> methods = new LinkedList<Method>();
addAnnotatedMethods(acls, getTarget().getClass().getMethods(), methods);
addAnnotatedMethods(acls, getTarget().getClass().getDeclaredMethods(), methods);
+ if (getTargetClass() != getTarget().getClass()) {
+ addAnnotatedMethods(acls, getTargetClass().getMethods(), methods);
+ addAnnotatedMethods(acls, getTargetClass().getDeclaredMethods(), methods);
+ }
return methods;
}
@@ -375,6 +395,10 @@
}
private Object resolveResource(String resourceName, Class<?> type) {
+ if (resourceManager == null) {
+ return null;
+ }
return resourceManager.resolveResource(resourceName, type, resourceResolvers);
}
+
}