beeframework-svn Mailing List for Bee Framework (Page 3)
Brought to you by:
b_hartmann,
m_plomer
You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(12) |
Jun
(5) |
Jul
(6) |
Aug
(25) |
Sep
(25) |
Oct
(6) |
Nov
(29) |
Dec
|
2014 |
Jan
(2) |
Feb
(10) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(35) |
Aug
(9) |
Sep
(33) |
Oct
(30) |
Nov
(4) |
Dec
(1) |
2015 |
Jan
(3) |
Feb
(13) |
Mar
(13) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <m_p...@us...> - 2014-10-09 02:29:41
|
Revision: 254 http://sourceforge.net/p/beeframework/code/254 Author: m_plomer Date: 2014-10-09 02:29:34 +0000 (Thu, 09 Oct 2014) Log Message: ----------- omissions from previous refactorings Modified Paths: -------------- trunk/framework/Bee/Context/BeanCreationException.php Modified: trunk/framework/Bee/Context/BeanCreationException.php =================================================================== --- trunk/framework/Bee/Context/BeanCreationException.php 2014-10-09 01:54:35 UTC (rev 253) +++ trunk/framework/Bee/Context/BeanCreationException.php 2014-10-09 02:29:34 UTC (rev 254) @@ -38,7 +38,7 @@ * @return BeanCreationException */ public function __construct($name, $message=null, Exception $cause = null) { - parent::__construct(sprintf(self::EXCEPTION_MESSAGE, $name, $message), $cause); + parent::__construct(sprintf(self::EXCEPTION_MESSAGE, $name, $message), 0, $cause); $this->name = $name; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-09 01:54:43
|
Revision: 253 http://sourceforge.net/p/beeframework/code/253 Author: m_plomer Date: 2014-10-09 01:54:35 +0000 (Thu, 09 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Added Paths: ----------- trunk/framework/Bee/Context/Util/XmlNamespace/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-09 01:45:48
|
Revision: 252 http://sourceforge.net/p/beeframework/code/252 Author: m_plomer Date: 2014-10-09 01:45:40 +0000 (Thu, 09 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Removed Paths: ------------- trunk/framework/Bee/Context/Util/Namespace/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-09 01:43:59
|
Revision: 251 http://sourceforge.net/p/beeframework/code/251 Author: m_plomer Date: 2014-10-09 01:43:55 +0000 (Thu, 09 Oct 2014) Log Message: ----------- omissions from previous refactorings Modified Paths: -------------- trunk/framework/Bee/Context/AbstractContext.php trunk/framework/Bee/Context/Config/Scope/RequestScope.php Added Paths: ----------- trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php trunk/framework/Bee/Context/Config/Scope/SessionScope.php Removed Paths: ------------- trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php trunk/framework/Bee/Context/Config/Scope/Session.php Modified: trunk/framework/Bee/Context/AbstractContext.php =================================================================== --- trunk/framework/Bee/Context/AbstractContext.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/AbstractContext.php 2014-10-09 01:43:55 UTC (rev 251) @@ -31,12 +31,13 @@ use Bee\Context\Config\IScopeAware; use Bee\Context\Config\Scope\CacheScope; use Bee\Context\Config\Scope\PrototypeScope; +use Bee\Context\Config\Scope\RequestScope; +use Bee\Context\Config\Scope\SessionScope; use Bee\Context\Support\ContextUtils; use Bee\IContext; use Bee\Utils\Types; use Exception; use ReflectionClass; -use RequestScope; /** * Enter description here... @@ -554,7 +555,7 @@ IBeanDefinition::SCOPE_CACHE => new CacheScope($uniqueId), IBeanDefinition::SCOPE_PROTOTYPE => new PrototypeScope($uniqueId), IBeanDefinition::SCOPE_REQUEST => new RequestScope($uniqueId), - IBeanDefinition::SCOPE_SESSION => new Scope($uniqueId) + IBeanDefinition::SCOPE_SESSION => new SessionScope($uniqueId) ); $this->scopes = $scopes; } Deleted: trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php =================================================================== --- trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,85 +0,0 @@ -<?php -namespace Bee\Context\Config\BeanDefinition; -/* - * Copyright 2008-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\Context\Config\IBeanDefinition; - -/** - * Enter description here... - * - * @author Benjamin Hartmann - * @author Michael Plomer <mic...@it...> - */ -class GenericBeanDefinition extends AbstractBeanDefinition { - - private $parentName; - - /** - * @param IBeanDefinition $original - */ - public function __construct(IBeanDefinition $original = null) { - parent::__construct($original); - } - - /** - * @return String - */ - public function getParentName() { - return $this->parentName; - } - - /** - * @param String $parentName - */ - public function setParentName($parentName) { - $this->parentName = $parentName; - } - - /** - * - * @param $id - * @return void - */ - // todo: this isn't actually a toString()... prints lots of stuff itself... - public function toString($id=null) { - echo '<b>Bean Definition:</b><br/>'; - if (!is_null($id)) { - echo 'id: '.$id.'<br/>'; - } - echo 'class: '.$this->getBeanClassName().'<br/>'; - echo 'Scope: '.$this->getScope().'<br/>'; - $args = $this->getConstructorArgumentValues(); - if (!empty($args)) { - echo '<br/>'; - echo 'constructor args:<br/>'; - foreach ($args as $value) { - var_dump($value); - echo '<br/>'; - } - } - $props = $this->getPropertyValues(); - if (!empty($props)) { - echo '<br/>'; - echo 'properties:<br/>'; - foreach ($props as $key => $value) { - echo "$key: "; - var_dump($value); - echo '<br/>'; - } - } - echo '<hr/>'; - } -} Copied: trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php (from rev 250, trunk/framework/Bee/Context/Config/BeanDefinition/Generic.php) =================================================================== --- trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php (rev 0) +++ trunk/framework/Bee/Context/Config/BeanDefinition/GenericBeanDefinition.php 2014-10-09 01:43:55 UTC (rev 251) @@ -0,0 +1,85 @@ +<?php +namespace Bee\Context\Config\BeanDefinition; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use Bee\Context\Config\IBeanDefinition; + +/** + * Enter description here... + * + * @author Benjamin Hartmann + * @author Michael Plomer <mic...@it...> + */ +class GenericBeanDefinition extends AbstractBeanDefinition { + + private $parentName; + + /** + * @param IBeanDefinition $original + */ + public function __construct(IBeanDefinition $original = null) { + parent::__construct($original); + } + + /** + * @return String + */ + public function getParentName() { + return $this->parentName; + } + + /** + * @param String $parentName + */ + public function setParentName($parentName) { + $this->parentName = $parentName; + } + + /** + * + * @param $id + * @return void + */ + // todo: this isn't actually a toString()... prints lots of stuff itself... + public function toString($id=null) { + echo '<b>Bean Definition:</b><br/>'; + if (!is_null($id)) { + echo 'id: '.$id.'<br/>'; + } + echo 'class: '.$this->getBeanClassName().'<br/>'; + echo 'Scope: '.$this->getScope().'<br/>'; + $args = $this->getConstructorArgumentValues(); + if (!empty($args)) { + echo '<br/>'; + echo 'constructor args:<br/>'; + foreach ($args as $value) { + var_dump($value); + echo '<br/>'; + } + } + $props = $this->getPropertyValues(); + if (!empty($props)) { + echo '<br/>'; + echo 'properties:<br/>'; + foreach ($props as $key => $value) { + echo "$key: "; + var_dump($value); + echo '<br/>'; + } + } + echo '<hr/>'; + } +} Modified: trunk/framework/Bee/Context/Config/Scope/RequestScope.php =================================================================== --- trunk/framework/Bee/Context/Config/Scope/RequestScope.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/Scope/RequestScope.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,4 +1,5 @@ <?php +namespace Bee\Context\Config\Scope; /* * Copyright 2008-2014 the original author or authors. * Deleted: trunk/framework/Bee/Context/Config/Scope/Session.php =================================================================== --- trunk/framework/Bee/Context/Config/Scope/Session.php 2014-10-08 23:50:28 UTC (rev 250) +++ trunk/framework/Bee/Context/Config/Scope/Session.php 2014-10-09 01:43:55 UTC (rev 251) @@ -1,74 +0,0 @@ -<?php -/* - * Copyright 2008-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\Context\Config\IObjectFactory; -use Bee\Context\Config\IScope; - -/** - * Enter description here... - * - * @author Benjamin Hartmann - * @author Michael Plomer <mic...@it...> - */ -class SessionScope implements IScope { - - const SESSION_SCOPE_PREFIX = '__sessionScopeContent'; - - /** - * @var - */ - private $id; - - /** - * @param $id - */ - public function __construct($id) { - $this->id = $id; - } - - /** - * @param string $beanName - * @param IObjectFactory $objectFactory - * @return mixed|Object - */ - public function get($beanName, IObjectFactory $objectFactory) { - $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; - $scopedObject =& $beans[$beanName]; - if(is_null($scopedObject)) { - $scopedObject =& $objectFactory->getObject(); - $beans[$beanName] =& $scopedObject; - } - return $scopedObject; - } - - /** - * @param $beanName - * @return Object - */ - public function remove($beanName) { - $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; - $bean = $beans[$beanName]; - unset($beans[$beanName]); - return $bean; - } - - /** - * @return string - */ - public function getConversationId() { - return session_id(); - } -} \ No newline at end of file Copied: trunk/framework/Bee/Context/Config/Scope/SessionScope.php (from rev 250, trunk/framework/Bee/Context/Config/Scope/Session.php) =================================================================== --- trunk/framework/Bee/Context/Config/Scope/SessionScope.php (rev 0) +++ trunk/framework/Bee/Context/Config/Scope/SessionScope.php 2014-10-09 01:43:55 UTC (rev 251) @@ -0,0 +1,75 @@ +<?php +namespace Bee\Context\Config\Scope; +/* + * Copyright 2008-2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use Bee\Context\Config\IObjectFactory; +use Bee\Context\Config\IScope; + +/** + * Enter description here... + * + * @author Benjamin Hartmann + * @author Michael Plomer <mic...@it...> + */ +class SessionScope implements IScope { + + const SESSION_SCOPE_PREFIX = '__sessionScopeContent'; + + /** + * @var + */ + private $id; + + /** + * @param $id + */ + public function __construct($id) { + $this->id = $id; + } + + /** + * @param string $beanName + * @param IObjectFactory $objectFactory + * @return mixed|Object + */ + public function get($beanName, IObjectFactory $objectFactory) { + $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; + $scopedObject =& $beans[$beanName]; + if(is_null($scopedObject)) { + $scopedObject =& $objectFactory->getObject(); + $beans[$beanName] =& $scopedObject; + } + return $scopedObject; + } + + /** + * @param $beanName + * @return Object + */ + public function remove($beanName) { + $beans =& $_SESSION[$this->id.self::SESSION_SCOPE_PREFIX]; + $bean = $beans[$beanName]; + unset($beans[$beanName]); + return $bean; + } + + /** + * @return string + */ + public function getConversationId() { + return session_id(); + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 23:50:30
|
Revision: 250 http://sourceforge.net/p/beeframework/code/250 Author: m_plomer Date: 2014-10-08 23:50:28 +0000 (Wed, 08 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Modified Paths: -------------- trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AntPathMethodNameResolver.php Modified: trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AntPathMethodNameResolver.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AntPathMethodNameResolver.php 2014-10-08 23:47:21 UTC (rev 249) +++ trunk/framework/Bee/MVC/Controller/Multiaction/MethodNameResolver/AntPathMethodNameResolver.php 2014-10-08 23:50:28 UTC (rev 250) @@ -22,7 +22,7 @@ /** * A method name resolver that uses a mapping from ant-style path definitions to handler method names. The path definitions are parsed - * by <code>Bee_Utils_AntPathMatcher</code> and can contain wildcards (*, ?). + * by <code>Bee\Utils\AntPathMatcher</code> and can contain wildcards (*, ?). * * @see Bee\MVC\Controller\MultiAction * @see Bee\MVC\Controller\Multiaction\IMethodNameResolver This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 23:47:23
|
Revision: 249 http://sourceforge.net/p/beeframework/code/249 Author: m_plomer Date: 2014-10-08 23:47:21 +0000 (Wed, 08 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Modified Paths: -------------- trunk/framework/Bee/Context/Support/ParseState.php Modified: trunk/framework/Bee/Context/Support/ParseState.php =================================================================== --- trunk/framework/Bee/Context/Support/ParseState.php 2014-10-08 23:41:59 UTC (rev 248) +++ trunk/framework/Bee/Context/Support/ParseState.php 2014-10-08 23:47:21 UTC (rev 249) @@ -36,10 +36,10 @@ /** * Add a new {@link Bee_Context_Support_ParseStateEntry} to the stack - * @param Bee_Context_Support_ParseStateEntry $entry + * @param ParseState_Entry $entry * @return void */ - public function push(Bee_Context_Support_ParseStateEntry $entry) { + public function push(ParseState_Entry $entry) { array_push($this->state, $entry); } @@ -64,7 +64,6 @@ /** * Marker interface for entries into the {@link ParseState}. */ -interface Bee_Context_Support_ParseStateEntry { +interface ParseState_Entry { -} -?> \ No newline at end of file +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 23:42:07
|
Revision: 248 http://sourceforge.net/p/beeframework/code/248 Author: m_plomer Date: 2014-10-08 23:41:59 +0000 (Wed, 08 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Modified Paths: -------------- trunk/framework/Bee/Security/Transactions/Interceptor/NameMatchTransactionAttributeSource.php trunk/framework/Bee/Utils/PatternMatcher.php Modified: trunk/framework/Bee/Security/Transactions/Interceptor/NameMatchTransactionAttributeSource.php =================================================================== --- trunk/framework/Bee/Security/Transactions/Interceptor/NameMatchTransactionAttributeSource.php 2014-10-08 23:22:21 UTC (rev 247) +++ trunk/framework/Bee/Security/Transactions/Interceptor/NameMatchTransactionAttributeSource.php 2014-10-08 23:41:59 UTC (rev 248) @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +use Bee\Utils\PatternMatcher; /** * Created by IntelliJ IDEA. @@ -91,11 +92,10 @@ * as well as direct equality. Can be overridden in subclasses. * @param string $methodName the method name of the class * @param string $mappedName the name in the descriptor - * @return if the names match + * @return bool if the names match * @see org.springframework.util.PatternMatchUtils#simpleMatch(String, String) */ protected function isMatch($methodName, $mappedName) { - return Bee_Utils_PatternMatcher::simpleMatch($mappedName, $methodName); + return PatternMatcher::simpleMatch($mappedName, $methodName); } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/Utils/PatternMatcher.php =================================================================== --- trunk/framework/Bee/Utils/PatternMatcher.php 2014-10-08 23:22:21 UTC (rev 247) +++ trunk/framework/Bee/Utils/PatternMatcher.php 2014-10-08 23:41:59 UTC (rev 248) @@ -1,4 +1,5 @@ <?php +namespace Bee\Utils; /* * Copyright 2008-2014 the original author or authors. * @@ -14,7 +15,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -use Bee\Utils\Strings; /** * Created by IntelliJ IDEA. @@ -24,7 +24,7 @@ * To change this template use File | Settings | File Templates. */ -class Bee_Utils_PatternMatcher { +class PatternMatcher { /** * Match a String against the given pattern, supporting the following simple This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 23:22:25
|
Revision: 247 http://sourceforge.net/p/beeframework/code/247 Author: m_plomer Date: 2014-10-08 23:22:21 +0000 (Wed, 08 Oct 2014) Log Message: ----------- - omissions from previous namespace refactoring Modified Paths: -------------- trunk/framework/Bee/Context/AbstractContext.php trunk/framework/Bee/Context/XmlContext.php Removed Paths: ------------- trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php trunk/framework/Bee/MVC/Interceptor/StripSlashes.php Modified: trunk/framework/Bee/Context/AbstractContext.php =================================================================== --- trunk/framework/Bee/Context/AbstractContext.php 2014-10-08 22:36:57 UTC (rev 246) +++ trunk/framework/Bee/Context/AbstractContext.php 2014-10-08 23:22:21 UTC (rev 247) @@ -700,7 +700,7 @@ // @todo: catch IllegalStateException in case scope is not active (e.g. no session started...) // not needed for session, request, prototype scopes but maybe for fancy new scope implementations... - $scopedInstance = $scope->get($beanName, new Bee_Context_Abstract_ObjectFactoryImpl($beanName, $localBeanDefinition, $this)); + $scopedInstance = $scope->get($beanName, new AbstractContext_ObjectFactoryImpl($beanName, $localBeanDefinition, $this)); $bean = $this->getObjectForBeanInstance($scopedInstance, $name, $beanName, $localBeanDefinition); @@ -908,7 +908,7 @@ /** * Workaround for an anonymous implementation of IObjectFactory. */ -final class Bee_Context_Abstract_ObjectFactoryImpl implements IObjectFactory { +final class AbstractContext_ObjectFactoryImpl implements IObjectFactory { /** * Enter description here... Modified: trunk/framework/Bee/Context/XmlContext.php =================================================================== --- trunk/framework/Bee/Context/XmlContext.php 2014-10-08 22:36:57 UTC (rev 246) +++ trunk/framework/Bee/Context/XmlContext.php 2014-10-08 23:22:21 UTC (rev 247) @@ -31,7 +31,7 @@ class XmlContext extends AbstractContext { /** - * @var Bee_Context_Xml_CachableConfig + * @var XmlContext_CachableConfig */ private $configCacheable; @@ -44,7 +44,7 @@ */ public function __construct($locations='', $callInitMethod=true) { parent::__construct($locations, false); - $this->configCacheable = new Bee_Context_Xml_CachableConfig(explode(",", $locations)); + $this->configCacheable = new XmlContext_CachableConfig(explode(",", $locations)); if ($callInitMethod) { $this->init(); } @@ -60,7 +60,7 @@ } } -class Bee_Context_Xml_CachableConfig implements ICachableResource { +class XmlContext_CachableConfig implements ICachableResource { /** * Enter description here... Deleted: trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php =================================================================== --- trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php 2014-10-08 22:36:57 UTC (rev 246) +++ trunk/framework/Bee/MVC/Interceptor/JsonDecoding.php 2014-10-08 23:22:21 UTC (rev 247) @@ -1,28 +0,0 @@ -<?php -/* - * Copyright 2008-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\MVC\Interceptor\JsonDecodingInterceptor; - -/** - * Decodes the JSON string from a request parameter ('json' by default) and adds the contents of the decoded structure as request - * parameters. - * - * @author Michael Plomer <mic...@it...> - * - * @deprecated replaced by Bee\MVC\Interceptor\JsonDecodingInterceptor - */ -class Bee_MVC_Interceptor_JsonDecoding extends JsonDecodingInterceptor { -} \ No newline at end of file Deleted: trunk/framework/Bee/MVC/Interceptor/StripSlashes.php =================================================================== --- trunk/framework/Bee/MVC/Interceptor/StripSlashes.php 2014-10-08 22:36:57 UTC (rev 246) +++ trunk/framework/Bee/MVC/Interceptor/StripSlashes.php 2014-10-08 23:22:21 UTC (rev 247) @@ -1,28 +0,0 @@ -<?php -/* - * Copyright 2008-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\MVC\Interceptor\StripSlashesInterceptor; - -/** - * Enter description here... - * - * @author Michael Plomer <mic...@it...> - * @author Benjamin Hartmann - * - * @deprecated replaced by Bee\MVC\Interceptor\StripSlashesInterceptor - */ -class Bee_MVC_Interceptor_StripSlashes extends StripSlashesInterceptor { -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 12:21:05
|
Revision: 245 http://sourceforge.net/p/beeframework/code/245 Author: m_plomer Date: 2014-10-08 12:21:00 +0000 (Wed, 08 Oct 2014) Log Message: ----------- fixed AntPathToRegexTransformer and RegexMappingInvocationResolver behavior on trailing /** patterns Modified Paths: -------------- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php trunk/framework/Bee/Utils/AntPathToRegexTransformer.php trunk/tests/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolverTest.php trunk/tests/Bee/Utils/AntPathDataProvider.php Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php 2014-10-08 09:12:00 UTC (rev 244) +++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolver.php 2014-10-08 12:21:00 UTC (rev 245) @@ -1,5 +1,6 @@ <?php namespace Bee\MVC\Controller\Multiaction\HandlerMethodInvocator; + /* * Copyright 2008-2014 the original author or authors. * @@ -82,12 +83,11 @@ */ public function getInvocationDefinition(Bee_MVC_IHttpRequest $request) { $pathInfo = $request->getPathInfo(); + /** @var MethodInvocation[] $matchingPatterns */ $matchingPatterns = array(); foreach ($this->mappedMethods as $regex => $invocInfo) { - $matches = array(); if (preg_match($regex, $pathInfo, $matches) === 1) { $invocInfo->setParamValues($matches); -// return $invocInfo; $matchingPatterns[$regex] = $invocInfo; } } @@ -97,32 +97,31 @@ } uksort($matchingPatterns, function ($patternA, $patternB) use ($matchingPatterns, $pathInfo) { - /** @var MethodInvocation[] $matchingPatterns */ - $matchA = $matchingPatterns[$patternA]; - $matchB = $matchingPatterns[$patternB]; - $emptyMatches = 0; $litLength = function ($carry, $item) use (&$emptyMatches) { if ($carry === false) { return $item; } - if($item) { - if(substr($item, -1) == '/') { + if ($item) { + if (substr($item, -1) == '/') { $item = substr($item, 0, -1); } - return preg_replace('#/'.preg_quote($item).'#', '', $carry, 1); + return preg_replace('#/' . preg_quote($item) . '#', '', $carry, 1); } $emptyMatches++; return $carry; }; + + $matchA = $matchingPatterns[$patternA]; $litA = array_reduce($matchA->getParamValues(), $litLength, false); $litA = preg_replace('#//#', '/', $litA); + $litCountA = substr_count($litA, '/'); $emptyMatches *= -1; + $matchB = $matchingPatterns[$patternB]; $litB = array_reduce($matchB->getParamValues(), $litLength, false); $litB = preg_replace('#//#', '/', $litB); - $litCountA = substr_count($litA, '/'); $litCountB = substr_count($litB, '/'); if ($litCountA != $litCountB) { @@ -145,7 +144,10 @@ if ($countA != $countB) { return $countA - $countB; } - return -$emptyMatches; + if($emptyMatches != 0) { + return -$emptyMatches; + } + return strlen($matchA->getAntPathPattern()) - strlen($matchB->getAntPathPattern()); }); if (self::getLog()->isDebugEnabled()) { @@ -169,5 +171,4 @@ } return self::$methodMetadataMap[$methodFullName]; } - } \ No newline at end of file Modified: trunk/framework/Bee/Utils/AntPathToRegexTransformer.php =================================================================== --- trunk/framework/Bee/Utils/AntPathToRegexTransformer.php 2014-10-08 09:12:00 UTC (rev 244) +++ trunk/framework/Bee/Utils/AntPathToRegexTransformer.php 2014-10-08 12:21:00 UTC (rev 245) @@ -27,7 +27,8 @@ '#\*#' => '([^/]*)', // "*" matches any string that does not contain slashes '#\(\[\^/\]\*\)\(\[\^/\]\*\)/#' => '((?:[^/]+/)*?)', // "**/" - replaced by "([^/]+)" above - matches 0:n path elements '#\(\[\^/\]\*\)\(\[\^/\]\*\)#' => '(.*?)', - '#(^|(?<=[^(*]))\?#' => '[^/]' + '#(^|(?<=[^(*]))\?#' => '[^/]', + '#/\(\.\*\?\)$#' => '(?:/(.*?))??' ); public static $TYPE_EXPRESSION_MAP = array( @@ -80,4 +81,12 @@ $matches = array(); return !!preg_match(self::PARAMETER_MATCH, $antPathPattern, $matches); } + + public static function test($antPathPattern = '/**') { + foreach(self::$SIMPLE_REPLACEMENTS as $pattern => $replace) { + var_dump($antPathPattern); + $antPathPattern = preg_replace($pattern, $replace, $antPathPattern); + echo $antPathPattern . '<hr/>'; + } + } } \ No newline at end of file Modified: trunk/tests/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolverTest.php =================================================================== --- trunk/tests/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolverTest.php 2014-10-08 09:12:00 UTC (rev 244) +++ trunk/tests/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/RegexMappingInvocationResolverTest.php 2014-10-08 12:21:00 UTC (rev 245) @@ -36,6 +36,7 @@ public function testMapping(RegexMappingInvocationResolver $resolver, $pathInfo, $expectedAntPath, $expectedParams = array()) { $request = new HttpRequestMock($pathInfo); $invocation = $resolver->getInvocationDefinition($request); + $this->assertTrue(!is_null($invocation)); $this->assertEquals($expectedAntPath, $invocation->getAntPathPattern()); $res = array_intersect_key($invocation->getParamValues(), array_flip($invocation->getUrlParameterPositions())); @@ -94,7 +95,7 @@ '/complicated/more/x/y/z/compliment/hermelin/hase', '/complicated/more/**/compl*/{string2}/**', array('hermelin')), - + array($testMapping, '', '/**') ); } Modified: trunk/tests/Bee/Utils/AntPathDataProvider.php =================================================================== --- trunk/tests/Bee/Utils/AntPathDataProvider.php 2014-10-08 09:12:00 UTC (rev 244) +++ trunk/tests/Bee/Utils/AntPathDataProvider.php 2014-10-08 12:21:00 UTC (rev 245) @@ -103,10 +103,12 @@ array("*bla*/**/bla/*", "XXXblaXXXX/testing/testing/bla/testing/testing", False), array("/x/x/**/bla", "/x/x/x/", False), + array("/x/x/**/bla", "/x/x/bla", true), array("/test/**", "/test", true), - array("", "", True)//, + array("/**", "", true), + array("", "", true)//, // array("/{bla}.*", "/testing.html", True) // #65 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-08 09:12:06
|
Revision: 244 http://sourceforge.net/p/beeframework/code/244 Author: m_plomer Date: 2014-10-08 09:12:00 +0000 (Wed, 08 Oct 2014) Log Message: ----------- removed previously deprecated Bee_MVC_Controller_MultiAction (replaced by Bee\MVC\Controller\MultiActionController) Modified Paths: -------------- trunk/examples/conf/context.xml trunk/framework/Bee/MVC/Controller/MultiActionController.php trunk/framework/Bee/MVC/Controller/MultiActionMultiDelegates.php Removed Paths: ------------- trunk/framework/Bee/MVC/Controller/MultiAction.php Modified: trunk/examples/conf/context.xml =================================================================== --- trunk/examples/conf/context.xml 2014-10-05 23:57:40 UTC (rev 243) +++ trunk/examples/conf/context.xml 2014-10-08 09:12:00 UTC (rev 244) @@ -23,7 +23,7 @@ <!-- METHOD NAME RESOLVER --> <bean id="methodNameResolver" class="Bee_MVC_Controller_Multiaction_MethodNameResolver_AnnotationBased" scope="prototype"/> - <bean id="multiactionControllerTemplate" class="Bee_MVC_Controller_MultiAction"> + <bean id="multiactionControllerTemplate" class="Bee\MVC\Controller\MultiActionController"> <property name="methodNameResolver" ref="methodNameResolver"/> </bean> Deleted: trunk/framework/Bee/MVC/Controller/MultiAction.php =================================================================== --- trunk/framework/Bee/MVC/Controller/MultiAction.php 2014-10-05 23:57:40 UTC (rev 243) +++ trunk/framework/Bee/MVC/Controller/MultiAction.php 2014-10-08 09:12:00 UTC (rev 244) @@ -1,34 +0,0 @@ -<?php -/* - * Copyright 2008-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -use Bee\MVC\Controller\MultiActionController; - -/** - * The multiaction controller handles requests by delegating to method calls on a delegate object. The methods to be used are - * determined by the method name resolver. - * - * A handler method must take at least one argument, type-hinted to Bee_MVC_IHttpRequest, and return a Bee_MVC_ModelAndView. - * - * @see Bee_MVC_IHttpRequest - * @see Bee_MVC_ModelAndView - * - * @author Michael Plomer <mic...@it...> - * @author Benjamin Hartmann - * - * @deprecated replaced by \Bee\MVC\Controller\MultiActionController - */ -class Bee_MVC_Controller_MultiAction extends MultiActionController { -} Modified: trunk/framework/Bee/MVC/Controller/MultiActionController.php =================================================================== --- trunk/framework/Bee/MVC/Controller/MultiActionController.php 2014-10-05 23:57:40 UTC (rev 243) +++ trunk/framework/Bee/MVC/Controller/MultiActionController.php 2014-10-08 09:12:00 UTC (rev 244) @@ -19,6 +19,7 @@ use Bee\MVC\Controller\Multiaction\IMethodNameResolver; use Bee\MVC\Controller\Multiaction\NoHandlerMethodFoundException; use Bee_MVC_IHttpRequest; +use Bee_MVC_ModelAndView; use Bee_Utils_Assert; use Bee_Utils_Reflection; use Bee_Utils_Strings; @@ -67,10 +68,10 @@ private $methodNameResolver; protected function init() { - Bee_Utils_Assert::notNull($this->delegate, '\'delegate\' property is required in Bee_MVC_Controller_MultiAction'); + Bee_Utils_Assert::notNull($this->delegate, '\'delegate\' property is required in ' . __CLASS__); Bee_Utils_Assert::isTrue( !is_null($this->methodInvocator) || !is_null($this->methodNameResolver), - 'either \'methodInvocator\' or \'methodNameResolver\' property required in Bee_MVC_Controller_MultiAction' + 'either \'methodInvocator\' or \'methodNameResolver\' property required in ' . __CLASS__ ); } @@ -79,7 +80,7 @@ * * @param Bee_MVC_IHttpRequest $request * @throws Exception - * @return \Bee_MVC_ModelAndView + * @return Bee_MVC_ModelAndView */ protected function handleRequestInternally(Bee_MVC_IHttpRequest $request) { if(!is_null($this->methodInvocator)) { Modified: trunk/framework/Bee/MVC/Controller/MultiActionMultiDelegates.php =================================================================== --- trunk/framework/Bee/MVC/Controller/MultiActionMultiDelegates.php 2014-10-05 23:57:40 UTC (rev 243) +++ trunk/framework/Bee/MVC/Controller/MultiActionMultiDelegates.php 2014-10-08 09:12:00 UTC (rev 244) @@ -73,7 +73,7 @@ */ protected function init() { parent::init(); - Bee_Utils_Assert::notNull($this->delegateResolver, '\'methodNameResolver\' property is required in Bee_MVC_Controller_MultiAction'); + Bee_Utils_Assert::notNull($this->delegateResolver, '\'methodNameResolver\' property is required in ' . __CLASS__); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-05 23:57:49
|
Revision: 243 http://sourceforge.net/p/beeframework/code/243 Author: m_plomer Date: 2014-10-05 23:57:40 +0000 (Sun, 05 Oct 2014) Log Message: ----------- Persistence: introduced JsonSerializable subclass of Doctrine2 Paginator Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Added Paths: ----------- trunk/framework/Bee/Persistence/Doctrine2/JsonSerializablePaginator.php trunk/framework/Bee/Utils/IJsonSerializable.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 18:36:44 UTC (rev 242) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-05 23:57:40 UTC (rev 243) @@ -154,7 +154,7 @@ if (!is_null($orderAndLimitHolder) && $orderAndLimitHolder->getPageSize() > 0) { $q->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); $q->setMaxResults($orderAndLimitHolder->getPageSize()); - $paginator = new Paginator($q, $this->useWhereInPagination()); + $paginator = new JsonSerializablePaginator($q, $this->useWhereInPagination()); $paginator->setUseOutputWalkers(false); $orderAndLimitHolder->setResultCount(count($paginator)); return $paginator; Added: trunk/framework/Bee/Persistence/Doctrine2/JsonSerializablePaginator.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/JsonSerializablePaginator.php (rev 0) +++ trunk/framework/Bee/Persistence/Doctrine2/JsonSerializablePaginator.php 2014-10-05 23:57:40 UTC (rev 243) @@ -0,0 +1,16 @@ +<?php +namespace Bee\Persistence\Doctrine2; + +use Doctrine\ORM\Tools\Pagination\Paginator; +use Bee\Utils\IJsonSerializable; + +/** + * Class JsonSerializablePaginator + * @package Bee\Tools\Entities + */ +class JsonSerializablePaginator extends Paginator implements IJsonSerializable { + + public function jsonSerialize() { + return $this->getIterator()->getArrayCopy(); + } +} \ No newline at end of file Added: trunk/framework/Bee/Utils/IJsonSerializable.php =================================================================== --- trunk/framework/Bee/Utils/IJsonSerializable.php (rev 0) +++ trunk/framework/Bee/Utils/IJsonSerializable.php 2014-10-05 23:57:40 UTC (rev 243) @@ -0,0 +1,13 @@ +<?php +namespace Bee\Utils; + +/** + * Interface IJsonSerializable + * @package Iter8\Utils + */ +interface IJsonSerializable { + /** + * @return mixed + */ + function jsonSerialize(); +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-01 18:36:53
|
Revision: 242 http://sourceforge.net/p/beeframework/code/242 Author: m_plomer Date: 2014-10-01 18:36:44 +0000 (Wed, 01 Oct 2014) Log Message: ----------- Persistence: fixed severe pagination bug in Doctrine2 DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 15:33:22 UTC (rev 241) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 18:36:44 UTC (rev 242) @@ -150,7 +150,7 @@ * @param IOrderAndLimitHolder $orderAndLimitHolder * @return array|Paginator */ - protected function getPaginatedOrderedResultFromQuery(Query $q, IOrderAndLimitHolder $orderAndLimitHolder) { + protected function getPaginatedOrderedResultFromQuery(Query $q, IOrderAndLimitHolder $orderAndLimitHolder = null) { if (!is_null($orderAndLimitHolder) && $orderAndLimitHolder->getPageSize() > 0) { $q->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); $q->setMaxResults($orderAndLimitHolder->getPageSize()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-01 15:33:30
|
Revision: 241 http://sourceforge.net/p/beeframework/code/241 Author: m_plomer Date: 2014-10-01 15:33:22 +0000 (Wed, 01 Oct 2014) Log Message: ----------- Persistence: fixed severe pagination bug in Doctrine2 DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 15:30:32 UTC (rev 240) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 15:33:22 UTC (rev 241) @@ -155,6 +155,7 @@ $q->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); $q->setMaxResults($orderAndLimitHolder->getPageSize()); $paginator = new Paginator($q, $this->useWhereInPagination()); + $paginator->setUseOutputWalkers(false); $orderAndLimitHolder->setResultCount(count($paginator)); return $paginator; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-10-01 15:30:38
|
Revision: 240 http://sourceforge.net/p/beeframework/code/240 Author: m_plomer Date: 2014-10-01 15:30:32 +0000 (Wed, 01 Oct 2014) Log Message: ----------- Persistence: fixed severe pagination bug in Doctrine2 DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-28 22:03:01 UTC (rev 239) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-10-01 15:30:32 UTC (rev 240) @@ -41,8 +41,12 @@ */ public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null, $hydrationMode = null) { $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); - $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); - return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); + $this->applyOrderMapping($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); + $q = $this->getQueryFromBuilder($queryBuilder); + if(!is_null($hydrationMode)) { + $q->setHydrationMode($hydrationMode); + } + return $this->getPaginatedOrderedResultFromQuery($q, $orderAndLimitHolder); } /** @@ -99,7 +103,7 @@ * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null) { + protected final function applyOrderMapping(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null) { if (is_null($defaultOrderMapping)) { $defaultOrderMapping = array(); } @@ -112,17 +116,6 @@ foreach ($orderMapping as $orderField => $orderDir) { $queryBuilder->addOrderBy($orderField, $orderDir); } - - if (is_null($orderAndLimitHolder)) { - return; - } - - if ($orderAndLimitHolder->getPageSize() > 0) { - $paginator = new Paginator($queryBuilder, false); - $orderAndLimitHolder->setResultCount(count($paginator)); - $queryBuilder->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); - $queryBuilder->setMaxResults($orderAndLimitHolder->getPageSize()); - } } /** @@ -151,4 +144,28 @@ throw $e; } } + + /** + * @param Query $q + * @param IOrderAndLimitHolder $orderAndLimitHolder + * @return array|Paginator + */ + protected function getPaginatedOrderedResultFromQuery(Query $q, IOrderAndLimitHolder $orderAndLimitHolder) { + if (!is_null($orderAndLimitHolder) && $orderAndLimitHolder->getPageSize() > 0) { + $q->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); + $q->setMaxResults($orderAndLimitHolder->getPageSize()); + $paginator = new Paginator($q, $this->useWhereInPagination()); + $orderAndLimitHolder->setResultCount(count($paginator)); + return $paginator; + } else { + return $q->getResult($q->getHydrationMode()); + } + } + + /** + * @return bool + */ + protected function useWhereInPagination() { + return true; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-28 22:03:13
|
Revision: 239 http://sourceforge.net/p/beeframework/code/239 Author: m_plomer Date: 2014-09-28 22:03:01 +0000 (Sun, 28 Sep 2014) Log Message: ----------- Persistence: fixed bug in PaginationBase MVC: Dispatcher now accepts a MAV also from Interceptors, bypasses rest of chain and controller in that case Modified Paths: -------------- trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php trunk/examples/classes/Test/Mvc/ParamTestDelegate.php trunk/examples/conf/views.xml trunk/examples/index.php trunk/framework/Bee/MVC/Dispatcher.php trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php =================================================================== --- trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/examples/classes/Test/Mvc/ClassicTestDelegate.php 2014-09-28 22:03:01 UTC (rev 239) @@ -13,10 +13,12 @@ /** * * @Bee_MVC_Controller_Multiaction_RequestHandler(httpMethod = "GET", pathPattern = "/**\/testClassic/**") + * @param Bee_MVC_IHttpRequest $request + * @return bool */ public function handleTestParams(Bee_MVC_IHttpRequest $request) { - var_dump($request); - return true; +// var_dump($request); + return new \Bee_MVC_ModelAndView(array('delegateName' => get_class($this)), 'testview'); } - +kk } \ No newline at end of file Modified: trunk/examples/classes/Test/Mvc/ParamTestDelegate.php =================================================================== --- trunk/examples/classes/Test/Mvc/ParamTestDelegate.php 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/examples/classes/Test/Mvc/ParamTestDelegate.php 2014-09-28 22:03:01 UTC (rev 239) @@ -21,10 +21,11 @@ * @param MC $testParam * @param boolean $getParam * @return bool + * @Bee_MVC_Controller_Multiaction_RequestHandler(httpMethod = "GET", pathPattern = "/**\/testClassic/**") * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/ghi/*\/{0}/{2}/const/{boolParam}", httpMethod="GET") * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/{0}/{2}/{boolParam}", httpMethod="POST") */ - public function handleTestParams($paramA, Bee_MVC_IHttpRequest $request, MC $paramB, $boolParam = false, $testParam = null, $getParam = false) { + public function handleTestParams($paramA = null, Bee_MVC_IHttpRequest $request, MC $paramB, $boolParam = false, $testParam = null, $getParam = false) { echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>'; // var_dump($paramA); // var_dump($paramB); @@ -64,6 +65,9 @@ /** * * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**\/testParam/{paramA}/") + * @param MC $paramB + * @param Bee_MVC_IHttpRequest $request + * @return bool */ public function handleTestParams2(MC $paramB, Bee_MVC_IHttpRequest $request) { echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>'; @@ -75,7 +79,7 @@ /** * @param int $getParam * @return Bee_MVC_ModelAndView - * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**") + * @Bee_MVC_Controller_Multiaction_RequestHandler(pathPattern = "/**", httpMethod="GET") */ public function handleDefault($getParam = 1000) { echo '<hr/>'. get_class($this) .'::'. __FUNCTION__ .'<hr/>'; Modified: trunk/examples/conf/views.xml =================================================================== --- trunk/examples/conf/views.xml 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/examples/conf/views.xml 2014-09-28 22:03:01 UTC (rev 239) @@ -3,4 +3,5 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd"> + <bean id="testview" class="Bee_MVC_View_JsonService" /> </beans> Modified: trunk/examples/index.php =================================================================== --- trunk/examples/index.php 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/examples/index.php 2014-09-28 22:03:01 UTC (rev 239) @@ -11,4 +11,4 @@ Bee_Cache_Manager::init(); //Bee_Framework::setProductionMode(true); -Bee_Framework::dispatchRequestUsingXmlContext(__DIR__.'/conf/context-mvc.xml'); \ No newline at end of file +Bee_Framework::dispatchRequestUsingXmlContext(__DIR__.'/conf/context-newinterceptors.xml'); \ No newline at end of file Modified: trunk/framework/Bee/MVC/Dispatcher.php =================================================================== --- trunk/framework/Bee/MVC/Dispatcher.php 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/framework/Bee/MVC/Dispatcher.php 2014-09-28 22:03:01 UTC (rev 239) @@ -262,25 +262,31 @@ $mav = null; $interceptors = array(); $handlerException = null; + $interceptorIndex = -1; try { - $mappedHandler = $this->handlerMapping->getHandler($request); $interceptors = $mappedHandler->getInterceptors(); $handler = $mappedHandler->getHandler(); -// $interceptorIndex = -1; - + $mav = null; for ($i = 0; $i < count($interceptors); $i++) { $interceptor = $interceptors[$i]; - if (!$interceptor->preHandle($request, $handler)) { + $interceptorResult = $interceptor->preHandle($request, $handler); + if (!$interceptorResult) { // $this->triggerAfterCompletion($handler, $interceptorIndex, $request, null); return; } -// $interceptorIndex = $i; + $interceptorIndex = $i; + if($interceptorResult instanceof Bee_MVC_ModelAndView) { + $mav = $interceptorResult; + break; + } } // @todo: introduce HandlerAdapter - $mav = $handler->handleRequest($request); + if(is_null($mav)) { + $mav = $handler->handleRequest($request); + } } catch (Exception $e) { $this->getLog()->warn('handler or interceptor exception caught, trying to resolve appropriate error view', $e); @@ -308,7 +314,7 @@ $interceptors = $this->handlerMapping->getInterceptors(); } // Apply postHandle methods of registered interceptors. - for ($i = count($interceptors) - 1; $i >= 0; $i--) { + for ($i = $interceptorIndex; $i >= 0; $i--) { $interceptor = $interceptors[$i]; $interceptor->postHandle($request, $handler, $mav); } Modified: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-26 18:41:49 UTC (rev 238) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-28 22:03:01 UTC (rev 239) @@ -71,7 +71,6 @@ * @param $currentPage */ public function setCurrentPage($currentPage) { - $currentPage = $currentPage > $this->getPageCount() - 1 ? $this->getPageCount() - 1 : $currentPage; $currentPage = $currentPage < 0 ? 0 : $currentPage; $this->currentPage = $currentPage; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 18:41:55
|
Revision: 238 http://sourceforge.net/p/beeframework/code/238 Author: m_plomer Date: 2014-09-26 18:41:49 +0000 (Fri, 26 Sep 2014) Log Message: ----------- before Added Paths: ----------- tags/0.10.1-beta/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 16:14:30
|
Revision: 237 http://sourceforge.net/p/beeframework/code/237 Author: m_plomer Date: 2014-09-26 16:14:27 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Xml: top level beans now have an ID autogenerated if none defined Modified Paths: -------------- trunk/framework/Bee/Context/Xml/ParserDelegate.php Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 16:10:02 UTC (rev 236) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 16:14:27 UTC (rev 237) @@ -754,7 +754,9 @@ $bd = !is_null($handler) ? $handler->parse($ele, new ParserContext($this->readerContext, $this, $containingBd)) : null; if (!is_null($bd)) { $beanName = BeanDefinitionReaderUtils::generateBeanName($bd, $this->readerContext->getRegistry(), true); - $this->readerContext->getRegistry()->registerBeanDefinition($beanName, $bd); + if(!$this->readerContext->getRegistry()->containsBeanDefinition($beanName)) { + $this->readerContext->getRegistry()->registerBeanDefinition($beanName, $bd); + } $bd = $this->decorateBeanDefinitionIfRequired($ele, new BeanDefinitionHolder($bd, $beanName)); } return $bd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 16:10:05
|
Revision: 236 http://sourceforge.net/p/beeframework/code/236 Author: m_plomer Date: 2014-09-26 16:10:02 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Xml: top level beans now have an ID autogenerated if none defined Modified Paths: -------------- trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php Modified: trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php =================================================================== --- trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php 2014-09-26 14:56:42 UTC (rev 235) +++ trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php 2014-09-26 16:10:02 UTC (rev 236) @@ -1,5 +1,6 @@ <?php namespace Bee\Context\Xml\XmlNamespace; + /* * Copyright 2008-2014 the original author or authors. * @@ -31,151 +32,152 @@ * Date: Feb 17, 2010 * Time: 11:36:56 PM */ - abstract class AbstractBeanDefinitionParser implements IBeanDefinitionParser, IConstants { - /** Constant for the id attribute */ - const ID_ATTRIBUTE = 'id'; + /** Constant for the id attribute */ + const ID_ATTRIBUTE = 'id'; - public final function parse(DOMElement $element, ParserContext $parserContext) { - $definition = $this->parseInternal($element, $parserContext); - if (!$parserContext->isNested()) { - try { - $aliases = $this->shouldParseNameAliases() ? Utils::parseNameAttribute($element) : null; + public final function parse(DOMElement $element, ParserContext $parserContext) { + $definition = $this->parseInternal($element, $parserContext); + if (!$parserContext->isNested()) { + try { + $aliases = $this->shouldParseNameAliases() ? Utils::parseNameAttribute($element) : null; - $id = $this->resolveId($element, $definition, $parserContext); - if (!Bee_Utils_Strings::hasText($id) && count($aliases) > 0) { - $id = Utils::getIdFromAliases($aliases, $parserContext->getReaderContext(), $element); - } - if (!Bee_Utils_Strings::hasText($id)) { - $parserContext->getReaderContext()->error( - "Id is required for element '" . $element->localName . "' when used as a top-level tag", $element); - } - $holder = new BeanDefinitionHolder($definition, $id, $aliases); - $this->registerBeanDefinition($holder, $parserContext->getRegistry()); + $id = $this->resolveId($element, $definition, $parserContext); + if (!Bee_Utils_Strings::hasText($id) && count($aliases) > 0) { + $id = Utils::getIdFromAliases($aliases, $parserContext->getReaderContext(), $element); + } + if (!Bee_Utils_Strings::hasText($id)) { +// $parserContext->getReaderContext()->error( +// "Id is required for element '" . $element->localName . "' when used as a top-level tag", $element); + // force-generate an ID so top level elements that are referenced e.g. via decorators can still be + // defined at the top level and do not need to have an ID manually defined + $id = BeanDefinitionReaderUtils::generateBeanName($definition, $parserContext->getRegistry(), true); + } + $holder = new BeanDefinitionHolder($definition, $id, $aliases); + $this->registerBeanDefinition($holder, $parserContext->getRegistry()); // if ($this->shouldFireEvents()) { // $componentDefinition = new BeanComponentDefinition(holder); // postProcessComponentDefinition(componentDefinition); // parserContext.registerComponent(componentDefinition); // } - } catch (Bee_Context_BeanDefinitionStoreException $ex) { - $parserContext->getReaderContext()->error($ex->getMessage(), $element); - return null; - } - } - return $definition; - } + } catch (Bee_Context_BeanDefinitionStoreException $ex) { + $parserContext->getReaderContext()->error($ex->getMessage(), $element); + return null; + } + } + return $definition; + } - /** - * Resolve the ID for the supplied {@link BeanDefinition}. - * <p>When using {@link #shouldGenerateId generation}, a name is generated automatically. - * Otherwise, the ID is extracted from the "id" attribute, potentially with a - * {@link #shouldGenerateIdAsFallback() fallback} to a generated id. - * @param DOMElement $element the element that the bean definition has been built from - * @param Bee_Context_Config_BeanDefinition_Abstract $definition the bean definition to be registered - * @param ParserContext $parserContext the object encapsulating the current state of the parsing process; - * provides access to a {@link org.springframework.beans.factory.support.BeanDefinitionRegistry} - * @return string the resolved id - * @throws Bee_Context_BeanDefinitionStoreException if no unique name could be generated - * for the given bean definition - */ - protected function resolveId(DOMElement $element, Bee_Context_Config_BeanDefinition_Abstract $definition, ParserContext $parserContext) { + /** + * Resolve the ID for the supplied {@link BeanDefinition}. + * <p>When using {@link #shouldGenerateId generation}, a name is generated automatically. + * Otherwise, the ID is extracted from the "id" attribute, potentially with a + * {@link #shouldGenerateIdAsFallback() fallback} to a generated id. + * @param DOMElement $element the element that the bean definition has been built from + * @param Bee_Context_Config_BeanDefinition_Abstract $definition the bean definition to be registered + * @param ParserContext $parserContext the object encapsulating the current state of the parsing process; + * provides access to a {@link org.springframework.beans.factory.support.BeanDefinitionRegistry} + * @return string the resolved id + * @throws Bee_Context_BeanDefinitionStoreException if no unique name could be generated + * for the given bean definition + */ + protected function resolveId(DOMElement $element, Bee_Context_Config_BeanDefinition_Abstract $definition, ParserContext $parserContext) { - if ($this->shouldGenerateId()) { - return BeanDefinitionReaderUtils::generateBeanName($definition, $parserContext->getRegistry(), false); - } - else { - $id = $element->getAttribute(self::ID_ATTRIBUTE); - if (!Bee_Utils_Strings::hasText($id) && $this->shouldGenerateIdAsFallback()) { - $id = BeanDefinitionReaderUtils::generateBeanName($definition, $parserContext->getRegistry(), false); - } - return $id; - } - } + if ($this->shouldGenerateId()) { + return BeanDefinitionReaderUtils::generateBeanName($definition, $parserContext->getRegistry(), false); + } else { + $id = $element->getAttribute(self::ID_ATTRIBUTE); + if (!Bee_Utils_Strings::hasText($id) && $this->shouldGenerateIdAsFallback()) { + $id = BeanDefinitionReaderUtils::generateBeanName($definition, $parserContext->getRegistry(), false); + } + return $id; + } + } - /** - * Register the supplied {@link BeanDefinitionHolder bean} with the supplied - * {@link BeanDefinitionRegistry registry}. - * <p>Subclasses can override this method to control whether or not the supplied - * {@link BeanDefinitionHolder bean} is actually even registered, or to - * register even more beans. - * <p>The default implementation registers the supplied {@link BeanDefinitionHolder bean} - * with the supplied {@link BeanDefinitionRegistry registry} only if the <code>isNested</code> - * parameter is <code>false</code>, because one typically does not want inner beans - * to be registered as top level beans. - * @param BeanDefinitionHolder $definition the bean definition to be registered - * @param IBeanDefinitionRegistry $registry the registry that the bean is to be registered with - * @see BeanDefinitionReaderUtils#registerBeanDefinition(BeanDefinitionHolder, BeanDefinitionRegistry) - */ - protected function registerBeanDefinition(BeanDefinitionHolder $definition, IBeanDefinitionRegistry $registry) { + /** + * Register the supplied {@link BeanDefinitionHolder bean} with the supplied + * {@link BeanDefinitionRegistry registry}. + * <p>Subclasses can override this method to control whether or not the supplied + * {@link BeanDefinitionHolder bean} is actually even registered, or to + * register even more beans. + * <p>The default implementation registers the supplied {@link BeanDefinitionHolder bean} + * with the supplied {@link BeanDefinitionRegistry registry} only if the <code>isNested</code> + * parameter is <code>false</code>, because one typically does not want inner beans + * to be registered as top level beans. + * @param BeanDefinitionHolder $definition the bean definition to be registered + * @param IBeanDefinitionRegistry $registry the registry that the bean is to be registered with + * @see BeanDefinitionReaderUtils#registerBeanDefinition(BeanDefinitionHolder, BeanDefinitionRegistry) + */ + protected function registerBeanDefinition(BeanDefinitionHolder $definition, IBeanDefinitionRegistry $registry) { BeanDefinitionReaderUtils::registerBeanDefinition($definition, $registry); - } + } - /** - * Central template method to actually parse the supplied {@link Element} - * into one or more {@link BeanDefinition BeanDefinitions}. - * @param DOMElement $element the element that is to be parsed into one or more {@link BeanDefinition BeanDefinitions} - * @param ParserContext $parserContext the object encapsulating the current state of the parsing process; - * provides access to a {@link org.springframework.beans.factory.support.BeanDefinitionRegistry} - * @return Bee_Context_Config_BeanDefinition_Abstract the primary {@link BeanDefinition} resulting from the parsing of the supplied {@link Element} - * @see #parse(org.w3c.dom.Element, ParserContext) - * @see #postProcessComponentDefinition(org.springframework.beans.factory.parsing.BeanComponentDefinition) - */ - protected abstract function parseInternal(DOMElement $element, ParserContext $parserContext); + /** + * Central template method to actually parse the supplied {@link Element} + * into one or more {@link BeanDefinition BeanDefinitions}. + * @param DOMElement $element the element that is to be parsed into one or more {@link BeanDefinition BeanDefinitions} + * @param ParserContext $parserContext the object encapsulating the current state of the parsing process; + * provides access to a {@link org.springframework.beans.factory.support.BeanDefinitionRegistry} + * @return Bee_Context_Config_BeanDefinition_Abstract the primary {@link BeanDefinition} resulting from the parsing of the supplied {@link Element} + * @see #parse(org.w3c.dom.Element, ParserContext) + * @see #postProcessComponentDefinition(org.springframework.beans.factory.parsing.BeanComponentDefinition) + */ + protected abstract function parseInternal(DOMElement $element, ParserContext $parserContext); - /** - * Should an ID be generated instead of read from the passed in {@link Element}? - * <p>Disabled by default; subclasses can override this to enable ID generation. - * Note that this flag is about <i>always</i> generating an ID; the parser - * won't even check for an "id" attribute in this case. - * @return boolean whether the parser should always generate an id - */ - protected function shouldGenerateId() { - return false; - } + /** + * Should an ID be generated instead of read from the passed in {@link Element}? + * <p>Disabled by default; subclasses can override this to enable ID generation. + * Note that this flag is about <i>always</i> generating an ID; the parser + * won't even check for an "id" attribute in this case. + * @return boolean whether the parser should always generate an id + */ + protected function shouldGenerateId() { + return false; + } - /** - * Should an ID be generated instead if the passed in {@link Element} does not - * specify an "id" attribute explicitly? - * <p>Disabled by default; subclasses can override this to enable ID generation - * as fallback: The parser will first check for an "id" attribute in this case, - * only falling back to a generated ID if no value was specified. - * @return boolean whether the parser should generate an id if no id was specified - */ - protected function shouldGenerateIdAsFallback() { - return false; - } + /** + * Should an ID be generated instead if the passed in {@link Element} does not + * specify an "id" attribute explicitly? + * <p>Disabled by default; subclasses can override this to enable ID generation + * as fallback: The parser will first check for an "id" attribute in this case, + * only falling back to a generated ID if no value was specified. + * @return boolean whether the parser should generate an id if no id was specified + */ + protected function shouldGenerateIdAsFallback() { + return false; + } - protected function shouldParseNameAliases() { - return true; - } + protected function shouldParseNameAliases() { + return true; + } - /** - * Controls whether this parser is supposed to fire a - * {@link org.springframework.beans.factory.parsing.BeanComponentDefinition} - * event after parsing the bean definition. - * <p>This implementation returns <code>true</code> by default; that is, - * an event will be fired when a bean definition has been completely parsed. - * Override this to return <code>false</code> in order to suppress the event. - * @return boolean <code>true</code> in order to fire a component registration event - * after parsing the bean definition; <code>false</code> to suppress the event - * @see #postProcessComponentDefinition - * @see org.springframework.beans.factory.parsing.ReaderContext#fireComponentRegistered - */ + /** + * Controls whether this parser is supposed to fire a + * {@link org.springframework.beans.factory.parsing.BeanComponentDefinition} + * event after parsing the bean definition. + * <p>This implementation returns <code>true</code> by default; that is, + * an event will be fired when a bean definition has been completely parsed. + * Override this to return <code>false</code> in order to suppress the event. + * @return boolean <code>true</code> in order to fire a component registration event + * after parsing the bean definition; <code>false</code> to suppress the event + * @see #postProcessComponentDefinition + * @see org.springframework.beans.factory.parsing.ReaderContext#fireComponentRegistered + */ // protected function shouldFireEvents() { // return true; // } - /** - * Hook method called after the primary parsing of a - * {@link BeanComponentDefinition} but before the - * {@link BeanComponentDefinition} has been registered with a - * {@link org.springframework.beans.factory.support.BeanDefinitionRegistry}. - * <p>Derived classes can override this method to supply any custom logic that - * is to be executed after all the parsing is finished. - * <p>The default implementation is a no-op. - * @param mixed $componentDefinition the {@link BeanComponentDefinition} that is to be processed - */ + /** + * Hook method called after the primary parsing of a + * {@link BeanComponentDefinition} but before the + * {@link BeanComponentDefinition} has been registered with a + * {@link org.springframework.beans.factory.support.BeanDefinitionRegistry}. + * <p>Derived classes can override this method to supply any custom logic that + * is to be executed after all the parsing is finished. + * <p>The default implementation is a no-op. + * @param mixed $componentDefinition the {@link BeanComponentDefinition} that is to be processed + */ // protected function postProcessComponentDefinition(BeanComponentDefinition componentDefinition) { // } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 14:56:50
|
Revision: 235 http://sourceforge.net/p/beeframework/code/235 Author: m_plomer Date: 2014-09-26 14:56:42 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Utils: added ValueFactoryBean and namespace def Modified Paths: -------------- trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php trunk/framework/Bee/Context/Xml/ParserDelegate.php trunk/framework/acl-default.xml Modified: trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php =================================================================== --- trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php 2014-09-26 14:14:00 UTC (rev 234) +++ trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php 2014-09-26 14:56:42 UTC (rev 235) @@ -34,6 +34,6 @@ * @param BeanDefinitionBuilder $builder */ protected function doParse(DOMElement $element, ParserContext $parserContext, BeanDefinitionBuilder $builder) { - $builder->addPropertyValue('sourceValue', $parserContext->getDelegate()->parseValueElement($element, 'string')); + $builder->addPropertyValue('sourceValue', $parserContext->getDelegate()->parseTypedAttributeValueElement($element, 'string')); } } Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 14:14:00 UTC (rev 234) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 14:56:42 UTC (rev 235) @@ -482,9 +482,11 @@ * @param DOMElement $ele * @param IBeanDefinition $bd * @param string $elementName + * @param null $defaultType + * @throws Bee_Context_BeanCreationException * @return BeanDefinitionHolder|TypedStringValue|ArrayValue|RuntimeBeanNameReference|RuntimeBeanReference|null */ - private function parseComplexPropElement(DOMElement $ele, IBeanDefinition $bd, $elementName) { + private function parseComplexPropElement(DOMElement $ele, IBeanDefinition $bd, $elementName, $defaultType = null) { // Should only have one child element: ref, value, list, etc. $nl = $ele->childNodes; @@ -520,8 +522,7 @@ // ref.setSource(extractSource(ele)); return $ref; } else if ($hasValueAttribute) { - - $valueHolder = $this->buildTypedStringValue($ele->getAttribute(self::VALUE_ATTRIBUTE), $ele->getAttribute(self::TYPE_ATTRIBUTE), $ele); + $valueHolder = $this->parseTypedAttributeValueElement($ele, $defaultType); // @todo provide source info via BeanMetadataElement // valueHolder.setSource(extractSource(ele)); return $valueHolder; @@ -535,6 +536,15 @@ } /** + * @param DOMElement $ele + * @param $defaultType + * @return TypedStringValue + */ + public function parseTypedAttributeValueElement(DOMElement $ele, $defaultType) { + return $this->buildTypedStringValue($ele->getAttribute(self::VALUE_ATTRIBUTE), $ele, $defaultType); + } + + /** * Parse a value, ref or collection sub-element of a property or * constructor-arg element * @param DOMElement $ele subelement of property element; we don't know which yet @@ -636,13 +646,7 @@ */ public function parseValueElement(DOMElement $ele, $defaultType) { // It's a literal value. - $value = Bee_Utils_Dom::getTextValue($ele); - - $typeName = $ele->getAttribute(self::TYPE_ATTRIBUTE); - if (!Bee_Utils_Strings::hasText($typeName)) { - $typeName = $defaultType; - } - return $this->buildTypedStringValue($value, $typeName, $ele); + return $this->buildTypedStringValue(Bee_Utils_Dom::getTextValue($ele), $ele, $defaultType); } /** @@ -650,16 +654,22 @@ * @see org.springframework.beans.factory.config.TypedStringValue * * @param String $value - * @param String $targetTypeName * @param DOMElement $ele + * @param string|null $defaultType * @return TypedStringValue */ - protected function buildTypedStringValue($value, $targetTypeName, DOMElement $ele) { + public function buildTypedStringValue($value, DOMElement $ele, $defaultType = null) { + + $typeName = $ele->getAttribute(self::TYPE_ATTRIBUTE); + if (!Bee_Utils_Strings::hasText($typeName)) { + $typeName = $defaultType; + } + $typedValue = null; - if (!Bee_Utils_Strings::hasText($targetTypeName)) { + if (!Bee_Utils_Strings::hasText($typeName)) { $typedValue = new TypedStringValue($value, $this->propertyEditorRegistry); } else { - $typedValue = new TypedStringValue($value, $this->propertyEditorRegistry, $targetTypeName); + $typedValue = new TypedStringValue($value, $this->propertyEditorRegistry, $typeName); } // @todo provide source info via BeanMetadataElement // $typedValue->setSource(extractSource(ele)); @@ -728,7 +738,7 @@ if (!Bee_Utils_Strings::hasText($key)) { $this->readerContext->error("Tag 'assoc-item' must have a 'key' attribute", $ele); } - $val = $this->parseComplexPropElement($ele, $bd, "<assoc-item> for key $key"); + $val = $this->parseComplexPropElement($ele, $bd, "<assoc-item> for key $key", $defaultTypeClassName); return array($key, $val); } Modified: trunk/framework/acl-default.xml =================================================================== --- trunk/framework/acl-default.xml 2014-09-26 14:14:00 UTC (rev 234) +++ trunk/framework/acl-default.xml 2014-09-26 14:56:42 UTC (rev 235) @@ -2,7 +2,7 @@ <beans xmlns="http://www.beeframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.1.xsd"> + xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd"> <bean id="basicAuditLogger" class="Bee_Security_Acls_Impl_BasicAuditLogger" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 14:14:08
|
Revision: 234 http://sourceforge.net/p/beeframework/code/234 Author: m_plomer Date: 2014-09-26 14:14:00 +0000 (Fri, 26 Sep 2014) Log Message: ----------- fix in pagination base Modified Paths: -------------- trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-26 14:04:16 UTC (rev 233) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-26 14:14:00 UTC (rev 234) @@ -47,6 +47,13 @@ } /** + * @param int $pageSize + */ + public function setPageSize($pageSize) { + $this->pageSize = $pageSize; + } + + /** * @return int */ public function getPageCount() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 14:04:24
|
Revision: 233 http://sourceforge.net/p/beeframework/code/233 Author: m_plomer Date: 2014-09-26 14:04:16 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Xml: added ability to decorate custom namespace beans with custom decorators - namespace fixes Modified Paths: -------------- trunk/framework/bee-beans-1.2.xsd trunk/framework/bee-util-1.0.xsd trunk/tests/Bee/Context/Xml/BeanDefinitionReaderTest-context.xml Modified: trunk/framework/bee-beans-1.2.xsd =================================================================== --- trunk/framework/bee-beans-1.2.xsd 2014-09-26 13:11:26 UTC (rev 232) +++ trunk/framework/bee-beans-1.2.xsd 2014-09-26 14:04:16 UTC (rev 233) @@ -325,6 +325,21 @@ </xsd:attribute> </xsd:attributeGroup> + <xsd:attributeGroup name="typedValueAttributes"> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation> + <![CDATA[A short-cut alternative to a nested "<value>...</value>" element.]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[The type that the value attribute should be validated against and converted + to.]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:attributeGroup> + <xsd:element name="bean"> <xsd:annotation> <xsd:documentation source="java:org.springframework.beans.factory.config.BeanDefinition"><![CDATA[ @@ -670,12 +685,7 @@ <![CDATA[A short-cut alternative to a nested "<ref bean='...'/>".]]></xsd:documentation> </xsd:annotation> </xsd:attribute> - <xsd:attribute name="value" type="xsd:string"> - <xsd:annotation> - <xsd:documentation> - <![CDATA[A short-cut alternative to a nested "<value>...</value>" element.]]></xsd:documentation> - </xsd:annotation> - </xsd:attribute> + <xsd:attributeGroup ref="typedValueAttributes"/> </xsd:complexType> Modified: trunk/framework/bee-util-1.0.xsd =================================================================== --- trunk/framework/bee-util-1.0.xsd 2014-09-26 13:11:26 UTC (rev 232) +++ trunk/framework/bee-util-1.0.xsd 2014-09-26 14:04:16 UTC (rev 233) @@ -1,19 +1,20 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <xsd:schema xmlns="http://www.beeframework.org/schema/util" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - xmlns:beans="http://www.beeframework.org/schema/beans" - targetNamespace="http://www.beeframework.org/schema/util" - elementFormDefault="qualified" - attributeFormDefault="unqualified"> + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:beans="http://www.beeframework.org/schema/beans" + targetNamespace="http://www.beeframework.org/schema/util" + elementFormDefault="qualified" + attributeFormDefault="unqualified"> - <xsd:import namespace="http://www.beeframework.org/schema/beans" schemaLocation="http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd"/> + <xsd:import namespace="http://www.beeframework.org/schema/beans" + schemaLocation="http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd"/> - <xsd:annotation> - <xsd:documentation><![CDATA[ + <xsd:annotation> + <xsd:documentation><![CDATA[ Defines the configuration elements for misc context utilities. ]]></xsd:documentation> - </xsd:annotation> + </xsd:annotation> <xsd:element name="array"> <xsd:annotation> @@ -24,7 +25,7 @@ <xsd:complexType> <xsd:complexContent> <xsd:extension base="beans:identifiedType"> - <xsd:group ref="beans:arrayElements" /> + <xsd:group ref="beans:arrayElements"/> <xsd:attributeGroup ref="beans:commonBeanAttributes"/> <xsd:attributeGroup ref="beans:collectionBeanAttributes"/> </xsd:extension> @@ -34,18 +35,19 @@ <xsd:element name="value"> <xsd:annotation> - <xsd:documentation><![CDATA[ - Conveniently defines an array factory bean - ]]></xsd:documentation> + <xsd:documentation><![CDATA[Conveniently defines a value factory bean]]></xsd:documentation> </xsd:annotation> - <xsd:complexType mixed="true"> - <xsd:choice minOccurs="0" maxOccurs="unbounded"/> - <xsd:attribute name="type" type="xsd:string"> - <xsd:annotation> - <xsd:documentation><![CDATA[The type that the value attribute should be validated against and converted - to.]]></xsd:documentation> - </xsd:annotation> - </xsd:attribute> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="beans:identifiedType"> + <xsd:sequence> + <xsd:element ref="beans:null" minOccurs="0" maxOccurs="1"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attributeGroup ref="beans:typedValueAttributes"/> + <xsd:attributeGroup ref="beans:commonBeanAttributes"/> + </xsd:extension> + </xsd:complexContent> </xsd:complexType> </xsd:element> Modified: trunk/tests/Bee/Context/Xml/BeanDefinitionReaderTest-context.xml =================================================================== --- trunk/tests/Bee/Context/Xml/BeanDefinitionReaderTest-context.xml 2014-09-26 13:11:26 UTC (rev 232) +++ trunk/tests/Bee/Context/Xml/BeanDefinitionReaderTest-context.xml 2014-09-26 14:04:16 UTC (rev 233) @@ -44,4 +44,6 @@ <assoc-item key="a" value="Zulu" /> </util:array> + <util:value type="int" id="tt" value="15"> + </util:value> </beans> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 13:11:29
|
Revision: 232 http://sourceforge.net/p/beeframework/code/232 Author: m_plomer Date: 2014-09-26 13:11:26 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Xml: added ability to decorate custom namespace beans with custom decorators Modified Paths: -------------- trunk/framework/Bee/Context/Util/ArrayFactoryBean.php trunk/framework/Bee/Context/Util/Namespace/Handler.php trunk/framework/Bee/Context/Xml/ParserDelegate.php trunk/framework/bee-util-1.0.xsd Added Paths: ----------- trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php trunk/framework/Bee/Context/Util/ValueFactoryBean.php Modified: trunk/framework/Bee/Context/Util/ArrayFactoryBean.php =================================================================== --- trunk/framework/Bee/Context/Util/ArrayFactoryBean.php 2014-09-26 12:53:49 UTC (rev 231) +++ trunk/framework/Bee/Context/Util/ArrayFactoryBean.php 2014-09-26 13:11:26 UTC (rev 232) @@ -22,6 +22,9 @@ */ class ArrayFactoryBean extends AbstractFactoryBean { + /** + * @var array + */ private $sourceArray; /** Modified: trunk/framework/Bee/Context/Util/Namespace/Handler.php =================================================================== --- trunk/framework/Bee/Context/Util/Namespace/Handler.php 2014-09-26 12:53:49 UTC (rev 231) +++ trunk/framework/Bee/Context/Util/Namespace/Handler.php 2014-09-26 13:11:26 UTC (rev 232) @@ -26,5 +26,6 @@ public function init() { $this->registerBeanDefinitionParser("array", new Bee_Context_Util_Namespace_ArrayFactoryDefinitionParser()); + $this->registerBeanDefinitionParser("value", new Bee_Context_Util_Namespace_ValueFactoryDefinitionParser()); } } Added: trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php =================================================================== --- trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php (rev 0) +++ trunk/framework/Bee/Context/Util/Namespace/ValueFactoryDefinitionParser.php 2014-09-26 13:11:26 UTC (rev 232) @@ -0,0 +1,39 @@ +<?php +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +use Bee\Context\Support\BeanDefinitionBuilder; +use Bee\Context\Xml\ParserContext; +use Bee\Context\Xml\XmlNamespace\AbstractSingleBeanDefinitionParser; + +/** + * User: mp + * Date: 03.07.11 + * Time: 23:35 + */ +class Bee_Context_Util_Namespace_ValueFactoryDefinitionParser extends AbstractSingleBeanDefinitionParser { + protected function getBeanClassName(DOMElement $element) { + return 'Bee\Context\Util\ValueFactoryBean'; + } + + /** + * @param DOMElement $element + * @param ParserContext $parserContext + * @param BeanDefinitionBuilder $builder + */ + protected function doParse(DOMElement $element, ParserContext $parserContext, BeanDefinitionBuilder $builder) { + $builder->addPropertyValue('sourceValue', $parserContext->getDelegate()->parseValueElement($element, 'string')); + } +} Added: trunk/framework/Bee/Context/Util/ValueFactoryBean.php =================================================================== --- trunk/framework/Bee/Context/Util/ValueFactoryBean.php (rev 0) +++ trunk/framework/Bee/Context/Util/ValueFactoryBean.php 2014-09-26 13:11:26 UTC (rev 232) @@ -0,0 +1,33 @@ +<?php + +namespace Bee\Context\Util; + +/** + * Class ValueFactoryBean + * @package Bee\Context\Util + */ +class ValueFactoryBean extends AbstractFactoryBean { + + /** + * @var mixed + */ + private $sourceValue; + + protected function &createInstance() { + return $this->sourceValue; + } + + /** + * @param mixed $sourceValue + */ + public function setSourceValue($sourceValue) { + $this->sourceValue = $sourceValue; + } + + /** + * @return null|string + */ + function getObjectType() { + return null; + } +} \ No newline at end of file Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 12:53:49 UTC (rev 231) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 13:11:26 UTC (rev 232) @@ -1,5 +1,6 @@ <?php namespace Bee\Context\Xml; + /* * Copyright 2008-2014 the original author or authors. * @@ -40,11 +41,11 @@ * Enter description here... * * @todo: What's with the various undefined $defaultTypeClassName vars littered throughout this class? Refer to Source (i.e. Spring) and fix... - * + * * @author Michael Plomer <mic...@it...> */ class ParserDelegate implements IConstants { - + /** * The default namespace for bean definitions * @@ -52,14 +53,14 @@ */ const BEANS_NAMESPACE_URI = 'http://www.beeframework.org/schema/beans'; - const DEFAULT_VALUE = 'default'; + const DEFAULT_VALUE = 'default'; const BEAN_ELEMENT = 'bean'; - + const ID_ATTRIBUTE = 'id'; - + const CLASS_ATTRIBUTE = 'class'; - + const ABSTRACT_ATTRIBUTE = 'abstract'; const INIT_METHOD_ATTRIBUTE = 'init-method'; @@ -69,7 +70,7 @@ const FACTORY_METHOD_ATTRIBUTE = 'factory-method'; const FACTORY_BEAN_ATTRIBUTE = 'factory-bean'; - + const CONSTRUCTOR_ARG_ELEMENT = 'constructor-arg'; const INDEX_ATTRIBUTE = 'index'; @@ -93,39 +94,39 @@ const VALUE_ELEMENT = 'value'; const NULL_ELEMENT = 'null'; - + const ARRAY_ELEMENT = 'array'; - const MERGE_ATTRIBUTE = 'merge'; + const MERGE_ATTRIBUTE = 'merge'; const DEFAULT_MERGE_ATTRIBUTE = 'default-merge'; const DEFAULT_INIT_METHOD_ATTRIBUTE = 'default-init-method'; const DEFAULT_DESTROY_METHOD_ATTRIBUTE = 'default-destroy-method'; - - + + /** * Enter description here... * * @var DocumentDefaultsDefinition */ private $defaults; - + /** * Enter description here... * * @var ReaderContext */ private $readerContext; - + /** * Enter description here... * * @var array */ private $usedNames = array(); - + /** * Enter description here... * @@ -155,13 +156,13 @@ public function initDefaults(DOMElement $root) { $defaults = new DocumentDefaultsDefinition(); $defaults->setMerge(filter_var($root->getAttribute(self::DEFAULT_MERGE_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); - if($root->hasAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)) { + if ($root->hasAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)) { $defaults->setInitMethod($root->getAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)); } - if($root->hasAttribute(self::DEFAULT_DESTROY_METHOD_ATTRIBUTE)) { + if ($root->hasAttribute(self::DEFAULT_DESTROY_METHOD_ATTRIBUTE)) { $defaults->setDestroyMethod($root->getAttribute(self::DEFAULT_DESTROY_METHOD_ATTRIBUTE)); } - + // @todo: provide source info via BeanMetadataElement // defaults.setSource(this.readerContext.extractSource(root)); @@ -190,7 +191,7 @@ if (is_null($containingBd)) { $this->checkNameUniqueness($beanName, $aliases, $ele); } - + $beanDefinition = $this->parseNamedBeanDefinitionElement($ele, $beanName, $containingBd); if (!is_null($beanDefinition)) { @@ -203,12 +204,12 @@ return null; } } - + return new BeanDefinitionHolder($beanDefinition, $beanName, $aliases); } return null; } - + /** * Enter description here... * @@ -217,7 +218,7 @@ * @param DOMElement $beanElement */ private function checkNameUniqueness($beanName, array $aliases = null, DOMElement $beanElement) { - $aliases = !is_null($aliases) ? array_fill_keys($aliases, true) : array(); + $aliases = !is_null($aliases) ? array_fill_keys($aliases, true) : array(); $foundName = null; @@ -248,22 +249,22 @@ if ($ele->hasAttribute(self::CLASS_ATTRIBUTE)) { $className = trim($ele->getAttribute(self::CLASS_ATTRIBUTE)); } - $parent = Utils::parseParentAttribute($ele); + $parent = Utils::parseParentAttribute($ele); try { array_push($this->parseState, $beanName); $bd = BeanDefinitionReaderUtils::createBeanDefinition($parent, $className); - Utils::parseScopeAttribute($ele, $bd, $containingBd); + Utils::parseScopeAttribute($ele, $bd, $containingBd); if ($ele->hasAttribute(self::ABSTRACT_ATTRIBUTE)) { $bd->setAbstract(filter_var($ele->getAttribute(self::ABSTRACT_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); } - Utils::parseDependsOnAttribute($ele, $bd); + Utils::parseDependsOnAttribute($ele, $bd); - if ($ele->hasAttribute(self::INIT_METHOD_ATTRIBUTE)) { + if ($ele->hasAttribute(self::INIT_METHOD_ATTRIBUTE)) { $initMethodName = $ele->getAttribute(self::INIT_METHOD_ATTRIBUTE); if (Bee_Utils_Strings::hasText($initMethodName)) { $bd->setInitMethodName($initMethodName); @@ -335,7 +336,7 @@ */ public function parseConstructorArgElements(DOMElement $beanEle, IMethodArguments $argsHolder, IBeanDefinition $bd) { $nl = $beanEle->childNodes; - foreach($nl as $node) { + foreach ($nl as $node) { if ($node instanceof DOMElement && Bee_Utils_Dom::nodeNameEquals($node, self::CONSTRUCTOR_ARG_ELEMENT)) { $this->parseConstructorArgElement($node, $argsHolder, $bd); } @@ -351,7 +352,7 @@ */ public function parsePropertyElements(DOMElement $beanEle, IBeanDefinition $bd) { $nl = $beanEle->childNodes; - foreach($nl as $node) { + foreach ($nl as $node) { if ($node instanceof DOMElement && Bee_Utils_Dom::nodeNameEquals($node, self::PROPERTY_ELEMENT)) { $this->parsePropertyElement($node, $bd); } @@ -365,7 +366,7 @@ */ public function parseMethodInvocationElements(DOMElement $beanEle, IBeanDefinition $bd) { $nl = $beanEle->childNodes; - foreach($nl as $node) { + foreach ($nl as $node) { if ($node instanceof DOMElement && Bee_Utils_Dom::nodeNameEquals($node, self::METHOD_INVOCATION_ELEMENT)) { $this->parseMethodInvocationElement($node, $bd); } @@ -380,12 +381,12 @@ * @throws Exception */ public function parseConstructorArgElement(DOMElement $ele, IMethodArguments $argsHolder, IBeanDefinition $bd) { - + $indexAttr = $ele->getAttribute(self::INDEX_ATTRIBUTE); if (Bee_Utils_Strings::hasLength($indexAttr) && is_numeric($indexAttr) && ($index = intval($indexAttr)) >= 0) { $existingArgs = $argsHolder->getConstructorArgumentValues(); - if(isset($existingArgs[$index])) { + if (isset($existingArgs[$index])) { $this->readerContext->error("Multiple occurrences of value $index for attribute 'index' of tag 'constructor-arg'", $ele); } else { try { @@ -473,7 +474,7 @@ */ public function parsePropertyValue(DOMElement $ele, IBeanDefinition $bd, $propertyName) { $elementName = ($propertyName != null) ? - "<property> element for property '$propertyName'" : "<constructor-arg> element"; + "<property> element for property '$propertyName'" : "<constructor-arg> element"; return $this->parseComplexPropElement($ele, $bd, $elementName); } @@ -484,11 +485,11 @@ * @return BeanDefinitionHolder|TypedStringValue|ArrayValue|RuntimeBeanNameReference|RuntimeBeanReference|null */ private function parseComplexPropElement(DOMElement $ele, IBeanDefinition $bd, $elementName) { - + // Should only have one child element: ref, value, list, etc. $nl = $ele->childNodes; $subElement = null; - foreach($nl as $candidateEle) { + foreach ($nl as $candidateEle) { if ($candidateEle instanceof DOMElement) { if (Bee_Utils_Dom::nodeNameEquals($candidateEle, self::DESCRIPTION_ELEMENT)) { // Keep going: we don't use these values for now. @@ -519,7 +520,7 @@ // ref.setSource(extractSource(ele)); return $ref; } else if ($hasValueAttribute) { - + $valueHolder = $this->buildTypedStringValue($ele->getAttribute(self::VALUE_ATTRIBUTE), $ele->getAttribute(self::TYPE_ATTRIBUTE), $ele); // @todo provide source info via BeanMetadataElement // valueHolder.setSource(extractSource(ele)); @@ -585,7 +586,7 @@ return $ref; } else if (Bee_Utils_Dom::nodeNameEquals($ele, self::IDREF_ELEMENT)) { - + // A generic reference to any name of any bean. $refName = $ele->getAttribute(self::BEAN_REF_ATTRIBUTE); if (!Bee_Utils_Strings::hasLength($refName)) { @@ -606,16 +607,9 @@ return $ref; } else if (Bee_Utils_Dom::nodeNameEquals($ele, self::VALUE_ELEMENT)) { - // It's a literal value. - $value = Bee_Utils_Dom::getTextValue($ele); + return $this->parseValueElement($ele, $defaultType); - $typeName = $ele->getAttribute(self::TYPE_ATTRIBUTE); - if (!Bee_Utils_Strings::hasText($typeName)) { - $typeName = $defaultType; - } - return $this->buildTypedStringValue($value, $typeName, $ele); - } else if (Bee_Utils_Dom::nodeNameEquals($ele, self::NULL_ELEMENT)) { // It's a distinguished null value. Let's wrap it in a TypedStringValue @@ -627,15 +621,31 @@ // @todo: determine sensible collection types for PHP and implement parsers accordingly... } else if (Bee_Utils_Dom::nodeNameEquals($ele, self::ARRAY_ELEMENT)) { - + return $this->parseArrayElement($ele, $bd); } $this->readerContext->error("Unknown property sub-element: [$ele->nodeName]", $ele); return null; } - + /** + * @param DOMElement $ele + * @param string $defaultType + * @return TypedStringValue + */ + public function parseValueElement(DOMElement $ele, $defaultType) { + // It's a literal value. + $value = Bee_Utils_Dom::getTextValue($ele); + + $typeName = $ele->getAttribute(self::TYPE_ATTRIBUTE); + if (!Bee_Utils_Strings::hasText($typeName)) { + $typeName = $defaultType; + } + return $this->buildTypedStringValue($value, $typeName, $ele); + } + + /** * Build a typed String value Object for the given raw value. * @see org.springframework.beans.factory.config.TypedStringValue * @@ -673,18 +683,18 @@ $nl = $collectionEle->childNodes; $list = array(); - foreach($nl as $ele) { - if($ele instanceof DOMElement) { - if (Bee_Utils_Dom::nodeNameEquals($ele, self::ASSOC_ITEM_ELEMENT)) { + foreach ($nl as $ele) { + if ($ele instanceof DOMElement) { + if (Bee_Utils_Dom::nodeNameEquals($ele, self::ASSOC_ITEM_ELEMENT)) { $assoc = true; list($key, $value) = $this->parseAssocItemElement($ele, $bd, $defaultType); - $list[$numericKeys ? intval($key) : $key] = $value; - } else if($this->isDefaultNamespace($ele->namespaceURI)) { + $list[$numericKeys ? intval($key) : $key] = $value; + } else if ($this->isDefaultNamespace($ele->namespaceURI)) { $numeric = true; - array_push($list, $this->parsePropertySubElement($ele, $bd, $defaultType)); - } + array_push($list, $this->parsePropertySubElement($ele, $bd, $defaultType)); + } } - if($assoc && $numeric) { + if ($assoc && $numeric) { $this->readerContext->error('Must not combine \'assoc-item\' elements and other elements in the same \'array\' element!', $collectionEle); } } @@ -696,14 +706,14 @@ * @return bool|mixed */ public function parseMergeAttribute(DOMElement $collectionElement) { - if($collectionElement->hasAttribute(self::MERGE_ATTRIBUTE)) { + if ($collectionElement->hasAttribute(self::MERGE_ATTRIBUTE)) { $value = $collectionElement->getAttribute(self::MERGE_ATTRIBUTE); if (self::DEFAULT_VALUE !== $value) { return filter_var($value, FILTER_VALIDATE_BOOLEAN); } } return $this->defaults->getMerge(); - } + } /** * @param DOMElement $ele @@ -732,7 +742,7 @@ public function parseCustomElement(DOMElement $ele, IBeanDefinition $containingBd = null) { $handler = $this->findNamespaceHandler($ele); $bd = !is_null($handler) ? $handler->parse($ele, new ParserContext($this->readerContext, $this, $containingBd)) : null; - if(!is_null($bd)) { + if (!is_null($bd)) { $beanName = BeanDefinitionReaderUtils::generateBeanName($bd, $this->readerContext->getRegistry(), true); $this->readerContext->getRegistry()->registerBeanDefinition($beanName, $bd); $bd = $this->decorateBeanDefinitionIfRequired($ele, new BeanDefinitionHolder($bd, $beanName)); @@ -767,13 +777,13 @@ // Decorate based on custom attributes first. $attributes = $ele->attributes; - foreach($attributes as $node) { - $finalDefinition = $this->decorateIfRequired($node, $finalDefinition); + foreach ($attributes as $node) { + $finalDefinition = $this->decorateIfRequired($node, $finalDefinition); } // Decorate based on custom nested elements. $children = $ele->childNodes; - foreach($children as $node) { + foreach ($children as $node) { if ($node->nodeType == XML_ELEMENT_NODE) { $finalDefinition = $this->decorateIfRequired($node, $finalDefinition); } Modified: trunk/framework/bee-util-1.0.xsd =================================================================== --- trunk/framework/bee-util-1.0.xsd 2014-09-26 12:53:49 UTC (rev 231) +++ trunk/framework/bee-util-1.0.xsd 2014-09-26 13:11:26 UTC (rev 232) @@ -15,7 +15,6 @@ ]]></xsd:documentation> </xsd:annotation> - <xsd:element name="array"> <xsd:annotation> <xsd:documentation><![CDATA[ @@ -33,4 +32,21 @@ </xsd:complexType> </xsd:element> + <xsd:element name="value"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Conveniently defines an array factory bean + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[The type that the value attribute should be validated against and converted + to.]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + </xsd:schema> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 12:53:59
|
Revision: 231 http://sourceforge.net/p/beeframework/code/231 Author: m_plomer Date: 2014-09-26 12:53:49 +0000 (Fri, 26 Sep 2014) Log Message: ----------- Context/Xml: added ability to decorate custom namespace beans with custom decorators Modified Paths: -------------- trunk/framework/Bee/Context/BeanDefinitionValueResolver.php trunk/framework/Bee/Context/Support/BeanDefinitionReaderUtils.php trunk/framework/Bee/Context/Xml/ParserDelegate.php trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php trunk/framework/Bee/MVC/View/RequestStoringRedirectView.php Modified: trunk/framework/Bee/Context/BeanDefinitionValueResolver.php =================================================================== --- trunk/framework/Bee/Context/BeanDefinitionValueResolver.php 2014-09-26 08:53:13 UTC (rev 230) +++ trunk/framework/Bee/Context/BeanDefinitionValueResolver.php 2014-09-26 12:53:49 UTC (rev 231) @@ -134,21 +134,17 @@ private function resolveReference($argName, RuntimeBeanReference $ref) { try { if ($ref->isToParent()) { - if (is_null($this->context->getParent())) { // @todo: a lot of debug information is lost here throw new Bee_Context_BeanCreationException($this->beanName); } // return $this->context->getParent()->getBean($ref->getBeanName()); return $this->getBeanFromContext($ref->getBeanNames(), $this->context->getParent()); - } else { - // $bean = $this->context->getBean($ref->getBeanName()); // $this->context->registerDependentBean($ref->getBeanName(), $this->beanName); // return $bean; return $this->getBeanFromContext($ref->getBeanNames(), $this->context); - } } catch (Bee_Context_BeansException $ex) { Modified: trunk/framework/Bee/Context/Support/BeanDefinitionReaderUtils.php =================================================================== --- trunk/framework/Bee/Context/Support/BeanDefinitionReaderUtils.php 2014-09-26 08:53:13 UTC (rev 230) +++ trunk/framework/Bee/Context/Support/BeanDefinitionReaderUtils.php 2014-09-26 12:53:49 UTC (rev 231) @@ -1,5 +1,6 @@ <?php namespace Bee\Context\Support; + /* * Copyright 2008-2014 the original author or authors. * @@ -81,22 +82,21 @@ $id = $generatedBeanName; // @todo: special name generation for inner beans (see below) - // Top-level bean: use plain class name. - // Increase counter until the id is unique. - $counter = -1; - while ($counter == -1 || $registry->containsBeanDefinition($id)) { - $counter++; - $id = $generatedBeanName . self::GENERATED_BEAN_NAME_SEPARATOR . $counter; - } // @todo: this should be used for name generation of inner beans. right now we don't have a good identity function for PHP // objects. (btw, is this necessary at all?) -// if ($isInnerBean) { - // Inner bean: generate identity hashcode suffix. -// $id = $generatedBeanName + self::GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition); -// } else { - // shold wrap the above code here... -// } + if ($isInnerBean) { + // Inner bean: generate identity hashcode suffix. + $id = $generatedBeanName . self::GENERATED_BEAN_NAME_SEPARATOR . spl_object_hash($definition); + } else { + // Top-level bean: use plain class name. + // Increase counter until the id is unique. + $counter = -1; + while ($counter == -1 || $registry->containsBeanDefinition($id)) { + $counter++; + $id = $generatedBeanName . self::GENERATED_BEAN_NAME_SEPARATOR . $counter; + } + } return $id; } Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 08:53:13 UTC (rev 230) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2014-09-26 12:53:49 UTC (rev 231) @@ -545,12 +545,10 @@ public function parsePropertySubElement(DOMElement $ele, IBeanDefinition $bd, $defaultType = null) { if (!$this->isDefaultNamespace($ele->namespaceURI)) { - // todo MP: why is this missing? prevents XMLs with e.g. nested <util:array/> elements from being parsed // return $this->parseNestedCustomElement($ele, $bd); -// return $this->parseCustomElement($ele, $bd); - throw new Bee_Context_BeanCreationException($bd->getBeanClassName(), 'Namespaced nested elements are currently not supported'); - +// return $this->decorateWithCustomElement($ele, $bd); +// throw new Bee_Context_BeanCreationException($bd->getBeanClassName(), 'Namespaced nested elements are currently not supported'); } else if (Bee_Utils_Dom::nodeNameEquals($ele, self::BEAN_ELEMENT)) { $bdHolder = $this->parseBeanDefinitionElement($ele, $bd); @@ -681,7 +679,7 @@ $assoc = true; list($key, $value) = $this->parseAssocItemElement($ele, $bd, $defaultType); $list[$numericKeys ? intval($key) : $key] = $value; - } else { + } else if($this->isDefaultNamespace($ele->namespaceURI)) { $numeric = true; array_push($list, $this->parsePropertySubElement($ele, $bd, $defaultType)); } @@ -732,13 +730,29 @@ * @return IBeanDefinition */ public function parseCustomElement(DOMElement $ele, IBeanDefinition $containingBd = null) { + $handler = $this->findNamespaceHandler($ele); + $bd = !is_null($handler) ? $handler->parse($ele, new ParserContext($this->readerContext, $this, $containingBd)) : null; + if(!is_null($bd)) { + $beanName = BeanDefinitionReaderUtils::generateBeanName($bd, $this->readerContext->getRegistry(), true); + $this->readerContext->getRegistry()->registerBeanDefinition($beanName, $bd); + $bd = $this->decorateBeanDefinitionIfRequired($ele, new BeanDefinitionHolder($bd, $beanName)); + } + return $bd; + } + + /** + * @param DOMElement $ele + * @return XmlNamespace\IHandler|null + * @throws Bee_Context_BeanCreationException + */ + protected function findNamespaceHandler(DOMElement $ele) { $namespaceUri = $ele->namespaceURI; $handler = $this->readerContext->getNamespaceHandlerResolver()->resolve($namespaceUri); if (is_null($handler)) { $this->readerContext->error("Unable to locate Spring NamespaceHandler for XML schema namespace [$namespaceUri]", $ele); return null; } - return $handler->parse($ele, new ParserContext($this->readerContext, $this, $containingBd)); + return $handler; } /** Modified: trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php =================================================================== --- trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php 2014-09-26 08:53:13 UTC (rev 230) +++ trunk/framework/Bee/Context/Xml/XmlNamespace/AbstractBeanDefinitionParser.php 2014-09-26 12:53:49 UTC (rev 231) @@ -58,8 +58,7 @@ // postProcessComponentDefinition(componentDefinition); // parserContext.registerComponent(componentDefinition); // } - } - catch (Bee_Context_BeanDefinitionStoreException $ex) { + } catch (Bee_Context_BeanDefinitionStoreException $ex) { $parserContext->getReaderContext()->error($ex->getMessage(), $element); return null; } Modified: trunk/framework/Bee/MVC/View/RequestStoringRedirectView.php =================================================================== --- trunk/framework/Bee/MVC/View/RequestStoringRedirectView.php 2014-09-26 08:53:13 UTC (rev 230) +++ trunk/framework/Bee/MVC/View/RequestStoringRedirectView.php 2014-09-26 12:53:49 UTC (rev 231) @@ -48,6 +48,9 @@ return $this->stores; } + /** + * @param array $model + */ public function render(array $model = array()) { $this->augmentModel($model); $getParams = array_key_exists(self::MODEL_KEY_GET_PARAMS, $model) ? $model[self::MODEL_KEY_GET_PARAMS] : array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-26 08:53:25
|
Revision: 230 http://sourceforge.net/p/beeframework/code/230 Author: m_plomer Date: 2014-09-26 08:53:13 +0000 (Fri, 26 Sep 2014) Log Message: ----------- fixed bee-util namespace declaration Modified Paths: -------------- trunk/examples/conf/context-mvc.xml trunk/examples/conf/context.xml trunk/examples/conf/views.xml Modified: trunk/examples/conf/context-mvc.xml =================================================================== --- trunk/examples/conf/context-mvc.xml 2014-09-25 23:57:21 UTC (rev 229) +++ trunk/examples/conf/context-mvc.xml 2014-09-26 08:53:13 UTC (rev 230) @@ -4,7 +4,7 @@ xmlns:utils="http://www.beeframework.org/schema/util" xmlns:mvc="http://www.beeframework.org/schema/mvc" xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd - http://www.beeframework.org/schema/util http://www.beeframework.org/schema/utils/bee-utils-1.0.xsd + http://www.beeframework.org/schema/util http://www.beeframework.org/schema/utils/bee-util-1.0.xsd http://www.beeframework.org/schema/mvc http://www.beeframework.org/schema/utils/bee-mvc-1.0.xsd"> <!-- VIEW RESOLVER --> Modified: trunk/examples/conf/context.xml =================================================================== --- trunk/examples/conf/context.xml 2014-09-25 23:57:21 UTC (rev 229) +++ trunk/examples/conf/context.xml 2014-09-26 08:53:13 UTC (rev 230) @@ -4,7 +4,7 @@ xmlns:utils="http://www.beeframework.org/schema/util" xmlns:mvc="http://www.beeframework.org/schema/mvc" xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd - http://www.beeframework.org/schema/util http://www.beeframework.org/schema/utils/bee-utils-1.0.xsd + http://www.beeframework.org/schema/util http://www.beeframework.org/schema/utils/bee-util-1.0.xsd http://www.beeframework.org/schema/mvc http://www.beeframework.org/schema/utils/bee-mvc-1.0.xsd"> <!-- VIEW RESOLVER --> Modified: trunk/examples/conf/views.xml =================================================================== --- trunk/examples/conf/views.xml 2014-09-25 23:57:21 UTC (rev 229) +++ trunk/examples/conf/views.xml 2014-09-26 08:53:13 UTC (rev 230) @@ -1,10 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.beeframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:utils="http://www.beeframework.org/schema/util" - xmlns:mvc="http://www.beeframework.org/schema/mvc" - xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd - http://www.beeframework.org/schema/util http://www.beeframework.org/schema/utils/bee-utils-1.0.xsd - http://www.beeframework.org/schema/mvc http://www.beeframework.org/schema/utils/bee-mvc-1.0.xsd"> + xsi:schemaLocation="http://www.beeframework.org/schema/beans http://www.beeframework.org/schema/beans/bee-beans-1.2.xsd"> </beans> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-25 23:57:32
|
Revision: 229 http://sourceforge.net/p/beeframework/code/229 Author: m_plomer Date: 2014-09-25 23:57:21 +0000 (Thu, 25 Sep 2014) Log Message: ----------- Modified Paths: -------------- trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-25 23:53:45 UTC (rev 228) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-25 23:57:21 UTC (rev 229) @@ -64,8 +64,8 @@ * @param $currentPage */ public function setCurrentPage($currentPage) { + $currentPage = $currentPage > $this->getPageCount() - 1 ? $this->getPageCount() - 1 : $currentPage; $currentPage = $currentPage < 0 ? 0 : $currentPage; - $currentPage = $currentPage > $this->getPageCount() - 1 ? $this->getPageCount() - 1 : $currentPage; $this->currentPage = $currentPage; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |