1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-09 08:52:51 +00:00

Implements automatically generated template classes from XSD schemas

This commit is contained in:
2011-12-31 13:09:56 -02:00
parent 273b872d53
commit beea690568
3394 changed files with 15664 additions and 10012 deletions

View File

@@ -0,0 +1,32 @@
/*
* This file is part of l2jserver2 <l2jserver2.com>.
*
* l2jserver2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver2 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver2. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.tool.conversor.itemtemplate;
import com.l2jserver.model.template.item.ItemMaterial;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class XmlNsItemMaterialGenerator {
public static void main(String[] args) {
for (final ItemMaterial type : ItemMaterial.values()) {
System.out.println("<xs:enumeration value=\"" + type.name()
+ "\" />");
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* This file is part of l2jserver2 <l2jserver2.com>.
*
* l2jserver2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver2 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver2. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.tool.conversor.itemtemplate;
import com.l2jserver.model.template.item.ItemType;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class XmlNsItemTypeGenerator {
public static void main(String[] args) {
for (final ItemType type : ItemType.values()) {
System.out.println("<xs:enumeration value=\"" + type.name()
+ "\" />");
}
}
}

View File

@@ -1,62 +0,0 @@
package com.l2jserver.tool.xml;
import java.io.File;
import java.io.IOException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.SchemaOutputResolver;
import javax.xml.transform.Result;
import javax.xml.transform.stream.StreamResult;
import com.l2jserver.model.template.SkillTemplate;
import com.l2jserver.model.template.character.CharacterTemplate;
import com.l2jserver.model.template.item.ItemTemplate;
import com.l2jserver.model.template.npc.NPCTemplate;
import com.l2jserver.service.game.template.XMLTemplateService.TeleportationTemplateContainer;
public class TemplateSchemaGeneratorMain {
/**
* @param args
* none
* @throws Exception
* any exception
*/
public static void main(String[] args) throws Exception {
final File baseDir = new File("generated/schemas");
JAXBContext context = JAXBContext.newInstance(CharacterTemplate.class,
NPCTemplate.class, ItemTemplate.class, SkillTemplate.class,
TeleportationTemplateContainer.class);
context.generateSchema(new SchemaOutputResolver() {
public Result createOutput(String namespaceUri,
String suggestedFileName) throws IOException {
switch (namespaceUri) {
case "http://schemas.l2jserver2.com/teleport":
suggestedFileName = "teleport.xsd";
break;
case "http://schemas.l2jserver2.com/skill":
suggestedFileName = "skill.xsd";
break;
case "http://schemas.l2jserver2.com/npc":
suggestedFileName = "npc.xsd";
break;
case "http://schemas.l2jserver2.com/item":
suggestedFileName = "item.xsd";
break;
case "http://schemas.l2jserver2.com/character":
suggestedFileName = "character.xsd";
break;
case "":
namespaceUri = "[empty]";
suggestedFileName = "l2jserver2.xsd";
break;
}
System.out.println(namespaceUri + " mapped to "
+ suggestedFileName);
return new StreamResult(new File(baseDir, suggestedFileName));
}
});
}
}