Skip to content

Commit

Permalink
Moving directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
highsource committed Sep 26, 2014
1 parent e34a779 commit 9c9c164
Show file tree
Hide file tree
Showing 4,630 changed files with 19,953 additions and 228,110 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
26 changes: 26 additions & 0 deletions ant/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions ant/src/main/java/org/jvnet/jaxb2_commons/xjc/XJC2Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.jvnet.jaxb2_commons.xjc;

import java.io.File;
import java.lang.reflect.Field;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.Path;

public class XJC2Task extends com.sun.tools.xjc.XJC2Task {

@Override
public void execute() throws BuildException {

hack();
super.execute();
}

protected void hack() {
try {
final Field declaredField = getClass().getSuperclass()
.getDeclaredField("classpath");
declaredField.setAccessible(true);
final Path path = (Path) declaredField.get(this);
if (path != null) {
for (String pathElement : path.list()) {
options.classpaths.add(new File(pathElement).toURI()
.toURL());
}
}
} catch (Exception ex) {
throw new BuildException(ex);
}
}
}
28 changes: 28 additions & 0 deletions basic/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.jvnet.jaxb2_commons.plugin;

import javax.xml.namespace.QName;

public class Customizations {

public static String NAMESPACE_URI = "http://jaxb2-commons.dev.java.net/basic";

public static QName GENERATED_ELEMENT_NAME = new QName(NAMESPACE_URI,
"generated");

public static QName IGNORED_ELEMENT_NAME = new QName(NAMESPACE_URI,
"ignored");

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package org.jvnet.jaxb2_commons.plugin;

import javax.xml.namespace.QName;

import org.jvnet.jaxb2_commons.util.CustomizationUtils;

import com.sun.tools.xjc.model.CClassInfo;
import com.sun.tools.xjc.model.CEnumLeafInfo;
import com.sun.tools.xjc.model.CPropertyInfo;
import com.sun.tools.xjc.outline.ClassOutline;
import com.sun.tools.xjc.outline.EnumOutline;
import com.sun.tools.xjc.outline.FieldOutline;

public class CustomizedIgnoring implements Ignoring {

private final QName[] ignoredCustomizationElementNames;

public CustomizedIgnoring(QName... names) {
this.ignoredCustomizationElementNames = names;
}

public QName[] getIgnoredCustomizationElementNames() {
return ignoredCustomizationElementNames;
}

public boolean isIgnored(ClassOutline classOutline) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(classOutline, name)) {
return true;
}
}
return false;
}

public boolean isIgnored(EnumOutline enumOutline) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(enumOutline, name)) {
return true;
}
}
return false;
}

public boolean isIgnored(FieldOutline fieldOutline) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(fieldOutline, name)) {
return true;
}
}
return false;
}

public boolean isIgnored(CClassInfo classInfo) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(classInfo, name)) {
return true;
}
}
return false;
}

public boolean isIgnored(CEnumLeafInfo enumLeafInfo) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(enumLeafInfo, name)) {
return true;
}
}
return false;
}

public boolean isIgnored(CPropertyInfo propertyInfo) {
for (QName name : getIgnoredCustomizationElementNames()) {
if (CustomizationUtils.containsCustomization(propertyInfo, name)) {
return true;
}
}
return false;
}

}
24 changes: 24 additions & 0 deletions basic/src/main/java/org/jvnet/jaxb2_commons/plugin/Ignoring.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.jvnet.jaxb2_commons.plugin;

import com.sun.tools.xjc.model.CClassInfo;
import com.sun.tools.xjc.model.CEnumLeafInfo;
import com.sun.tools.xjc.model.CPropertyInfo;
import com.sun.tools.xjc.outline.ClassOutline;
import com.sun.tools.xjc.outline.EnumOutline;
import com.sun.tools.xjc.outline.FieldOutline;

