├── .asf.yaml ├── .gitattributes ├── .github ├── GH-ROBOTS.txt ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── codeql-analysis.yml │ ├── dependency-review.yml │ ├── maven.yml │ └── scorecards-analysis.yml ├── .gitignore ├── .pmd ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── NOTICE.txt ├── PROPOSAL.html ├── README.md ├── RELEASE-NOTES.txt ├── SECURITY.md ├── commons-digester3-core ├── checkstyle-suppressions.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ ├── AbstractMethodRule.java │ │ │ ├── AbstractObjectCreationFactory.java │ │ │ ├── AbstractRulesImpl.java │ │ │ ├── BeanPropertySetterRule.java │ │ │ ├── CallMethodRule.java │ │ │ ├── CallParamRule.java │ │ │ ├── DefaultThrowingErrorHandler.java │ │ │ ├── Digester.java │ │ │ ├── ExtendedBaseRules.java │ │ │ ├── FactoryCreateRule.java │ │ │ ├── NodeCreateRule.java │ │ │ ├── ObjectCreateRule.java │ │ │ ├── ObjectCreationFactory.java │ │ │ ├── ObjectParamRule.java │ │ │ ├── PathCallParamRule.java │ │ │ ├── PatternRuleMatcher.java │ │ │ ├── RecordedInvocation.java │ │ │ ├── RegexMatcher.java │ │ │ ├── RegexRules.java │ │ │ ├── Rule.java │ │ │ ├── RuleMatcher.java │ │ │ ├── RuleSet.java │ │ │ ├── RuleSetBase.java │ │ │ ├── Rules.java │ │ │ ├── RulesBase.java │ │ │ ├── SetNestedPropertiesRule.java │ │ │ ├── SetNextRule.java │ │ │ ├── SetPropertiesRule.java │ │ │ ├── SetPropertyRule.java │ │ │ ├── SetRootRule.java │ │ │ ├── SetTopRule.java │ │ │ ├── SimpleRegexMatcher.java │ │ │ ├── StackAction.java │ │ │ ├── Substitutor.java │ │ │ ├── WithDefaultsRulesWrapper.java │ │ │ ├── annotations │ │ │ ├── AnnotationHandler.java │ │ │ ├── AnnotationHandlerFactory.java │ │ │ ├── DefaultAnnotationHandlerFactory.java │ │ │ ├── DigesterRule.java │ │ │ ├── DigesterRuleList.java │ │ │ ├── FromAnnotationsRuleModule.java │ │ │ ├── WithMemoryRulesBinder.java │ │ │ ├── handlers │ │ │ │ ├── AbstractMethodHandler.java │ │ │ │ ├── BeanPropertySetterHandler.java │ │ │ │ ├── CallMethodHandler.java │ │ │ │ ├── CallParamHandler.java │ │ │ │ ├── FactoryCreateHandler.java │ │ │ │ ├── ObjectCreateHandler.java │ │ │ │ ├── PathCallParamHandler.java │ │ │ │ ├── SetNextHandler.java │ │ │ │ ├── SetPropertiesHandler.java │ │ │ │ ├── SetRootHandler.java │ │ │ │ ├── SetTopHandler.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── reflect │ │ │ │ ├── MethodArgument.java │ │ │ │ └── package-info.java │ │ │ ├── rules │ │ │ │ ├── BeanPropertySetter.java │ │ │ │ ├── CallMethod.java │ │ │ │ ├── CallParam.java │ │ │ │ ├── CreationRule.java │ │ │ │ ├── FactoryCreate.java │ │ │ │ ├── ObjectCreate.java │ │ │ │ ├── PathCallParam.java │ │ │ │ ├── SetNext.java │ │ │ │ ├── SetProperty.java │ │ │ │ ├── SetRoot.java │ │ │ │ ├── SetTop.java │ │ │ │ └── package-info.java │ │ │ └── utils │ │ │ │ ├── AnnotationUtils.java │ │ │ │ └── package-info.java │ │ │ ├── binder │ │ │ ├── AbstractBackToLinkedRuleBuilder.java │ │ │ ├── AbstractNamespaceURIBasedRulesModule.java │ │ │ ├── AbstractParamTypeBuilder.java │ │ │ ├── AbstractRulesModule.java │ │ │ ├── AddAliasBuilder.java │ │ │ ├── BeanPropertySetterBuilder.java │ │ │ ├── BinderClassLoader.java │ │ │ ├── ByRuleBuilder.java │ │ │ ├── ByRuleProviderBuilder.java │ │ │ ├── CallMethodBuilder.java │ │ │ ├── CallParamBuilder.java │ │ │ ├── DefaultRulesBinder.java │ │ │ ├── DigesterLoader.java │ │ │ ├── DigesterLoadingException.java │ │ │ ├── ErrorMessage.java │ │ │ ├── FactoryCreateBuilder.java │ │ │ ├── FromBinderRuleSet.java │ │ │ ├── LinkedRuleBuilder.java │ │ │ ├── NestedPropertiesBuilder.java │ │ │ ├── NodeCreateRuleProvider.java │ │ │ ├── ObjectCreateBuilder.java │ │ │ ├── ObjectParamBuilder.java │ │ │ ├── PathCallParamBuilder.java │ │ │ ├── PluginCreateRuleBuilder.java │ │ │ ├── PluginDeclarationRuleBuilder.java │ │ │ ├── RuleProvider.java │ │ │ ├── RulesBinder.java │ │ │ ├── RulesModule.java │ │ │ ├── SetNextBuilder.java │ │ │ ├── SetPropertiesBuilder.java │ │ │ ├── SetPropertyBuilder.java │ │ │ ├── SetRootBuilder.java │ │ │ ├── SetTopBuilder.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── plugins │ │ │ ├── Declaration.java │ │ │ ├── InitializableRule.java │ │ │ ├── LogUtils.java │ │ │ ├── PluginAssertionFailure.java │ │ │ ├── PluginConfigurationException.java │ │ │ ├── PluginContext.java │ │ │ ├── PluginCreateRule.java │ │ │ ├── PluginDeclarationRule.java │ │ │ ├── PluginException.java │ │ │ ├── PluginInvalidInputException.java │ │ │ ├── PluginManager.java │ │ │ ├── PluginRules.java │ │ │ ├── RuleFinder.java │ │ │ ├── RuleLoader.java │ │ │ ├── RulesFactory.java │ │ │ ├── package-info.java │ │ │ └── strategies │ │ │ │ ├── FinderFromClass.java │ │ │ │ ├── FinderFromDfltClass.java │ │ │ │ ├── FinderFromDfltMethod.java │ │ │ │ ├── FinderFromDfltResource.java │ │ │ │ ├── FinderFromFile.java │ │ │ │ ├── FinderFromMethod.java │ │ │ │ ├── FinderFromResource.java │ │ │ │ ├── FinderSetProperties.java │ │ │ │ ├── LoaderFromClass.java │ │ │ │ ├── LoaderFromStream.java │ │ │ │ ├── LoaderSetProperties.java │ │ │ │ └── package-info.java │ │ │ ├── substitution │ │ │ ├── CompoundSubstitutor.java │ │ │ ├── MultiVariableExpander.java │ │ │ ├── VariableAttributes.java │ │ │ ├── VariableExpander.java │ │ │ ├── VariableSubstitutor.java │ │ │ └── package-info.java │ │ │ └── xmlrules │ │ │ ├── AbstractXmlMethodRule.java │ │ │ ├── AbstractXmlRule.java │ │ │ ├── BeanPropertySetterRule.java │ │ │ ├── CallMethodRule.java │ │ │ ├── CallParamRule.java │ │ │ ├── FactoryCreateRule.java │ │ │ ├── FromXmlRulesModule.java │ │ │ ├── IncludeRule.java │ │ │ ├── NameSpaceURIRulesBinder.java │ │ │ ├── NodeCreateRule.java │ │ │ ├── ObjectCreateRule.java │ │ │ ├── ObjectParamRule.java │ │ │ ├── PatternRule.java │ │ │ ├── PatternStack.java │ │ │ ├── PrefixedRulesBinder.java │ │ │ ├── SetNamespaceURIRule.java │ │ │ ├── SetNestedPropertiesAliasRule.java │ │ │ ├── SetNestedPropertiesIgnoreRule.java │ │ │ ├── SetNestedPropertiesRule.java │ │ │ ├── SetNextRule.java │ │ │ ├── SetPropertiesAliasRule.java │ │ │ ├── SetPropertiesIgnoreRule.java │ │ │ ├── SetPropertiesRule.java │ │ │ ├── SetPropertyRule.java │ │ │ ├── SetRootRule.java │ │ │ ├── SetTopRule.java │ │ │ ├── WithMemoryRulesBinder.java │ │ │ ├── XmlRulesModule.java │ │ │ └── package-info.java │ └── resources │ │ ├── org │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── xmlrules │ │ │ └── digester-rules.dtd │ │ └── overview.html │ └── test │ ├── java │ └── org │ │ └── apache │ │ └── commons │ │ └── digester3 │ │ ├── Address.java │ │ ├── AlphaBean.java │ │ ├── AsyncReaderTestCase.java │ │ ├── BeanPropertySetterRuleTestCase.java │ │ ├── BetaBean.java │ │ ├── Box.java │ │ ├── CallMethodRuleTestCase.java │ │ ├── DTDValidationTestCase.java │ │ ├── Digester133TestCase.java │ │ ├── Digester153TestCase.java │ │ ├── Digester162TestCase.java │ │ ├── Digester171TestCase.java │ │ ├── DigesterTestCase.java │ │ ├── Employee.java │ │ ├── ErrorHandlerTest.java │ │ ├── ExtendedBaseRulesTestCase.java │ │ ├── LocationTrackerTestCase.java │ │ ├── Nameable.java │ │ ├── NamedBean.java │ │ ├── NamespaceSnapshotTestCase.java │ │ ├── NamespacedBox.java │ │ ├── NodeCreateRuleTestCase.java │ │ ├── ObjectCreationFactoryTestImpl.java │ │ ├── ObjectParamRuleTestCase.java │ │ ├── OtherTestObjectCreationFactory.java │ │ ├── OverlappingCallMethodRuleTestCase.java │ │ ├── ParamBean.java │ │ ├── PrimitiveBean.java │ │ ├── RegexRulesTestCase.java │ │ ├── RuleTestCase.java │ │ ├── RulesBaseTestCase.java │ │ ├── SetNestedPropertiesRuleTestCase.java │ │ ├── SetPropertiesRuleTestCase.java │ │ ├── SetPropertyRuleTestCase.java │ │ ├── SimpleTestBean.java │ │ ├── TestBean.java │ │ ├── TestEntityResolution.java │ │ ├── TestFactoryCreate.java │ │ ├── TestRule.java │ │ ├── TestRuleSet.java │ │ ├── URLTestCase.java │ │ ├── WithDefaultsRulesWrapperTestCase.java │ │ ├── XIncludeTestCase.java │ │ ├── XMLSchemaTestCase.java │ │ ├── annotations │ │ ├── AbstractAnnotatedPojoTestCase.java │ │ ├── addressbook │ │ │ ├── Address.java │ │ │ ├── AddressBook.java │ │ │ ├── AddressBookTestCase.java │ │ │ └── Person.java │ │ ├── catalog │ │ │ ├── AudioVisual.java │ │ │ ├── Book.java │ │ │ ├── BookFactory.java │ │ │ ├── Catalog.java │ │ │ ├── CatalogTestCase.java │ │ │ └── Item.java │ │ ├── employee │ │ │ ├── Address.java │ │ │ ├── Employee.java │ │ │ └── EmployeeTestCase.java │ │ ├── failingtests │ │ │ ├── BeanWithFakeHandler.java │ │ │ ├── FailingDigesterLoaderHandlerFactory.java │ │ │ ├── FailingTestCase.java │ │ │ ├── FakeHandler.java │ │ │ └── FakeRule.java │ │ ├── person │ │ │ ├── Person.java │ │ │ └── PersonTestCase.java │ │ ├── rss │ │ │ ├── Channel.java │ │ │ ├── Image.java │ │ │ ├── Item.java │ │ │ └── RssTestCase.java │ │ └── servletbean │ │ │ ├── ServletBean.java │ │ │ └── ServletBeanTestCase.java │ │ ├── binder │ │ ├── BinderClassLoaderTestCase.java │ │ ├── Digester163TestCase.java │ │ ├── DigesterLoaderTestCase.java │ │ └── Entity.java │ │ ├── plugins │ │ ├── Container.java │ │ ├── ContainerCustomRules.java │ │ ├── DumperRule.java │ │ ├── ObjectTestImpl.java │ │ ├── Slider.java │ │ ├── TestConfigurablePluginAttributes.java │ │ ├── TestDeclaration.java │ │ ├── TestDefaultPlugin.java │ │ ├── TestDelegate.java │ │ ├── TestInline.java │ │ ├── TestLocalRules.java │ │ ├── TestRecursion.java │ │ ├── TestRuleInfo.java │ │ ├── TestXmlRuleInfo.java │ │ ├── TextLabel.java │ │ ├── TextLabel2.java │ │ ├── TextLabel2RuleInfo.java │ │ ├── Utils.java │ │ └── Widget.java │ │ ├── substitution │ │ ├── CompoundSubstitutorTestCase.java │ │ └── VariableExpansionTestCase.java │ │ └── xmlrules │ │ ├── BeanPropertySetterRuleTestCase.java │ │ ├── CallParamTestObject.java │ │ ├── DigesterPatternStackTest.java │ │ ├── DigesterRulesSourceTestImpl.java │ │ ├── Entry.java │ │ ├── Feed.java │ │ ├── FromXmlRuleSetTest.java │ │ ├── IncludeTest.java │ │ ├── ObjectTestImpl.java │ │ ├── SetNamespaceURITestCase.java │ │ └── ThrowExceptionCreationFactory.java │ └── resources │ └── org │ └── apache │ └── commons │ └── digester3 │ ├── AttributeDefinedConstructor.xml │ ├── BasicConstructor.xml │ ├── ConstructorWithAttributeAndElement.xml │ ├── Test-digester-172-wrong.xml │ ├── Test1.xml │ ├── Test10.xml │ ├── Test11.xml │ ├── Test12-01.xml │ ├── Test12-02.xml │ ├── Test12.xml │ ├── Test13-01.xml │ ├── Test13-02.xml │ ├── Test13.xsd │ ├── Test2.xml │ ├── Test3.xml │ ├── Test4.xml │ ├── Test5.xml │ ├── Test6.xml │ ├── Test7.xml │ ├── Test8.xml │ ├── Test9.xml │ ├── annotations │ ├── addressbook │ │ └── AddressBook.xml │ ├── catalog │ │ └── Catalog.xml │ ├── employee │ │ └── Employee.xml │ ├── person │ │ └── Person.xml │ ├── rss │ │ └── Channel.xml │ └── servletbean │ │ └── ServletBean.xml │ ├── binder │ ├── rules.xml │ └── test.xml │ ├── digester-162.xml │ ├── document-with-relative-dtd-error.xml │ ├── document-with-relative-dtd.xml │ ├── extractPropertyNameFromAttribute.xml │ ├── plugins │ ├── ObjectTestImplRuleInfo.xml │ ├── test1.xml │ ├── test2.xml │ ├── test3.xml │ ├── test4a.xml │ ├── test4b.xml │ ├── test5a.xml │ ├── test5b.xml │ ├── test5c.xml │ ├── test6.xml │ ├── test7.xml │ ├── xmlrules1.xml │ └── xmlrules2.xml │ ├── simple.dtd │ └── xmlrules │ ├── atom-content.xml │ ├── atom-rules.xml │ ├── constructor-testrules.xml │ ├── extractPropertyNameFromAttribute-rules.xml │ ├── test-call-param-rules.xml │ ├── test-node-create-rules-input.xml │ ├── test-node-create-rules.xml │ ├── test.xml │ ├── testCircularRules.xml │ ├── testPropertyAliasRules.xml │ ├── testfactory.xml │ ├── testfactoryignore.xml │ ├── testfactorynoignore.xml │ ├── testrules.xml │ └── testrulesinclude.xml ├── commons-digester3-dist ├── pom.xml └── src │ └── main │ └── assembly │ ├── LICENSE-with-deps.txt │ ├── NOTICE-with-deps.txt │ ├── bin.xml │ └── src.xml ├── commons-digester3-examples ├── annotations │ └── atom │ │ ├── pom.xml │ │ ├── readme.txt │ │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── annotations │ │ │ └── atom │ │ │ ├── Entry.java │ │ │ ├── Feed.java │ │ │ └── Main.java │ │ └── xmlcontent.xml ├── api │ ├── addressbook │ │ ├── example.xml │ │ ├── pom.xml │ │ ├── readme.txt │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── api │ │ │ └── addressbook │ │ │ ├── Address.java │ │ │ ├── AddressBook.java │ │ │ ├── Main.java │ │ │ └── Person.java │ ├── catalog │ │ ├── example.xml │ │ ├── pom.xml │ │ ├── readme.txt │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── api │ │ │ └── catalog │ │ │ ├── AudioVisual.java │ │ │ ├── Book.java │ │ │ ├── BookFactory.java │ │ │ ├── Catalog.java │ │ │ ├── Item.java │ │ │ └── Main.java │ ├── dbinsert │ │ ├── example.xml │ │ ├── pom.xml │ │ ├── readme.txt │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── api │ │ │ └── dbinsert │ │ │ ├── Main.java │ │ │ ├── Row.java │ │ │ ├── RowInserterRule.java │ │ │ └── Table.java │ ├── document-markup │ │ ├── pom.xml │ │ ├── readme.txt │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── api │ │ │ └── documentmarkup │ │ │ ├── Main.java │ │ │ ├── MarkupDigester.java │ │ │ ├── SetTextSegmentRule.java │ │ │ └── TextSegmentHandler.java │ └── readme.txt ├── edsl │ └── atom │ │ ├── pom.xml │ │ ├── readme.txt │ │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── edsl │ │ │ └── atom │ │ │ ├── AtomRulesModule.java │ │ │ ├── Entry.java │ │ │ ├── Feed.java │ │ │ └── Main.java │ │ └── xmlcontent.xml ├── plugins │ └── pipeline │ │ ├── compound.xml │ │ ├── input.txt │ │ ├── pom.xml │ │ ├── readme.txt │ │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── plugins │ │ │ └── pipeline │ │ │ ├── CaseTransform.java │ │ │ ├── CompoundTransform.java │ │ │ ├── Pipeline.java │ │ │ ├── SubstituteTransform.java │ │ │ └── Transform.java │ │ ├── substitute.xml │ │ └── uppercase.xml ├── pom.xml ├── readme.txt ├── rss │ ├── LICENSE.txt │ ├── pom.xml │ ├── readme.txt │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── rss │ │ │ ├── Channel.java │ │ │ ├── Image.java │ │ │ ├── Item.java │ │ │ ├── RSSDigester.java │ │ │ └── TextInput.java │ │ └── resources │ │ └── org │ │ └── apache │ │ └── commons │ │ └── digester3 │ │ └── rss │ │ ├── package-info.java │ │ └── rss-example.xml └── xmlrules │ ├── addressbook │ ├── example.xml │ ├── pom.xml │ ├── readme.txt │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── commons │ │ │ └── digester3 │ │ │ └── examples │ │ │ └── xmlrules │ │ │ └── addressbook │ │ │ ├── Address.java │ │ │ ├── AddressBook.java │ │ │ ├── Main.java │ │ │ └── Person.java │ └── xmlrules.xml │ └── readme.txt ├── pom.xml └── src ├── changes └── changes.xml ├── media └── logo.xcf └── site ├── fml └── guide │ └── faq.fml ├── resources ├── download_digester.cgi ├── dtds │ ├── digester-rules-3.0.dtd │ └── digester-rules.dtd └── images │ └── logo.png ├── site.xml └── xdoc ├── download_digester.xml ├── guide ├── annotations.xml ├── async.xml ├── binder.xml ├── constructor.xml ├── core.xml ├── plugins.xml ├── substitution.xml └── xmlrules.xml ├── index.xml ├── issue-tracking.xml └── mail-lists.xml /.asf.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | github: 17 | description: "Apache Commons Digester" 18 | homepage: https://commons.apache.org/digester/ 19 | 20 | notifications: 21 | commits: commits@commons.apache.org 22 | issues: issues@commons.apache.org 23 | pullrequests: issues@commons.apache.org 24 | jira_options: link label 25 | jobs: notifications@commons.apache.org 26 | issues_bot_dependabot: notifications@commons.apache.org 27 | pullrequests_bot_dependabot: notifications@commons.apache.org 28 | issues_bot_codecov-commenter: notifications@commons.apache.org 29 | pullrequests_bot_codecov-commenter: notifications@commons.apache.org 30 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | * text=auto 17 | -------------------------------------------------------------------------------- /.github/GH-ROBOTS.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Keeps on creating FUD PRs in test code 17 | # Does not follow Apache disclosure policies 18 | User-agent: JLLeitschuh/security-research 19 | Disallow: * 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | version: 2 17 | updates: 18 | - package-ecosystem: "maven" 19 | directory: "/" 20 | schedule: 21 | interval: "weekly" 22 | day: "friday" 23 | - package-ecosystem: "github-actions" 24 | directory: "/" 25 | schedule: 26 | interval: "weekly" 27 | day: "friday" 28 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated! 21 | 22 | Before you push a pull request, review this list: 23 | 24 | - [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project. 25 | - [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. 26 | - [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice. 27 | - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. 28 | - [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge. 29 | -------------------------------------------------------------------------------- /.github/workflows/dependency-review.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: 'Dependency Review' 19 | on: [pull_request] 20 | 21 | permissions: 22 | contents: read 23 | 24 | jobs: 25 | dependency-review: 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: 'Checkout Repository' 29 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 30 | - name: 'Dependency Review PR' 31 | uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.project 3 | **/.settings/ 4 | **/bin/ 5 | **/target/ 6 | **/*.iml 7 | **/.idea/ 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 17 | The Apache code of conduct page is [https://www.apache.org/foundation/policies/conduct.html](https://www.apache.org/foundation/policies/conduct.html). 18 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons Digester 2 | Copyright 2001-2025 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (https://www.apache.org/). 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 17 | The Apache Commons security page is [https://commons.apache.org/security.html](https://commons.apache.org/security.html). 18 | -------------------------------------------------------------------------------- /commons-digester3-core/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/DefaultThrowingErrorHandler.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.xml.sax.ErrorHandler; 23 | import org.xml.sax.SAXException; 24 | import org.xml.sax.SAXParseException; 25 | 26 | /** 27 | * @since 3.3 28 | */ 29 | public class DefaultThrowingErrorHandler 30 | implements ErrorHandler 31 | { 32 | 33 | @Override 34 | public void error( final SAXParseException e ) 35 | throws SAXException 36 | { 37 | throw e; 38 | } 39 | 40 | @Override 41 | public void fatalError( final SAXParseException e ) 42 | throws SAXException 43 | { 44 | throw e; 45 | } 46 | 47 | @Override 48 | public void warning( final SAXParseException e ) 49 | throws SAXException 50 | { 51 | throw e; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/RegexMatcher.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * Regular expression matching strategy for RegexRules. 24 | * 25 | * @since 1.5 26 | */ 27 | public abstract class RegexMatcher 28 | { 29 | 30 | /** 31 | * Returns true if the given pattern matches the given path according to the regex algorithm that this strategy 32 | * applies. 33 | * 34 | * @param pathPattern the standard digester path representing the element 35 | * @param rulePattern the regex pattern the path will be tested against 36 | * @return true if the given pattern matches the given path 37 | */ 38 | public abstract boolean match( String pathPattern, String rulePattern ); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/RuleMatcher.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.xml.sax.Attributes; 23 | 24 | /** 25 | * Defines a functor interface implemented by classes that perform a predicate test 26 | * 27 | * @since 3.0 28 | */ 29 | public interface RuleMatcher 30 | { 31 | 32 | /** 33 | * Use the specified parameter to perform a test. 34 | * 35 | * @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace 36 | * aware or the element has no namespace 37 | * @param pattern Nesting pattern to be matched for this Rule 38 | * @param name the local name if the parser is namespace aware, or just the element name otherwise 39 | * @param attributes The attribute list of this element 40 | * @return true, if the test succeeds, false otherwise 41 | */ 42 | boolean match( String namespace, String pattern, String name, Attributes attributes ); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/AnnotationHandlerFactory.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.annotation.Annotation; 23 | import java.lang.reflect.AnnotatedElement; 24 | 25 | /** 26 | * An object capable of providing instances of {@link AnnotationHandler}. 27 | * 28 | * @since 3.0 29 | */ 30 | public interface AnnotationHandlerFactory 31 | { 32 | 33 | /** 34 | * Return an instance of the specified type. 35 | * 36 | * @param The {@link AnnotationHandler} type has to be created 37 | * @param type the class of the object to be returned. 38 | * @return an instance of the specified class. 39 | * @throws Exception if any error occurs while creating the {@link AnnotationHandler} instance. 40 | */ 41 | > H newInstance( Class type ) 42 | throws Exception; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/DefaultAnnotationHandlerFactory.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.annotation.Annotation; 23 | import java.lang.reflect.AnnotatedElement; 24 | 25 | /** 26 | * Default {@link AnnotationHandlerFactory} implementation. 27 | * 28 | * @since 3.0 29 | */ 30 | final class DefaultAnnotationHandlerFactory 31 | implements AnnotationHandlerFactory 32 | { 33 | 34 | @Override 35 | public > L newInstance( final Class type ) 36 | throws Exception 37 | { 38 | return type.newInstance(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/DigesterRuleList.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | * Meta-annotation that marks an annotation as a list of commons-digester annotations. 30 | * 31 | * @since 2.1 32 | */ 33 | @Documented 34 | @Target( ElementType.ANNOTATION_TYPE ) 35 | @Retention( RetentionPolicy.RUNTIME ) 36 | public @interface DigesterRuleList 37 | { 38 | 39 | } 40 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/handlers/BeanPropertySetterHandler.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations.handlers; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.reflect.Field; 23 | 24 | import org.apache.commons.digester3.annotations.AnnotationHandler; 25 | import org.apache.commons.digester3.annotations.rules.BeanPropertySetter; 26 | import org.apache.commons.digester3.binder.RulesBinder; 27 | 28 | /** 29 | * {@link BeanPropertySetter} handler. 30 | * 31 | * @since 3.0 32 | */ 33 | public final class BeanPropertySetterHandler 34 | implements AnnotationHandler 35 | { 36 | 37 | @Override 38 | public void handle( final BeanPropertySetter annotation, final Field element, final RulesBinder rulesBinder ) 39 | { 40 | rulesBinder.forPattern( annotation.pattern() ) 41 | .withNamespaceURI( annotation.namespaceURI() ) 42 | .setBeanProperty() 43 | .withName( element.getName() ); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/handlers/SetNextHandler.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations.handlers; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.reflect.Method; 23 | 24 | import org.apache.commons.digester3.annotations.rules.SetNext; 25 | import org.apache.commons.digester3.binder.RulesBinder; 26 | 27 | /** 28 | * {@link SetNext} handler. 29 | * 30 | * @since 3.0 31 | */ 32 | public final class SetNextHandler 33 | extends AbstractMethodHandler 34 | { 35 | 36 | @Override 37 | protected void doBind( final String pattern, final String namespaceURI, final Method method, final Class type, final boolean fireOnBegin, 38 | final RulesBinder rulesBinder ) 39 | { 40 | rulesBinder.forPattern( pattern ) 41 | .withNamespaceURI( namespaceURI ) 42 | .setNext( method.getName() ) 43 | .withParameterType( type ) 44 | .fireOnBegin( fireOnBegin ); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/handlers/SetRootHandler.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations.handlers; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.reflect.Method; 23 | 24 | import org.apache.commons.digester3.annotations.rules.SetRoot; 25 | import org.apache.commons.digester3.binder.RulesBinder; 26 | 27 | /** 28 | * {@link SetRoot} handler. 29 | * 30 | * @since 3.0 31 | */ 32 | public final class SetRootHandler 33 | extends AbstractMethodHandler 34 | { 35 | 36 | @Override 37 | protected void doBind( final String pattern, final String namespaceURI, final Method method, final Class type, final boolean fireOnBegin, 38 | final RulesBinder rulesBinder ) 39 | { 40 | rulesBinder.forPattern( pattern ) 41 | .withNamespaceURI( namespaceURI ) 42 | .setRoot( method.getName() ) 43 | .withParameterType( type ) 44 | .fireOnBegin( fireOnBegin ); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/handlers/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code handlers} package contains 22 | * {@link org.apache.commons.digester3.annotations.AnnotationHandler} 23 | * implementations. 24 | */ 25 | package org.apache.commons.digester3.annotations.handlers; 26 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code annotations} package provides annotations based 22 | * rule definitions for {@code Digester}. 23 | */ 24 | package org.apache.commons.digester3.annotations; 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/reflect/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code reflect} package supply missing JVM classes to allow user 22 | * manipulate entities as {@link java.lang.reflect.AnnotatedElement}. 23 | */ 24 | package org.apache.commons.digester3.annotations.reflect; 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/rules/CreationRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.annotations.rules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | * Marks a Digester rule as a creation rule, that's crucial for the {@code setNext} rule. 30 | * 31 | * @since 2.1 32 | */ 33 | @Documented 34 | @Target( ElementType.ANNOTATION_TYPE ) 35 | @Retention( RetentionPolicy.RUNTIME ) 36 | public @interface CreationRule 37 | { 38 | 39 | } 40 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/rules/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Classes contained in this package are annotations that reflect Digester rules. 22 | */ 23 | package org.apache.commons.digester3.annotations.rules; 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/annotations/utils/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Contains commons utilities classes for Java annotations manipulation. 22 | */ 23 | package org.apache.commons.digester3.annotations.utils; 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/binder/ByRuleBuilder.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.binder; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | 24 | /** 25 | * Builder chained when invoking {@link LinkedRuleBuilder#addRule(Rule)}. 26 | * 27 | * @param The rule type will be returned by this builder 28 | */ 29 | public final class ByRuleBuilder 30 | extends AbstractBackToLinkedRuleBuilder 31 | { 32 | 33 | private final R rule; 34 | 35 | ByRuleBuilder( final String keyPattern, final String namespaceURI, final RulesBinder mainBinder, final LinkedRuleBuilder mainBuilder, 36 | final R rule ) 37 | { 38 | super( keyPattern, namespaceURI, mainBinder, mainBuilder ); 39 | this.rule = rule; 40 | } 41 | 42 | @Override 43 | protected R createRule() 44 | { 45 | return rule; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/binder/PluginDeclarationRuleBuilder.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.binder; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.plugins.PluginDeclarationRule; 23 | 24 | /** 25 | * Builder chained when invoking {@link LinkedRuleBuilder#declarePlugin()}. 26 | * 27 | * @since 3.0 28 | */ 29 | public final class PluginDeclarationRuleBuilder 30 | extends AbstractBackToLinkedRuleBuilder 31 | { 32 | 33 | PluginDeclarationRuleBuilder( final String keyPattern, final String namespaceURI, final RulesBinder mainBinder, 34 | final LinkedRuleBuilder mainBuilder ) 35 | { 36 | super( keyPattern, namespaceURI, mainBinder, mainBuilder ); 37 | } 38 | 39 | @Override 40 | protected PluginDeclarationRule createRule() 41 | { 42 | return new PluginDeclarationRule(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/binder/RuleProvider.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.binder; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | 24 | /** 25 | * An object capable of providing instances of {@link Rule}. 26 | * 27 | * @param The Rule type created by the provider. 28 | * @since 3.0 29 | */ 30 | public interface RuleProvider 31 | { 32 | 33 | /** 34 | * Provides an instance of {@link Rule}. Must never return null. 35 | * 36 | * @return an instance of {@link Rule}. 37 | */ 38 | R get(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/binder/RulesModule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.binder; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * A module is the Digester rule bindings provider. 24 | * 25 | * @since 3.0 26 | */ 27 | public interface RulesModule 28 | { 29 | 30 | /** 31 | * Configure the Digester rules binding via the given rules binder. 32 | * 33 | * @param rulesBinder The binder instance used to configure rules bindings. 34 | */ 35 | void configure( RulesBinder rulesBinder ); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/binder/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The Digester EDSL allows configure Digester using fluent APIs. 22 | * 23 | * @since 3.0 24 | */ 25 | package org.apache.commons.digester3.binder; 26 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code xmlrules} package provides for XML-based definition of 22 | * rules for {@code Digester}. This improves maintainability of Java code, 23 | * as rules are now defined in XML and read into {@code Digester} 24 | * at run-time. 25 | */ 26 | package org.apache.commons.digester3; 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/plugins/InitializableRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.plugins; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * Defines an interface that a Rule class can implement if it wishes to get an initialization callback after the rule 24 | * has been added to the set of Rules within a PluginRules instance. 25 | * 26 | * @since 1.6 27 | */ 28 | public interface InitializableRule 29 | { 30 | 31 | /** 32 | * Called after this Rule object has been added to the list of all Rules. Note that if a single InitializableRule 33 | * instance is associated with more than one pattern, then this method will be called more than once. 34 | * 35 | * @param pattern is the digester match pattern that will trigger this rule. 36 | */ 37 | void postRegisterInit( String pattern ); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/plugins/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code plugins} package provides an easy mechanism whereby new 22 | * digestion rules can be added dynamically during a digestion. 23 | */ 24 | package org.apache.commons.digester3.plugins; 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/plugins/strategies/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code plugins.strategies} package contains "rule-finding" strategy 22 | * classes, and their associated "helper" loader classes. 23 | */ 24 | package org.apache.commons.digester3.plugins.strategies; 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/substitution/VariableExpander.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.substitution; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | *

