This commit is contained in:
Lana Steuck 2014-04-09 09:20:23 -07:00
commit 9e2ec325f7
131 changed files with 4763 additions and 1432 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -71,6 +71,9 @@ public class JDefinedClass
/** Static initializer, if this class has one */ /** Static initializer, if this class has one */
private JBlock init = null; private JBlock init = null;
/** Instance initializer, if this class has one */
private JBlock instanceInit = null;
/** class javadoc */ /** class javadoc */
private JDocComment jdoc = null; private JDocComment jdoc = null;
@ -517,6 +520,18 @@ public class JDefinedClass
return init; return init;
} }
/**
* Creates, if necessary, and returns the instance initializer
* for this class.
*
* @return JBlock containing initialization statements for this class
*/
public JBlock instanceInit() {
if (instanceInit == null)
instanceInit = new JBlock();
return instanceInit;
}
/** /**
* Adds a constructor to this class. * Adds a constructor to this class.
* *
@ -793,6 +808,8 @@ public class JDefinedClass
f.d(field); f.d(field);
if (init != null) if (init != null)
f.nl().p("static").s(init); f.nl().p("static").s(init);
if (instanceInit != null)
f.nl().s(instanceInit);
for (JMethod m : constructors) { for (JMethod m : constructors) {
f.nl().d(m); f.nl().d(m);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,46 +28,20 @@
*/ */
package com.sun.codemodel.internal.util; package com.sun.codemodel.internal.util;
import java.lang.reflect.Constructor;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder; import java.nio.charset.CharsetEncoder;
/** /**
* Creates {@link CharsetEncoder} from a charset name. * Creates {@link CharsetEncoder} from a charset name.
* *
* Fixes a MS1252 handling bug in JDK1.4.2.
*
* @author * @author
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/ */
public class EncoderFactory { public class EncoderFactory {
public static CharsetEncoder createEncoder( String encodin ) { public static CharsetEncoder createEncoder( String encodin ) {
Charset cs = Charset.forName(System.getProperty("file.encoding")); Charset cs = Charset.forName(System.getProperty("file.encoding"));
CharsetEncoder encoder = cs.newEncoder(); CharsetEncoder encoder = cs.newEncoder();
if( cs.getClass().getName().equals("sun.nio.cs.MS1252") ) {
try {
// at least JDK1.4.2_01 has a bug in MS1252 encoder.
// specifically, it returns true for any character.
// return a correct encoder to workaround this problem
// statically binding to MS1252Encoder will cause a Link error
// (at least in IBM JDK1.4.1)
@SuppressWarnings("unchecked")
Class<? extends CharsetEncoder> ms1252encoder = (Class<? extends CharsetEncoder>) Class.forName("com.sun.codemodel.internal.util.MS1252Encoder");
Constructor<? extends CharsetEncoder> c = ms1252encoder.getConstructor(new Class[]{
Charset.class
});
return c.newInstance(new Object[]{cs});
} catch( Throwable t ) {
// if something funny happens, ignore it and fall back to
// a broken MS1252 encoder. It's probably still better
// than choking here.
return encoder;
}
}
return encoder; return encoder;
} }
} }

View File

@ -1,223 +0,0 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @(#)$Id: MS1252Encoder.java,v 1.2 2005/09/10 19:07:33 kohsuke Exp $
*/
package com.sun.codemodel.internal.util;
import java.nio.charset.Charset;
/**
* MS1252 encoder that corrects a bug in JDK1.4.2_01.
*
* <p>
* See
* http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
* for the normative definition.
*
* This code depends on Sun internal package, so we have to make sure
* it won't be executed on other JDKs.
*/
public final class MS1252Encoder extends SingleByteEncoder {
public MS1252Encoder(Charset cs) {
super(cs, index1, index2, 0xFF00, 0x00FF, 8);
}
private final static String index2 =
"\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" +
"\b\t\n\u000B\f\r\u000E\u000F" +
"\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" +
"\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" +
"\u0020\u0021\"\u0023\u0024\u0025\u0026\'" +
"\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" +
"\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" +
"\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" +
"\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" +
"\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" +
"\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" +
"\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" +
"\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" +
"\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" +
"\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" +
"\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" +
"\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" +
"\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" +
"\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" +
"\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" +
"\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" +
"\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" +
"\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" +
"\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" +
"\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" +
"\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" +
"\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u009F\u0000\u0000\u0000\u0000\u008E\u009E\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" +
"\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" +
"\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" +
"\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000";
private final static short index1[] = {
0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
};
public boolean canEncode(char c) {
char test = index2.charAt( index1[(c&0xFF00)>>8] + (c&0xFF) );
return test!=0;
}
}

View File

@ -1,159 +0,0 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @(#)SingleByteEncoder.java 1.14 03/01/23
*/
package com.sun.codemodel.internal.util;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
import sun.nio.cs.Surrogate;
abstract class SingleByteEncoder
extends CharsetEncoder
{
private final short index1[];
private final String index2;
private final int mask1;
private final int mask2;
private final int shift;
private final Surrogate.Parser sgp = new Surrogate.Parser();
protected SingleByteEncoder(Charset cs,
short[] index1, String index2,
int mask1, int mask2, int shift)
{
super(cs, 1.0f, 1.0f);
this.index1 = index1;
this.index2 = index2;
this.mask1 = mask1;
this.mask2 = mask2;
this.shift = shift;
}
public boolean canEncode(char c) {
char testEncode;
testEncode = index2.charAt(index1[(c & mask1) >> shift]
+ (c & mask2));
if (testEncode == '\u0000')
return false;
else
return true;
}
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
sp = (sp <= sl ? sp : sl);
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.limit();
dp = (dp <= dl ? dp : dl);
try {
while (sp < sl) {
char c = sa[sp];
if (Surrogate.is(c)) {
if (sgp.parse(c, sa, sp, sl) < 0)
return sgp.error();
return sgp.unmappableResult();
}
if (c >= '\uFFFE')
return CoderResult.unmappableForLength(1);
if (dl - dp < 1)
return CoderResult.OVERFLOW;
char e = index2.charAt(index1[(c & mask1) >> shift]
+ (c & mask2));
// If output byte is zero because input char is zero
// then character is mappable, o.w. fail
if (e == '\u0000' && c != '\u0000')
return CoderResult.unmappableForLength(1);
sp++;
da[dp++] = (byte)e;
}
return CoderResult.UNDERFLOW;
} finally {
src.position(sp - src.arrayOffset());
dst.position(dp - dst.arrayOffset());
}
}
private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
int mark = src.position();
try {
while (src.hasRemaining()) {
char c = src.get();
if (Surrogate.is(c)) {
if (sgp.parse(c, src) < 0)
return sgp.error();
return sgp.unmappableResult();
}
if (c >= '\uFFFE')
return CoderResult.unmappableForLength(1);
if (!dst.hasRemaining())
return CoderResult.OVERFLOW;
char e = index2.charAt(index1[(c & mask1) >> shift]
+ (c & mask2));
// If output byte is zero because input char is zero
// then character is mappable, o.w. fail
if (e == '\u0000' && c != '\u0000')
return CoderResult.unmappableForLength(1);
mark++;
dst.put((byte)e);
}
return CoderResult.UNDERFLOW;
} finally {
src.position(mark);
}
}
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
if (true && src.hasArray() && dst.hasArray())
return encodeArrayLoop(src, dst);
else
return encodeBufferLoop(src, dst);
}
public byte encode(char inputChar) {
return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] +
(inputChar & mask2));
}
}

View File

@ -1,355 +0,0 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.codemodel.internal.util;
import java.nio.CharBuffer;
import java.nio.charset.CoderResult;
/**
* Utility class for dealing with surrogates.
*
* @author Mark Reinhold
* @version 1.11, 03/01/23
*/
class Surrogate {
private Surrogate() { }
// UTF-16 surrogate-character ranges
//
public static final char MIN_HIGH = '\uD800';
public static final char MAX_HIGH = '\uDBFF';
public static final char MIN_LOW = '\uDC00';
public static final char MAX_LOW = '\uDFFF';
public static final char MIN = MIN_HIGH;
public static final char MAX = MAX_LOW;
// Range of UCS-4 values that need surrogates in UTF-16
//
public static final int UCS4_MIN = 0x10000;
public static final int UCS4_MAX = (1 << 20) + UCS4_MIN - 1;
/**
* Tells whether or not the given UTF-16 value is a high surrogate.
*/
public static boolean isHigh(int c) {
return (MIN_HIGH <= c) && (c <= MAX_HIGH);
}
/**
* Tells whether or not the given UTF-16 value is a low surrogate.
*/
public static boolean isLow(int c) {
return (MIN_LOW <= c) && (c <= MAX_LOW);
}
/**
* Tells whether or not the given UTF-16 value is a surrogate character,
*/
public static boolean is(int c) {
return (MIN <= c) && (c <= MAX);
}
/**
* Tells whether or not the given UCS-4 character must be represented as a
* surrogate pair in UTF-16.
*/
public static boolean neededFor(int uc) {
return (uc >= UCS4_MIN) && (uc <= UCS4_MAX);
}
/**
* Returns the high UTF-16 surrogate for the given UCS-4 character.
*/
public static char high(int uc) {
return (char)(0xd800 | (((uc - UCS4_MIN) >> 10) & 0x3ff));
}
/**
* Returns the low UTF-16 surrogate for the given UCS-4 character.
*/
public static char low(int uc) {
return (char)(0xdc00 | ((uc - UCS4_MIN) & 0x3ff));
}
/**
* Converts the given surrogate pair into a 32-bit UCS-4 character.
*/
public static int toUCS4(char c, char d) {
return (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000;
}
/**
* Surrogate parsing support. Charset implementations may use instances of
* this class to handle the details of parsing UTF-16 surrogate pairs.
*/
public static class Parser {
public Parser() { }
private int character; // UCS-4
private CoderResult error = CoderResult.UNDERFLOW;
private boolean isPair;
/**
* Returns the UCS-4 character previously parsed.
*/
public int character() {
return character;
}
/**
* Tells whether or not the previously-parsed UCS-4 character was
* originally represented by a surrogate pair.
*/
public boolean isPair() {
return isPair;
}
/**
* Returns the number of UTF-16 characters consumed by the previous
* parse.
*/
public int increment() {
return isPair ? 2 : 1;
}
/**
* If the previous parse operation detected an error, return the object
* describing that error.
*/
public CoderResult error() {
return error;
}
/**
* Returns an unmappable-input result object, with the appropriate
* input length, for the previously-parsed character.
*/
public CoderResult unmappableResult() {
return CoderResult.unmappableForLength(isPair ? 2 : 1);
}
/**
* Parses a UCS-4 character from the given source buffer, handling
* surrogates.
*
* @param c The first character
* @param in The source buffer, from which one more character
* will be consumed if c is a high surrogate
*
* @return Either a parsed UCS-4 character, in which case the isPair()
* and increment() methods will return meaningful values, or
* -1, in which case error() will return a descriptive result
* object
*/
public int parse(char c, CharBuffer in) {
if (isHigh(c)) {
if (!in.hasRemaining()) {
error = CoderResult.UNDERFLOW;
return -1;
}
char d = in.get();
if (isLow(d)) {
character = toUCS4(c, d);
isPair = true;
error = null;
return character;
}
error = CoderResult.malformedForLength(1);
return -1;
}
if (isLow(c)) {
error = CoderResult.malformedForLength(1);
return -1;
}
character = c;
isPair = false;
error = null;
return character;
}
/**
* Parses a UCS-4 character from the given source buffer, handling
* surrogates.
*
* @param c The first character
* @param ia The input array, from which one more character
* will be consumed if c is a high surrogate
* @param ip The input index
* @param il The input limit
*
* @return Either a parsed UCS-4 character, in which case the isPair()
* and increment() methods will return meaningful values, or
* -1, in which case error() will return a descriptive result
* object
*/
public int parse(char c, char[] ia, int ip, int il) {
if (isHigh(c)) {
if (il - ip < 2) {
error = CoderResult.UNDERFLOW;
return -1;
}
char d = ia[ip + 1];
if (isLow(d)) {
character = toUCS4(c, d);
isPair = true;
error = null;
return character;
}
error = CoderResult.malformedForLength(1);
return -1;
}
if (isLow(c)) {
error = CoderResult.malformedForLength(1);
return -1;
}
character = c;
isPair = false;
error = null;
return character;
}
}
/**
* Surrogate generation support. Charset implementations may use instances
* of this class to handle the details of generating UTF-16 surrogate
* pairs.
*/
public static class Generator {
public Generator() { }
private CoderResult error = CoderResult.OVERFLOW;
/**
* If the previous generation operation detected an error, return the
* object describing that error.
*/
public CoderResult error() {
return error;
}
/**
* Generates one or two UTF-16 characters to represent the given UCS-4
* character.
*
* @param uc The UCS-4 character
* @param len The number of input bytes from which the UCS-4 value
* was constructed (used when creating result objects)
* @param dst The destination buffer, to which one or two UTF-16
* characters will be written
*
* @return Either a positive count of the number of UTF-16 characters
* written to the destination buffer, or -1, in which case
* error() will return a descriptive result object
*/
public int generate(int uc, int len, CharBuffer dst) {
if (uc <= 0xffff) {
if (is(uc)) {
error = CoderResult.malformedForLength(len);
return -1;
}
if (dst.remaining() < 1) {
error = CoderResult.OVERFLOW;
return -1;
}
dst.put((char)uc);
error = null;
return 1;
}
if (uc < UCS4_MIN) {
error = CoderResult.malformedForLength(len);
return -1;
}
if (uc <= UCS4_MAX) {
if (dst.remaining() < 2) {
error = CoderResult.OVERFLOW;
return -1;
}
dst.put(high(uc));
dst.put(low(uc));
error = null;
return 2;
}
error = CoderResult.unmappableForLength(len);
return -1;
}
/**
* Generates one or two UTF-16 characters to represent the given UCS-4
* character.
*
* @param uc The UCS-4 character
* @param len The number of input bytes from which the UCS-4 value
* was constructed (used when creating result objects)
* @param da The destination array, to which one or two UTF-16
* characters will be written
* @param dp The destination position
* @param dl The destination limit
*
* @return Either a positive count of the number of UTF-16 characters
* written to the destination buffer, or -1, in which case
* error() will return a descriptive result object
*/
public int generate(int uc, int len, char[] da, int dp, int dl) {
if (uc <= 0xffff) {
if (is(uc)) {
error = CoderResult.malformedForLength(len);
return -1;
}
if (dl - dp < 1) {
error = CoderResult.OVERFLOW;
return -1;
}
da[dp] = (char)uc;
error = null;
return 1;
}
if (uc < UCS4_MIN) {
error = CoderResult.malformedForLength(len);
return -1;
}
if (uc <= UCS4_MAX) {
if (dl - dp < 2) {
error = CoderResult.OVERFLOW;
return -1;
}
da[dp] = high(uc);
da[dp + 1] = low(uc);
error = null;
return 2;
}
error = CoderResult.unmappableForLength(len);
return -1;
}
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Output all source files into a single stream.
*
* This is primarily for test purposes.
*
* @author
* Aleksei Valikov (valikov@gmx.net)
*/
package com.sun.codemodel.internal.writer;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import com.sun.codemodel.internal.CodeWriter;
import com.sun.codemodel.internal.JPackage;
public class OutputStreamCodeWriter extends CodeWriter {
private final PrintStream out;
/**
* @param os
* This stream will be closed at the end of the code generation.
*/
public OutputStreamCodeWriter(OutputStream os, String encoding) {
try {
this.out = new PrintStream(os, false, encoding);
} catch (UnsupportedEncodingException ueex) {
throw new IllegalArgumentException(ueex);
}
this.encoding = encoding;
}
public OutputStream openBinary(JPackage pkg, String fileName)
throws IOException {
return new FilterOutputStream(out) {
public void close() {
// don't let this stream close
}
};
}
public void close() throws IOException {
out.close();
}
}

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -30,10 +30,10 @@ BASEDIR_DOESNT_EXIST = \
Non-existent directory: {0} Non-existent directory: {0}
VERSION = \ VERSION = \
schemagen 2.2.8-b130911.1802 schemagen 2.2.9-b140218.1920
FULLVERSION = \ FULLVERSION = \
schemagen full version "2.2.8-b130911.1802" schemagen full version "2.2.9-b140218.1920"
USAGE = \ USAGE = \
Usage: schemagen [-options ...] <java files> \n\ Usage: schemagen [-options ...] <java files> \n\

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2}
BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0} BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.8-b130911.1802" FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.9-b140218.1920"
USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path> : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding> : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file> : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path> : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding> : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file> : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la colu
BASEDIR_DOESNT_EXIST = Directorio no existente: {0} BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = versi\u00F3n completa de schemagen "2.2.8-b130911.1802" FULLVERSION = versi\u00F3n completa de schemagen "2.2.9-b140218.1920"
USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso> : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso> : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n> : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo> : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso> : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso> : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n> : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo> : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0
BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = version compl\u00E8te de schemagen "2.2.8-b130911.1802" FULLVERSION = version compl\u00E8te de schemagen "2.2.9-b140218.1920"
USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2}
BASEDIR_DOESNT_EXIST = Directory non esistente: {0} BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = versione completa schemagen "2.2.8-b130911.1802" FULLVERSION = versione completa schemagen "2.2.9-b140218.1920"
USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path> : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding> : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file> : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path> : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding> : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file> : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u
BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0} BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802" FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920"
USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path> : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding> : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file> : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path> : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding> : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file> : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD
BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0} BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802" FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920"
USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path> : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding> : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file> : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4. USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path> : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding> : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file> : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2}
BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0} BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
VERSION = gera\u00E7\u00E3o do esquema 2.2.8-b130911.1802 VERSION = gera\u00E7\u00E3o do esquema 2.2.9-b140218.1920
FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.8-b130911.1802" FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.9-b140218.1920"
USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path> : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path> : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path> : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding> : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file> : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path> : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path> : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path> : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding> : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file> : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0} BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path> : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding> : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file> : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path> : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding> : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file> : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0} BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
VERSION = schemagen 2.2.8-b130911.1802 VERSION = schemagen 2.2.9-b140218.1920
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path> : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding> : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file> : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path> : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding> : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file> : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,6 @@ import com.sun.tools.internal.ws.util.ClassNameInfo;
import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle;
import com.sun.xml.internal.ws.model.RuntimeModeler; import com.sun.xml.internal.ws.model.RuntimeModeler;
import javax.annotation.processing.ProcessingEnvironment;
import javax.jws.Oneway; import javax.jws.Oneway;
import javax.jws.WebMethod; import javax.jws.WebMethod;
import javax.jws.WebParam; import javax.jws.WebParam;
@ -609,12 +608,6 @@ public abstract class WebServiceVisitor extends SimpleElementVisitor6<Void, Obje
} }
protected boolean isLegalSei(TypeElement interfaceElement) { protected boolean isLegalSei(TypeElement interfaceElement) {
for (VariableElement field : ElementFilter.fieldsIn(interfaceElement.getEnclosedElements()))
if (field.getConstantValue() != null) {
builder.processError(WebserviceapMessages.WEBSERVICEAP_SEI_CANNOT_CONTAIN_CONSTANT_VALUES(
interfaceElement.getQualifiedName(), field.getSimpleName()));
return false;
}
return methodsAreLegal(interfaceElement); return methodsAreLegal(interfaceElement);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -41,6 +41,7 @@ import javax.xml.namespace.QName;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.*; import java.util.*;
@ -107,7 +108,7 @@ public class PseudoSchemaBuilder {
} }
//add w3c EPR binding //add w3c EPR binding
if(!(options.noAddressingBbinding) && options.target.isLaterThan(Options.Target.V2_1)){ if(!(options.noAddressingBbinding) && options.target.isLaterThan(Options.Target.V2_1)){
InputSource is = new InputSource(new ByteArrayInputStream(w3ceprSchemaBinding.getBytes())); InputSource is = new InputSource(new ByteArrayInputStream(w3ceprSchemaBinding.getBytes(StandardCharsets.UTF_8)));
is.setSystemId(sysId+(++i +1)); is.setSystemId(sysId+(++i +1));
b.schemas.add(is); b.schemas.add(is);
} }

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions. # questions.
# #
build-id=2.2.9-b130926.1035 build-id=2.2.10-b140228.1436
build-version=JAX-WS RI 2.2.9-b130926.1035 build-version=JAX-WS RI 2.2.10-b140228.1436
major-version=2.2.9 major-version=2.2.10
svn-revision=8c29a9a53251ff741fca1664a8221dc876b2eac8 svn-revision=e1d4708e8a2aee1ae9d38313452e14ce4b67851a

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -171,20 +171,20 @@ Driver.CompilingSchema = \
Driver.FailedToGenerateCode = \ Driver.FailedToGenerateCode = \
Failed to produce code. Failed to produce code.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \ Driver.FilePrologComment = \
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \n\ This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \n\
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\ See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
Any modifications to this file will be lost upon recompilation of the source schema. \n\ Any modifications to this file will be lost upon recompilation of the source schema. \n\
Generated on: {0} \n Generated on: {0} \n
Driver.Version = \ Driver.Version = \
xjc 2.2.8-b130911.1802 xjc 2.2.9-b140218.1920
Driver.FullVersion = \ Driver.FullVersion = \
xjc full version "2.2.8-b130911.1802" xjc full version "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Ein Schema wird kompiliert ...
Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden. Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.8-b130911.1802" Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Compilando un esquema...
Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo. Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.8-b130911.1802 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.9-b140218.1920 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = versi\u00F3n completa de xjc "2.2.8-b130911.1802" Driver.FullVersion = versi\u00F3n completa de xjc "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilation d'un sch\u00e9ma...
Driver.FailedToGenerateCode = Echec de la production du code. Driver.FailedToGenerateCode = Echec de la production du code.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.9-b140218.1920 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = version compl\u00E8te xjc "2.2.8-b130911.1802" Driver.FullVersion = version compl\u00E8te xjc "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilazione di uno schema in corso...
Driver.FailedToGenerateCode = Produzione del codice non riuscita. Driver.FailedToGenerateCode = Produzione del codice non riuscita.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.9-b140218.1920 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = versione completa xjc "2.2.8-b130911.1802" Driver.FullVersion = versione completa xjc "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u30b9\u30ad\u30fc\u30de\u306e\u30b3\u30f3\u30d1\u30a4\
Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.8-b130911.1802\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.9-b140218.1920\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802" Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \uc2a4\ud0a4\ub9c8\ub97c \ucef4\ud30c\uc77c\ud558\ub294
Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.8-b130911.1802 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.9-b140218.1920 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
Driver.Version = XJC 2.2.8-b130911.1802 Driver.Version = XJC 2.2.9-b140218.1920
Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802" Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilando um esquema...
Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo. Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.8-b130911.1802 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.9-b140218.1920 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = vers\u00E3o completa de xjc "2.2.8-b130911.1802" Driver.FullVersion = vers\u00E3o completa de xjc "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7f16\u8bd1\u6a21\u5f0f...
Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.8-b130911.1802 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.9-b140218.1920 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7de8\u8b6f\u7db1\u8981...
Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc. Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
Driver.Version = xjc 2.2.8-b130911.1802 Driver.Version = xjc 2.2.9-b140218.1920
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802" Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
Driver.BuildID = 2.2.8-b130911.1802 Driver.BuildID = 2.2.9-b140218.1920
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -468,25 +468,22 @@ public final class BIProperty extends AbstractDeclarationImpl {
r = ct.get(getBuilder().model); r = ct.get(getBuilder().model);
} else { } else {
FieldRendererFactory frf = getBuilder().fieldRendererFactory; FieldRendererFactory frf = getBuilder().fieldRendererFactory;
// according to the spec we should bahave as in jaxb1. So we ignore possiblity that property could be nullable
if(prop.isOptionalPrimitive()) { switch(opm) {
// the property type can be primitive type if we are to ignore absence // the property type can be primitive type if we are to ignore absence
switch(opm) {
case PRIMITIVE: case PRIMITIVE:
r = frf.getRequiredUnboxed(); r = frf.getRequiredUnboxed();
break; break;
case WRAPPER: case WRAPPER:
// force the wrapper type // force the wrapper type
r = frf.getSingle(); r = prop.isOptionalPrimitive() ? frf.getSingle() : frf.getDefault();
break; break;
case ISSET: case ISSET:
r = frf.getSinglePrimitiveAccess(); r = prop.isOptionalPrimitive() ? frf.getSinglePrimitiveAccess() : frf.getDefault();
break; break;
default: default:
throw new Error(); throw new Error();
}
} else {
r = frf.getDefault();
} }
} }
if(opm==OptionalPropertyMode.ISSET) { if(opm==OptionalPropertyMode.ISSET) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -91,6 +91,9 @@ import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext;
import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx; import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx;
import com.sun.xml.internal.bind.v2.util.DataSourceSource; import com.sun.xml.internal.bind.v2.util.DataSourceSource;
import java.util.logging.Logger;
import com.sun.xml.internal.bind.Util;
import java.util.logging.Level;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -105,6 +108,8 @@ import org.xml.sax.SAXException;
public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class> public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<Type,Class>
implements RuntimeBuiltinLeafInfo, Transducer<T> { implements RuntimeBuiltinLeafInfo, Transducer<T> {
private static final Logger logger = Util.getClassLogger();
private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) { private RuntimeBuiltinLeafInfoImpl(Class type, QName... typeNames) {
super(type, typeNames); super(type, typeNames);
LEAVES.put(type,this); LEAVES.put(type,this);
@ -196,6 +201,7 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<
public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos; public static final List<RuntimeBuiltinLeafInfoImpl<?>> builtinBeanInfos;
public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri"; public static final String MAP_ANYURI_TO_URI = "mapAnyUriToUri";
public static final String USE_OLD_GMONTH_MAPPING = "jaxb.ri.useOldGmonthMapping";
static { static {
@ -960,7 +966,14 @@ public abstract class RuntimeBuiltinLeafInfoImpl<T> extends BuiltinLeafInfoImpl<
m.put(DatatypeConstants.DATETIME, "%Y-%M-%DT%h:%m:%s"+ "%z"); m.put(DatatypeConstants.DATETIME, "%Y-%M-%DT%h:%m:%s"+ "%z");
m.put(DatatypeConstants.DATE, "%Y-%M-%D" +"%z"); m.put(DatatypeConstants.DATE, "%Y-%M-%D" +"%z");
m.put(DatatypeConstants.TIME, "%h:%m:%s"+ "%z"); m.put(DatatypeConstants.TIME, "%h:%m:%s"+ "%z");
m.put(DatatypeConstants.GMONTH, "--%M--%z"); if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) {
m.put(DatatypeConstants.GMONTH, "--%M%z"); // E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12
} else { // backw. compatibility
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "Old GMonth mapping used.");
}
m.put(DatatypeConstants.GMONTH, "--%M--%z");
}
m.put(DatatypeConstants.GDAY, "---%D" + "%z"); m.put(DatatypeConstants.GDAY, "---%D" + "%z");
m.put(DatatypeConstants.GYEAR, "%Y" + "%z"); m.put(DatatypeConstants.GYEAR, "%Y" + "%z");
m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z"); m.put(DatatypeConstants.GYEARMONTH, "%Y-%M" + "%z");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,6 @@
package com.sun.xml.internal.bind.v2.model.nav; package com.sun.xml.internal.bind.v2.model.nav;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.Collection; import java.util.Collection;
import com.sun.xml.internal.bind.v2.runtime.Location; import com.sun.xml.internal.bind.v2.runtime.Location;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -550,7 +550,7 @@ import com.sun.xml.internal.bind.v2.runtime.Location;
@Override @Override
public Class loadObjectFactory(Class referencePoint, String pkg) { public Class loadObjectFactory(Class referencePoint, String pkg) {
ClassLoader cl= SecureLoader.getClassClassLoader(referencePoint); ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint);
if (cl == null) if (cl == null)
cl = SecureLoader.getSystemClassLoader(); cl = SecureLoader.getSystemClassLoader();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -140,22 +140,23 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
*/ */
private final Loader itemsLoader = new Loader(false) { private final Loader itemsLoader = new Loader(false) {
private ThreadLocal<BeanT> target = new ThreadLocal<BeanT>(); private ThreadLocal<Stack<BeanT>> target = new ThreadLocal<Stack<BeanT>>();
private ThreadLocal<ValueT> map = new ThreadLocal<ValueT>(); private ThreadLocal<Stack<ValueT>> map = new ThreadLocal<Stack<ValueT>>();
private int depthCounter = 0; // needed to clean ThreadLocals
@Override @Override
public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
// create or obtain the Map object // create or obtain the Map object
try { try {
target.set((BeanT)state.prev.target); BeanT target = (BeanT) state.prev.target;
map.set(acc.get(target.get())); ValueT mapValue = acc.get(target);
depthCounter++; if(mapValue == null)
if(map.get() == null) { mapValue = ClassFactory.create(mapImplClass);
map.set(ClassFactory.create(mapImplClass)); else
} mapValue.clear();
map.get().clear();
state.target = map.get(); Stack.push(this.target, target);
Stack.push(map, mapValue);
state.target = mapValue;
} catch (AccessorException e) { } catch (AccessorException e) {
// recover from error by setting a dummy Map that receives and discards the values // recover from error by setting a dummy Map that receives and discards the values
handleGenericException(e,true); handleGenericException(e,true);
@ -167,11 +168,7 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
public void leaveElement(State state, TagName ea) throws SAXException { public void leaveElement(State state, TagName ea) throws SAXException {
super.leaveElement(state, ea); super.leaveElement(state, ea);
try { try {
acc.set(target.get(), map.get()); acc.set(Stack.pop(target), Stack.pop(map));
if (--depthCounter == 0) {
target.remove();
map.remove();
}
} catch (AccessorException ex) { } catch (AccessorException ex) {
handleGenericException(ex,true); handleGenericException(ex,true);
} }
@ -289,4 +286,36 @@ final class SingleMapNodeProperty<BeanT,ValueT extends Map> extends PropertyImpl
return acc; return acc;
return null; return null;
} }
private static final class Stack<T> {
private Stack<T> parent;
private T value;
private Stack(Stack<T> parent, T value) {
this.parent = parent;
this.value = value;
}
private Stack(T value) {
this.value = value;
}
private static <T> void push(ThreadLocal<Stack<T>> holder, T value) {
Stack<T> parent = holder.get();
if (parent == null)
holder.set(new Stack<T>(value));
else
holder.set(new Stack<T>(parent, value));
}
private static <T> T pop(ThreadLocal<Stack<T>> holder) {
Stack<T> current = holder.get();
if (current.parent == null)
holder.remove();
else
holder.set(current.parent);
return current.value;
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1070,18 +1070,22 @@ public final class XmlSchemaGenerator<T,C,F,M> {
} }
Collection<TypeInfo> refs = propInfo.ref(); Collection<TypeInfo> refs = propInfo.ref();
TypeInfo ti; if ((refs != null) && (!refs.isEmpty()) && (elemName != null)){
if ((refs != null) && (!refs.isEmpty()) && (elemName != null) ClassInfoImpl cImpl = null;
&& ((ti = refs.iterator().next()) == null || ti instanceof ClassInfoImpl)) { for (TypeInfo ref : refs) {
ClassInfoImpl cImpl = (ClassInfoImpl)ti; if (ref == null || ref instanceof ClassInfoImpl) {
if ((cImpl != null) && (cImpl.getElementName() != null)) { if (elemName.equals(((ClassInfoImpl)ref).getElementName())) {
e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart())); cImpl = (ClassInfoImpl) ref;
} else { break;
e.ref(new QName("", tn.getLocalPart())); }
}
} }
} else { if (cImpl != null)
e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));
else
e.ref(new QName("", tn.getLocalPart()));
} else
e.ref(tn); e.ref(tn);
}
} }
} else { } else {
e.name(tn.getLocalPart()); e.name(tn.getLocalPart());

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
/**
* LazyEnvelopeSource provides the source to create lazy Envelope
*
* @author shih-chang.chen@oracle.com
*/
public interface LazyEnvelopeSource extends javax.xml.transform.Source {
/**
* Retrieve payload qname without materializing its contents
* @return
* @throws SOAPException
*/
public QName getPayloadQName();
public XMLStreamReader readToBodyStarTag() throws XMLStreamException;
public XMLStreamReader readPayload();
public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException;
public boolean isPayloadStreamReader();
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -621,7 +621,8 @@ class HttpSOAPConnection extends SOAPConnection {
String plain = user + ":"; String plain = user + ":";
byte[] nameBytes = plain.getBytes(); byte[] nameBytes = plain.getBytes();
byte[] passwdBytes = password.getBytes(); byte[] passwdBytes = (password == null ? new byte[0] : password
.getBytes());
// concatenate user name and password bytes and encode them // concatenate user name and password bytes and encode them
byte[] concat = new byte[nameBytes.length + passwdBytes.length]; byte[] concat = new byte[nameBytes.length + passwdBytes.length];

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -84,7 +84,7 @@ public class MessagingException extends Exception {
* *
* @return next Exception, null if none. * @return next Exception, null if none.
*/ */
public Exception getNextException() { public synchronized Exception getNextException() {
return next; return next;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,6 @@ import com.sun.xml.internal.messaging.saaj.packaging.mime.*;
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*; import com.sun.xml.internal.messaging.saaj.packaging.mime.util.*;
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import com.sun.xml.internal.messaging.saaj.util.FinalArrayList;
/** /**
* The MimeMultipart class is an implementation of the abstract Multipart * The MimeMultipart class is an implementation of the abstract Multipart
@ -393,13 +392,12 @@ public class BMMimeMultipart extends MimeMultipart {
int i; int i;
int l = pattern.length; int l = pattern.length;
int lx = l -1; int lx = l -1;
int bufferLength = 0;
BitSet eof = new BitSet(1); BitSet eof = new BitSet(1);
long[] posVector = new long[1]; long[] posVector = new long[1];
while (true) { while (true) {
is.mark(l); is.mark(l);
bufferLength = readNext(is, buffer, l, eof, posVector, sin); readNext(is, buffer, l, eof, posVector, sin);
if (eof.get(0)) { if (eof.get(0)) {
// End of stream // End of stream
return false; return false;
@ -561,7 +559,7 @@ public class BMMimeMultipart extends MimeMultipart {
if (prevBuffer[s-1] == (byte)13) { if (prevBuffer[s-1] == (byte)13) {
// if buffer[0] == (byte)10 // if buffer[0] == (byte)10
if (buffer[0] == (byte)10) { if (buffer[0] == (byte)10) {
int j=lx-1; int j;
for(j = lx-1; j > 0; j--) { for(j = lx-1; j > 0; j--) {
if (buffer[j+1] != pattern[j]) { if (buffer[j+1] != pattern[j]) {
break; break;
@ -695,7 +693,6 @@ public class BMMimeMultipart extends MimeMultipart {
* Iterates through all the parts and outputs each Mime part * Iterates through all the parts and outputs each Mime part
* separated by a boundary. * separated by a boundary.
*/ */
byte[] buf = new byte[1024];
public void writeTo(OutputStream os) public void writeTo(OutputStream os)
throws IOException, MessagingException { throws IOException, MessagingException {
@ -715,19 +712,25 @@ public class BMMimeMultipart extends MimeMultipart {
if (in != null) { if (in != null) {
OutputUtil.writeln(bnd, os); // put out boundary OutputUtil.writeln(bnd, os); // put out boundary
if ((os instanceof ByteOutputStream) && lazyAttachments) { if ((os instanceof ByteOutputStream) && lazyAttachments) {
((ByteOutputStream)os).write(in); ((ByteOutputStream) os).write(in);
} else { } else {
ByteOutputStream baos = new ByteOutputStream(in.available()); ByteOutputStream baos = null;
baos.write(in); try {
baos.writeTo(os); baos = new ByteOutputStream(in.available());
// reset the inputstream so that we can support a baos.write(in);
//getAttachment later baos.writeTo(os);
in = baos.newInputStream(); // reset the inputstream so that we can support a
// getAttachment later
in = baos.newInputStream();
} finally {
if (baos != null)
baos.close();
}
} }
// this will endup writing the end boundary // this will endup writing the end boundary
} else { } else {
// put out last boundary // put out last boundary
OutputUtil.writeAsAscii(bnd, os); OutputUtil.writeAsAscii(bnd, os);
OutputUtil.writeAsAscii("--", os); OutputUtil.writeAsAscii("--", os);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -193,13 +193,17 @@ public final class MimeBodyPart {
SharedInputStream sis = (SharedInputStream) is; SharedInputStream sis = (SharedInputStream) is;
contentStream = sis.newStream(sis.getPosition(), -1); contentStream = sis.newStream(sis.getPosition(), -1);
} else { } else {
ByteOutputStream bos = null;
try { try {
ByteOutputStream bos = new ByteOutputStream(); bos = new ByteOutputStream();
bos.write(is); bos.write(is);
content = bos.getBytes(); content = bos.getBytes();
contentLength = bos.getCount(); contentLength = bos.getCount();
} catch (IOException ioex) { } catch (IOException ioex) {
throw new MessagingException("Error reading input stream", ioex); throw new MessagingException("Error reading input stream", ioex);
} finally {
if (bos != null)
bos.close();
} }
} }
@ -1075,8 +1079,12 @@ public final class MimeBodyPart {
*/ */
protected void updateHeaders() throws MessagingException { protected void updateHeaders() throws MessagingException {
DataHandler dh = getDataHandler(); DataHandler dh = getDataHandler();
if (dh == null) // Huh ? /*
return; * Code flow indicates null is never returned from
* getdataHandler() - findbugs
*/
//if (dh == null) // Huh ?
// return;
try { try {
String type = dh.getContentType(); String type = dh.getContentType();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -318,6 +318,7 @@ public class MimeMultipart {
byte[] bndbytes = ASCIIUtility.getBytes(boundary); byte[] bndbytes = ASCIIUtility.getBytes(boundary);
int bl = bndbytes.length; int bl = bndbytes.length;
ByteOutputStream buf = null;
try { try {
// Skip the preamble // Skip the preamble
LineInputStream lin = new LineInputStream(in); LineInputStream lin = new LineInputStream(in);
@ -370,7 +371,7 @@ public class MimeMultipart {
if (!in.markSupported()) if (!in.markSupported())
throw new MessagingException("Stream doesn't support mark"); throw new MessagingException("Stream doesn't support mark");
ByteOutputStream buf = null; buf = null;
// if we don't have a shared input stream, we copy the data // if we don't have a shared input stream, we copy the data
if (sin == null) if (sin == null)
buf = new ByteOutputStream(); buf = new ByteOutputStream();
@ -471,6 +472,9 @@ public class MimeMultipart {
} }
} catch (IOException ioex) { } catch (IOException ioex) {
throw new MessagingException("IO Error", ioex); throw new MessagingException("IO Error", ioex);
} finally {
if (buf != null)
buf.close();
} }
if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) { if (!ignoreMissingEndBoundary && !foundClosingBoundary && sin== null) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -107,7 +107,7 @@ public class MimePullMultipart extends MimeMultipart {
List<MIMEPart> prts = mm.getAttachments(); List<MIMEPart> prts = mm.getAttachments();
for(MIMEPart part : prts) { for(MIMEPart part : prts) {
if (part != soapPart) { if (part != soapPart) {
AttachmentPart attach = new AttachmentPartImpl(part); new AttachmentPartImpl(part);
this.addBodyPart(new MimeBodyPart(part)); this.addBodyPart(new MimeBodyPart(part));
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -141,10 +141,13 @@ public class ASCIIUtility {
* Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}. * Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
*/ */
public static byte[] getBytes(InputStream is) throws IOException { public static byte[] getBytes(InputStream is) throws IOException {
ByteOutputStream bos = new ByteOutputStream(); ByteOutputStream bos = null;
try { try {
bos = new ByteOutputStream();
bos.write(is); bos.write(is);
} finally { } finally {
if (bos != null)
bos.close();
is.close(); is.close();
} }
return bos.toByteArray(); return bos.toByteArray();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -138,7 +138,6 @@ public class AttachmentPartImpl extends AttachmentPart {
} }
public int getSize() throws SOAPException { public int getSize() throws SOAPException {
byte[] bytes;
if (mimePart != null) { if (mimePart != null) {
try { try {
return mimePart.read().available(); return mimePart.read().available();
@ -388,6 +387,7 @@ public class AttachmentPartImpl extends AttachmentPart {
} }
dataHandler = null; dataHandler = null;
InputStream decoded = null; InputStream decoded = null;
ByteOutputStream bos = null;
try { try {
decoded = MimeUtility.decode(content, "base64"); decoded = MimeUtility.decode(content, "base64");
InternetHeaders hdrs = new InternetHeaders(); InternetHeaders hdrs = new InternetHeaders();
@ -395,7 +395,7 @@ public class AttachmentPartImpl extends AttachmentPart {
//TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
// Ctor with inputStream causes problems based on the InputStream // Ctor with inputStream causes problems based on the InputStream
// has markSupported()==true // has markSupported()==true
ByteOutputStream bos = new ByteOutputStream(); bos = new ByteOutputStream();
bos.write(decoded); bos.write(decoded);
rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
setMimeHeader("Content-Type", contentType); setMimeHeader("Content-Type", contentType);
@ -403,8 +403,11 @@ public class AttachmentPartImpl extends AttachmentPart {
log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e); log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage()); throw new SOAPExceptionImpl(e.getLocalizedMessage());
} finally { } finally {
if (bos != null)
bos.close();
try { try {
decoded.close(); if (decoded != null)
decoded.close();
} catch (IOException ex) { } catch (IOException ex) {
throw new SOAPException(ex); throw new SOAPException(ex);
} }
@ -478,13 +481,14 @@ public class AttachmentPartImpl extends AttachmentPart {
mimePart = null; mimePart = null;
} }
dataHandler = null; dataHandler = null;
ByteOutputStream bos = null;
try { try {
InternetHeaders hdrs = new InternetHeaders(); InternetHeaders hdrs = new InternetHeaders();
hdrs.setHeader("Content-Type", contentType); hdrs.setHeader("Content-Type", contentType);
//TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart //TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
// Ctor with inputStream causes problems based on whether the InputStream has // Ctor with inputStream causes problems based on whether the InputStream has
// markSupported()==true or false // markSupported()==true or false
ByteOutputStream bos = new ByteOutputStream(); bos = new ByteOutputStream();
bos.write(content); bos.write(content);
rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount()); rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
setMimeHeader("Content-Type", contentType); setMimeHeader("Content-Type", contentType);
@ -492,6 +496,8 @@ public class AttachmentPartImpl extends AttachmentPart {
log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e); log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage()); throw new SOAPExceptionImpl(e.getLocalizedMessage());
} finally { } finally {
if (bos != null)
bos.close();
try { try {
content.close(); content.close();
} catch (IOException ex) { } catch (IOException ex) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.transform.Source; import javax.xml.transform.Source;
/** /**
@ -52,4 +53,8 @@ public interface Envelope extends SOAPEnvelope {
* Output the content. * Output the content.
*/ */
void output(OutputStream out, boolean isFastInfoset) throws IOException; void output(OutputStream out, boolean isFastInfoset) throws IOException;
void setStaxBridge(StaxBridge bridge) throws SOAPException;
StaxBridge getStaxBridge() throws SOAPException;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,18 +29,22 @@ import java.util.logging.Logger;
import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParser;
import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.XMLReader; import org.xml.sax.XMLReader;
import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.util.*; import com.sun.xml.internal.messaging.saaj.util.*;
import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer; import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer;
/** /**
@ -58,20 +62,73 @@ public class EnvelopeFactory {
public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart) public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart)
throws SOAPException throws SOAPException
{ {
if (src instanceof JAXMStreamSource) {
try {
if (!SOAPPartImpl.lazyContentLength) {
((JAXMStreamSource) src).reset();
}
} catch (java.io.IOException ioe) {
log.severe("SAAJ0515.source.reset.exception");
throw new SOAPExceptionImpl(ioe);
}
}
if (src instanceof LazyEnvelopeSource) {
return lazy((LazyEnvelopeSource)src, soapPart);
}
if (soapPart.message.isLazySoapBodyParsing()) {
return parseEnvelopeStax(src, soapPart);
} else {
return parseEnvelopeSax(src, soapPart);
}
}
private static Envelope lazy(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
try {
StaxBridge staxBridge = new StaxLazySourceBridge(src, soapPart);
staxBridge.bridgeEnvelopeAndHeaders();
Envelope env = (Envelope) soapPart.getEnvelope();
env.setStaxBridge(staxBridge);
return env;
} catch (XMLStreamException e) {
throw new SOAPException(e);
}
}
static private XMLInputFactory xmlInputFactory = null;
private static Envelope parseEnvelopeStax(Source src, SOAPPartImpl soapPart)
throws SOAPException {
XMLStreamReader streamReader = null;
if (src instanceof StAXSource) {
streamReader = ((StAXSource) src).getXMLStreamReader();
}
try {
if (streamReader == null) {
if (xmlInputFactory == null) xmlInputFactory = XMLInputFactory.newInstance();
streamReader = xmlInputFactory.createXMLStreamReader(src);
}
// SaajStaxWriter saajWriter = new SaajStaxWriter(soapPart.message, soapPart.document);
// XMLStreamReaderToXMLStreamWriter readerWriterBridge = new XMLStreamReaderToXMLStreamWriter(
// streamReader, saajWriter, soapPart.getSOAPNamespace());
StaxBridge readerWriterBridge = new StaxReaderBridge(streamReader, soapPart);
//bridge will stop reading at body element, and parse upon request, so save it
//on the envelope
readerWriterBridge.bridgeEnvelopeAndHeaders();
Envelope env = (Envelope) soapPart.getEnvelope();
env.setStaxBridge(readerWriterBridge);
return env;
} catch (Exception e) {
throw new SOAPException(e);
}
}
private static Envelope parseEnvelopeSax(Source src, SOAPPartImpl soapPart)
throws SOAPException {
// Insert SAX filter to disallow Document Type Declarations since // Insert SAX filter to disallow Document Type Declarations since
// they are not legal in SOAP // they are not legal in SOAP
SAXParser saxParser = null; SAXParser saxParser = null;
if (src instanceof StreamSource) { if (src instanceof StreamSource) {
if (src instanceof JAXMStreamSource) {
try {
if (!SOAPPartImpl.lazyContentLength) {
((JAXMStreamSource) src).reset();
}
} catch (java.io.IOException ioe) {
log.severe("SAAJ0515.source.reset.exception");
throw new SOAPExceptionImpl(ioe);
}
}
try { try {
saxParser = parserPool.get(); saxParser = parserPool.get();
} catch (Exception e) { } catch (Exception e) {

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.soap;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
public interface LazyEnvelope extends Envelope {
public XMLStreamReader getPayloadReader() throws SOAPException;
public boolean isLazy();
public void writeTo(XMLStreamWriter writer) throws XMLStreamException, SOAPException;
/**
* Retrieve payload qname without materializing its contents
* @return
* @throws SOAPException
*/
public QName getPayloadQName() throws SOAPException;
/**
* Retrieve payload attribute value without materializing its contents
* @param localName
* @return
* @throws SOAPException
*/
public String getPayloadAttributeValue(String localName) throws SOAPException;
/**
* Retrieve payload attribute value without materializing its contents
* @param qName
* @return
* @throws SOAPException
*/
public String getPayloadAttributeValue(QName qName) throws SOAPException;
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamReader;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParseException; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParseException;
@ -66,12 +67,44 @@ public class MessageFactoryImpl extends MessageFactory {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public SOAPMessage createMessage(String protocol) throws SOAPException {
if (SOAPConstants.SOAP_1_1_PROTOCOL.equals(protocol))
return new com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl();
else
return new com.sun.xml.internal.messaging.saaj.soap.ver1_2.Message1_2Impl();
}
public SOAPMessage createMessage(boolean isFastInfoset, public SOAPMessage createMessage(boolean isFastInfoset,
boolean acceptFastInfoset) throws SOAPException boolean acceptFastInfoset) throws SOAPException
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public SOAPMessage createMessage(MimeHeaders headers, XMLStreamReader reader) throws SOAPException, IOException {
String contentTypeString = MessageImpl.getContentType(headers);
if (listener != null) {
throw new SOAPException("Listener OutputStream is not supported with XMLStreamReader");
}
try {
ContentType contentType = new ContentType(contentTypeString);
int stat = MessageImpl.identifyContentType(contentType);
if (MessageImpl.isSoap1_1Content(stat)) {
return new Message1_1Impl(headers,contentType,stat,reader);
} else if (MessageImpl.isSoap1_2Content(stat)) {
return new Message1_2Impl(headers,contentType,stat,reader);
} else {
log.severe("SAAJ0530.soap.unknown.Content-Type");
throw new SOAPExceptionImpl("Unrecognized Content-Type");
}
} catch (ParseException e) {
log.severe("SAAJ0531.soap.cannot.parse.Content-Type");
throw new SOAPExceptionImpl(
"Unable to parse content type: " + e.getMessage());
}
}
public SOAPMessage createMessage(MimeHeaders headers, InputStream in) public SOAPMessage createMessage(MimeHeaders headers, InputStream in)
throws SOAPException, IOException { throws SOAPException, IOException {
String contentTypeString = MessageImpl.getContentType(headers); String contentTypeString = MessageImpl.getContentType(headers);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,9 @@ import java.util.logging.Logger;
import javax.activation.DataHandler; import javax.activation.DataHandler;
import javax.activation.DataSource; import javax.activation.DataSource;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import com.sun.xml.internal.messaging.saaj.packaging.mime.Header; import com.sun.xml.internal.messaging.saaj.packaging.mime.Header;
@ -110,6 +112,8 @@ public abstract class MessageImpl
private InputStream inputStreamAfterSaveChanges = null; private InputStream inputStreamAfterSaveChanges = null;
public static final String LAZY_SOAP_BODY_PARSING = "saaj.lazy.soap.body";
// switch back to old MimeMultipart incase of problem // switch back to old MimeMultipart incase of problem
private static boolean switchOffBM = false; private static boolean switchOffBM = false;
private static boolean switchOffLazyAttachment = false; private static boolean switchOffLazyAttachment = false;
@ -341,7 +345,12 @@ public abstract class MessageImpl
} }
private void init(MimeHeaders headers, int stat, final ContentType contentType, final InputStream in) throws SOAPExceptionImpl { public MessageImpl(MimeHeaders headers, ContentType ct, int stat,
XMLStreamReader reader) throws SOAPExceptionImpl {
init(headers, stat, ct, reader);
}
private void init(MimeHeaders headers, int stat, final ContentType contentType, final Object input) throws SOAPExceptionImpl {
this.headers = headers; this.headers = headers;
try { try {
@ -382,20 +391,42 @@ public abstract class MessageImpl
+ " Expected: " + " Expected: "
+ getExpectedContentType()); + getExpectedContentType());
} }
InputStream in = null;
XMLStreamReader rdr = null;
if (input instanceof InputStream) {
in = (InputStream) input;
} else {
//is a StAX reader
rdr = (XMLStreamReader) input;
}
if ((stat & PLAIN_XML_FLAG) != 0) { if ((stat & PLAIN_XML_FLAG) != 0) {
if (isFastInfoset) { if (in != null) {
getSOAPPart().setContent( if (isFastInfoset) {
FastInfosetReflection.FastInfosetSource_new(in)); getSOAPPart().setContent(
FastInfosetReflection.FastInfosetSource_new(in));
} else {
initCharsetProperty(contentType);
getSOAPPart().setContent(new StreamSource(in));
}
} else { } else {
initCharsetProperty(contentType); //is a StAX reader
getSOAPPart().setContent(new StreamSource(in)); if (isFastInfoset) {
//need to get FI stax reader
} else {
initCharsetProperty(contentType);
getSOAPPart().setContent(new StAXSource(rdr));
}
} }
} }
else if ((stat & MIME_MULTIPART_FLAG) != 0) { else if ((stat & MIME_MULTIPART_FLAG) != 0 && in == null) {
//only parse multipart in the inputstream case
//in stax reader case, we would be given the attachments separately
getSOAPPart().setContent(new StAXSource(rdr));
} else if ((stat & MIME_MULTIPART_FLAG) != 0) {
final InputStream finalIn = in;
DataSource ds = new DataSource() { DataSource ds = new DataSource() {
public InputStream getInputStream() { public InputStream getInputStream() {
return in; return finalIn;
} }
public OutputStream getOutputStream() { public OutputStream getOutputStream() {
@ -487,7 +518,17 @@ public abstract class MessageImpl
} }
} }
if (soapPartInputStream == null && soapMessagePart != null) { // findbugs correctly points out that we'd NPE instantiating
// the ContentType (just below here) if soapMessagePart were
// null. Hence are better off throwing a controlled exception
// at this point if it is null.
if (soapMessagePart == null) {
log.severe("SAAJ0510.soap.cannot.create.envelope");
throw new SOAPExceptionImpl(
"Unable to create envelope from given source: SOAP part not found");
}
if (soapPartInputStream == null) {
soapPartInputStream = soapMessagePart.getInputStream(); soapPartInputStream = soapMessagePart.getInputStream();
} }
@ -541,6 +582,15 @@ public abstract class MessageImpl
} }
} }
public boolean isLazySoapBodyParsing() {
Object lazyParsingProp = getProperty(LAZY_SOAP_BODY_PARSING);
if (lazyParsingProp == null) return false;
if (lazyParsingProp instanceof Boolean) {
return ((Boolean) lazyParsingProp).booleanValue();
} else {
return Boolean.valueOf(lazyParsingProp.toString());
}
}
public Object getProperty(String property) { public Object getProperty(String property) {
return (String) properties.get(property); return (String) properties.get(property);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -107,11 +107,11 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
} }
public org.w3c.dom.Text createTextNode(String data) { public org.w3c.dom.Text createTextNode(String data) {
return new TextImpl(this, data); return new SOAPTextImpl(this, data);
} }
public Comment createComment(String data) { public Comment createComment(String data) {
return new CommentImpl(this, data); return new SOAPCommentImpl(this, data);
} }
public CDATASection createCDATASection(String data) throws DOMException { public CDATASection createCDATASection(String data) throws DOMException {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -245,12 +245,18 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
* getBytes() is called on a ByteInputStream. * getBytes() is called on a ByteInputStream.
*/ */
if (!(is instanceof ByteInputStream)) { if (!(is instanceof ByteInputStream)) {
ByteOutputStream bout = new ByteOutputStream(); ByteOutputStream bout = null;
bout.write(is); try {
bout = new ByteOutputStream();
bout.write(is);
// source.setInputStream(new ByteInputStream(...)) // source.setInputStream(new ByteInputStream(...))
FastInfosetReflection.FastInfosetSource_setInputStream( FastInfosetReflection.FastInfosetSource_setInputStream(
source, bout.newInputStream()); source, bout.newInputStream());
} finally {
if (bout != null)
bout.close();
}
} }
this.source = source; this.source = source;
} }
@ -811,4 +817,6 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
public String getSourceCharsetEncoding() { public String getSourceCharsetEncoding() {
return sourceCharsetEncoding; return sourceCharsetEncoding;
} }
public abstract String getSOAPNamespace();
} }

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.soap;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
/**
* StaxBridge builds Envelope using a XMLStreamReaderToXMLStreamWriter
*
* @author shih-chang.chen@oracle.com
*/
public abstract class StaxBridge {
protected SaajStaxWriter saajWriter;
protected XMLStreamReaderToXMLStreamWriter readerToWriter;
protected XMLStreamReaderToXMLStreamWriter.Breakpoint breakpoint;
public StaxBridge(SOAPPartImpl soapPart) throws SOAPException {
readerToWriter = new XMLStreamReaderToXMLStreamWriter();
saajWriter = new SaajStaxWriter(soapPart.message, soapPart.getSOAPNamespace());
}
public void bridgeEnvelopeAndHeaders() throws XMLStreamException {
readerToWriter.bridge(breakpoint);
}
public void bridgePayload() throws XMLStreamException {
readerToWriter.bridge(breakpoint);
}
abstract public XMLStreamReader getPayloadReader();
abstract public QName getPayloadQName();
abstract public String getPayloadAttributeValue(String attName) ;
abstract public String getPayloadAttributeValue(QName attName) ;
}

View File

@ -0,0 +1,105 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.soap;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
/**
* StaxBridge builds Envelope from LazyEnvelopeSource
*
* @author shih-chang.chen@oracle.com
*/
public class StaxLazySourceBridge extends StaxBridge {
private LazyEnvelopeSource lazySource;
public StaxLazySourceBridge(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
super(soapPart);
lazySource = src;
final String soapEnvNS = soapPart.getSOAPNamespace();
try {
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(src.readToBodyStarTag(), saajWriter) {
public boolean proceedAfterStartElement() {
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
return false;
} else
return true;
}
};
} catch (XMLStreamException e) {
throw new SOAPException(e);
}
}
@Override
public XMLStreamReader getPayloadReader() {
return lazySource.readPayload();
// throw new UnsupportedOperationException();
}
@Override
public QName getPayloadQName() {
return lazySource.getPayloadQName();
}
@Override
public String getPayloadAttributeValue(String attName) {
if (lazySource.isPayloadStreamReader()) {
XMLStreamReader reader = lazySource.readPayload();
if (reader.getEventType() == reader.START_ELEMENT) {
return reader.getAttributeValue(null, attName);
}
}
return null;
}
@Override
public String getPayloadAttributeValue(QName attName) {
if (lazySource.isPayloadStreamReader()) {
XMLStreamReader reader = lazySource.readPayload();
if (reader.getEventType() == reader.START_ELEMENT) {
return reader.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart());
}
}
return null;
}
public void bridgePayload() throws XMLStreamException {
//Assuming out is at Body
writePayloadTo(saajWriter);
}
public void writePayloadTo(XMLStreamWriter writer) throws XMLStreamException {
lazySource.writePayloadTo(writer);
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.soap;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamReader;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
/**
* StaxBridge builds Envelope using a XMLStreamReaderToXMLStreamWriter
*
* @author shih-chang.chen@oracle.com
*/
public class StaxReaderBridge extends StaxBridge {
private XMLStreamReader in;
public StaxReaderBridge(XMLStreamReader reader, SOAPPartImpl soapPart) throws SOAPException {
super(soapPart);
in = reader;
final String soapEnvNS = soapPart.getSOAPNamespace();
breakpoint = new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, saajWriter) {
boolean seenBody = false;
boolean stopedAtBody = false;
public boolean proceedBeforeStartElement() {
if (stopedAtBody) return true;
if (seenBody) {
stopedAtBody = true;
return false;
}
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
seenBody = true;
}
return true;
}
};
}
public XMLStreamReader getPayloadReader() {
return in;
}
public QName getPayloadQName() {
return (in.getEventType() == in.START_ELEMENT) ? in.getName() : null;
}
public String getPayloadAttributeValue(String attName) {
return (in.getEventType() == in.START_ELEMENT) ? in.getAttributeValue(null, attName) : null;
}
public String getPayloadAttributeValue(QName attName) {
return (in.getEventType() == in.START_ELEMENT) ? in.getAttributeValue(attName.getNamespaceURI(), attName.getLocalPart()) : null;
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,14 +31,18 @@ import java.util.logging.Level;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.*; import org.w3c.dom.*;
import org.w3c.dom.Node;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.StaxBridge;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
/** /**
@ -48,6 +52,9 @@ import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
*/ */
public abstract class BodyImpl extends ElementImpl implements SOAPBody { public abstract class BodyImpl extends ElementImpl implements SOAPBody {
private SOAPFault fault; private SOAPFault fault;
// private XMLStreamReaderToXMLStreamWriter staxBridge;
private StaxBridge staxBridge;
private boolean payloadStreamRead = false;
protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName) { protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName) {
super(ownerDoc, bodyName); super(ownerDoc, bodyName);
@ -136,13 +143,22 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
} }
public boolean hasFault() { public boolean hasFault() {
initializeFault(); QName payloadQName = getPayloadQName();
return fault != null; return getFaultQName().equals(payloadQName);
}
private Object getFaultQName() {
return new QName(getNamespaceURI(), "Fault");
} }
public SOAPFault getFault() { public SOAPFault getFault() {
if (hasFault()) if (hasFault()) {
if (fault == null) {
//initialize fault member
fault = (SOAPFault) getFirstChildElement();
}
return fault; return fault;
}
return null; return null;
} }
@ -322,4 +338,130 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
return document; return document;
} }
private void materializePayloadWrapException() {
try {
materializePayload();
} catch (SOAPException e) {
throw new RuntimeException(e);
}
}
private void materializePayload() throws SOAPException {
if (staxBridge != null) {
if (payloadStreamRead) {
//the payload has already been read via stream reader and the
//stream has been exhausted already. Throw an
//exception since we are now trying to materialize as DOM and
//there is no stream left to read
throw new SOAPException("SOAPBody payload stream has been fully read - cannot materialize as DOM!");
}
try {
staxBridge.bridgePayload();
staxBridge = null;
payloadStreamRead = true;
} catch (XMLStreamException e) {
throw new SOAPException(e);
}
}
}
@Override
public boolean hasChildNodes() {
boolean hasChildren = super.hasChildNodes();
//to answer this question we need to know _whether_ we have at least one child
//So no need to materialize body if we already know we have a header child
if (!hasChildren) {
materializePayloadWrapException();
}
return super.hasChildNodes();
}
@Override
public NodeList getChildNodes() {
materializePayloadWrapException();
return super.getChildNodes();
}
@Override
public Node getFirstChild() {
Node child = super.getFirstChild();
if (child == null) {
materializePayloadWrapException();
}
return super.getFirstChild();
}
public Node getFirstChildNoMaterialize() {
return super.getFirstChild();
}
@Override
public Node getLastChild() {
materializePayloadWrapException();
return super.getLastChild();
}
XMLStreamReader getPayloadReader() {
return staxBridge.getPayloadReader();
}
void setStaxBridge(StaxBridge bridge) {
this.staxBridge = bridge;
}
StaxBridge getStaxBridge() {
return staxBridge;
}
void setPayloadStreamRead() {
this.payloadStreamRead = true;
}
QName getPayloadQName() {
if (staxBridge != null) {
return staxBridge.getPayloadQName();
} else {
//not lazy - Just get first child element and return its name
Element elem = getFirstChildElement();
if (elem != null) {
String ns = elem.getNamespaceURI();
String pref = elem.getPrefix();
String local = elem.getLocalName();
if (pref != null) return new QName(ns, local, pref);
if (ns != null) return new QName(ns, local);
return new QName(local);
}
}
return null;
}
String getPayloadAttributeValue(String attName) {
if (staxBridge != null) {
return staxBridge.getPayloadAttributeValue(attName);
} else {
//not lazy -Just get first child element and return its attribute
Element elem = getFirstChildElement();
if (elem != null) {
return elem.getAttribute(localName);
}
}
return null;
}
String getPayloadAttributeValue(QName attNAme) {
if (staxBridge != null) {
return staxBridge.getPayloadAttributeValue(attNAme);
} else {
//not lazy -Just get first child element and return its attribute
Element elem = getFirstChildElement();
if (elem != null) {
return elem.getAttributeNS(attNAme.getNamespaceURI(), attNAme.getLocalPart());
}
}
return null;
}
public boolean isLazy() {
return (staxBridge != null && !payloadStreamRead);
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -51,7 +51,7 @@ public class ElementImpl
public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern(); public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern();
public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern(); public static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern();
private AttributeManager encodingStyleAttribute = new AttributeManager(); private transient AttributeManager encodingStyleAttribute = new AttributeManager();
protected QName elementQName; protected QName elementQName;
@ -424,7 +424,32 @@ public class ElementImpl
} }
Element getFirstChildElement() {
Node child = getFirstChild();
while (child != null) {
if (child instanceof Element) {
return ((Element) child);
}
child = child.getNextSibling();
}
return null;
}
protected SOAPElement findChild(NameImpl name) { protected SOAPElement findChild(NameImpl name) {
Node eachChild = getFirstChild();
while (eachChild != null) {
if (eachChild instanceof SOAPElement) {
SOAPElement eachChildSoap = (SOAPElement) eachChild;
if (eachChildSoap.getElementName().equals(name)) {
return eachChildSoap;
}
}
eachChild = eachChild.getNextSibling();
}
return null;
}
protected SOAPElement findAndConvertChildElement(NameImpl name) {
Iterator eachChild = getChildElementNodes(); Iterator eachChild = getChildElementNodes();
while (eachChild.hasNext()) { while (eachChild.hasNext()) {
SOAPElement child = (SOAPElement) eachChild.next(); SOAPElement child = (SOAPElement) eachChild.next();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,30 +29,36 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.util.Iterator;
import java.util.logging.Level; import java.util.logging.Level;
import org.w3c.dom.Document;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.sax.*;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.soap.Envelope; import com.sun.xml.internal.messaging.saaj.soap.LazyEnvelope;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.StaxBridge;
import com.sun.xml.internal.messaging.saaj.soap.StaxLazySourceBridge;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection; import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection;
import com.sun.xml.internal.messaging.saaj.util.stax.LazyEnvelopeStaxReader;
import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer; import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer;
import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
/** /**
* Our implementation of the SOAP envelope. * Our implementation of the SOAP envelope.
* *
* @author Anil Vijendran (anil@sun.com) * @author Anil Vijendran (anil@sun.com)
*/ */
public abstract class EnvelopeImpl extends ElementImpl implements Envelope { public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
protected HeaderImpl header; protected HeaderImpl header;
protected BodyImpl body; protected BodyImpl body;
String omitXmlDecl = "yes"; String omitXmlDecl = "yes";
@ -103,11 +109,9 @@ public abstract class EnvelopeImpl extends ElementImpl implements Envelope {
NameImpl bodyName = getBodyName(prefix); NameImpl bodyName = getBodyName(prefix);
HeaderImpl header = null; HeaderImpl header = null;
SOAPElement firstChild = null; SOAPElement firstChild = (SOAPElement) getFirstChildElement();
Iterator eachChild = getChildElementNodes(); if (firstChild != null) {
if (eachChild.hasNext()) {
firstChild = (SOAPElement) eachChild.next();
if (firstChild.getElementName().equals(headerName)) { if (firstChild.getElementName().equals(headerName)) {
log.severe("SAAJ0120.impl.header.already.exists"); log.severe("SAAJ0120.impl.header.already.exists");
throw new SOAPExceptionImpl("Can't add a header when one is already present."); throw new SOAPExceptionImpl("Can't add a header when one is already present.");
@ -254,6 +258,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements Envelope {
public void output(OutputStream out) throws IOException { public void output(OutputStream out) throws IOException {
try { try {
// materializeBody();
Transformer transformer = Transformer transformer =
EfficientStreamingTransformer.newTransformer(); EfficientStreamingTransformer.newTransformer();
@ -357,4 +362,77 @@ public abstract class EnvelopeImpl extends ElementImpl implements Envelope {
+ elementQName.getLocalPart() + " to " + elementQName.getLocalPart() + " to "
+ newName.getLocalPart()); + newName.getLocalPart());
} }
@Override
public void setStaxBridge(StaxBridge bridge) throws SOAPException {
//set it on the body
((BodyImpl) getBody()).setStaxBridge(bridge);
}
@Override
public StaxBridge getStaxBridge() throws SOAPException {
return ((BodyImpl) getBody()).getStaxBridge();
}
@Override
public XMLStreamReader getPayloadReader() throws SOAPException {
return ((BodyImpl) getBody()).getPayloadReader();
}
@Override
public void writeTo(final XMLStreamWriter writer) throws XMLStreamException, SOAPException {
StaxBridge readBridge = this.getStaxBridge();
if (readBridge != null && readBridge instanceof StaxLazySourceBridge) {
// StaxSoapWriteBridge writingBridge = new StaxSoapWriteBridge(this);
// writingBridge.write(writer);
final String soapEnvNS = this.getNamespaceURI();
final DOMStreamReader reader = new DOMStreamReader(this);
XMLStreamReaderToXMLStreamWriter writingBridge = new XMLStreamReaderToXMLStreamWriter();
writingBridge.bridge( new XMLStreamReaderToXMLStreamWriter.Breakpoint(reader, writer) {
public boolean proceedAfterStartElement() {
if ("Body".equals(reader.getLocalName()) && soapEnvNS.equals(reader.getNamespaceURI()) ){
return false;
} else
return true;
}
});//bridgeToBodyStartTag
((StaxLazySourceBridge)readBridge).writePayloadTo(writer);
writer.writeEndElement();//body
writer.writeEndElement();//env
writer.writeEndDocument();
writer.flush();
} else {
LazyEnvelopeStaxReader lazyEnvReader = new LazyEnvelopeStaxReader(this);
XMLStreamReaderToXMLStreamWriter writingBridge = new XMLStreamReaderToXMLStreamWriter();
writingBridge.bridge(lazyEnvReader, writer);
// writingBridge.bridge(new XMLStreamReaderToXMLStreamWriter.Breakpoint(lazyEnvReader, writer));
}
//Assume the staxBridge is exhausted now since we would have read the body reader
((BodyImpl) getBody()).setPayloadStreamRead();
}
@Override
public QName getPayloadQName() throws SOAPException {
return ((BodyImpl) getBody()).getPayloadQName();
}
@Override
public String getPayloadAttributeValue(String localName) throws SOAPException {
return ((BodyImpl) getBody()).getPayloadAttributeValue(localName);
}
@Override
public String getPayloadAttributeValue(QName qName) throws SOAPException {
return ((BodyImpl) getBody()).getPayloadAttributeValue(qName);
}
@Override
public boolean isLazy() {
try {
return ((BodyImpl) getBody()).isLazy();
} catch (SOAPException e) {
return false;
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,17 +70,17 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
protected void findFaultCodeElement() { protected void findFaultCodeElement() {
this.faultCodeElement = this.faultCodeElement =
(SOAPFaultElement) findChild(getFaultCodeName()); (SOAPFaultElement) findAndConvertChildElement(getFaultCodeName());
} }
protected void findFaultActorElement() { protected void findFaultActorElement() {
this.faultActorElement = this.faultActorElement =
(SOAPFaultElement) findChild(getFaultActorName()); (SOAPFaultElement) findAndConvertChildElement(getFaultActorName());
} }
protected void findFaultStringElement() { protected void findFaultStringElement() {
this.faultStringElement = this.faultStringElement =
(SOAPFaultElement) findChild(getFaultStringName()); (SOAPFaultElement) findAndConvertChildElement(getFaultStringName());
} }
public void setFaultCode(String faultCode) throws SOAPException { public void setFaultCode(String faultCode) throws SOAPException {
@ -162,7 +162,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
protected void initializeDetail() { protected void initializeDetail() {
NameImpl detailName = getDetailName(); NameImpl detailName = getDetailName();
detail = (Detail) findChild(detailName); detail = (Detail) findAndConvertChildElement(detailName);
} }
public Detail getDetail() { public Detail getDetail() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import javax.xml.namespace.QName;
import javax.xml.soap.*; import javax.xml.soap.*;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,7 +37,7 @@ import org.w3c.dom.Text;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
public class CommentImpl public class SOAPCommentImpl
extends com.sun.org.apache.xerces.internal.dom.CommentImpl extends com.sun.org.apache.xerces.internal.dom.CommentImpl
implements javax.xml.soap.Text, org.w3c.dom.Comment { implements javax.xml.soap.Text, org.w3c.dom.Comment {
@ -47,7 +47,7 @@ public class CommentImpl
protected static ResourceBundle rb = protected static ResourceBundle rb =
log.getResourceBundle(); log.getResourceBundle();
public CommentImpl(SOAPDocumentImpl ownerDoc, String text) { public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
super(ownerDoc, text); super(ownerDoc, text);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ import javax.xml.soap.SOAPException;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants; import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
public class TextImpl public class SOAPTextImpl
extends com.sun.org.apache.xerces.internal.dom.TextImpl extends com.sun.org.apache.xerces.internal.dom.TextImpl
implements javax.xml.soap.Text, org.w3c.dom.Text { implements javax.xml.soap.Text, org.w3c.dom.Text {
@ -41,7 +41,7 @@ public class TextImpl
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN, Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings"); "com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
public TextImpl(SOAPDocumentImpl ownerDoc, String text) { public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
super(ownerDoc, text); super(ownerDoc, text);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamReader;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
@ -70,6 +71,11 @@ public class Message1_1Impl extends MessageImpl implements SOAPConstants {
super(headers,ct,stat,in); super(headers,ct,stat,in);
} }
public Message1_1Impl(MimeHeaders headers, ContentType ct, int stat, XMLStreamReader reader)
throws SOAPExceptionImpl {
super(headers,ct,stat,reader);
}
public SOAPPart getSOAPPart() { public SOAPPart getSOAPPart() {
if (soapPartImpl == null) { if (soapPartImpl == null) {
soapPartImpl = new SOAPPart1_1Impl(this); soapPartImpl = new SOAPPart1_1Impl(this);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -90,4 +90,9 @@ public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants {
return new SOAPPart1_1Impl(); return new SOAPPart1_1Impl();
} }
@Override
public String getSOAPNamespace() {
return SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE;
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -284,7 +284,7 @@ public class Fault1_2Impl extends FaultImpl {
} }
public String getFaultNode() { public String getFaultNode() {
SOAPElement faultNode = findChild(getFaultNodeName()); SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
if (faultNode == null) { if (faultNode == null) {
return null; return null;
} }
@ -292,7 +292,7 @@ public class Fault1_2Impl extends FaultImpl {
} }
public void setFaultNode(String uri) throws SOAPException { public void setFaultNode(String uri) throws SOAPException {
SOAPElement faultNode = findChild(getFaultNodeName()); SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
if (faultNode != null) { if (faultNode != null) {
faultNode.detachNode(); faultNode.detachNode();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import javax.xml.soap.*; import javax.xml.soap.*;
import javax.xml.stream.XMLStreamReader;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType; import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
@ -63,6 +64,11 @@ public class Message1_2Impl extends MessageImpl implements SOAPConstants{
super(headers,ct,stat,in); super(headers,ct,stat,in);
} }
public Message1_2Impl(MimeHeaders headers, ContentType ct, int stat, XMLStreamReader reader)
throws SOAPExceptionImpl {
super(headers,ct,stat,reader);
}
public SOAPPart getSOAPPart() { public SOAPPart getSOAPPart() {
if (soapPartImpl == null) if (soapPartImpl == null)
soapPartImpl = new SOAPPart1_2Impl(this); soapPartImpl = new SOAPPart1_2Impl(this);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,4 +87,9 @@ public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{
return new SOAPPart1_2Impl(); return new SOAPPart1_2Impl();
} }
@Override
public String getSOAPNamespace() {
return SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE;
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,9 +47,15 @@ public class JAXMStreamSource extends StreamSource {
} else if (is instanceof ByteInputStream) { } else if (is instanceof ByteInputStream) {
this.in = (ByteInputStream) is; this.in = (ByteInputStream) is;
} else { } else {
ByteOutputStream bout = new ByteOutputStream(); ByteOutputStream bout = null;
bout.write(is); try {
this.in = bout.newInputStream(); bout = new ByteOutputStream();
bout.write(is);
this.in = bout.newInputStream();
} finally {
if (bout != null)
bout.close();
}
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,17 +40,15 @@ import org.xml.sax.SAXNotSupportedException;
* Pool of SAXParser objects * Pool of SAXParser objects
*/ */
public class ParserPool { public class ParserPool {
private final BlockingQueue queue; private final BlockingQueue<SAXParser> queue;
private SAXParserFactory factory; private SAXParserFactory factory;
private int capacity;
public ParserPool(int capacity) { public ParserPool(int capacity) {
this.capacity = capacity; queue = new ArrayBlockingQueue<SAXParser>(capacity);
queue = new ArrayBlockingQueue(capacity);
//factory = SAXParserFactory.newInstance(); //factory = SAXParserFactory.newInstance();
factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl(); factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
for (int i=0; i < capacity; i++) { for (int i = 0; i < capacity; i++) {
try { try {
queue.put(factory.newSAXParser()); queue.put(factory.newSAXParser());
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
@ -75,8 +73,8 @@ public class ParserPool {
} }
public void put(SAXParser parser) { public boolean put(SAXParser parser) {
queue.offer(parser); return queue.offer(parser);
} }
public void returnParser(SAXParser saxParser) { public void returnParser(SAXParser saxParser) {

View File

@ -0,0 +1,359 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.util.stax;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.w3c.dom.Node;
import com.sun.xml.internal.messaging.saaj.soap.impl.BodyImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
/**
* "Hybrid" reader which
* @author desagar
*
*/
public class LazyEnvelopeStaxReader extends com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader {
// EnvelopeImpl env;
XMLStreamReader payloadReader = null;
boolean usePayloadReaderDelegate = false;
private QName bodyQName;
public LazyEnvelopeStaxReader(EnvelopeImpl env) throws SOAPException, XMLStreamException {
super(env);
// this.env = env;
bodyQName = new QName(env.getNamespaceURI(), "Body");
payloadReader = env.getStaxBridge().getPayloadReader();
int eventType = getEventType();
while (eventType != START_ELEMENT) {
eventType = nextTag();
}
}
public Object getProperty(String name) throws IllegalArgumentException {
if (usePayloadReaderDelegate) return payloadReader.getProperty(name);
return super.getProperty(name);
}
public int next() throws XMLStreamException {
// boolean previouslyUsingPayloadReader = usePayloadReaderDelegate;
//call checkReaderStatus to advance to payloadReader if needed
checkReaderStatus(true);
if (usePayloadReaderDelegate) return payloadReader.getEventType();
//if we just moved to payload reader, don't advance the pointer
// if (usePayloadReaderDelegate && !previouslyUsingPayloadReader) return payloadReader.getEventType();
// if (usePayloadReaderDelegate) return payloadReader.next();
return getEventType();
}
public void require(int type, String namespaceURI, String localName)
throws XMLStreamException {
if (usePayloadReaderDelegate) payloadReader.require(type, namespaceURI, localName);
else super.require(type, namespaceURI, localName);
}
public String getElementText() throws XMLStreamException {
if (usePayloadReaderDelegate) return payloadReader.getElementText();
return super.getElementText();
}
public int nextTag() throws XMLStreamException {
if (usePayloadReaderDelegate) return payloadReader.nextTag();
return super.nextTag();
}
public boolean hasNext() throws XMLStreamException {
checkReaderStatus(false);
boolean hasNext;
if (usePayloadReaderDelegate) {
hasNext = payloadReader.hasNext();
} else {
hasNext = super.hasNext();
}
/*if (!hasNext && payloadReader != null) {
usePayloadReaderDelegate = true;
hasNext = payloadReader.hasNext();
}*/
return hasNext;
}
private void checkReaderStatus(boolean advanceToNext) throws XMLStreamException {
//if we are using payloadReader, make sure it is not exhausted
//if it is, return to DOM based reader for remaining end elements (body and envelope)
if (usePayloadReaderDelegate) {
if (!payloadReader.hasNext()) {
usePayloadReaderDelegate = false;
}
} else if (START_ELEMENT == getEventType()) {
//if not on payload reader, check if we need to switch to payload reader
//if the current event is the SOAP body element start,
//and the body is lazy, switch to the payload reader
if (bodyQName.equals(getName())) {
//if we are just switching to payload reader, don't advance...payload reader
//will already be on the first payload element
usePayloadReaderDelegate = true;
advanceToNext = false;
}
}
if (advanceToNext) {
if (usePayloadReaderDelegate) {
payloadReader.next();
} else {
super.next();
}
}
}
public void close() throws XMLStreamException {
if (usePayloadReaderDelegate) payloadReader.close();
else super.close();
}
public String getNamespaceURI(String prefix) {
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(prefix);
return super.getNamespaceURI(prefix);
}
public boolean isStartElement() {
if (usePayloadReaderDelegate) return payloadReader.isStartElement();
return super.isStartElement();
}
public boolean isEndElement() {
if (usePayloadReaderDelegate) return payloadReader.isEndElement();
return super.isEndElement();
}
public boolean isCharacters() {
if (usePayloadReaderDelegate) return payloadReader.isCharacters();
return super.isEndElement();
}
public boolean isWhiteSpace() {
if (usePayloadReaderDelegate) return payloadReader.isWhiteSpace();
return super.isWhiteSpace();
}
public String getAttributeValue(String namespaceURI, String localName) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(namespaceURI, localName);
return super.getAttributeValue(namespaceURI, localName);
}
public int getAttributeCount() {
if (usePayloadReaderDelegate) return payloadReader.getAttributeCount();
return super.getAttributeCount();
}
public QName getAttributeName(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeName(index);
return super.getAttributeName(index);
}
public String getAttributeNamespace(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeNamespace(index);
return super.getAttributeNamespace(index);
}
public String getAttributeLocalName(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeLocalName(index);
return super.getAttributeLocalName(index);
}
public String getAttributePrefix(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributePrefix(index);
return super.getAttributePrefix(index);
}
public String getAttributeType(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeType(index);
return super.getAttributeType(index);
}
public String getAttributeValue(int index) {
if (usePayloadReaderDelegate) return payloadReader.getAttributeValue(index);
return super.getAttributeValue(index);
}
public boolean isAttributeSpecified(int index) {
if (usePayloadReaderDelegate) return payloadReader.isAttributeSpecified(index);
return super.isAttributeSpecified(index);
}
public int getNamespaceCount() {
if (usePayloadReaderDelegate) return payloadReader.getNamespaceCount();
return super.getNamespaceCount();
}
public String getNamespacePrefix(int index) {
if (usePayloadReaderDelegate) return payloadReader.getNamespacePrefix(index);
return super.getNamespacePrefix(index);
}
public String getNamespaceURI(int index) {
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI(index);
return super.getNamespaceURI(index);
}
public NamespaceContext getNamespaceContext() {
if (usePayloadReaderDelegate) return payloadReader.getNamespaceContext();
return super.getNamespaceContext();
}
public int getEventType() {
if (usePayloadReaderDelegate) return payloadReader.getEventType();
return super.getEventType();
}
public String getText() {
if (usePayloadReaderDelegate) return payloadReader.getText();
return super.getText();
}
public char[] getTextCharacters() {
if (usePayloadReaderDelegate) return payloadReader.getTextCharacters();
return super.getTextCharacters();
}
public int getTextCharacters(int sourceStart, char[] target,
int targetStart, int length) throws XMLStreamException {
if (usePayloadReaderDelegate) return payloadReader.getTextCharacters(sourceStart, target, targetStart,
length);
return super.getTextCharacters(sourceStart, target, targetStart, length);
}
public int getTextStart() {
if (usePayloadReaderDelegate) return payloadReader.getTextStart();
return super.getTextStart();
}
public int getTextLength() {
if (usePayloadReaderDelegate) return payloadReader.getTextLength();
return super.getTextLength();
}
public String getEncoding() {
if (usePayloadReaderDelegate) return payloadReader.getEncoding();
return super.getEncoding();
}
public boolean hasText() {
if (usePayloadReaderDelegate) return payloadReader.hasText();
return super.hasText();
}
public Location getLocation() {
if (usePayloadReaderDelegate) return payloadReader.getLocation();
return super.getLocation();
}
public QName getName() {
if (usePayloadReaderDelegate) return payloadReader.getName();
return super.getName();
}
public String getLocalName() {
if (usePayloadReaderDelegate) return payloadReader.getLocalName();
return super.getLocalName();
}
public boolean hasName() {
if (usePayloadReaderDelegate) return payloadReader.hasName();
return super.hasName();
}
public String getNamespaceURI() {
if (usePayloadReaderDelegate) return payloadReader.getNamespaceURI();
return super.getNamespaceURI();
}
public String getPrefix() {
if (usePayloadReaderDelegate) return payloadReader.getPrefix();
return super.getPrefix();
}
public String getVersion() {
if (usePayloadReaderDelegate) return payloadReader.getVersion();
return super.getVersion();
}
public boolean isStandalone() {
if (usePayloadReaderDelegate) return payloadReader.isStandalone();
return super.isStandalone();
}
public boolean standaloneSet() {
if (usePayloadReaderDelegate) return payloadReader.standaloneSet();
return super.standaloneSet();
}
public String getCharacterEncodingScheme() {
if (usePayloadReaderDelegate) return payloadReader.getCharacterEncodingScheme();
return super.getCharacterEncodingScheme();
}
public String getPITarget() {
if (usePayloadReaderDelegate) return payloadReader.getPITarget();
return super.getPITarget();
}
public String getPIData() {
if (usePayloadReaderDelegate) return payloadReader.getPIData();
return super.getPIData();
}
//make sure that message is not realized as a result of call
//to getFirstChild
protected Node getFirstChild(Node node) {
if (node instanceof BodyImpl) {
return ((BodyImpl) node).getFirstChildNoMaterialize();
} else {
return node.getFirstChild();
}
}
protected Node getNextSibling(Node node) {
if (node instanceof BodyImpl) {
//body is not expected to have a next sibling - even if it does
//we would have to materialize the node to retrieve it.
//Since we don't want to materialize it right now, just return null
return null;
}
return node.getNextSibling();
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
package com.sun.xml.internal.org.jvnet.mimepull; package com.sun.xml.internal.org.jvnet.mimepull;
import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService;
public abstract class CleanUpExecutorFactory { public abstract class CleanUpExecutorFactory {
private static final String DEFAULT_PROPERTY_NAME = CleanUpExecutorFactory.class private static final String DEFAULT_PROPERTY_NAME = CleanUpExecutorFactory.class
@ -42,5 +42,5 @@ public abstract class CleanUpExecutorFactory {
} }
} }
public abstract Executor getExecutor(); public abstract ScheduledExecutorService getScheduledExecutorService();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package com.sun.xml.internal.org.jvnet.mimepull; package com.sun.xml.internal.org.jvnet.mimepull;
import java.util.concurrent.TimeUnit;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@ -32,7 +34,7 @@ import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -45,6 +47,7 @@ import java.util.logging.Logger;
final class WeakDataFile extends WeakReference<DataFile> { final class WeakDataFile extends WeakReference<DataFile> {
private static final Logger LOGGER = Logger.getLogger(WeakDataFile.class.getName()); private static final Logger LOGGER = Logger.getLogger(WeakDataFile.class.getName());
private static int TIMEOUT = 10; //milliseconds
//private static final int MAX_ITERATIONS = 2; //private static final int MAX_ITERATIONS = 2;
private static ReferenceQueue<DataFile> refQueue = new ReferenceQueue<DataFile>(); private static ReferenceQueue<DataFile> refQueue = new ReferenceQueue<DataFile>();
private static List<WeakDataFile> refList = new ArrayList<WeakDataFile>(); private static List<WeakDataFile> refList = new ArrayList<WeakDataFile>();
@ -52,28 +55,22 @@ final class WeakDataFile extends WeakReference<DataFile> {
private final RandomAccessFile raf; private final RandomAccessFile raf;
private static boolean hasCleanUpExecutor = false; private static boolean hasCleanUpExecutor = false;
static { static {
int delay = 10;
try {
delay = Integer.getInteger("com.sun.xml.internal.org.jvnet.mimepull.delay", 10);
} catch (SecurityException se) {
if (LOGGER.isLoggable(Level.CONFIG)) {
LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
new Object[] {"com.sun.xml.internal.org.jvnet.mimepull.delay"});
}
}
CleanUpExecutorFactory executorFactory = CleanUpExecutorFactory.newInstance(); CleanUpExecutorFactory executorFactory = CleanUpExecutorFactory.newInstance();
if (executorFactory!=null) { if (executorFactory!=null) {
if (LOGGER.isLoggable(Level.FINE)) { if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Initializing clean up executor for MIMEPULL: {0}", executorFactory.getClass().getName()); LOGGER.log(Level.FINE, "Initializing clean up executor for MIMEPULL: {0}", executorFactory.getClass().getName());
} }
Executor executor = executorFactory.getExecutor(); ScheduledExecutorService scheduler = executorFactory.getScheduledExecutorService();
executor.execute(new Runnable() { scheduler.scheduleWithFixedDelay(new CleanupRunnable(), delay, delay, TimeUnit.SECONDS);
@Override
public void run() {
WeakDataFile weak;
while (true) {
try {
weak = (WeakDataFile) refQueue.remove();
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Cleaning file = {0} from reference queue.", weak.file);
}
weak.close();
} catch (InterruptedException e) {
}
}
}
});
hasCleanUpExecutor = true; hasCleanUpExecutor = true;
} }
} }
@ -157,4 +154,24 @@ final class WeakDataFile extends WeakReference<DataFile> {
weak.close(); weak.close();
} }
} }
private static class CleanupRunnable implements Runnable {
@Override
public void run() {
try {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Running cleanup task");
}
WeakDataFile weak = (WeakDataFile) refQueue.remove(TIMEOUT);
while (weak != null) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Cleaning file = {0} from reference queue.", weak.file);
}
weak.close();
weak = (WeakDataFile) refQueue.remove(TIMEOUT);
}
} catch (InterruptedException e) {
}
}
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,7 @@ public class Base64Data implements CharSequence, Cloneable {
private DataHandler dataHandler; private DataHandler dataHandler;
private byte[] data; private byte[] data;
private String hrefCid;
/** /**
* Length of the valid data in {@link #data}. * Length of the valid data in {@link #data}.
@ -531,4 +532,16 @@ public class Base64Data implements CharSequence, Cloneable {
// //
// } // }
public String getHrefCid() {
if (hrefCid == null && dataHandler != null && dataHandler instanceof StreamingDataHandler) {
hrefCid = ((StreamingDataHandler)dataHandler).getHrefCid();
}
return hrefCid;
}
public void setHrefCid(final String cid) {
this.hrefCid = cid;
if (dataHandler != null && dataHandler instanceof StreamingDataHandler) ((StreamingDataHandler)dataHandler).setHrefCid(cid);
}
} }

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex;
import javax.activation.DataHandler;
import javax.xml.soap.SOAPException;
import javax.xml.soap.Text;
/**
* BinaryText represents a MTOM attachment.
*
* @author shih-chang.chen@oracle.com
*/
public interface BinaryText extends Text {
public String getHref();
public DataHandler getDataHandler() throws SOAPException;
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex;
import javax.activation.DataHandler;
/**
* A SOAPElement implementation may support this interface to allow MTOM attachments.
*
* @author shih-chang.chen@oracle.com
*/
public interface MtomEnabled {
BinaryText addBinaryText(byte[] bytes);
BinaryText addBinaryText(String contentType, byte[] bytes);
BinaryText addBinaryText(String href, DataHandler dl);
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
/**
* A StAxSOAPBody is a SOAPBody that allows to be loaded from a StAX style payload.
*
* @author shih-chang.chen@oracle.com
*/
public interface StAxSOAPBody {
/**
* The StAxSOAPBody represents the StAX source of SOAPBody payload.
*/
public static interface Payload {
/**
* Retrieve payload qname without materializing its contents
* @return
* @throws SOAPException
*/
public QName getPayloadQName();
public XMLStreamReader readPayload() throws XMLStreamException;
public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException;
/**
* Retrieve payload attribute value without materializing its contents
* @param localName
* @return
* @throws SOAPException
*/
public String getPayloadAttributeValue(String localName) throws XMLStreamException;
/**
* Retrieve payload attribute value without materializing its contents
* @param qName
* @return
* @throws SOAPException
*/
public String getPayloadAttributeValue(QName qName) throws XMLStreamException;
public void materialize() throws SOAPException;
}
public void setPayload(Payload src) throws SOAPException;
public Payload getPayload()throws SOAPException;
public boolean hasStaxPayload();
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,6 +52,8 @@ import java.net.URL;
*/ */
public abstract class StreamingDataHandler extends DataHandler implements Closeable { public abstract class StreamingDataHandler extends DataHandler implements Closeable {
private String hrefCid;
public StreamingDataHandler(Object o, String s) { public StreamingDataHandler(Object o, String s) {
super(o, s); super(o, s);
} }
@ -142,4 +144,11 @@ public abstract class StreamingDataHandler extends DataHandler implements Closea
*/ */
public abstract void close() throws IOException; public abstract void close() throws IOException;
public String getHrefCid() {
return hrefCid;
}
public void setHrefCid(final String cid) {
this.hrefCid = cid;
}
} }

View File

@ -0,0 +1,895 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import static org.w3c.dom.Node.*;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.util.Collections;
import java.util.Iterator;
/**
* Create an {@link XMLStreamReader} on top of a DOM tree.
*
* <p>
* Since various libraries as well as users often create "incorrect" DOM node,
* this class spends a lot of efforts making sure that broken DOM trees are
* nevertheless interpreted correctly.
*
* <p>
* For example, if a DOM level
* 1 tree is passed, each method will attempt to return the correct value
* by using {@link Node#getNodeName()}.
*
* <p>
* Similarly, if DOM is missing explicit namespace declarations,
* this class attempts to emulate necessary declarations.
*
*
* @author Santiago.PericasGeertsen@sun.com
* @author Kohsuke Kawaguchi
*/
public class DOMStreamReader implements XMLStreamReader, NamespaceContext {
/**
* Current DOM node being traversed.
*/
protected Node _current;
/**
* Starting node of the subtree being traversed.
*/
private Node _start;
/**
* Named mapping for attributes and NS decls for the current node.
*/
private NamedNodeMap _namedNodeMap;
/**
* If the reader points at {@link #CHARACTERS the text node},
* its whole value.
*
* <p>
* This is simply a cache of {@link Text#getWholeText()} of {@link #_current},
* but when a large binary data sent as base64 text, this could get very much
* non-trivial.
*/
protected String wholeText;
/**
* List of attributes extracted from <code>_namedNodeMap</code>.
*/
private final FinalArrayList<Attr> _currentAttributes = new FinalArrayList<Attr>();
/**
* {@link Scope} buffer.
*/
protected Scope[] scopes = new Scope[8];
/**
* Depth of the current element. The first element gets depth==0.
* Also used as the index to {@link #scopes}.
*/
protected int depth = 0;
/**
* State of this reader. Any of the valid states defined in StAX'
* XMLStreamConstants class.
*/
protected int _state;
/**
* Namespace declarations on one element.
*
* Instances are reused.
*/
protected static final class Scope {
/**
* Scope for the parent element.
*/
final Scope parent;
/**
* List of namespace declarations extracted from <code>_namedNodeMap</code>
*/
final FinalArrayList<Attr> currentNamespaces = new FinalArrayList<Attr>();
/**
* Additional namespace declarations obtained as a result of "fixing" DOM tree,
* which were not part of the original DOM tree.
*
* One entry occupies two spaces (prefix followed by URI.)
*/
final FinalArrayList<String> additionalNamespaces = new FinalArrayList<String>();
Scope(Scope parent) {
this.parent = parent;
}
void reset() {
currentNamespaces.clear();
additionalNamespaces.clear();
}
int getNamespaceCount() {
return currentNamespaces.size()+additionalNamespaces.size()/2;
}
String getNamespacePrefix(int index) {
int sz = currentNamespaces.size();
if(index< sz) {
Attr attr = currentNamespaces.get(index);
String result = attr.getLocalName();
if (result == null) {
result = QName.valueOf(attr.getNodeName()).getLocalPart();
}
return result.equals("xmlns") ? null : result;
} else {
return additionalNamespaces.get((index-sz)*2);
}
}
String getNamespaceURI(int index) {
int sz = currentNamespaces.size();
if(index< sz) {
return currentNamespaces.get(index).getValue();
} else {
return additionalNamespaces.get((index-sz)*2+1);
}
}
/**
* Returns the prefix bound to the given URI, or null.
* This method recurses to the parent.
*/
String getPrefix(String nsUri) {
for( Scope sp=this; sp!=null; sp=sp.parent ) {
for( int i=sp.currentNamespaces.size()-1; i>=0; i--) {
String result = getPrefixForAttr(sp.currentNamespaces.get(i),nsUri);
if(result!=null)
return result;
}
for( int i=sp.additionalNamespaces.size()-2; i>=0; i-=2 )
if(sp.additionalNamespaces.get(i+1).equals(nsUri))
return sp.additionalNamespaces.get(i);
}
return null;
}
/**
* Returns the namespace URI bound by the given prefix.
*
* @param prefix
* Prefix to look up.
*/
String getNamespaceURI(String prefix) {
String nsDeclName = prefix.length()==0 ? "xmlns" : "xmlns:"+prefix;
for( Scope sp=this; sp!=null; sp=sp.parent ) {
for( int i=sp.currentNamespaces.size()-1; i>=0; i--) {
Attr a = sp.currentNamespaces.get(i);
if(a.getNodeName().equals(nsDeclName))
return a.getValue();
}
for( int i=sp.additionalNamespaces.size()-2; i>=0; i-=2 )
if(sp.additionalNamespaces.get(i).equals(prefix))
return sp.additionalNamespaces.get(i+1);
}
return null;
}
}
public DOMStreamReader() {
}
public DOMStreamReader(Node node) {
setCurrentNode(node);
}
public void setCurrentNode(Node node) {
scopes[0] = new Scope(null);
depth=0;
_start = _current = node;
_state = START_DOCUMENT;
// verifyDOMIntegrity(node);
// displayDOM(node, System.out);
}
public void close() throws XMLStreamException {
}
/**
* Called when the current node is {@link Element} to look at attribute list
* (which contains both ns decl and attributes in DOM) and split them
* to attributes-proper and namespace decls.
*/
protected void splitAttributes() {
// Clear attribute and namespace lists
_currentAttributes.clear();
Scope scope = allocateScope();
_namedNodeMap = _current.getAttributes();
if (_namedNodeMap != null) {
final int n = _namedNodeMap.getLength();
for (int i = 0; i < n; i++) {
final Attr attr = (Attr) _namedNodeMap.item(i);
final String attrName = attr.getNodeName();
if (attrName.startsWith("xmlns:") || attrName.equals("xmlns")) { // NS decl?
scope.currentNamespaces.add(attr);
}
else {
_currentAttributes.add(attr);
}
}
}
// verify that all the namespaces used in element and attributes are indeed available
ensureNs(_current);
for( int i=_currentAttributes.size()-1; i>=0; i-- ) {
Attr a = _currentAttributes.get(i);
if(fixNull(a.getNamespaceURI()).length()>0)
ensureNs(a); // no need to declare "" for attributes in the default namespace
}
}
/**
* Sub-routine of {@link #splitAttributes()}.
*
* <p>
* Makes sure that the namespace URI/prefix used in the given node is available,
* and if not, declare it on the current scope to "fix" it.
*
* It's often common to create DOM trees without putting namespace declarations,
* and this makes sure that such DOM tree will be properly marshalled.
*/
private void ensureNs(Node n) {
String prefix = fixNull(n.getPrefix());
String uri = fixNull(n.getNamespaceURI());
Scope scope = scopes[depth];
String currentUri = scope.getNamespaceURI(prefix);
if(prefix.length()==0) {
currentUri = fixNull(currentUri);
if(currentUri.equals(uri))
return; // declared correctly
} else {
if(currentUri!=null && currentUri.equals(uri))
return; // declared correctly
}
if(prefix.equals("xml") || prefix.equals("xmlns"))
return; // implicitly declared namespaces
// needs to be declared
scope.additionalNamespaces.add(prefix);
scope.additionalNamespaces.add(uri);
}
/**
* Allocate new {@link Scope} for {@link #splitAttributes()}.
*/
private Scope allocateScope() {
if(scopes.length==++depth) {
Scope[] newBuf = new Scope[scopes.length*2];
System.arraycopy(scopes,0,newBuf,0,scopes.length);
scopes = newBuf;
}
Scope scope = scopes[depth];
if(scope==null) {
scope = scopes[depth] = new Scope(scopes[depth-1]);
} else {
scope.reset();
}
return scope;
}
public int getAttributeCount() {
if (_state == START_ELEMENT)
return _currentAttributes.size();
throw new IllegalStateException("DOMStreamReader: getAttributeCount() called in illegal state");
}
/**
* Return an attribute's local name. Handle the case of DOM level 1 nodes.
*/
public String getAttributeLocalName(int index) {
if (_state == START_ELEMENT) {
String localName = _currentAttributes.get(index).getLocalName();
return (localName != null) ? localName :
QName.valueOf(_currentAttributes.get(index).getNodeName()).getLocalPart();
}
throw new IllegalStateException("DOMStreamReader: getAttributeLocalName() called in illegal state");
}
/**
* Return an attribute's qname. Handle the case of DOM level 1 nodes.
*/
public QName getAttributeName(int index) {
if (_state == START_ELEMENT) {
Node attr = _currentAttributes.get(index);
String localName = attr.getLocalName();
if (localName != null) {
String prefix = attr.getPrefix();
String uri = attr.getNamespaceURI();
return new QName(fixNull(uri), localName, fixNull(prefix));
}
else {
return QName.valueOf(attr.getNodeName());
}
}
throw new IllegalStateException("DOMStreamReader: getAttributeName() called in illegal state");
}
public String getAttributeNamespace(int index) {
if (_state == START_ELEMENT) {
String uri = _currentAttributes.get(index).getNamespaceURI();
return fixNull(uri);
}
throw new IllegalStateException("DOMStreamReader: getAttributeNamespace() called in illegal state");
}
public String getAttributePrefix(int index) {
if (_state == START_ELEMENT) {
String prefix = _currentAttributes.get(index).getPrefix();
return fixNull(prefix);
}
throw new IllegalStateException("DOMStreamReader: getAttributePrefix() called in illegal state");
}
public String getAttributeType(int index) {
if (_state == START_ELEMENT) {
return "CDATA";
}
throw new IllegalStateException("DOMStreamReader: getAttributeType() called in illegal state");
}
public String getAttributeValue(int index) {
if (_state == START_ELEMENT) {
return _currentAttributes.get(index).getNodeValue();
}
throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state");
}
public String getAttributeValue(String namespaceURI, String localName) {
if (_state == START_ELEMENT) {
if (_namedNodeMap != null) {
Node attr = _namedNodeMap.getNamedItemNS(namespaceURI, localName);
return attr != null ? attr.getNodeValue() : null;
}
return null;
}
throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state");
}
public String getCharacterEncodingScheme() {
return null;
}
public String getElementText() throws javax.xml.stream.XMLStreamException {
throw new RuntimeException("DOMStreamReader: getElementText() not implemented");
}
public String getEncoding() {
return null;
}
public int getEventType() {
return _state;
}
/**
* Return an element's local name. Handle the case of DOM level 1 nodes.
*/
public String getLocalName() {
if (_state == START_ELEMENT || _state == END_ELEMENT) {
String localName = _current.getLocalName();
return localName != null ? localName :
QName.valueOf(_current.getNodeName()).getLocalPart();
}
else if (_state == ENTITY_REFERENCE) {
return _current.getNodeName();
}
throw new IllegalStateException("DOMStreamReader: getAttributeValue() called in illegal state");
}
public Location getLocation() {
return DummyLocation.INSTANCE;
}
/**
* Return an element's qname. Handle the case of DOM level 1 nodes.
*/
public javax.xml.namespace.QName getName() {
if (_state == START_ELEMENT || _state == END_ELEMENT) {
String localName = _current.getLocalName();
if (localName != null) {
String prefix = _current.getPrefix();
String uri = _current.getNamespaceURI();
return new QName(fixNull(uri), localName, fixNull(prefix));
}
else {
return QName.valueOf(_current.getNodeName());
}
}
throw new IllegalStateException("DOMStreamReader: getName() called in illegal state");
}
public NamespaceContext getNamespaceContext() {
return this;
}
/**
* Verifies the current state to see if we can return the scope, and do so
* if appropriate.
*
* Used to implement a bunch of StAX API methods that have the same usage restriction.
*/
private Scope getCheckedScope() {
if (_state == START_ELEMENT || _state == END_ELEMENT) {
return scopes[depth];
}
throw new IllegalStateException("DOMStreamReader: neither on START_ELEMENT nor END_ELEMENT");
}
public int getNamespaceCount() {
return getCheckedScope().getNamespaceCount();
}
public String getNamespacePrefix(int index) {
return getCheckedScope().getNamespacePrefix(index);
}
public String getNamespaceURI(int index) {
return getCheckedScope().getNamespaceURI(index);
}
public String getNamespaceURI() {
if (_state == START_ELEMENT || _state == END_ELEMENT) {
String uri = _current.getNamespaceURI();
return fixNull(uri);
}
return null;
}
/**
* This method is not particularly fast, but shouldn't be called very
* often. If we start to use it more, we should keep track of the
* NS declarations using a NamespaceContext implementation instead.
*/
public String getNamespaceURI(String prefix) {
if (prefix == null) {
throw new IllegalArgumentException("DOMStreamReader: getNamespaceURI(String) call with a null prefix");
}
else if (prefix.equals("xml")) {
return "http://www.w3.org/XML/1998/namespace";
}
else if (prefix.equals("xmlns")) {
return "http://www.w3.org/2000/xmlns/";
}
// check scopes
String nsUri = scopes[depth].getNamespaceURI(prefix);
if(nsUri!=null) return nsUri;
// then ancestors above start node
Node node = findRootElement();
String nsDeclName = prefix.length()==0 ? "xmlns" : "xmlns:"+prefix;
while (node.getNodeType() != DOCUMENT_NODE) {
// Is ns declaration on this element?
NamedNodeMap namedNodeMap = node.getAttributes();
Attr attr = (Attr) namedNodeMap.getNamedItem(nsDeclName);
if (attr != null)
return attr.getValue();
node = node.getParentNode();
}
return null;
}
public String getPrefix(String nsUri) {
if (nsUri == null) {
throw new IllegalArgumentException("DOMStreamReader: getPrefix(String) call with a null namespace URI");
}
else if (nsUri.equals("http://www.w3.org/XML/1998/namespace")) {
return "xml";
}
else if (nsUri.equals("http://www.w3.org/2000/xmlns/")) {
return "xmlns";
}
// check scopes
String prefix = scopes[depth].getPrefix(nsUri);
if(prefix!=null) return prefix;
// then ancestors above start node
Node node = findRootElement();
while (node.getNodeType() != DOCUMENT_NODE) {
// Is ns declaration on this element?
NamedNodeMap namedNodeMap = node.getAttributes();
for( int i=namedNodeMap.getLength()-1; i>=0; i-- ) {
Attr attr = (Attr)namedNodeMap.item(i);
prefix = getPrefixForAttr(attr,nsUri);
if(prefix!=null)
return prefix;
}
node = node.getParentNode();
}
return null;
}
/**
* Finds the root element node of the traversal.
*/
private Node findRootElement() {
int type;
Node node = _start;
while ((type = node.getNodeType()) != DOCUMENT_NODE
&& type != ELEMENT_NODE) {
node = node.getParentNode();
}
return node;
}
/**
* If the given attribute is a namespace declaration for the given namespace URI,
* return its prefix. Otherwise null.
*/
private static String getPrefixForAttr(Attr attr, String nsUri) {
String attrName = attr.getNodeName();
if (!attrName.startsWith("xmlns:") && !attrName.equals("xmlns"))
return null; // not nsdecl
if(attr.getValue().equals(nsUri)) {
if(attrName.equals("xmlns"))
return "";
String localName = attr.getLocalName();
return (localName != null) ? localName :
QName.valueOf(attrName).getLocalPart();
}
return null;
}
public Iterator getPrefixes(String nsUri) {
// This is an incorrect implementation,
// but AFAIK it's not used in the JAX-WS runtime
String prefix = getPrefix(nsUri);
if(prefix==null) return Collections.emptyList().iterator();
else return Collections.singletonList(prefix).iterator();
}
public String getPIData() {
if (_state == PROCESSING_INSTRUCTION) {
return ((ProcessingInstruction) _current).getData();
}
return null;
}
public String getPITarget() {
if (_state == PROCESSING_INSTRUCTION) {
return ((ProcessingInstruction) _current).getTarget();
}
return null;
}
public String getPrefix() {
if (_state == START_ELEMENT || _state == END_ELEMENT) {
String prefix = _current.getPrefix();
return fixNull(prefix);
}
return null;
}
public Object getProperty(String str) throws IllegalArgumentException {
return null;
}
public String getText() {
if (_state == CHARACTERS)
return wholeText;
if(_state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE)
return _current.getNodeValue();
throw new IllegalStateException("DOMStreamReader: getTextLength() called in illegal state");
}
public char[] getTextCharacters() {
return getText().toCharArray();
}
public int getTextCharacters(int sourceStart, char[] target, int targetStart,
int targetLength) throws XMLStreamException {
String text = getText();
int copiedSize = Math.min(targetLength, text.length() - sourceStart);
text.getChars(sourceStart, sourceStart + copiedSize, target, targetStart);
return copiedSize;
}
public int getTextLength() {
return getText().length();
}
public int getTextStart() {
if (_state == CHARACTERS || _state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE) {
return 0;
}
throw new IllegalStateException("DOMStreamReader: getTextStart() called in illegal state");
}
public String getVersion() {
return null;
}
public boolean hasName() {
return (_state == START_ELEMENT || _state == END_ELEMENT);
}
public boolean hasNext() throws javax.xml.stream.XMLStreamException {
return (_state != END_DOCUMENT);
}
public boolean hasText() {
if (_state == CHARACTERS || _state == CDATA || _state == COMMENT || _state == ENTITY_REFERENCE) {
return getText().trim().length() > 0;
}
return false;
}
public boolean isAttributeSpecified(int param) {
return false;
}
public boolean isCharacters() {
return (_state == CHARACTERS);
}
public boolean isEndElement() {
return (_state == END_ELEMENT);
}
public boolean isStandalone() {
return true;
}
public boolean isStartElement() {
return (_state == START_ELEMENT);
}
public boolean isWhiteSpace() {
if (_state == CHARACTERS || _state == CDATA)
return getText().trim().length()==0;
return false;
}
private static int mapNodeTypeToState(int nodetype) {
switch (nodetype) {
case CDATA_SECTION_NODE:
return CDATA;
case COMMENT_NODE:
return COMMENT;
case ELEMENT_NODE:
return START_ELEMENT;
case ENTITY_NODE:
return ENTITY_DECLARATION;
case ENTITY_REFERENCE_NODE:
return ENTITY_REFERENCE;
case NOTATION_NODE:
return NOTATION_DECLARATION;
case PROCESSING_INSTRUCTION_NODE:
return PROCESSING_INSTRUCTION;
case TEXT_NODE:
return CHARACTERS;
default:
throw new RuntimeException("DOMStreamReader: Unexpected node type");
}
}
public int next() throws XMLStreamException {
while(true) {
int r = _next();
switch (r) {
case CHARACTERS:
// if we are currently at text node, make sure that this is a meaningful text node.
Node prev = _current.getPreviousSibling();
if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
continue; // nope. this is just a continuation of previous text that should be invisible
Text t = (Text)_current;
wholeText = t.getWholeText();
if(wholeText.length()==0)
continue; // nope. this is empty text.
return CHARACTERS;
case START_ELEMENT:
splitAttributes();
return START_ELEMENT;
default:
return r;
}
}
}
protected int _next() throws XMLStreamException {
Node child;
switch (_state) {
case END_DOCUMENT:
throw new IllegalStateException("DOMStreamReader: Calling next() at END_DOCUMENT");
case START_DOCUMENT:
// Don't skip document element if this is a fragment
if (_current.getNodeType() == ELEMENT_NODE) {
return (_state = START_ELEMENT);
}
child = _current.getFirstChild();
if (child == null) {
return (_state = END_DOCUMENT);
}
else {
_current = child;
return (_state = mapNodeTypeToState(_current.getNodeType()));
}
case START_ELEMENT:
child = _current.getFirstChild();
if (child == null) {
return (_state = END_ELEMENT);
}
else {
_current = child;
return (_state = mapNodeTypeToState(_current.getNodeType()));
}
case END_ELEMENT:
case CHARACTERS:
case COMMENT:
case CDATA:
case ENTITY_REFERENCE:
case PROCESSING_INSTRUCTION:
if (_state == END_ELEMENT) depth--;
// If at the end of this fragment, then terminate traversal
if (_current == _start) {
return (_state = END_DOCUMENT);
}
Node sibling = _current.getNextSibling();
if (sibling == null) {
_current = _current.getParentNode();
// getParentNode() returns null for fragments
_state = (_current == null || _current.getNodeType() == DOCUMENT_NODE) ?
END_DOCUMENT : END_ELEMENT;
return _state;
}
else {
_current = sibling;
return (_state = mapNodeTypeToState(_current.getNodeType()));
}
case DTD:
case ATTRIBUTE:
case NAMESPACE:
default:
throw new RuntimeException("DOMStreamReader: Unexpected internal state");
}
}
public int nextTag() throws javax.xml.stream.XMLStreamException {
int eventType = next();
while (eventType == CHARACTERS && isWhiteSpace()
|| eventType == CDATA && isWhiteSpace()
|| eventType == SPACE
|| eventType == PROCESSING_INSTRUCTION
|| eventType == COMMENT)
{
eventType = next();
}
if (eventType != START_ELEMENT && eventType != END_ELEMENT) {
throw new XMLStreamException("DOMStreamReader: Expected start or end tag");
}
return eventType;
}
public void require(int type, String namespaceURI, String localName)
throws javax.xml.stream.XMLStreamException
{
if (type != _state) {
throw new XMLStreamException("DOMStreamReader: Required event type not found");
}
if (namespaceURI != null && !namespaceURI.equals(getNamespaceURI())) {
throw new XMLStreamException("DOMStreamReader: Required namespaceURI not found");
}
if (localName != null && !localName.equals(getLocalName())) {
throw new XMLStreamException("DOMStreamReader: Required localName not found");
}
}
public boolean standaloneSet() {
return true;
}
// -- Debugging ------------------------------------------------------
/*
private static void displayDOM(Node node, java.io.OutputStream ostream) {
try {
System.out.println("\n====\n");
XmlUtil.newTransformer().transform(
new DOMSource(node), new StreamResult(ostream));
System.out.println("\n====\n");
}
catch (Exception e) {
e.printStackTrace();
}
}
private static void verifyDOMIntegrity(Node node) {
switch (node.getNodeType()) {
case ELEMENT_NODE:
case ATTRIBUTE_NODE:
// DOM level 1?
if (node.getLocalName() == null) {
System.out.println("WARNING: DOM level 1 node found");
System.out.println(" -> node.getNodeName() = " + node.getNodeName());
System.out.println(" -> node.getNamespaceURI() = " + node.getNamespaceURI());
System.out.println(" -> node.getLocalName() = " + node.getLocalName());
System.out.println(" -> node.getPrefix() = " + node.getPrefix());
}
if (node.getNodeType() == ATTRIBUTE_NODE) return;
NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++) {
verifyDOMIntegrity(attrs.item(i));
}
case DOCUMENT_NODE:
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
verifyDOMIntegrity(children.item(i));
}
}
}
*/
private static String fixNull(String s) {
if(s==null) return "";
else return s;
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import javax.xml.stream.Location;
/**
* {@link Location} that returns no info.
*
* @author Santiago.PericasGeertsen@sun.com
*/
public final class DummyLocation implements Location {
private DummyLocation() {}
public static final Location INSTANCE = new DummyLocation();
public int getCharacterOffset() {
return -1;
}
public int getColumnNumber() {
return -1;
}
public int getLineNumber() {
return -1;
}
public String getPublicId() {
return null;
}
public String getSystemId() {
return null;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import java.util.ArrayList;
import java.util.Collection;
/**
* {@link ArrayList} with a final marker to help JIT.
* @author Kohsuke Kawaguchi
*/
public final class FinalArrayList<T> extends ArrayList<T> {
public FinalArrayList(int initialCapacity) {
super(initialCapacity);
}
public FinalArrayList() {
}
public FinalArrayList(Collection collection) {
super(collection);
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.stream.XMLStreamWriter;
/**
* A {@link XMLStreamWriter} that used for MTOM encoding may provide its own
* {@link AttachmentMarshaller}. The marshaller could do processing based on
* MTOM threshold, and make decisions about inlining the attachment data or not.
*
* @author Jitendra Kotamraju
* @see JAXBMessage
* @see MtomCodec
*/
public interface MtomStreamWriter {
AttachmentMarshaller getAttachmentMarshaller();
}

View File

@ -0,0 +1,153 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import java.util.Iterator;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.stream.XMLStreamException;
import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
/**
* SaajStaxReaderEx
*
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReaderEx {
//TODO extends com.sun.xml.internal.ws.streaming.DOMStreamReader
private BinaryText binaryText = null;
private Base64Data base64AttData = null;
public SaajStaxReaderEx(SOAPElement se) {
super(se);
}
@Override
public int next() throws XMLStreamException {
binaryText = null;
base64AttData = null;
while(true) {
int r = _next();
switch (r) {
case CHARACTERS:
if (_current instanceof BinaryText) {
binaryText = (BinaryText) _current;
base64AttData = new Base64Data();
try {
base64AttData.set(binaryText.getDataHandler());
//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
} else {
// if we are currently at text node, make sure that this is a meaningful text node.
Node prev = _current.getPreviousSibling();
if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
continue; // nope. this is just a continuation of previous text that should be invisible
Text t = (Text)_current;
wholeText = t.getWholeText();
if(wholeText.length()==0)
continue; // nope. this is empty text.
}
return CHARACTERS;
case START_ELEMENT:
splitAttributes();
return START_ELEMENT;
default:
return r;
}
}
}
@Override
public String getElementTextTrim() throws XMLStreamException {
// TODO Auto-generated method stub
return null;
}
@Override
public CharSequence getPCDATA() throws XMLStreamException {
return (binaryText != null) ? base64AttData : getText();
}
@Override
public com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx getNamespaceContext() {
return new com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx() {
@Override
public String getNamespaceURI(String prefix) {
return _current.lookupNamespaceURI(prefix);
}
@Override
public String getPrefix(String uri) {
return _current.lookupPrefix(uri);
}
@Override
public Iterator getPrefixes(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Iterator<Binding> iterator() {
// TODO Auto-generated method stub
return null;
}
};
}
@Override
public int getTextLength() {
return (binaryText != null) ? base64AttData.length() : super.getTextLength();
}
@Override
public int getTextStart() {
return (binaryText != null) ? 0: super.getTextStart();
}
@Override
public char[] getTextCharacters() {
if (binaryText != null) {
char[] chars = new char[base64AttData.length()];
base64AttData.writeTo(chars, 0);
return chars;
}
return super.getTextCharacters();
}
}

View File

@ -0,0 +1,330 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import java.util.Arrays;
import java.util.Iterator;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.w3c.dom.Comment;
import org.w3c.dom.Node;
/**
* SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
*
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxWriter implements XMLStreamWriter {
protected SOAPMessage soap;
protected String envURI;
protected SOAPElement currentElement;
static final protected String Envelope = "Envelope";
static final protected String Header = "Header";
static final protected String Body = "Body";
static final protected String xmlns = "xmlns";
public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
soap = msg;
this.envURI = uri;
}
public SOAPMessage getSOAPMessage() {
return soap;
}
protected SOAPElement getEnvelope() throws SOAPException {
return soap.getSOAPPart().getEnvelope();
}
@Override
public void writeStartElement(final String localName) throws XMLStreamException {
try {
currentElement = currentElement.addChildElement(localName);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public void writeStartElement(final String ns, final String ln) throws XMLStreamException {
writeStartElement(null, ln, ns);
}
@Override
public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
try {
if (envURI.equals(ns)) {
if (Envelope.equals(ln)) {
currentElement = getEnvelope();
fixPrefix(prefix);
return;
} else if (Header.equals(ln)) {
currentElement = soap.getSOAPHeader();
fixPrefix(prefix);
return;
} else if (Body.equals(ln)) {
currentElement = soap.getSOAPBody();
fixPrefix(prefix);
return;
}
}
currentElement = (prefix == null) ?
currentElement.addChildElement(new QName(ns, ln)) :
currentElement.addChildElement(ln, prefix, ns);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
private void fixPrefix(final String prfx) throws XMLStreamException {
String oldPrfx = currentElement.getPrefix();
if (prfx != null && !prfx.equals(oldPrfx)) {
currentElement.setPrefix(prfx);
}
}
@Override
public void writeEmptyElement(final String uri, final String ln) throws XMLStreamException {
writeStartElement(null, ln, uri);
}
@Override
public void writeEmptyElement(final String prefix, final String ln, final String uri) throws XMLStreamException {
writeStartElement(prefix, ln, uri);
}
@Override
public void writeEmptyElement(final String ln) throws XMLStreamException {
writeStartElement(null, ln, null);
}
@Override
public void writeEndElement() throws XMLStreamException {
if (currentElement != null) currentElement = currentElement.getParentElement();
}
@Override
public void writeEndDocument() throws XMLStreamException {
}
@Override
public void close() throws XMLStreamException {
}
@Override
public void flush() throws XMLStreamException {
}
@Override
public void writeAttribute(final String ln, final String val) throws XMLStreamException {
writeAttribute(null, null, ln, val);
}
@Override
public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
try {
if (ns == null) {
if (prefix == null && xmlns.equals(ln)) {
currentElement.addNamespaceDeclaration("", value);
} else {
currentElement.setAttributeNS("", ln, value);
}
} else {
QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
currentElement.addAttribute(name, value);
}
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public void writeAttribute(final String ns, final String ln, final String val) throws XMLStreamException {
writeAttribute(null, ns, ln, val);
}
@Override
public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
// make prefix default if null or "xmlns" (according to javadoc)
if (prefix == null || "xmlns".equals(prefix)) {
prefix = "";
}
try {
currentElement.addNamespaceDeclaration(prefix, uri);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public void writeDefaultNamespace(final String uri) throws XMLStreamException {
writeNamespace("", uri);
}
@Override
public void writeComment(final String data) throws XMLStreamException {
Comment c = soap.getSOAPPart().createComment(data);
currentElement.appendChild(c);
}
@Override
public void writeProcessingInstruction(final String target) throws XMLStreamException {
Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
currentElement.appendChild(n);
}
@Override
public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
currentElement.appendChild(n);
}
@Override
public void writeCData(final String data) throws XMLStreamException {
Node n = soap.getSOAPPart().createCDATASection(data);
currentElement.appendChild(n);
}
@Override
public void writeDTD(final String dtd) throws XMLStreamException {
//TODO ... Don't do anything here
}
@Override
public void writeEntityRef(final String name) throws XMLStreamException {
Node n = soap.getSOAPPart().createEntityReference(name);
currentElement.appendChild(n);
}
@Override
public void writeStartDocument() throws XMLStreamException {
}
@Override
public void writeStartDocument(final String version) throws XMLStreamException {
if (version != null) soap.getSOAPPart().setXmlVersion(version);
}
@Override
public void writeStartDocument(final String encoding, final String version) throws XMLStreamException {
if (version != null) soap.getSOAPPart().setXmlVersion(version);
if (encoding != null) {
try {
soap.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
}
@Override
public void writeCharacters(final String text) throws XMLStreamException {
try {
currentElement.addTextNode(text);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
try {
currentElement.addTextNode(new String(chr));
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public String getPrefix(final String uri) throws XMLStreamException {
return currentElement.lookupPrefix(uri);
}
@Override
public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
try {
this.currentElement.addNamespaceDeclaration(prefix, uri);
} catch (SOAPException e) {
throw new XMLStreamException(e);
}
}
@Override
public void setDefaultNamespace(final String uri) throws XMLStreamException {
setPrefix("", uri);
}
@Override
public void setNamespaceContext(final NamespaceContext context)throws XMLStreamException {
throw new UnsupportedOperationException();
}
@Override
public Object getProperty(final String name) throws IllegalArgumentException {
//TODO the following line is to make eclipselink happy ... they are aware of this problem -
if (javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES.equals(name)) return Boolean.FALSE;
return null;
}
@Override
public NamespaceContext getNamespaceContext() {
return new NamespaceContext() {
public String getNamespaceURI(final String prefix) {
return currentElement.getNamespaceURI(prefix);
}
public String getPrefix(final String namespaceURI) {
return currentElement.lookupPrefix(namespaceURI);
}
public Iterator getPrefixes(final String namespaceURI) {
return new Iterator() {
String prefix = getPrefix(namespaceURI);
public boolean hasNext() {
return (prefix != null);
}
public Object next() {
if (!hasNext()) throw new java.util.NoSuchElementException();
String next = prefix;
prefix = null;
return next;
}
public void remove() {}
};
}
};
}
}

View File

@ -0,0 +1,244 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.UUID;
import javax.activation.DataHandler;
import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException;
import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled;
import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx;
import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler;
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
//
//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter;
//import com.sun.xml.internal.ws.developer.StreamingDataHandler;
//import com.sun.xml.internal.ws.streaming.MtomStreamWriter;
/**
* SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl.
*
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter {
static final protected String xopNS = "http://www.w3.org/2004/08/xop/include";
static final protected String Include = "Include";
static final protected String href = "href";
private enum State {xopInclude, others};
private State state = State.others;
private BinaryText binaryText;
public SaajStaxWriterEx(SOAPMessage msg, String uri) throws SOAPException {
super(msg, uri);
}
public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
if (xopNS.equals(ns) && Include.equals(ln)) {
state = State.xopInclude;
return;
} else {
super.writeStartElement(prefix, ln, ns);
}
}
@Override
public void writeEndElement() throws XMLStreamException {
if (state.equals(State.xopInclude)) {
state = State.others;
} else {
super.writeEndElement();
}
}
@Override
public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException {
if (binaryText != null && href.equals(ln)) {
return;
} else {
super.writeAttribute(prefix, ns, ln, value);
}
}
// @Override
// public void writeComment(String data) throws XMLStreamException {
// ((ElementImpl)currentElement).addCommentNode(data);
// }
//
// @Override
// public void writeCData(String data) throws XMLStreamException {
// CDataTextImpl cdt = new CDataTextImpl(soap.getSOAPPart(), data);
// currentElement.appendChild(cdt);
// }
@Override
public NamespaceContextEx getNamespaceContext() {
return new NamespaceContextEx() {
public String getNamespaceURI(String prefix) {
return currentElement.getNamespaceURI(prefix);
}
public String getPrefix(String namespaceURI) {
return currentElement.lookupPrefix(namespaceURI);
}
public Iterator getPrefixes(final String namespaceURI) {
return new Iterator() {
String prefix = getPrefix(namespaceURI);
public boolean hasNext() {
return (prefix != null);
}
public Object next() {
if (prefix == null) throw new java.util.NoSuchElementException();
String next = prefix;
prefix = null;
return next;
}
public void remove() {}
};
}
public Iterator<Binding> iterator() {
return new Iterator<Binding>() {
public boolean hasNext() { return false; }
public Binding next() { return null; }
public void remove() {}
};
}
};
}
@Override
public void writeBinary(DataHandler data) throws XMLStreamException {
// binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl)soap, null, currentElement.getOwnerDocument(), data);
// currentElement.appendChild(binaryText);
addBinaryText(data);
}
@Override
public OutputStream writeBinary(String arg0) throws XMLStreamException {
return null;
}
@Override
public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamException {
// if (mtomThreshold == -1 || mtomThreshold > length) return null;
byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
if (currentElement instanceof MtomEnabled) {
binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
} else {
throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
}
}
@Override
public void writePCDATA(CharSequence arg0) throws XMLStreamException {
if (arg0 instanceof Base64Data) {
// The fix of StreamReaderBufferCreator preserves this dataHandler
addBinaryText(((Base64Data) arg0).getDataHandler());
} else {
// We should not normally get here as we expect a DataHandler,
// but this is the most general solution. If we do get
// something other than a Data Handler, create a Text node with
// the data. Another alternative would be to throw an exception,
// but in the most general case, we don't know whether this input
// is expected.
try {
currentElement.addTextNode(arg0.toString());
} catch (SOAPException e) {
throw new XMLStreamException("Cannot add Text node", e);
}
}
}
static private String encodeCid() {
String cid = "example.jaxws.sun.com";
String name = UUID.randomUUID() + "@";
return name + cid;
}
private String addBinaryText(DataHandler data) {
String hrefOrCid = null;
if (data instanceof StreamingDataHandler) {
hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
}
if (hrefOrCid == null) hrefOrCid = encodeCid();
String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
// Should we do the threshold processing on DataHandler ? But that would be
// expensive as DataHolder need to read the data again from its source
//binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
//currentElement.appendChild(binaryText);
if (currentElement instanceof MtomEnabled) {
binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
} else {
throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
}
return hrefOrCid;
}
public AttachmentMarshaller getAttachmentMarshaller() {
return new AttachmentMarshaller() {
@Override
public String addMtomAttachment(DataHandler data, String ns, String ln) {
// if (mtomThreshold == -1) return null;
String hrefOrCid = addBinaryText(data);
// return binaryText.getHref();
return hrefOrCid;
}
@Override
public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String ns, String ln) {
// if (mtomThreshold == -1 || mtomThreshold > length) return null;
byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
// binaryText = (BinaryTextImpl) ((ElementImpl) currentElement).addAsBase64TextNode(bytes);
if (currentElement instanceof MtomEnabled) {
binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
} else {
throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
}
return binaryText.getHref();
}
@Override
public String addSwaRefAttachment(DataHandler data) {
return "cid:"+encodeCid();
}
@Override
public boolean isXOPPackage() {
return true;
}
};
}
}

View File

@ -0,0 +1,297 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.org.jvnet.staxex.util;
import java.io.IOException;
import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.XMLConstants;
import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
/**
* Reads a sub-tree from {@link XMLStreamReader} and writes to {@link XMLStreamWriter}
* as-is.
*
* <p>
* This class can be sub-classed to implement a simple transformation logic.
*
* @author Kohsuke Kawaguchi
* @author Ryan Shoemaker
*/
public class XMLStreamReaderToXMLStreamWriter {
static public class Breakpoint {
protected XMLStreamReader reader;
protected XMLStreamWriter writer;
public Breakpoint(XMLStreamReader r, XMLStreamWriter w) { reader = r; writer = w; }
public XMLStreamReader reader() { return reader; }
public XMLStreamWriter writer() { return writer; }
public boolean proceedBeforeStartElement() { return true; }
public boolean proceedAfterStartElement() { return true; }
}
private static final int BUF_SIZE = 4096;
protected XMLStreamReader in;
protected XMLStreamWriter out;
private char[] buf;
boolean optimizeBase64Data = false;
AttachmentMarshaller mtomAttachmentMarshaller;
/**
* Reads one subtree and writes it out.
*
* <p>
* The {@link XMLStreamWriter} never receives a start/end document event.
* Those need to be written separately by the caller.
*/
public void bridge(XMLStreamReader in, XMLStreamWriter out) throws XMLStreamException {
bridge(in, out, null);
}
public void bridge(Breakpoint breakPoint) throws XMLStreamException {
bridge(breakPoint.reader(), breakPoint.writer(), breakPoint);
}
private void bridge(XMLStreamReader in, XMLStreamWriter out, Breakpoint breakPoint) throws XMLStreamException {
assert in!=null && out!=null;
this.in = in;
this.out = out;
optimizeBase64Data = (in instanceof XMLStreamReaderEx);
if (out instanceof XMLStreamWriterEx && out instanceof MtomStreamWriter) {
mtomAttachmentMarshaller = ((MtomStreamWriter) out).getAttachmentMarshaller();
}
// remembers the nest level of elements to know when we are done.
int depth=0;
buf = new char[BUF_SIZE];
// if the parser is at the start tag, proceed to the first element
int event = getEventType();
if( event!=XMLStreamConstants.START_ELEMENT)
throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event);
do {
// These are all of the events listed in the javadoc for
// XMLEvent.
// The spec only really describes 11 of them.
switch (event) {
case XMLStreamConstants.START_ELEMENT :
if (breakPoint != null && !breakPoint.proceedBeforeStartElement()) return;
depth++;
handleStartElement();
if (breakPoint != null && !breakPoint.proceedAfterStartElement()) return;
break;
case XMLStreamConstants.END_ELEMENT :
handleEndElement();
depth--;
if(depth==0)
return;
break;
case XMLStreamConstants.CHARACTERS :
handleCharacters();
break;
case XMLStreamConstants.ENTITY_REFERENCE :
handleEntityReference();
break;
case XMLStreamConstants.PROCESSING_INSTRUCTION :
handlePI();
break;
case XMLStreamConstants.COMMENT :
handleComment();
break;
case XMLStreamConstants.DTD :
handleDTD();
break;
case XMLStreamConstants.CDATA :
handleCDATA();
break;
case XMLStreamConstants.SPACE :
handleSpace();
break;
case XMLStreamConstants.END_DOCUMENT:
throw new XMLStreamException("Malformed XML at depth="+depth+", Reached EOF. Event="+event);
default :
throw new XMLStreamException("Cannot process event: " + event);
}
event=getNextEvent();
} while (depth!=0);
}
protected void handlePI() throws XMLStreamException {
out.writeProcessingInstruction(
in.getPITarget(),
in.getPIData());
}
protected void handleCharacters() throws XMLStreamException {
CharSequence c = null;
if (optimizeBase64Data) {
c = ((XMLStreamReaderEx)in).getPCDATA();
}
if ((c != null) && (c instanceof Base64Data)) {
if (mtomAttachmentMarshaller != null) {
Base64Data b64d = (Base64Data) c;
((XMLStreamWriterEx)out).writeBinary(b64d.getDataHandler());
} else {
try {
((Base64Data)c).writeTo(out);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
} else {
for (int start=0,read=buf.length; read == buf.length; start+=buf.length) {
read = in.getTextCharacters(start, buf, 0, buf.length);
out.writeCharacters(buf, 0, read);
}
}
}
protected void handleEndElement() throws XMLStreamException {
out.writeEndElement();
}
protected void handleStartElement() throws XMLStreamException {
String nsUri = in.getNamespaceURI();
if(nsUri==null)
out.writeStartElement(in.getLocalName());
else
out.writeStartElement(
fixNull(in.getPrefix()),
in.getLocalName(),
nsUri
);
// start namespace bindings
int nsCount = in.getNamespaceCount();
for (int i = 0; i < nsCount; i++) {
out.writeNamespace(
in.getNamespacePrefix(i),
fixNull(in.getNamespaceURI(i))); // zephyr doesn't like null, I don't know what is correct, so just fix null to "" for now
}
// write attributes
int attCount = in.getAttributeCount();
for (int i = 0; i < attCount; i++) {
handleAttribute(i);
}
}
/**
* Writes out the {@code i}-th attribute of the current element.
*
* <p>
* Used from {@link #handleStartElement()}.
*/
protected void handleAttribute(int i) throws XMLStreamException {
String nsUri = in.getAttributeNamespace(i);
String prefix = in.getAttributePrefix(i);
if (fixNull(nsUri).equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
//Its a namespace decl, ignore as it is already written.
return;
}
if(nsUri==null || prefix == null || prefix.equals("")) {
out.writeAttribute(
in.getAttributeLocalName(i),
in.getAttributeValue(i)
);
} else {
out.writeAttribute(
prefix,
nsUri,
in.getAttributeLocalName(i),
in.getAttributeValue(i)
);
}
}
protected void handleDTD() throws XMLStreamException {
out.writeDTD(in.getText());
}
protected void handleComment() throws XMLStreamException {
out.writeComment(in.getText());
}
protected void handleEntityReference() throws XMLStreamException {
out.writeEntityRef(in.getText());
}
protected void handleSpace() throws XMLStreamException {
handleCharacters();
}
protected void handleCDATA() throws XMLStreamException {
out.writeCData(in.getText());
}
private static String fixNull(String s) {
if(s==null) return "";
else return s;
}
private int getEventType() throws XMLStreamException {
int event = in.getEventType();
// if the parser is at the start tag, proceed to the first element
//Note - need to do this every time because we could be using a composite reader
if(event == XMLStreamConstants.START_DOCUMENT) {
// nextTag doesn't correctly handle DTDs
while( !in.isStartElement() ) {
event = in.next();
if (event == XMLStreamConstants.COMMENT)
handleComment();
}
}
return event;
}
private int getNextEvent() throws XMLStreamException {
in.next();
return getEventType();
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@ import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import com.sun.xml.internal.ws.api.addressing.AddressingVersion; import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter;
import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
import com.sun.xml.internal.ws.server.WSEndpointImpl; import com.sun.xml.internal.ws.server.WSEndpointImpl;
import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants;
import com.sun.istack.internal.Nullable; import com.sun.istack.internal.Nullable;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil;
import com.sun.xml.internal.ws.util.DOMUtil; import com.sun.xml.internal.ws.util.DOMUtil;
import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter;
import com.sun.xml.internal.ws.util.xml.XmlUtil; import com.sun.xml.internal.ws.util.xml.XmlUtil;
import com.sun.xml.internal.ws.util.xml.XMLStreamReaderToXMLStreamWriter; import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants; import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.xml.sax.*; import org.xml.sax.*;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -158,7 +158,7 @@ public class FilterMessageImpl extends Message {
} }
public Message copy() { public Message copy() {
return delegate.copy(); return delegate.copy().copyFrom(delegate);
} }
public @NotNull String getID(@NotNull WSBinding binding) { public @NotNull String getID(@NotNull WSBinding binding) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -196,6 +196,12 @@ import java.util.UUID;
*/ */
public abstract class Message { public abstract class Message {
// See Packet for doc.
private boolean isProtocolMessage = false;
// next two are package protected - should only be used from Packet
boolean isProtocolMessage() { return isProtocolMessage; }
void setIsProtocolMessage() { isProtocolMessage = true; }
/** /**
* Returns true if headers are present in the message. * Returns true if headers are present in the message.
* *
@ -724,11 +730,33 @@ public abstract class Message {
* <p> * <p>
* The restrictions placed on the use of copied {@link Message} can be * The restrictions placed on the use of copied {@link Message} can be
* relaxed if necessary, but it will make the copy method more expensive. * relaxed if necessary, but it will make the copy method more expensive.
*
* <h3>IMPORTANT</h3>
* <p> WHEN YOU IMPLEMENT OR CHANGE A {@link .copy()} METHOD, YOU MUST
* USE THE {@link copyFrom(Message)} METHOD IN THE IMPLEMENTATION.
*/ */
// TODO: update the class javadoc with 'lifescope' // TODO: update the class javadoc with 'lifescope'
// and move the discussion about life scope there. // and move the discussion about life scope there.
public abstract Message copy(); public abstract Message copy();
/**
* The {@link Message#copy()} method is used as a shorthand
* throughout the codecase in place of calling a copy constructor.
* However, that shorthand make it difficult to have a concrete
* method here in the base to do common work.
*
* <p> Rather than have each {@code copy} method duplicate code, the
* following method is used in each {@code copy} implementation.
* It MUST be called.
*
* @return The Message that calls {@code copyFrom} inside the
* {@code copy} method after the copy constructor
*/
public final Message copyFrom(Message m) {
isProtocolMessage = m.isProtocolMessage;
return this;
}
/** /**
* Retuns a unique id for the message. The id can be used for various things, * Retuns a unique id for the message. The id can be used for various things,
* like debug assistance, logging, and MIME encoding(say for boundary). * like debug assistance, logging, and MIME encoding(say for boundary).

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -93,6 +93,11 @@ class MessageWrapper extends StreamMessage {
return delegate.equals(obj); return delegate.equals(obj);
} }
@Override
boolean isProtocolMessage() { return delegate.isProtocolMessage(); }
@Override
void setIsProtocolMessage() { delegate.setIsProtocolMessage(); }
@Override @Override
public boolean hasHeaders() { public boolean hasHeaders() {
return delegate.hasHeaders(); return delegate.hasHeaders();
@ -105,7 +110,7 @@ class MessageWrapper extends StreamMessage {
@Override @Override
public String toString() { public String toString() {
return delegate.toString(); return "{MessageWrapper: " + delegate.toString() + "}";
} }
@Override @Override
@ -214,7 +219,7 @@ class MessageWrapper extends StreamMessage {
@Override @Override
public Message copy() { public Message copy() {
return delegate.copy(); return delegate.copy().copyFrom(delegate);
} }
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -248,6 +248,26 @@ public final class Packet
if (message != null) this.message.setMessageMedadata(this); if (message != null) this.message.setMessageMedadata(this);
} }
// ALL NEW PACKETS SHOULD HAVE THIS AS false.
// SETTING TO true MUST BE DONE EXPLICITLY,
// NOT VIA COPYING/RELATING PACKETS.
public boolean isProtocolMessage() {
return message != null && message.isProtocolMessage();
}
public void setIsProtocolMessage() {
assert message != null;
message.setIsProtocolMessage();
}
private String userStateId;
public String getUserStateId() {
return userStateId;
}
public void setUserStateId(final String x) {
assert x != null && x.length() <= 256;
userStateId = x;
}
private WSDLOperationMapping wsdlOperationMapping = null; private WSDLOperationMapping wsdlOperationMapping = null;
private QName wsdlOperation; private QName wsdlOperation;
@ -894,6 +914,7 @@ public final class Packet
response.component = request.component; response.component = request.component;
response.mtomAcceptable = request.mtomAcceptable; response.mtomAcceptable = request.mtomAcceptable;
response.mtomRequest = request.mtomRequest; response.mtomRequest = request.mtomRequest;
response.userStateId = request.userStateId;
// copy other properties that need to be copied. is there any? // copy other properties that need to be copied. is there any?
} }
@ -1255,6 +1276,12 @@ public final class Packet
return getCodec().encode(this, buffer); return getCodec().encode(this, buffer);
} }
/**
* This content type may be set by one of the following ways:
* (1) By the codec as a result of decoding an incoming message
* (2) Cached by a codec after encoding the message
* (3) By a caller of Codec.decode(InputStream, String contentType, Packet)
*/
private ContentType contentType; private ContentType contentType;
/** /**
@ -1410,6 +1437,13 @@ public final class Packet
//Use the getter to make sure all the logic is executed correctly //Use the getter to make sure all the logic is executed correctly
MTOMFeature myMtomFeature = getMtomFeature(); MTOMFeature myMtomFeature = getMtomFeature();
if(myMtomFeature != null && myMtomFeature.isEnabled()) { if(myMtomFeature != null && myMtomFeature.isEnabled()) {
//If the content type is set already on this outbound Packet,
//(e.g.) through Codec.decode(InputStream, String contentType, Packet)
//and it is a non-mtom content type, then don't use mtom to encode it
ContentType curContentType = getInternalContentType();
if (curContentType != null && !isMtomContentType(curContentType)) {
return false;
}
//On client, always use XOP encoding if MTOM is enabled //On client, always use XOP encoding if MTOM is enabled
//On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding //On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding
//if either request is XOP encoded (mtomRequest) or //if either request is XOP encoded (mtomRequest) or
@ -1432,11 +1466,14 @@ public final class Packet
} }
private boolean isMtomContentType() { private boolean isMtomContentType() {
return (getInternalContentType() != null) && return (getInternalContentType() != null && isMtomContentType(getInternalContentType()));
(getInternalContentType().getContentType().contains("application/xop+xml"));
} }
/** private boolean isMtomContentType(ContentType cType) {
return cType.getContentType().contains("application/xop+xml");
}
/**
* @deprecated * @deprecated
*/ */
public void addSatellite(@NotNull com.sun.xml.internal.ws.api.PropertySet satellite) { public void addSatellite(@NotNull com.sun.xml.internal.ws.api.PropertySet satellite) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,17 @@
package com.sun.xml.internal.ws.api.message; package com.sun.xml.internal.ws.api.message;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
public interface StreamingSOAP { public interface StreamingSOAP {
public XMLStreamReader readEnvelope(); public XMLStreamReader readEnvelope();
public QName getPayloadQName();
public XMLStreamReader readToBodyStarTag() throws XMLStreamException;
public XMLStreamReader readPayload() throws XMLStreamException;
public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException;
public void writePayloadTo(XMLStreamWriter writer)throws XMLStreamException;
public boolean isPayloadStreamReader();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,7 @@ import javax.xml.soap.SOAPMessage;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
import com.sun.xml.internal.ws.api.SOAPVersion; import com.sun.xml.internal.ws.api.SOAPVersion;
@ -265,7 +266,7 @@ public class SAAJFactory {
*/ */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException { public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage(); SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg); SaajStaxWriter writer = new SaajStaxWriter(msg, soapVersion.nsUri);
try { try {
message.writeTo(writer); message.writeTo(writer);
} catch (XMLStreamException e) { } catch (XMLStreamException e) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,8 @@ import org.w3c.dom.Node;
/** /**
* SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface. * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
* *
* @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter
*
* @author shih-chang.chen@oracle.com * @author shih-chang.chen@oracle.com
*/ */
public class SaajStaxWriter implements XMLStreamWriter { public class SaajStaxWriter implements XMLStreamWriter {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,6 @@ package com.sun.xml.internal.ws.client.sei;
import com.sun.istack.internal.NotNull; import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable; import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.SOAPVersion; import com.sun.xml.internal.ws.api.SOAPVersion;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import com.sun.xml.internal.ws.api.client.WSPortInfo; import com.sun.xml.internal.ws.api.client.WSPortInfo;
import com.sun.xml.internal.ws.api.databinding.Databinding; import com.sun.xml.internal.ws.api.databinding.Databinding;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference; import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
@ -167,8 +166,7 @@ public final class SEIStub extends Stub implements InvocationHandler {
if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) { if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) {
throw new IllegalStateException("Passed object is not proxy!"); throw new IllegalStateException("Passed object is not proxy!");
} }
Class<?> declaringClass = method.getDeclaringClass(); if (method == null || method.getDeclaringClass() == null
if (method == null || declaringClass == null
|| Modifier.isStatic(method.getModifiers())) { || Modifier.isStatic(method.getModifiers())) {
throw new IllegalStateException("Invoking static method is not allowed!"); throw new IllegalStateException("Invoking static method is not allowed!");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -50,8 +50,6 @@ import javax.activation.DataSource;
*/ */
public abstract class StreamingDataHandler extends com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler { public abstract class StreamingDataHandler extends com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler {
private String hrefCid;
public StreamingDataHandler(Object o, String s) { public StreamingDataHandler(Object o, String s) {
super(o, s); super(o, s);
} }
@ -63,13 +61,4 @@ public abstract class StreamingDataHandler extends com.sun.xml.internal.org.jvne
public StreamingDataHandler(DataSource dataSource) { public StreamingDataHandler(DataSource dataSource) {
super(dataSource); super(dataSource);
} }
public String getHrefCid() {
return hrefCid;
}
public void setHrefCid(final String cid) {
this.hrefCid = cid;
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,7 @@ public final class ContentTypeImpl implements com.sun.xml.internal.ws.api.pipe.C
try { try {
internalContentType = new ContentType(contentType); internalContentType = new ContentType(contentType);
tmpCharset = internalContentType.getParameter("charset"); tmpCharset = internalContentType.getParameter("charset");
rootId = internalContentType.getParameter("start");
} catch(Exception e) { } catch(Exception e) {
//Ignore the parsing exception. //Ignore the parsing exception.
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -118,12 +118,14 @@ abstract class MimeCodec implements Codec {
} }
ContentTypeImpl ctImpl = (ContentTypeImpl)getStaticContentType(packet); ContentTypeImpl ctImpl = (ContentTypeImpl)getStaticContentType(packet);
String boundary = ctImpl.getBoundary(); String boundary = ctImpl.getBoundary();
String rootId = ctImpl.getRootId();
boolean hasAttachments = (boundary != null); boolean hasAttachments = (boundary != null);
Codec rootCodec = getMimeRootCodec(packet); Codec rootCodec = getMimeRootCodec(packet);
if (hasAttachments) { if (hasAttachments) {
writeln("--"+boundary, out); writeln("--"+boundary, out);
ContentType ct = rootCodec.getStaticContentType(packet); ContentType ct = rootCodec.getStaticContentType(packet);
String ctStr = (ct != null) ? ct.getContentType() : rootCodec.getMimeType(); String ctStr = (ct != null) ? ct.getContentType() : rootCodec.getMimeType();
if (rootId != null) writeln("Content-ID: " + rootId, out);
writeln("Content-Type: " + ctStr, out); writeln("Content-Type: " + ctStr, out);
writeln(out); writeln(out);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -112,9 +112,15 @@ public class MtomCodec extends MimeCodec {
} }
public static ContentType getStaticContentTypeStatic(Packet packet, SOAPVersion version) { public static ContentType getStaticContentTypeStatic(Packet packet, SOAPVersion version) {
ContentType ct = (ContentType) packet.getInternalContentType(); ContentTypeImpl ct = (ContentTypeImpl) packet.getInternalContentType();
if ( ct != null ) return ct; if ( ct != null ) {
//Note - this case of boundary = null or root content ID = null should never happen
//after a recent bug fix in Packet.shouldUseMtom logic, but just in
//case we get here with a Packet that has a non-null content type with
//a null boundary, the content type of the Packet will be reset
if (ct.getBoundary() != null && ct.getRootId() != null)
return ct;
}
String uuid = UUID.randomUUID().toString(); String uuid = UUID.randomUUID().toString();
String boundary = "uuid:" + uuid; String boundary = "uuid:" + uuid;
String rootId = "<rootpart*"+uuid+"@example.jaxws.sun.com>"; String rootId = "<rootpart*"+uuid+"@example.jaxws.sun.com>";
@ -327,7 +333,7 @@ public class MtomCodec extends MimeCodec {
} }
public static class MtomStreamWriterImpl extends XMLStreamWriterFilter implements XMLStreamWriterEx, public static class MtomStreamWriterImpl extends XMLStreamWriterFilter implements XMLStreamWriterEx,
MtomStreamWriter, HasEncoding { com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter, HasEncoding {
private final List<ByteArrayBuffer> mtomAttachments; private final List<ByteArrayBuffer> mtomAttachments;
private final String boundary; private final String boundary;
private final MTOMFeature myMtomFeature; private final MTOMFeature myMtomFeature;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -326,7 +326,7 @@ public final class XMLMessage {
} }
public Message copy() { public Message copy() {
return getMessage().copy(); return getMessage().copy().copyFrom(getMessage());
} }
protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException { protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException {
@ -449,7 +449,7 @@ public final class XMLMessage {
} }
public Message copy() { public Message copy() {
return getMessage().copy(); return getMessage().copy().copyFrom(getMessage());
} }
protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException { protected void writePayloadTo(ContentHandler contentHandler, ErrorHandler errorHandler, boolean fragment) throws SAXException {
@ -507,6 +507,7 @@ public final class XMLMessage {
super(that.soapVersion); super(that.soapVersion);
this.ds = that.ds; this.ds = that.ds;
this.headerList = HeaderList.copy(that.headerList); this.headerList = HeaderList.copy(that.headerList);
this.copyFrom(that);
} }
public boolean hasUnconsumedDataSource() { public boolean hasUnconsumedDataSource() {
@ -560,7 +561,7 @@ public final class XMLMessage {
} }
public Message copy() { public Message copy() {
return new UnknownContent(this); return new UnknownContent(this).copyFrom(this);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -120,6 +120,7 @@ public abstract class AbstractMessageImpl extends Message {
*/ */
protected AbstractMessageImpl(AbstractMessageImpl that) { protected AbstractMessageImpl(AbstractMessageImpl that) {
this.soapVersion = that.soapVersion; this.soapVersion = that.soapVersion;
this.copyFrom(that);
} }
@Override @Override
@ -150,11 +151,7 @@ public abstract class AbstractMessageImpl extends Message {
hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null ); hasAttachments()? new AttachmentUnmarshallerImpl(getAttachments()) : null );
} }
/** public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException {
* Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
*/
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
String soapNsUri = soapVersion.nsUri; String soapNsUri = soapVersion.nsUri;
w.writeStartDocument(); w.writeStartDocument();
w.writeStartElement("S","Envelope",soapNsUri); w.writeStartElement("S","Envelope",soapNsUri);
@ -169,7 +166,14 @@ public abstract class AbstractMessageImpl extends Message {
} }
// write the body // write the body
w.writeStartElement("S","Body",soapNsUri); w.writeStartElement("S","Body",soapNsUri);
}
/**
* Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
*/
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
writeToBodyStart(w);
writePayloadTo(w); writePayloadTo(w);
w.writeEndElement(); w.writeEndElement();

Some files were not shown because too many files have changed in this diff Show More