Updated buid info and made package list consistant.

This commit is contained in:
Willem Cazander 2013-08-09 19:34:52 +02:00
parent f290b73132
commit d4f80f338a
17 changed files with 122 additions and 26 deletions

View file

@ -41,8 +41,9 @@ src/main/build/jvm-test.sh /usr/lib/jvm/jdk1.5.0_22/
-- Make release build --
# todo make work
cd project-root/;
cd /tmp;
git clone ssh://<scm_username>@git.sv.gnu.org/srv/git/x4o.git;
cd x4o;
mvn clean package;
mvn -B -Dusername=<scm_username> clean install release:clean release:prepare release:perform;
src/main/build/gnu-up.sh <scm_username> <version>
@ -51,8 +52,10 @@ src/main/build/gnu-up.sh <scm_username> <version>
-- Make site --
cd project-root/;
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Pbuild-site-x4o-support clean package site site:stage
mvn clean install; # (installs the snapshots plugins so we can run the current eld-doc task in site phase)
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" mvn -Pbuild-site-x4o-support clean package site site:stage;
cp -r target/staging/x4o-* target/site/;
cp -r target/site/ ~/public_html/site-x4o;
-- Check for code style --

View file

@ -53,6 +53,9 @@ public class TestFooBarDriver extends X4ODriver<TestFooBar> {
return LANGUAGE_VERSIONS;
}
// Convenience method not really needed but like this it limits a few non-needed objects.
// and does makes sure only only one instance is registered to the X4ODriverManager.
// thus it is currently the preferred way to create and get an instance of your language driver.
static public TestFooBarDriver getInstance() {
return (TestFooBarDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
}
@ -172,6 +175,7 @@ writer.writeFile(result, new File("/tmp/test-bean.xml");
+--
And writer gives output like;
(please note that full write support is not yet completed)
+--
<?xml version="1.0" encoding="UTF-8"?>

View file

@ -64,7 +64,7 @@ Usage
<dependency>
<groupId>org.x4o.plugin</groupId>
<artifactId>x4o-plugin-ant</artifactId>
<version>${project.version}</version>
<version>0.8.6-SNAPSHOT</version>
</dependency>
+--

View file

@ -48,9 +48,9 @@ public abstract class X4ODriver<T> {
public final static String DEFAULT_LANGUAGE_VERSION = "1.0";
/**
* Public constructor.
* marker constructor.
*/
public X4ODriver() {
public X4ODriver(/*X4ODriverManager.ConstructorMarker marker*/) {
}
/**

View file

@ -207,6 +207,8 @@ public final class X4ODriverManager {
}
try {
Class<?> driverClass = X4OLanguageClassLoader.loadClass(driverClassName);
//Constructor<?> markedConstructor = driverClass.getDeclaredConstructor(new Class[]{ConstructorMarker.class});
//X4ODriver<?> driver = (X4ODriver<?>)markedConstructor.newInstance(new Object[]{new ConstructorMarker()});
X4ODriver<?> driver = (X4ODriver<?>)driverClass.newInstance();
registerX4ODriver(driver);
return driver;
@ -215,6 +217,14 @@ public final class X4ODriverManager {
}
}
/*
* Class to make sure all driver instances are created by this manager instance.
final public class ConstructorMarker {
private ConstructorMarker() {
}
}*/
/**
* Loads all defined language drivers in classpath.
*/

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Provides interfaces for two way object converters.
* The interfaces for two way object converters.
*
*
* @since 1.0

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Provides implementations of object to text converters.
* The default implementations to convert text to objects.
*
*
* @since 1.0

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2004-2013, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The SAX Extended classes and interfaces.
*
* @since 1.0
*/
package org.x4o.xml.io.sax.ext;

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The Sax based classes and interfaces.
* The SAX based classes and interfaces.
*
* @since 1.0
*/

View file

@ -42,7 +42,7 @@ import org.xml.sax.SAXException;
public class ApiDocNodeWriterBean implements ApiDocNodeWriter {
private ApiDocNodeBody nodeBody = null;
private Integer nodeBodyOrder = null;
private List<Integer> nodeBodyOrders = null;
private Object bean = null;
private String method = null;
private List<Class<?>> targetClasses = null;
@ -75,10 +75,18 @@ public class ApiDocNodeWriterBean implements ApiDocNodeWriter {
if (ammo==null) {
continue;
}
ApiDocNodeWriterBean methodWriter = new ApiDocNodeWriterBean(ammo.nodeBody(), bean, method.getName(), ammo.targetClasses());
if (ammo.nodeBodyOrder()!=-1) {
methodWriter.setNodeBodyOrder(ammo.nodeBodyOrder());
if (ammo.targetClasses().length==0) {
throw new IllegalArgumentException("Can't configure writer bean with empty 'targetClasses' parameter.");
}
if (ammo.targetClasses().length!=ammo.nodeBodyOrders().length) {
throw new IllegalArgumentException("Can't configure writer bean with non-equal array size of 'nodeBodyOrders'("+ammo.nodeBodyOrders().length+") and 'targetClasses'("+ammo.targetClasses().length+") parameters.");
}
ApiDocNodeWriterBean methodWriter = new ApiDocNodeWriterBean(ammo.nodeBody(), bean, method.getName(), ammo.targetClasses());
List<Integer> nodeBodyOrder = new ArrayList<Integer>();
for (int order:ammo.nodeBodyOrders()) {
nodeBodyOrder.add(order);
}
methodWriter.setNodeBodyOrders(nodeBodyOrder);
if (ammo.contentGroup().length()>0) {
methodWriter.setContentGroup(ammo.contentGroup());
}
@ -154,17 +162,17 @@ public class ApiDocNodeWriterBean implements ApiDocNodeWriter {
}
/**
* @return the nodeBodyOrder
* @return the nodeBodyOrders
*/
public Integer getNodeBodyOrder() {
return nodeBodyOrder;
public List<Integer> getNodeBodyOrders() {
return nodeBodyOrders;
}
/**
* @param nodeBodyOrder the nodeBodyOrder to set
* @param nodeBodyOrders the nodeBodyOrders to set
*/
public void setNodeBodyOrder(Integer nodeBodyOrder) {
this.nodeBodyOrder = nodeBodyOrder;
public void setNodeBodyOrders(List<Integer> nodeBodyOrders) {
this.nodeBodyOrders = nodeBodyOrders;
}
/**

View file

@ -43,7 +43,7 @@ public @interface ApiDocNodeWriterMethod {
ApiDocNodeBody nodeBody();
int nodeBodyOrder() default -1;
int[] nodeBodyOrders() default {-1};
String contentGroup() default "";

View file

@ -34,6 +34,8 @@ import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@ -387,7 +389,7 @@ public class ApiDocWriter {
private List<ApiDocNodeWriter> findNodeBodyWriters(ApiDocNode node,ApiDocNodeBody nodeBody) {
List<ApiDocNodeWriter> result = new ArrayList<ApiDocNodeWriter>();
Class<?> objClass = node.getUserData().getClass();
final Class<?> objClass = node.getUserData().getClass();
for (ApiDocNodeWriter writer:doc.getNodeBodyWriters()) {
if (!nodeBody.equals(writer.getNodeBody())) {
continue;
@ -398,6 +400,45 @@ public class ApiDocWriter {
}
}
}
Collections.sort(result, new Comparator<ApiDocNodeWriter>() {
public int compare(ApiDocNodeWriter o1, ApiDocNodeWriter o2) {
int index1 = -1;
int index2 = -1;
for (int i=0;i<o1.getTargetClasses().size();i++) {
Class<?> c = o1.getTargetClasses().get(i);
if (c.isAssignableFrom(objClass)) {
index1 = i;
break;
}
}
for (int i=0;i<o2.getTargetClasses().size();i++) {
Class<?> c = o2.getTargetClasses().get(i);
if (c.isAssignableFrom(objClass)) {
index1 = i;
break;
}
}
// TODO: note check return value if are oke in order..
if (index1==-1 && index2==-1) {
return 0;
}
if (index1==-1) {
return 1;
}
if (index2==-1) {
return -1;
}
int orderValue1 = o1.getNodeBodyOrders().get(index1);
int orderValue2 = o2.getNodeBodyOrders().get(index2);
if (orderValue1==orderValue2) {
return 0;
}
if (orderValue1 > orderValue2) {
return -1;
}
return 1;
}
});
return result;
}

View file

@ -36,6 +36,7 @@ public interface ApiDocNodeWriter {
ApiDocNodeBody getNodeBody();
List<Class<?>> getTargetClasses();
List<Integer> getNodeBodyOrders();
void writeNodeContent(ApiDocWriteEvent<ApiDocNode> e) throws SAXException;
}

View file

@ -22,7 +22,7 @@
*/
/**
* Api Doc Dom classes.
* The Api Doc Dom classes.
*
* @author Willem Cazander
* @since 1.0 May 12,2013

View file

@ -22,7 +22,7 @@
*/
/**
* Api Doc Writer classes.
* The Api Doc Writer classes.
*
* @author Willem Cazander
* @since 1.0 May 12,2013

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The ant plugin tasks.
* The Ant plugin tasks.
*
* @since 1.0
*/

View file

@ -21,7 +21,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* The maven plugin mojos.
* The Maven plugin mojos.
*
* @since 1.0
*/