24 | * An Interface describing a class capable of expanding strings which may contain variable references. The exact syntax 25 | * of the "reference", and the mechanism for determining the corresponding value to be used is up to the concrete 26 | * implementation. 27 | *

28 | * 29 | * @since 1.6 30 | */ 31 | public interface VariableExpander 32 | { 33 | 34 | /** 35 | * Return the input string with any variables replaced by their corresponding value. If there are no variables in 36 | * the string, then the input parameter is returned unaltered. 37 | * 38 | * @param param the string containing variables to be replaced. 39 | * @return the input string with any variables replaced by their corresponding value. 40 | */ 41 | String expand( String param ); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/substitution/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The {@code substitution} provides for manipulation of XML attributes and 22 | * element body text before the data is processed by any Rule objects. 23 | */ 24 | package org.apache.commons.digester3.substitution; 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/PatternStack.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.util.Stack; 23 | 24 | /** 25 | */ 26 | final class PatternStack 27 | extends Stack 28 | { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @Override 33 | public String toString() 34 | { 35 | final StringBuilder strBuilder = new StringBuilder(); 36 | for ( String elem : this ) 37 | { 38 | if ( !elem.isEmpty() ) 39 | { 40 | if ( strBuilder.length() > 0 ) 41 | { 42 | strBuilder.append( '/' ); 43 | } 44 | strBuilder.append( elem ); 45 | } 46 | } 47 | return strBuilder.toString(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetNamespaceURIRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | import org.xml.sax.Attributes; 24 | 25 | /** 26 | * @since 3.0 27 | */ 28 | final class SetNamespaceURIRule 29 | extends Rule 30 | { 31 | 32 | private final NameSpaceURIRulesBinder rulesBinder; 33 | 34 | SetNamespaceURIRule( final NameSpaceURIRulesBinder rulesBinder ) 35 | { 36 | this.rulesBinder = rulesBinder; 37 | } 38 | 39 | @Override 40 | public void begin( final String namespace, final String name, final Attributes attributes ) 41 | throws Exception 42 | { 43 | rulesBinder.addNamespaceURI( attributes.getValue( "namespaceURI" ) ); 44 | } 45 | 46 | @Override 47 | public void end( final String namespace, final String name ) 48 | throws Exception 49 | { 50 | rulesBinder.removeNamespaceURI(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | import org.apache.commons.digester3.binder.NestedPropertiesBuilder; 24 | import org.xml.sax.Attributes; 25 | 26 | /** 27 | */ 28 | final class SetNestedPropertiesAliasRule 29 | extends Rule 30 | { 31 | 32 | @Override 33 | public void begin( final String namespace, final String name, final Attributes attributes ) 34 | throws Exception 35 | { 36 | final String elementName = attributes.getValue( "attr-name" ); 37 | final String propertyName = attributes.getValue( "prop-name" ); 38 | 39 | final NestedPropertiesBuilder builder = getDigester().peek(); 40 | builder.addAlias( elementName ).forProperty( propertyName ); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | import org.apache.commons.digester3.binder.NestedPropertiesBuilder; 24 | import org.xml.sax.Attributes; 25 | 26 | /** 27 | */ 28 | final class SetNestedPropertiesIgnoreRule 29 | extends Rule 30 | { 31 | 32 | @Override 33 | public void begin( final String namespace, final String name, final Attributes attributes ) 34 | throws Exception 35 | { 36 | final String elementName = attributes.getValue( "elem-name" ); 37 | 38 | final NestedPropertiesBuilder builder = getDigester().peek(); 39 | builder.ignoreElement( elementName ); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | import org.apache.commons.digester3.binder.SetPropertiesBuilder; 24 | import org.xml.sax.Attributes; 25 | 26 | /** 27 | */ 28 | final class SetPropertiesAliasRule 29 | extends Rule 30 | { 31 | 32 | @Override 33 | public void begin( final String namespace, final String name, final Attributes attributes ) 34 | throws Exception 35 | { 36 | final String attributeName = attributes.getValue( "attr-name" ); 37 | final String propertyName = attributes.getValue( "prop-name" ); 38 | 39 | final SetPropertiesBuilder builder = getDigester().peek(); 40 | builder.addAlias( attributeName ).forProperty( propertyName ); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.Rule; 23 | import org.apache.commons.digester3.binder.SetPropertiesBuilder; 24 | import org.xml.sax.Attributes; 25 | 26 | /** 27 | */ 28 | final class SetPropertiesIgnoreRule 29 | extends Rule 30 | { 31 | 32 | @Override 33 | public void begin( final String namespace, final String name, final Attributes attributes ) 34 | throws Exception 35 | { 36 | final String attributeName = attributes.getValue( "attr-name" ); 37 | 38 | final SetPropertiesBuilder builder = getDigester().peek(); 39 | builder.ignoreAttribute( attributeName ); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertyRule.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.xmlrules; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import org.apache.commons.digester3.binder.LinkedRuleBuilder; 23 | import org.apache.commons.digester3.binder.RulesBinder; 24 | import org.xml.sax.Attributes; 25 | 26 | /** 27 | */ 28 | final class SetPropertyRule 29 | extends AbstractXmlRule 30 | { 31 | 32 | SetPropertyRule( final RulesBinder targetRulesBinder, final PatternStack patternStack ) 33 | { 34 | super( targetRulesBinder, patternStack ); 35 | } 36 | 37 | @Override 38 | protected void bindRule( final LinkedRuleBuilder linkedRuleBuilder, final Attributes attributes ) 39 | throws Exception 40 | { 41 | final String name = attributes.getValue( "name" ); 42 | final String value = attributes.getValue( "value" ); 43 | linkedRuleBuilder.setProperty( name ).extractingValueFromAttribute( value ); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * The Digester package lets you configure an XML to Java object mapping module, 22 | * which triggers certain actions called rules whenever a particular pattern of 23 | * nested XML elements is recognized. 24 | */ 25 | package org.apache.commons.digester3.xmlrules; 26 | -------------------------------------------------------------------------------- /commons-digester3-core/src/main/resources/overview.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | Overview Documentation for COMMONS-DIGESTER 21 | 22 | 23 |

The Digester component of the Apache Commons subproject supports 24 | rules-based processing of arbitrary XML documents.

25 | 26 |

See the 27 | 28 | Package Description for the org.apache.commons.digester 29 | package for more information.

30 | 31 | 32 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/Nameable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | /** 22 | * Interface used for testing. 23 | */ 24 | public interface Nameable 25 | { 26 | String getName(); 27 | 28 | void setName( String name ); 29 | } 30 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/NamedBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | /** 22 | * Very simple test bean 23 | */ 24 | public class NamedBean 25 | { 26 | 27 | private String name = "**UNSET**"; 28 | 29 | public NamedBean() 30 | { 31 | } 32 | 33 | public NamedBean( final String name ) 34 | { 35 | } 36 | 37 | public String getName() 38 | { 39 | return name; 40 | } 41 | 42 | public void setName( final String name ) 43 | { 44 | this.name = name; 45 | } 46 | 47 | public void test( final String name, final String ignored ) 48 | { 49 | setName( name ); 50 | } 51 | 52 | @Override 53 | public String toString() 54 | { 55 | return "NamedBean[" + getName() + "]"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/NamespacedBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * Simple class for use in unit tests. A box with a namespaces property to store the current namespaces as a Map. Used 25 | * by NamespaceSnapshotTestCase. 26 | */ 27 | public class NamespacedBox 28 | extends Box 29 | { 30 | 31 | private Map namespaces; 32 | 33 | public NamespacedBox() 34 | { 35 | } 36 | 37 | public Map getNamespaces() 38 | { 39 | return namespaces; 40 | } 41 | 42 | public void setNamespaces( final Map namespaces ) 43 | { 44 | this.namespaces = namespaces; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | import org.xml.sax.Attributes; 22 | import org.xml.sax.helpers.AttributesImpl; 23 | 24 | /** 25 | * Object creation factory used for testing. 26 | */ 27 | 28 | public class ObjectCreationFactoryTestImpl 29 | extends AbstractObjectCreationFactory 30 | { 31 | public boolean called; 32 | 33 | public Attributes attributes; 34 | 35 | @Override 36 | public Object createObject( final Attributes attributes ) 37 | { 38 | this.attributes = new AttributesImpl( attributes ); 39 | called = true; 40 | return this; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/OtherTestObjectCreationFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | /** 22 | * Another Object creation factory used for testing. 23 | */ 24 | 25 | public class OtherTestObjectCreationFactory 26 | extends ObjectCreationFactoryTestImpl 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/ParamBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | /** 22 | * This bean is used to replicate a reasonably complex use case whose behavior has changed from Digester 1.3 to 1.4. 23 | */ 24 | public class ParamBean 25 | { 26 | 27 | private boolean cool; 28 | 29 | private String that; 30 | 31 | private String _this; 32 | 33 | public ParamBean() 34 | { 35 | } 36 | 37 | public String getThat() 38 | { 39 | return that; 40 | } 41 | 42 | public String getThis() 43 | { 44 | return _this; 45 | } 46 | 47 | public boolean isCool() 48 | { 49 | return cool; 50 | } 51 | 52 | public void setCool( final boolean cool ) 53 | { 54 | this.cool = cool; 55 | } 56 | 57 | public String setThisAndThat( final String _this, final String that ) 58 | { 59 | this._this = _this; 60 | this.that = that; 61 | return "The Other"; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/PrimitiveBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3; 20 | 21 | /** 22 | * A simple bean with primitive properties. At the moment only need a boolean property. Feel free to add others later. 23 | */ 24 | public class PrimitiveBean 25 | { 26 | 27 | private boolean booleanValue; 28 | 29 | private boolean setBooleanCalled; 30 | 31 | public PrimitiveBean() 32 | { 33 | } 34 | 35 | public boolean getBoolean() 36 | { 37 | return booleanValue; 38 | } 39 | 40 | public boolean getSetBooleanCalled() 41 | { 42 | return setBooleanCalled; 43 | } 44 | 45 | public void setBoolean( final boolean booleanValue ) 46 | { 47 | this.booleanValue = booleanValue; 48 | setBooleanCalled = true; 49 | } 50 | 51 | public void testSetBoolean( final String ignored, final boolean booleanValue ) 52 | { 53 | setBoolean( booleanValue ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.catalog; 19 | 20 | import org.apache.commons.digester3.AbstractObjectCreationFactory; 21 | import org.xml.sax.Attributes; 22 | 23 | /** 24 | * @since 2.1 25 | */ 26 | public final class BookFactory 27 | extends AbstractObjectCreationFactory 28 | { 29 | 30 | private static final String ISBN = "isbn"; 31 | 32 | @Override 33 | public Book createObject( final Attributes attributes ) 34 | throws Exception 35 | { 36 | final String isbn = attributes.getValue( ISBN ); 37 | 38 | if ( isbn == null ) 39 | { 40 | throw new Exception( "Mandatory isbn attribute not present on book tag." ); 41 | } 42 | 43 | return new Book( isbn ); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.catalog; 19 | 20 | /** 21 | * @since 2.1 22 | */ 23 | public interface Item 24 | { 25 | 26 | void print(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/failingtests/BeanWithFakeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.failingtests; 19 | 20 | public final class BeanWithFakeHandler 21 | { 22 | 23 | @FakeRule 24 | private String something; 25 | 26 | public String getSomething() 27 | { 28 | return something; 29 | } 30 | 31 | public void setSomething( final String something ) 32 | { 33 | this.something = something; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FailingDigesterLoaderHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.failingtests; 19 | 20 | import static java.lang.String.format; 21 | import java.lang.annotation.Annotation; 22 | import java.lang.reflect.AnnotatedElement; 23 | 24 | import org.apache.commons.digester3.annotations.AnnotationHandler; 25 | import org.apache.commons.digester3.annotations.AnnotationHandlerFactory; 26 | 27 | public class FailingDigesterLoaderHandlerFactory 28 | implements AnnotationHandlerFactory 29 | { 30 | 31 | @Override 32 | public > H newInstance( final Class type ) 33 | throws Exception 34 | { 35 | throw new Exception( format( "Impossible to create '%s' instances", type.getName() ) ); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FakeHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.failingtests; 19 | 20 | import java.lang.annotation.Annotation; 21 | import java.lang.reflect.AnnotatedElement; 22 | 23 | import org.apache.commons.digester3.annotations.AnnotationHandler; 24 | import org.apache.commons.digester3.binder.RulesBinder; 25 | 26 | public final class FakeHandler 27 | implements AnnotationHandler 28 | { 29 | 30 | @Override 31 | public void handle( final Annotation annotation, final AnnotatedElement element, final RulesBinder rulesBinder ) 32 | { 33 | // do nothing 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FakeRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.failingtests; 19 | 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | import org.apache.commons.digester3.SetPropertiesRule; 26 | import org.apache.commons.digester3.annotations.DigesterRule; 27 | 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.FIELD) 30 | @DigesterRule( 31 | reflectsRule = SetPropertiesRule.class, 32 | handledBy = FakeHandler.class 33 | ) 34 | public @interface FakeRule 35 | { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.person; 19 | 20 | import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase; 21 | import org.junit.jupiter.api.Test; 22 | 23 | /** 24 | */ 25 | public final class PersonTestCase 26 | extends AbstractAnnotatedPojoTestCase 27 | { 28 | 29 | @Test 30 | public void testPerson() 31 | throws Exception 32 | { 33 | final Person person = new Person(); 34 | person.setId( 1 ); 35 | person.setName( "Gonzo" ); 36 | person.setCategory( "acquaintance" ); 37 | person.addEmail( "business", "gonzo@muppets.com" ); 38 | person.addEmail( "home", "gonzo@mymuppets.com" ); 39 | 40 | verifyExpectedEqualsToParsed( person ); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/annotations/servletbean/ServletBeanTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.annotations.servletbean; 19 | 20 | import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase; 21 | import org.junit.jupiter.api.Test; 22 | 23 | /** 24 | */ 25 | public final class ServletBeanTestCase 26 | extends AbstractAnnotatedPojoTestCase 27 | { 28 | 29 | @Test 30 | public void testServletBean() 31 | throws Exception 32 | { 33 | final ServletBean servletBean = new ServletBean(); 34 | servletBean.setServletName( "action" ); 35 | servletBean.setServletClass( "org.apache.struts.action.ActionServlet" ); 36 | servletBean.addInitParam( "application", "org.apache.struts.example.ApplicationResources" ); 37 | servletBean.addInitParam( "config", "/WEB-INF/struts-config.xml" ); 38 | 39 | verifyExpectedEqualsToParsed( servletBean ); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/binder/Entity.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.binder; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * Entity. 24 | */ 25 | public class Entity 26 | { 27 | 28 | private String author; 29 | 30 | /** 31 | * @return the author. 32 | */ 33 | public String getAuthor() 34 | { 35 | return author; 36 | } 37 | 38 | /** 39 | * @param author The author to set. 40 | */ 41 | public void setAuthor( final String author ) 42 | { 43 | this.author = author; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/Container.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | import java.util.List; 22 | import java.util.LinkedList; 23 | 24 | public class Container 25 | implements Widget 26 | { 27 | private final LinkedList children = new LinkedList<>(); 28 | 29 | public Container() 30 | { 31 | } 32 | 33 | public void addChild( final Widget child ) 34 | { 35 | children.add( child ); 36 | } 37 | 38 | public List getChildren() 39 | { 40 | return children; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/ContainerCustomRules.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | import org.apache.commons.digester3.Digester; 22 | 23 | public class ContainerCustomRules 24 | { 25 | public static void addRules( final Digester digester, final String pattern ) 26 | { 27 | // A Container object can have subtags called "widget" which 28 | // define any object of type Widget. Because a Container is 29 | // itself a widget, this allows us to build trees of objects. 30 | final PluginCreateRule pcr = new PluginCreateRule( Widget.class ); 31 | digester.addRule( pattern + "/widget", pcr ); 32 | digester.addSetNext( pattern + "/widget", "addChild" ); 33 | 34 | // allow users to declare plugins under a container as well 35 | final PluginDeclarationRule pdr = new PluginDeclarationRule(); 36 | digester.addRule( pattern + "/plugin", pdr ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/ObjectTestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | /** 22 | * Test harness object for holding results of digestion. 23 | */ 24 | 25 | public class ObjectTestImpl 26 | { 27 | 28 | private String value; 29 | 30 | public ObjectTestImpl() 31 | { 32 | } 33 | 34 | public String getValue() 35 | { 36 | return value; 37 | } 38 | 39 | public void setValue( final String val ) 40 | { 41 | value = val; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/TextLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.plugins; 19 | 20 | public class TextLabel 21 | implements Widget 22 | { 23 | private String id = "anonymous"; 24 | 25 | private String label = "nolabel"; 26 | 27 | public TextLabel() 28 | { 29 | } 30 | 31 | public String getId() 32 | { 33 | return id; 34 | } 35 | 36 | public String getLabel() 37 | { 38 | return label; 39 | } 40 | 41 | public void setId( final String id ) 42 | { 43 | this.id = id; 44 | } 45 | 46 | public void setLabel( final String label ) 47 | { 48 | this.label = label; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/TextLabel2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | public class TextLabel2 22 | implements Widget 23 | { 24 | private String id = "anonymous"; 25 | 26 | private String label = "nolabel"; 27 | 28 | public TextLabel2() 29 | { 30 | } 31 | 32 | public String getId() 33 | { 34 | return id; 35 | } 36 | 37 | public String getLabel() 38 | { 39 | return label; 40 | } 41 | 42 | public void setId( final String id ) 43 | { 44 | this.id = id; 45 | } 46 | 47 | public void setLabel( final String label ) 48 | { 49 | this.label = label; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/TextLabel2RuleInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | import org.apache.commons.digester3.Digester; 22 | 23 | public class TextLabel2RuleInfo 24 | { 25 | // define different rules on this class 26 | public static void addAltRules( final Digester digester, final String pattern ) 27 | { 28 | digester.addCallMethod( pattern + "/alt-id", "setId", 0 ); 29 | digester.addCallMethod( pattern + "/alt-label", "setLabel", 0 ); 30 | } 31 | 32 | // define default rules 33 | public static void addRules( final Digester digester, final String pattern ) 34 | { 35 | digester.addCallMethod( pattern + "/id", "setId", 0 ); 36 | digester.addCallMethod( pattern + "/label", "setLabel", 0 ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.commons.digester3.plugins; 19 | 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | 23 | /** 24 | * Entry point for all plugins package tests. 25 | */ 26 | public class Utils 27 | { 28 | 29 | /** 30 | * Gets an appropriate InputStream for the specified test file (which must be inside our current package. 31 | * 32 | * @param caller is always "this" for the calling object. 33 | * @param name is the test file we want 34 | * @throws IOException if an input/output error occurs 35 | */ 36 | public static InputStream getInputStream( final Object caller, final String name ) 37 | { 38 | return caller.getClass().getResourceAsStream( "/org/apache/commons/digester3/plugins/" + name ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/plugins/Widget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.plugins; 20 | 21 | public interface Widget 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/xmlrules/DigesterRulesSourceTestImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.xmlrules; 20 | 21 | import org.apache.commons.digester3.binder.AbstractRulesModule; 22 | 23 | /** 24 | * A test class, for validating FromXmlRuleSet's ability to 'include' programmatically-created rules from within an XML 25 | * rules file. 26 | */ 27 | public class DigesterRulesSourceTestImpl 28 | extends AbstractRulesModule 29 | { 30 | 31 | @Override 32 | protected void configure() 33 | { 34 | forPattern("baz") 35 | .createObject().ofType( ObjectTestImpl.class ) 36 | .then() 37 | .setProperties() 38 | .then() 39 | .setNext( "add" ).withParameterType( "java.lang.Object" ); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/java/org/apache/commons/digester3/xmlrules/ThrowExceptionCreationFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one or more 4 | * contributor license agreements. See the NOTICE file distributed with 5 | * this work for additional information regarding copyright ownership. 6 | * The ASF licenses this file to You under the Apache License, Version 2.0 7 | * (the "License"); you may not use this file except in compliance with 8 | * the License. You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.apache.commons.digester3.xmlrules; 20 | 21 | import org.apache.commons.digester3.AbstractObjectCreationFactory; 22 | import org.xml.sax.Attributes; 23 | 24 | /** 25 | * Object creation factory used for testing exception propagation. 26 | */ 27 | 28 | public class ThrowExceptionCreationFactory 29 | extends AbstractObjectCreationFactory 30 | { 31 | 32 | @Override 33 | public Object createObject( final Attributes attributes ) 34 | { 35 | throw new RuntimeException(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/AttributeDefinedConstructor.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/BasicConstructor.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/ConstructorWithAttributeAndElement.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 9.99 21 | 5.5 22 | 23 | 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test-digester-172-wrong.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | First Name 20 | 21 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 |
23 |
25 | 26 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 23 | 24 | 27 | 28 | 31 | 32 | 35 | 36 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test12-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 |
21 | home 22 | Home Street 23 | Home City 24 | HS 25 | HmZip 26 |
27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test12-02.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 |
21 | office 22 | Office Street 23 | Office City 24 | OS 25 | OfZip 26 |
27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 22 | First Name 23 | Last Name 24 | 21 25 | 1000000 26 | true 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test13-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | First Name 22 | Last Name 23 |
24 | home 25 | Home City 26 | HS 27 |
28 |
29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test13-02.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | First Name 22 | 23 | Last Name 24 |
25 | home 26 | Home City 27 | HS 28 |
29 |
30 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 22 | 24 | 26 | 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 23 | 25 | 27 | 28 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | First Name 22 | Last Name 23 | 21 24 | 1000000 25 | true 26 |
27 | home 28 | Home Street 29 | Home City 30 | HS 31 | HmZip 32 |
33 |
34 | office 35 | Office Street 36 | Office City 37 | OS 38 | OfZip 39 |
40 |
41 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | Value 1 23 | Value 2 24 | 25 | 26 | Value 3 27 | Value 4 28 | 29 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/Test9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | First Name 23 | 24 | 25 | Last Name 26 | 27 | 28 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/annotations/catalog/Catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | Ant, The Definitive Guide 22 | Jesse Tilly & Eric M. Burke 23 | Complete build management for Java. 24 | 25 | 26 | 27 | Effective Java 28 | Joshua Bloch 29 | Tips for experienced Java software developers. 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/annotations/employee/Employee.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 |
21 | Home Street 22 | Home City 23 | HS 24 | HmZip 25 |
26 | 27 |
28 | Office Street 29 | Office City 30 | OS 31 | OfZip 32 |
33 |
34 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/annotations/person/Person.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | Gonzo 21 | gonzo@muppets.com 22 | gonzo@mymuppets.com 23 | 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/annotations/servletbean/ServletBean.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | action 22 | org.apache.struts.action.ActionServlet 23 | 24 | application 25 | org.apache.struts.example.ApplicationResources 26 | 27 | 28 | config 29 | /WEB-INF/struts-config.xml 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/binder/rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/binder/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | Author 1 20 | 21 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/digester-162.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | Hello, world 23 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/document-with-relative-dtd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | Hello, world 23 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/extractPropertyNameFromAttribute.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | John 20 | Doe 21 | 22 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/ObjectTestImplRuleInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test1.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test2.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test3.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test4a.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 1 24 | 2 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test4b.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 1 24 | 2 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test5a.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | 23 | 24 | alt label 25 | 26 | 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test5b.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 23 | 24 | 25 | alt label 26 | 27 | 28 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/test5c.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | alt label 22 | 23 | 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/xmlrules1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/plugins/xmlrules2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/simple.dtd: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/constructor-testrules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/extractPropertyNameFromAttribute-rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/test-call-param-rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/test-node-create-rules-input.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | bar1-value 22 | 23 | 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/test-node-create-rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 555 27 | somestringvalue 28 | 29 | foo 30 | bar 31 | 32 | I am a property! 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | I am a property! 41 | 42 | 43 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/testCircularRules.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/testfactory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/testfactoryignore.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/testfactorynoignore.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /commons-digester3-core/src/test/resources/org/apache/commons/digester3/xmlrules/testrulesinclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /commons-digester3-dist/src/main/assembly/NOTICE-with-deps.txt: -------------------------------------------------------------------------------- 1 | 17 | Apache Commons Digester 18 | Copyright 2001-2023 The Apache Software Foundation 19 | 20 | This product includes software developed at 21 | The Apache Software Foundation (https://www.apache.org/). 22 | 23 | This product includes software - CGLIB - developed by 24 | Juozas Baliuka, Chris Nokleberg and Sam Berlin (http://cglib.sourceforge.net/) 25 | 26 | ASM - Copyright (c) 2000-2011 INRIA, France Telecom 27 | All rights reserved. (http://asm.ow2.org/) 28 | -------------------------------------------------------------------------------- /commons-digester3-dist/src/main/assembly/src.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | src 22 | 23 | tar.gz 24 | zip 25 | 26 | commons-digester3-${project.version}-src 27 | 28 | 29 | ${basedir}/../ 30 | 31 | **/.classpath 32 | **/.project 33 | **/.settings/ 34 | **/target/ 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /commons-digester3-examples/annotations/atom/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | This directory contains the example code for parsing ATOM newsfeeds. 19 | 20 | A packaged distribution can be created by using Apache Maven: 21 | 22 | * to compile: 23 | mvn compile 24 | 25 | * to build the jar artifact 26 | mvn package 27 | 28 | * to run: 29 | mvn verify 30 | 31 | Alternatively, you can set up your CLASSPATH appropriately, and 32 | run the example directly. 33 | -------------------------------------------------------------------------------- /commons-digester3-examples/annotations/atom/xmlcontent.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | Example Feed 25 | 26 | 2003-12-13T18:30 27 | 28 | John Doe 29 | 30 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 31 | 32 | 33 | Atom-Powered Robots Run Amok 34 | 35 | urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 36 | 2003-12-13T18:30 37 | this is just a simple test! 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.api.addressbook; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | import java.util.LinkedList; 21 | 22 | /** 23 | * See Main.java. 24 | */ 25 | public class AddressBook 26 | { 27 | 28 | private final LinkedList people = new LinkedList<>(); 29 | 30 | public void addPerson( final Person p ) 31 | { 32 | people.addLast( p ); 33 | } 34 | 35 | public void print() 36 | { 37 | System.out.println( "Address book has " + people.size() + " entries" ); 38 | 39 | for (final Person p : people) { 40 | p.print(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/catalog/example.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | Ant, The Definitive Guide 23 | Jesse Tilly & Eric M. Burke 24 | Complete build management for Java. 25 | 26 | 27 | 28 | Effective Java 29 | Joshua Bloch 30 | Tips for experienced Java software developers. 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.api.catalog; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | import java.util.LinkedList; 21 | 22 | /** 23 | * See Main.java. 24 | */ 25 | public class Catalog 26 | { 27 | 28 | private final LinkedList items = new LinkedList<>(); 29 | 30 | public void addItem( final Item item ) 31 | { 32 | items.addLast( item ); 33 | } 34 | 35 | public void print() 36 | { 37 | System.out.println( "This catalog has " + items.size() + " items" ); 38 | 39 | for (final Item item : items) { 40 | item.print(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Item.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.api.catalog; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * See Main.java. 22 | */ 23 | public interface Item 24 | { 25 | 26 | void print(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/dbinsert/example.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | Kermit 22 | green 23 | worrying 24 | 25 | 26 | Miss Piggy 27 | pink 28 | karate 29 | 30 |
31 | 32 | 33 | 34 | Drums 35 | Animal 36 | 37 |
38 |
-------------------------------------------------------------------------------- /commons-digester3-examples/api/dbinsert/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | == overview 19 | 20 | The files in this directory are intended as an example of how to use 21 | the Apache Digester's basic functionality via its java interface. 22 | 23 | Topics covered: 24 | * how to write a custom Rule class. 25 | * How to use digester to perform actions during parsing, rather 26 | than just build in-memory models of the input. 27 | 28 | == compiling and running 29 | 30 | * to compile: 31 | mvn compile 32 | 33 | * to build the jar artifact 34 | mvn package 35 | 36 | * to run: 37 | mvn verify 38 | 39 | Alternatively, you can set up your CLASSPATH appropriately, and 40 | run the example directly. 41 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/Table.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.api.dbinsert; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * See Main.java. 22 | */ 23 | public class Table 24 | { 25 | 26 | private String name; 27 | 28 | public Table() 29 | { 30 | } 31 | 32 | public String getName() 33 | { 34 | return name; 35 | } 36 | 37 | public void setName( final String name ) 38 | { 39 | this.name = name; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/document-markup/src/main/java/org/apache/commons/digester3/examples/api/documentmarkup/TextSegmentHandler.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.api.documentmarkup; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * Public interface for any Rule subclass which is interested in handling text segments as well as the complete body 22 | * text. 23 | */ 24 | public interface TextSegmentHandler 25 | { 26 | 27 | void textSegment( String text ) 28 | throws Exception; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /commons-digester3-examples/api/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | The subdirectories of this directory provide examples of how to use 19 | the Apache Digester's java API. 20 | 21 | With the API approach, java code is used to configure the digester with 22 | a set of rules to execute when XML is processed. It is these rules that 23 | determine how the input XML is mapped into a tree of java objects. 24 | 25 | An alternative is to use the "xmlrules" digester extension, which allows 26 | the digester rules to be configured via an XML file. This allows the 27 | mapping between input XML and java objects to be modified without 28 | recompilation of any source code. 29 | 30 | The examples are graduated in the following order: 31 | 32 | 1. addressbook 33 | 2. catalog 34 | 3. dbinsert 35 | 4. document-markup 36 | -------------------------------------------------------------------------------- /commons-digester3-examples/edsl/atom/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | This directory contains the example code for parsing ATOM newsfeeds. 19 | 20 | A packaged distribution can be created by using Apache Maven: 21 | 22 | * to compile: 23 | mvn compile 24 | 25 | * to build the jar artifact 26 | mvn package 27 | 28 | * to run: 29 | mvn verify 30 | 31 | Alternatively, you can set up your CLASSPATH appropriately, and 32 | run the example directly. 33 | -------------------------------------------------------------------------------- /commons-digester3-examples/edsl/atom/xmlcontent.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | Example Feed 25 | 26 | 2003-12-13T18:30 27 | 28 | John Doe 29 | 30 | urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 31 | 32 | 33 | Atom-Powered Robots Run Amok 34 | 35 | urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 36 | 2003-12-13T18:30 37 | this is just a simple test! 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/compound.xml: -------------------------------------------------------------------------------- 1 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | changeme 26 | transformed 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/input.txt: -------------------------------------------------------------------------------- 1 | Licensed to the Apache Software Foundation (ASF) under one or more 2 | contributor license agreements. See the NOTICE file distributed with 3 | this work for additional information regarding copyright ownership. 4 | The ASF licenses this file to You under the Apache License, Version 2.0 5 | (the "License"); you may not use this file except in compliance with 6 | the License. You may obtain a copy of the License at 7 | 8 | https://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | This is a test input file 17 | for the pipeline demo. 18 | 19 | It has multiple lines of text, which 20 | are transformed one-by-one using 21 | plugin classes. 22 | 23 | HERE IS SOME ALL-UPPERCASE TEXT and here some lowercase text 24 | which demonstrates the Case Transform plugin. 25 | 26 | Here are some lines to demonstrate the substitution plugin: 27 | changeme 1 28 | and changeme2 29 | and changeme again. 30 | 31 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | == overview 19 | 20 | The files in this directory are intended as an example of how to use 21 | the Apache Digester's "plugins" functionality. 22 | 23 | Topics covered: 24 | * how to declare "plugin points" using PluginCreateRule. 25 | * how to write plugin classes. 26 | 27 | If you're just starting with Digester, try the "api" examples first. 28 | This example demonstrates more advanced features of the digester. 29 | 30 | == compiling and running 31 | 32 | * to compile: 33 | mvn compile 34 | 35 | * to build the jar artifact 36 | mvn package 37 | 38 | * to run the examples: 39 | mvn verify -P run-uppercase 40 | mvn verify -P run-substitute 41 | mvn verify -P run-compound 42 | 43 | Alternatively, you can set up your CLASSPATH appropriately, and 44 | run the example directly. 45 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/Transform.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.plugins.pipeline; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * An interface that any user class must implement if it wishes to be plugged in at the "transform" tag of a pipeline 22 | * configuration file. 23 | */ 24 | public interface Transform 25 | { 26 | 27 | String transform( String s ); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/substitute.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | 23 | 24 | changeme 25 | changed 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /commons-digester3-examples/plugins/pipeline/uppercase.xml: -------------------------------------------------------------------------------- 1 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /commons-digester3-examples/readme.txt: -------------------------------------------------------------------------------- 1 | The subdirectories of this directory divide the examples into topics. 2 | 3 | The examples in API deal with the main Digester API. 4 | 5 | The xmlrules directory deals with the xmlrules extension which allows 6 | the digester rules to be configured via an XML file. This allows the 7 | mapping between input XML and java objects to be modified without 8 | recompilation of any source code. 9 | -------------------------------------------------------------------------------- /commons-digester3-examples/rss/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | This directory contains the example code for parsing RSS (Really Simple 19 | Syndication) newsfeeds, which was originally included directly in the 20 | commons-digester.jar file, in package "org.apache.commons.digester.rss". 21 | The package name has not been changed, so the only impact on applications 22 | relying on these classes will be the need to include an additional JAR 23 | file (commons-digester-rss.jar) in their classpath. 24 | 25 | A packaged distribution can be created by using Apache Maven: 26 | 27 | * to compile: 28 | mvn compile 29 | 30 | * to build the jar artifact 31 | mvn package 32 | 33 | * to run: 34 | mvn verify 35 | 36 | Alternatively, you can set up your CLASSPATH appropriately, and 37 | run the example directly. 38 | -------------------------------------------------------------------------------- /commons-digester3-examples/rss/src/main/resources/org/apache/commons/digester3/rss/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /** 19 | * Example usage of Digester to parse XML documents compatible with the Rich Site Summary format used by many newsfeeds. 20 | */ 21 | package org.apache.commons.digester3.rss; 22 | -------------------------------------------------------------------------------- /commons-digester3-examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java: -------------------------------------------------------------------------------- 1 | package org.apache.commons.digester3.examples.xmlrules.addressbook; 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * https://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | import java.util.LinkedList; 21 | 22 | /** 23 | * See Main.java. 24 | */ 25 | public class AddressBook 26 | { 27 | 28 | LinkedList people = new LinkedList<>(); 29 | 30 | public void addPerson( final Person p ) 31 | { 32 | people.addLast( p ); 33 | } 34 | 35 | public void print() 36 | { 37 | System.out.println( "Address book has " + people.size() + " entries" ); 38 | 39 | for (final Person p : people) { 40 | p.print(); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /commons-digester3-examples/xmlrules/readme.txt: -------------------------------------------------------------------------------- 1 | ######################################################################### 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ######################################################################### 17 | 18 | This directory deals with the xmlrules extension which allows 19 | the digester rules to be configured via an XML file. This allows the 20 | mapping between input XML and java objects to be modified without 21 | recompilation of any source code. 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/media/logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/commons-digester/fb73f8fd9309a5b32f302a3a0a98c47c9bee1860/src/media/logo.xcf -------------------------------------------------------------------------------- /src/site/resources/download_digester.cgi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Just call the standard mirrors.cgi script. It will use download.html 3 | # as the input template. 4 | exec /www/www.apache.org/dyn/mirrors/mirrors.cgi $* -------------------------------------------------------------------------------- /src/site/resources/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/commons-digester/fb73f8fd9309a5b32f302a3a0a98c47c9bee1860/src/site/resources/images/logo.png --------------------------------------------------------------------------------