Permalink
Browse files

Initial import from SVN.

  • Loading branch information...
schst committed May 22, 2012
0 parents commit 6d0a2b5093762dc90db8eaf6e4d11830399880ac
Showing with 11,544 additions and 0 deletions.
  1. +504 −0 LICENSE
  2. +22 −0 UPGRADE
  3. +120 −0 autopackage2.php
  4. +19 −0 build.php
  5. +52 −0 examples/AnotherClass.php
  6. +8 −0 examples/AnotherDog.php
  7. +27 −0 examples/CDataColor.php
  8. +135 −0 examples/ColorPrimitives.php
  9. +27 −0 examples/ColorPrimitivesFactory.php
  10. +95 −0 examples/Complex2.php
  11. +89 −0 examples/ConstructorColor.php
  12. +16 −0 examples/Dog.php
  13. +24 −0 examples/DynamicSetterClass.php
  14. +21 −0 examples/EmptyConstructorClass.php
  15. +72 −0 examples/Example1.php
  16. +59 −0 examples/Example2.php
  17. +53 −0 examples/Example3.php
  18. +44 −0 examples/ExampleClassLoader.php
  19. +42 −0 examples/ExampleCollection.php
  20. +48 −0 examples/ExampleExtension.php
  21. +29 −0 examples/ExampleMethods.php
  22. +75 −0 examples/MathExtension.php
  23. +39 −0 examples/MyCollector.php
  24. +31 −0 examples/Registry.php
  25. +39 −0 examples/TestAttributesRequired.php
  26. +39 −0 examples/TestCDataSetter.php
  27. +47 −0 examples/TestConstructor.php
  28. +43 −0 examples/TestDynamicSetters.php
  29. +45 −0 examples/TestDynamicTypes.php
  30. +34 −0 examples/TestEmptyConstructor.php
  31. +42 −0 examples/TestInterfaces.php
  32. +40 −0 examples/TestPrimitives.php
  33. +41 −0 examples/TestPrimitivesFactory.php
  34. +32 −0 examples/TestStaticClass.php
  35. +41 −0 examples/TestXInclude.php
  36. +36 −0 examples/Test__setExplicit.php
  37. +36 −0 examples/Test__setImplicit.php
  38. +36 −0 examples/Test__setPublicProperties.php
  39. +108 −0 package.php
  40. +342 −0 package.xml
  41. +288 −0 src/main/php/net/xjconf/DefinedTag.php
  42. +283 −0 src/main/php/net/xjconf/DefinitionParser.php
  43. +295 −0 src/main/php/net/xjconf/GenericTag.php
  44. +142 −0 src/main/php/net/xjconf/Tag.php
  45. +68 −0 src/main/php/net/xjconf/XJConf.php
  46. +30 −0 src/main/php/net/xjconf/XJConfClassLoader.php
  47. +226 −0 src/main/php/net/xjconf/XJConfFacade.php
  48. +386 −0 src/main/php/net/xjconf/XmlParser.php
  49. +188 −0 src/main/php/net/xjconf/converters/AbstractObjectValueConverter.php
  50. +106 −0 src/main/php/net/xjconf/converters/ArrayValueConverter.php
  51. +63 −0 src/main/php/net/xjconf/converters/AutoPrimitiveValueConverter.php
  52. +101 −0 src/main/php/net/xjconf/converters/ConstructorValueConverter.php
  53. +97 −0 src/main/php/net/xjconf/converters/FactoryMethodValueConverter.php
  54. +94 −0 src/main/php/net/xjconf/converters/PrimitiveValueConverter.php
  55. +132 −0 src/main/php/net/xjconf/converters/StaticClassValueConverter.php
  56. +38 −0 src/main/php/net/xjconf/converters/ValueConverter.php
  57. +43 −0 src/main/php/net/xjconf/converters/factories/ArrayValueConverterFactory.php
  58. +45 −0 src/main/php/net/xjconf/converters/factories/AutoPrimitiveValueConverterFactory.php
  59. +48 −0 src/main/php/net/xjconf/converters/factories/ConstructorValueConverterFactory.php
  60. +53 −0 src/main/php/net/xjconf/converters/factories/FactoryMethodValueConverterFactory.php
  61. +34 −0 src/main/php/net/xjconf/converters/factories/PrimitiveValueConverterFactory.php
  62. +53 −0 src/main/php/net/xjconf/converters/factories/StaticClassValueConverterFactory.php
  63. +41 −0 src/main/php/net/xjconf/converters/factories/ValueConverterFactory.php
  64. +65 −0 src/main/php/net/xjconf/converters/factories/ValueConverterFactoryChain.php
  65. +120 −0 src/main/php/net/xjconf/definitions/AbstractTagDefinition.php
  66. +309 −0 src/main/php/net/xjconf/definitions/AttributeDefinition.php
  67. +193 −0 src/main/php/net/xjconf/definitions/CDataDefinition.php
  68. +167 −0 src/main/php/net/xjconf/definitions/ChildDefinition.php
  69. +41 −0 src/main/php/net/xjconf/definitions/ConcreteTagDefinition.php
  70. +176 −0 src/main/php/net/xjconf/definitions/ConstructorDefinition.php
  71. +97 −0 src/main/php/net/xjconf/definitions/Definition.php
  72. +194 −0 src/main/php/net/xjconf/definitions/FactoryMethodDefinition.php
  73. +189 −0 src/main/php/net/xjconf/definitions/MethodCallTagDefinition.php
  74. +98 −0 src/main/php/net/xjconf/definitions/NamespaceDefinition.php
  75. +134 −0 src/main/php/net/xjconf/definitions/NamespaceDefinitions.php
  76. +500 −0 src/main/php/net/xjconf/definitions/TagDefinition.php
  77. +31 −0 src/main/php/net/xjconf/definitions/ValueModifier.php
  78. +126 −0 src/main/php/net/xjconf/definitions/handler/AbstractTagDefinitionHandler.php
  79. +98 −0 src/main/php/net/xjconf/definitions/handler/AttributeDefinitionHandler.php
  80. +82 −0 src/main/php/net/xjconf/definitions/handler/CDataDefinitionHandler.php
  81. +77 −0 src/main/php/net/xjconf/definitions/handler/ChildDefinitionHandler.php
  82. +131 −0 src/main/php/net/xjconf/definitions/handler/ConcreteTagDefinitionHandler.php
  83. +71 −0 src/main/php/net/xjconf/definitions/handler/ConstructorDefinitionHandler.php
  84. +49 −0 src/main/php/net/xjconf/definitions/handler/DefinitionHandler.php
  85. +48 −0 src/main/php/net/xjconf/definitions/handler/DefinitionHandlerFactory.php
  86. +55 −0 src/main/php/net/xjconf/definitions/handler/EmptyDefinitionHandler.php
  87. +78 −0 src/main/php/net/xjconf/definitions/handler/FactoryMethodDefinitionHandler.php
  88. +80 −0 src/main/php/net/xjconf/definitions/handler/MethodCallTagDefinitionHandler.php
  89. +42 −0 src/main/php/net/xjconf/examples/ClassLoader.php
  90. +141 −0 src/main/php/net/xjconf/examples/Color.php
  91. +99 −0 src/main/php/net/xjconf/examples/Complex.php
  92. +55 −0 src/main/php/net/xjconf/examples/MyClass.php
  93. +22 −0 src/main/php/net/xjconf/examples/MyInterface.php
  94. +47 −0 src/main/php/net/xjconf/examples/UpperString.php
  95. +55 −0 src/main/php/net/xjconf/examples/hidden/MyNestedClass.php
  96. +21 −0 src/main/php/net/xjconf/exceptions/InvalidNamespaceDefinitionException.php
  97. +21 −0 src/main/php/net/xjconf/exceptions/InvalidTagDefinitionException.php
  98. +21 −0 src/main/php/net/xjconf/exceptions/MissingAttributeException.php
  99. +21 −0 src/main/php/net/xjconf/exceptions/UnknownNamespaceException.php
  100. +21 −0 src/main/php/net/xjconf/exceptions/UnknownTagException.php
  101. +21 −0 src/main/php/net/xjconf/exceptions/UnsupportedOperationException.php
  102. +21 −0 src/main/php/net/xjconf/exceptions/ValueConversionException.php
  103. +21 −0 src/main/php/net/xjconf/exceptions/XJConfException.php
  104. +46 −0 src/main/php/net/xjconf/ext/Extension.php
  105. +94 −0 src/main/php/net/xjconf/ext/xinc/XInclude.php
  106. +21 −0 src/main/php/net/xjconf/ext/xinc/XIncludeException.php
  107. +6 −0 src/main/resources/examples/xml/defines-__setExplicit.xml
  108. +6 −0 src/main/resources/examples/xml/defines-__setImplicit.xml
  109. +6 −0 src/main/resources/examples/xml/defines-__setPublicProperties.xml
  110. +7 −0 src/main/resources/examples/xml/defines-attributes-required.xml
  111. +3 −0 src/main/resources/examples/xml/defines-auto-primitives.xml
  112. +6 −0 src/main/resources/examples/xml/defines-classloader.xml
  113. +4 −0 src/main/resources/examples/xml/defines-collection.xml
  114. +27 −0 src/main/resources/examples/xml/defines-constructor.xml
  115. +4 −0 src/main/resources/examples/xml/defines-dynamic-setters.xml
  116. +4 −0 src/main/resources/examples/xml/defines-dynamic-types.xml
  117. +5 −0 src/main/resources/examples/xml/defines-empty-constructor.xml
  118. +8 −0 src/main/resources/examples/xml/defines-extension.xml
  119. +4 −0 src/main/resources/examples/xml/defines-interfaces.xml
  120. +8 −0 src/main/resources/examples/xml/defines-method.xml
  121. +11 −0 src/main/resources/examples/xml/defines-primitives-factory.xml
  122. +11 −0 src/main/resources/examples/xml/defines-primitives.xml
  123. +7 −0 src/main/resources/examples/xml/defines-set-cdata.xml
  124. +6 −0 src/main/resources/examples/xml/defines-static.xml
  125. +32 −0 src/main/resources/examples/xml/defines.xml
  126. +11 −0 src/main/resources/examples/xml/defines2.xml
  127. +8 −0 src/main/resources/examples/xml/defines3.xml
  128. +5 −0 src/main/resources/examples/xml/test-__set.xml
  129. +3 −0 src/main/resources/examples/xml/test-attributes-required.xml
  130. +8 −0 src/main/resources/examples/xml/test-auto-primitives.xml
  131. +6 −0 src/main/resources/examples/xml/test-classloader.xml
  132. +7 −0 src/main/resources/examples/xml/test-collection.xml
  133. +14 −0 src/main/resources/examples/xml/test-constructor.xml
  134. +6 −0 src/main/resources/examples/xml/test-dynamic-setters.xml
  135. +6 −0 src/main/resources/examples/xml/test-dynamic-types.xml
  136. +3 −0 src/main/resources/examples/xml/test-empty-constructor.xml
  137. +24 −0 src/main/resources/examples/xml/test-extension.xml
  138. +5 −0 src/main/resources/examples/xml/test-interfaces.xml
  139. +6 −0 src/main/resources/examples/xml/test-method.xml
  140. +7 −0 src/main/resources/examples/xml/test-primitives.xml
  141. +3 −0 src/main/resources/examples/xml/test-set-cdata.xml
  142. +5 −0 src/main/resources/examples/xml/test-static.xml
  143. +3 −0 src/main/resources/examples/xml/test-xinclude-included.xml
  144. +9 −0 src/main/resources/examples/xml/test-xinclude.xml
  145. +19 −0 src/main/resources/examples/xml/test.xml
  146. +11 −0 src/main/resources/examples/xml/test2.xml
  147. +7 −0 src/main/resources/examples/xml/test3.xml
  148. +58 −0 src/test/IntegrationTests.php
  149. +50 −0 src/test/php/net/xjconf/integration/Example1TestCase.php
  150. +42 −0 src/test/php/net/xjconf/integration/Example2TestCase.php
  151. +43 −0 src/test/php/net/xjconf/integration/Example3TestCase.php
  152. +38 −0 src/test/php/net/xjconf/integration/ExampleClassLoaderTestCase.php
  153. +34 −0 src/test/php/net/xjconf/integration/ExampleCollectionTestCase.php
  154. +39 −0 src/test/php/net/xjconf/integration/ExampleExtensionTestCase.php
  155. +34 −0 src/test/php/net/xjconf/integration/TestAttributesRequiredTestCase.php
  156. +39 −0 src/test/php/net/xjconf/integration/TestAutoPrimitivesTestCase.php
  157. +34 −0 src/test/php/net/xjconf/integration/TestCDataSetterTestCase.php
  158. +47 −0 src/test/php/net/xjconf/integration/TestConstructorTestCase.php
  159. +35 −0 src/test/php/net/xjconf/integration/TestDynamicSettersTestCase.php
  160. +38 −0 src/test/php/net/xjconf/integration/TestDynamicTypesTestCase.php
  161. +34 −0 src/test/php/net/xjconf/integration/TestEmptyConstructorTestCase.php
  162. +35 −0 src/test/php/net/xjconf/integration/TestInterfacesTestCase.php
  163. +38 −0 src/test/php/net/xjconf/integration/TestPrimitivesFactoryTestCase.php
  164. +37 −0 src/test/php/net/xjconf/integration/TestPrimitivesTestCase.php
  165. +35 −0 src/test/php/net/xjconf/integration/TestStaticClassTestCase.php
  166. +39 −0 src/test/php/net/xjconf/integration/TestXIncludeTestCase.php
  167. +40 −0 src/test/php/net/xjconf/integration/Test__setExplicitTestCase.php
  168. +40 −0 src/test/php/net/xjconf/integration/Test__setImplicitTestCase.php
  169. +38 −0 src/test/php/net/xjconf/integration/Test__setPublicPropertiesTestCase.php
  170. +26 −0 tests/converters/ConvertersTestSuite.php
  171. +232 −0 tests/converters/PrimitiveValueConverterTestCase.php
  172. +92 −0 tests/definitions/AttributeDefinitionTestCase.php
  173. +94 −0 tests/definitions/CDataDefinitionTestCase.php
  174. +99 −0 tests/definitions/ConstructorDefinitionTestCase.php
  175. +30 −0 tests/definitions/DefinitionsTestSuite.php
  176. +98 −0 tests/definitions/FactoryMethodDefinitionTestCase.php
  177. +72 −0 tests/definitions/NamespaceDefinitionTestCase.php
  178. +35 −0 tests/run.php
  179. +53 −0 tests/runIntegration.php
504 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
22 UPGRADE
@@ -0,0 +1,22 @@
Upgrading from v0.3.x and lower to v0.4.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This document describes the steps you need to do when upgrading XJConf from any
of the 0.3.x versions and lower to 0.4.0.

1. Remove all includes of XJConf classes by hand. Instead, just include
XJConf/XJConf.php at the beginning of your application or script. This will
register an autoload method that takes care of loading all other classes
from XJConf.

2. Replace every occurance of XJConfLoader::load('package.ClassName'); with
use net::xjconf::package::ClassName;.
For example, if you use the XJConfFacade, you need to replace
XJConfLoader::load('XJConfFacade');
with
use net::xjconf::XJConfFacade;
while using
XJConfLoader::load('DefinitionParser', 'XmlParser');
needs to be replaced with
use net::xjconf::DefinitionParser;
use net::xjconf::XmlParser;
@@ -0,0 +1,120 @@
<?php
/**
* script to automate the generation of the
* package.xml file.
*
* $Id: package.php 442 2006-08-20 13:21:58Z schst $
*
* @author Stephan Schmidt <schst@php-tools.net>
* @package XJConfForPHP
* @subpackage Tools
*/
/**
* uses PackageFileManager
*/
require_once 'PEAR/PackageFileManager2.php';
require_once 'PEAR/PackageFileManager/Svn.php';
/**
* Base version
*/
$baseVersion = '0.2.0';
/**
* current version
*/
$version = $baseVersion . 'dev' . $argv[1];
$dir = dirname( __FILE__ );
/**
* Current API version
*/
$apiVersion = '0.2.0';
/**
* current state
*/
$state = 'devel';
/**
* current API stability
*/
$apiStability = 'alpha';
/**
* release notes
*/
$notes = <<<EOT
Feature additions:
- New feature to define abstract tags, which enables yo to define the concrete type in the tag instead of the definition (mikey)
- It is now possible to define an explicit setter method for character data inside a tag (schst)
- Added possibility to declare tags as static (schst)
- Added several unit tests (mikey)
- Added possibility to package XJConfForPHP as a STAR archive (mikey, schst)
- Added new value type "xjonf:auto-primitive" to guess the type of a scalar value (schst)
- Added implicit and explicit call to __set as well as possibility for setting public properties (mikey)
Bugfixes:
- Fixed bug #6: Enable factory methods without parameters in PHP 5.0.x (schst)
- Fixed bug #7: check, whether factory method can be called statically (schst)
- Fixed bug: prevent errors in case factory method does not return an instance of an object (mikey)
EOT;
/**
* package description
*/
$description = <<<EOT
XJConfForPHP is a port of XJConf. It enables you to create complex data structures consisting of
objects, arrays and primitives from virtually any XML document. It provides a simple XML language
to define the XML-to-object mappings. It features namespace support and is easily extendible.
EOT;
$package = new PEAR_PackageFileManager2();
$result = $package->setOptions(array(
'filelistgenerator' => 'file',
'ignore' => array( 'package.php', 'autopackage2.php', 'package.xml', '.svn', 'rfcs' ),
'simpleoutput' => true,
'baseinstalldir' => '/',
'packagedirectory' => './',
'dir_roles' => array(
'docs' => 'doc',
'examples' => 'doc',
'tests' => 'test',
)
));
if (PEAR::isError($result)) {
echo $result->getMessage();
die();
}
$package->setPackage('XJConfForPHP');
$package->setSummary('XML-to-object mapper.');
$package->setDescription($description);
$package->setChannel('pear.php-tools.net');
$package->setAPIVersion($apiVersion);
$package->setReleaseVersion($version);
$package->setReleaseStability($state);
$package->setAPIStability($apiStability);
$package->setNotes($notes);
$package->setPackageType('php');
$package->setLicense('LGPL', 'http://www.gnu.org/copyleft/lesser.txt');
$package->addMaintainer('lead', 'schst', 'Stephan Schmidt', 'schst@xjconf.net', 'yes');
$package->addMaintainer('lead', 'mikey', 'Frank Kleine', 'mikey@xjconf.net', 'yes');
$package->setPhpDep('5.0.0');
$package->setPearinstallerDep('1.4.0');
$package->addExtensionDep('required', 'xmlreader');
$package->generateContents();
$result = $package->writePackageFile();
if (PEAR::isError($result)) {
echo $result->getMessage();
die();
}
?>
@@ -0,0 +1,19 @@
<?php
require 'star/starWriter.php';
$starArchive = new StarArchive(new StarWriter('build/xjconf.star'));
$dirIt = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('XJConf'));
foreach ($dirIt as $file) {
if ($file->isFile() == false || substr($file->getPathname(), -4) != '.php') {
continue;
}
$fqClassName = str_replace('/', '::', str_replace('XJConf/', 'net/xjconf/', str_replace(DIRECTORY_SEPARATOR, '/', str_replace('.php', '', $file->getPathname()))));
$starArchive->add(new StarFile($file->getPathname(), __DIR__), $fqClassName);
}
$starArchive->addMetaData('title', 'XJConf for PHP');
$starArchive->addMetaData('package', 'net::xjconf');
$starArchive->addMetaData('version', '0.4.0dev');
$starArchive->addMetaData('author', 'XJConf Development Team <http://php.xjconf.net>');
$starArchive->addMetaData('copyright', '(c) 2007-2008 XJConf Development Team');
$starArchive->create();
?>
@@ -0,0 +1,52 @@
<?php
/**
* Class for example purposes.
*
* @author Stephan Schmidt <stephan.schmidt@schlund.de>
* @author Frank Kleine <mikey@xjconf.net>
*/
require_once __DIR__ . '/MyInterface.php';
/**
* Class for example purposes.
*
* @package XJConf
* @subpackage examples
*/
class AnotherClass implements MyInterface
{
/**
* hold bar
*
* @var MyInterface
*/
private $bar;
/**
* just foo
*/
public function foo()
{
// nothing to do here
}
/**
* set bar
*
* @param MyInterface $bar
*/
public function setBar(MyInterface $bar)
{
$this->bar = $bar;
}
/**
* return bar
*
* @return MyInterface
*/
public function getBar()
{
return $this->bar;
}
}
?>
@@ -0,0 +1,8 @@
<?php
class AnotherDog
{
public $species;
public $name;
}
?>
@@ -0,0 +1,27 @@
<?php
/**
* example class
*
* @author Frank Kleine <mikey@xjconf.net>
*/
/**
* example class
*
* @package XJConf
* @subpackage examples
*/
class CDataColor
{
protected $hex;
public function __construct($hex)
{
$this->hex = $hex;
}
public function getHex()
{
return $this->hex;
}
}
?>
@@ -0,0 +1,135 @@
<?php
/**
* example class
*
* @author Stephan Schmidt <stephan.schmidt@schlund.de>
* @author Frank Kleine <mikey@xjconf.net>
*/
/**
* example class
*
* @package XJConf
* @subpackage examples
*/
class ColorPrimitives
{
/**
* the red part of the color
*
* @var int
*/
private $red;
/**
* the green part of the color
*
* @var int
*/
private $green;
/**
* the blue part of the color
*
* @var int
*/
private $blue;
/**
* the name of the color
*
* @var int
*/
private $name = null;
/**
* the title of the color
*
* @var int
*/
private $colorTitle = null;
/**
* constructor
*
* @var string $name name of the color
*/
public function __construct($name)
{
$this->name = $name;
}
/**
* set the red part
*
* @param int $val
*/
public function setRed($val)
{
$this->red = $val;
}
/**
* set the green part
*
* @param int $val
*/
public function setGreen($val) {
$this->green = $val;
}
/**
* set the blue part
*
* @param int $val
*/
public function setBlue($val) {
$this->blue = $val;
}
/**
* set the title of the color
*
* @param string $title
*/
public function setColorTitle($title)
{
$this->colorTitle = $title;
}
/**
* get the rgb value as hex
*
* @return string
*/
public function getRGB()
{
return "#" . dechex($this->red) . dechex($this->green) . dechex($this->blue);
}
/**
* return the name of the color
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* return the title of the color
*
* @return string
*/
public function getColorTitle()
{
return $this->colorTitle;
}
/**
* returns string representation
*
* @return string
*/
public function __toString()
{
return $this->name . "(" . $this->getRGB() . ")";
}
}
?>
Oops, something went wrong.

0 comments on commit 6d0a2b5

Please sign in to comment.