public interface Ignoring {

public boolean isIgnored(ClassOutline classOutline);

public boolean isIgnored(EnumOutline enumOutline);

public boolean isIgnored(FieldOutline fieldOutline);

public boolean isIgnored(CClassInfo classInfo);

public boolean isIgnored(CEnumLeafInfo enumLeafInfo);

public boolean isIgnored(CPropertyInfo propertyInfo);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package org.jvnet.jaxb2_commons.plugin.autoinheritance;

import java.util.LinkedList;
import java.util.List;

import org.jvnet.jaxb2_commons.plugin.AbstractParameterizablePlugin;
import org.xml.sax.ErrorHandler;

import com.sun.codemodel.JClass;
import com.sun.codemodel.JDefinedClass;
import com.sun.tools.xjc.Options;
import com.sun.tools.xjc.model.CElementInfo;
import com.sun.tools.xjc.outline.ClassOutline;
import com.sun.tools.xjc.outline.ElementOutline;
import com.sun.tools.xjc.outline.Outline;

public class AutoInheritancePlugin extends AbstractParameterizablePlugin {

private String xmlRootElementsExtend = null;
private List<String> xmlRootElementsImplement = new LinkedList<String>();

private String xmlTypesExtend = null;
private List<String> xmlTypesImplement = new LinkedList<String>();

private List<String> jaxbElementsImplement = new LinkedList<String>();

public String getXmlRootElementsExtend() {
return xmlRootElementsExtend;
}

public void setXmlRootElementsExtend(String globalElementsExtend) {
this.xmlRootElementsExtend = globalElementsExtend;
}

public String getXmlRootElementsImplement() {
return xmlRootElementsImplement.toString();
}

public void setXmlRootElementsImplement(String xmlRootElementsImplement) {
this.xmlRootElementsImplement.add(xmlRootElementsImplement);
}

public String getXmlTypesExtend() {
return xmlTypesExtend;
}

public void setXmlTypesExtend(String globalComplexTypesExtend) {
this.xmlTypesExtend = globalComplexTypesExtend;
}

public String getXmlTypesImplement() {
return xmlTypesImplement.toString();
}

public void setXmlTypesImplement(String xmlTypesImplement) {
this.xmlTypesImplement.add(xmlTypesImplement);
}

public String getJaxbElementsImplement() {
return jaxbElementsImplement.toString();
}

public void setJaxbElementsImplement(String jaxbElementsImplement) {
this.jaxbElementsImplement.add(jaxbElementsImplement);
}

@Override
public String getOptionName() {
return "XautoInheritance";
}

@Override
public String getUsage() {
return "TBD";
}

@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
for (final ClassOutline classOutline : outline.getClasses()) {
if (classOutline.target.getElementName() != null) {
processGlobalElement(classOutline);
} else {
processGlobalComplexType(classOutline);
}
}
for (final CElementInfo elementInfo : outline.getModel()
.getAllElements()) {
final ElementOutline elementOutline = outline
.getElement(elementInfo);
if (elementOutline != null) {
processGlobalJAXBElement(elementOutline);
}
}
return true;
}

protected void processGlobalElement(ClassOutline classOutline) {

generateExtends(classOutline.implClass, xmlRootElementsExtend);
generateImplements(classOutline.implClass, xmlRootElementsImplement);

}

protected void processGlobalJAXBElement(ElementOutline elementOutline) {

generateImplements(elementOutline.implClass, jaxbElementsImplement);

}

protected void processGlobalComplexType(ClassOutline classOutline) {

generateExtends(classOutline.implClass, xmlTypesExtend);
generateImplements(classOutline.implClass, xmlTypesImplement);

}

private void generateExtends(JDefinedClass theClass, String name) {
if (name != null) {
final JClass targetClass = theClass.owner().ref(name);
if (theClass._extends() == theClass.owner().ref(Object.class)) {
theClass._extends(targetClass);
}
}
}

private void generateImplements(JDefinedClass theClass, String name) {
if (name != null) {
final JClass targetClass = theClass.owner().ref(name);
theClass._implements(targetClass);
}
}

private void generateImplements(JDefinedClass theClass, List<String> names) {
if (names != null && !names.isEmpty()) {
for (String name : names) {
generateImplements(theClass, name);
}
}
}

}
Loading

0 comments on commit 9c9c164

Please sign in to comment.