# SOME DESCRIPTIVE TITLE.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2013-04-29 13:14+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#: bootstrapping.xml:24
#, no-c-format
msgid "Bootstrapping"
msgstr ""

#. Tag: para
#: bootstrapping.xml:26
#, no-c-format
msgid "In <xref linkend=\"section-obtaining-validator\"/> you already saw one way for creating a <classname>Validator</classname> instance — via <methodname>Validation#buildDefaultValidatorFactory()</methodname>. In this chapter you will learn how to use the other methods in <classname>javax.validation.Validation</classname> in order to bootstrap specifically configured validators."
msgstr ""

#. Tag: title
#: bootstrapping.xml:34
#, no-c-format
msgid "Retrieving <classname>ValidatorFactory</classname> and <classname>Validator</classname>"
msgstr ""

#. Tag: para
#: bootstrapping.xml:37
#, no-c-format
msgid "You obtain a <classname>Validator</classname> by retrieving a <classname>ValidatorFactory</classname> via one of the static methods on <classname>javax.validation.Validation</classname> and calling <classname>getValidator()</classname> on the factory instance."
msgstr ""

#. Tag: para
#: bootstrapping.xml:42
#, no-c-format
msgid "shows how to obtain a validator from the default validator factory:"
msgstr ""

#. Tag: title
#: bootstrapping.xml:46
#, no-c-format
msgid "Bootstrapping default <classname>ValidatorFactory</classname> and <classname>Validator</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:49
#, no-c-format
msgid ""
      "ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n"
      "Validator validator = factory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:53
#, no-c-format
msgid "The generated <classname>ValidatorFactory</classname> and <classname>Validator</classname> instances are thread-safe and can be cached. As Hibernate Validator uses the factory as context for caching constraint metadata it is recommended to work with one factory instance within an application."
msgstr ""

#. Tag: para
#: bootstrapping.xml:60
#, no-c-format
msgid "Bean Validation supports working with several providers such as Hibernate Validator within one application. If more than one provider is present on the classpath, it is not guaranteed which one is chosen when creating a factory via <methodname>buildDefaultValidatorFactory()</methodname>."
msgstr ""

#. Tag: para
#: bootstrapping.xml:66
#, no-c-format
msgid "In this case you can explicitly specify the provider to use via <methodname>Validation#byProvider()</methodname>, passing the provider's <classname>ValidationProvider</classname> class as shown in <xref linkend=\"example-using-specific-provider\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:72
#, no-c-format
msgid "Bootstrapping <classname>ValidatorFactory</classname> and <classname>Validator</classname> using a specific provider"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:75
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byProvider( HibernateValidator.class )\n"
      "                .configure()\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:78
#, no-c-format
msgid "Note that the configuration object returned by <methodname>configure()</methodname> allows to specifically customize the factory before calling <methodname>buildValidatorFactory()</methodname>. The available options are discussed later in this chapter."
msgstr ""

#. Tag: para
#: bootstrapping.xml:83
#, no-c-format
msgid "Similarly you can retrieve the default validator factory for configuration which is demonstrated in <xref linkend=\"example-configuring-default-provider\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:88
#, no-c-format
msgid "Retrieving the default <classname>ValidatorFactory</classname> for configuration"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:91
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:95
#, no-c-format
msgid "If a <classname>ValidatorFactory</classname> instance is no longer in use, it should be disposed by calling <methodname>ValidatorFactory#close()</methodname>. This will free any resources possibly allocated by the factory."
msgstr ""

#. Tag: classname
#: bootstrapping.xml:102
#, no-c-format
msgid "ValidationProviderResolver"
msgstr ""

#. Tag: para
#: bootstrapping.xml:104
#, no-c-format
msgid "By default, available Bean Validation providers are discovered using the <ulink url=\"http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider\">Java Service Provider</ulink> mechanism."
msgstr ""

#. Tag: para
#: bootstrapping.xml:109
#, no-c-format
msgid "For that purpose, each provider includes the file <filename>META-INF/services/javax.validation.spi.ValidationProvider</filename>, containing the fully qualified classname of its <classname>ValidationProvider</classname> implementation. In the case of Hibernate Validator this is <classname>org.hibernate.validator.HibernateValidator</classname>."
msgstr ""

#. Tag: para
#: bootstrapping.xml:116
#, no-c-format
msgid "Depending on your environment and its classloading specifics, provider discovery via the Java's service loader mechanism might not work. In this case you can plug in a custom <classname>ValidationProviderResolver</classname> implementation which performs the provider retrieval. An example is OSGi, where you could implement a provider resolver which uses OSGi services for provider discovery."
msgstr ""

#. Tag: para
#: bootstrapping.xml:124
#, no-c-format
msgid "To use a custom provider resolver pass it via <methodname>providerResolver()</methodname> as shown shown in <xref linkend=\"example-using-custom-validation-provider-resolver\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:129
#, no-c-format
msgid "Using a custom <classname>ValidationProviderResolver</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:132
#, no-c-format
msgid ""
      "package org.hibernate.validator.referenceguide.chapter08;\n"
      "\n"
      "public class OsgiServiceDiscoverer implements ValidationProviderResolver {\n"
      "\n"
      "        @Override\n"
      "        public List&lt;ValidationProvider&lt;?&gt;&gt; getValidationProviders() {\n"
      "                //...\n"
      "        }\n"
      "}"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:134
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .providerResolver( new OsgiServiceDiscoverer() )\n"
      "                .configure()\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: title
#: bootstrapping.xml:140
#, no-c-format
msgid "Configuring a <classname>ValidatorFactory</classname>"
msgstr ""

#. Tag: para
#: bootstrapping.xml:142
#, no-c-format
msgid "By default validator factories retrieved from <classname>Validation</classname> and any validators they create are configured as per the XML descriptor <filename>META-INF/validation.xml</filename> (see <xref linkend=\"chapter-xml-configuration\"/>), if present."
msgstr ""

#. Tag: para
#: bootstrapping.xml:148
#, no-c-format
msgid "If you want to disable the XML based configuration, you can do so by invoking <methodname>Configuration#ignoreXmlConfiguration()</methodname>."
msgstr ""

#. Tag: para
#: bootstrapping.xml:152
#, no-c-format
msgid "The different values of the XML configuration can be accessed via <methodname>Configuration#getBootstrapConfiguration()</methodname>. This can for instance be helpful if you want to integrate Bean Validation into a managed environment and want to create managed instances of the objects configured via XML."
msgstr ""

#. Tag: para
#: bootstrapping.xml:158
#, no-c-format
msgid "Using the fluent configuration API, you can override one or more of the settings when bootstrapping the factory. The following sections show how to make use of the different options. Note that the <classname>Configuration</classname> class exposes the default implementations of the different extension points which can be useful if you want to use these as delegates for your custom implementations."
msgstr ""

#. Tag: classname
#: bootstrapping.xml:166
#, no-c-format
msgid "MessageInterpolator"
msgstr ""

#. Tag: para
#: bootstrapping.xml:168
#, no-c-format
msgid "Message interpolators are used by the validation engine to create user readable error messages from constraint message descriptors."
msgstr ""

#. Tag: para
#: bootstrapping.xml:171
#, no-c-format
msgid "In case the default message interpolation algorithm described in <xref linkend=\"chapter-message-interpolation\"/> is not sufficient for your needs, you can pass in your own implementation of the <classname>MessageInterpolator</classname> interface via <classname>Configuration#messageInterpolator()</classname> as shown in <xref linkend=\"example-using-custom-message-interpolator\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:179
#, no-c-format
msgid "Using a custom <classname>MessageInterpolator</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:182
#, no-c-format
msgid ""
      "package org.hibernate.validator.referenceguide.chapter08;\n"
      "\n"
      "public class MyMessageInterpolator implements MessageInterpolator {\n"
      "\n"
      "        @Override\n"
      "        public String interpolate(String messageTemplate, Context context) {\n"
      "                //...\n"
      "        }\n"
      "\n"
      "        @Override\n"
      "        public String interpolate(String messageTemplate, Context context, Locale locale) {\n"
      "                //...\n"
      "        }\n"
      "}"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:184
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .messageInterpolator( new MyMessageInterpolator() )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: classname
#: bootstrapping.xml:189
#, no-c-format
msgid "TraversableResolver"
msgstr ""

#. Tag: para
#: bootstrapping.xml:191
#, no-c-format
msgid "In some cases the validation engine should not access the state of a bean property. The most obvious example for that is a lazily loaded property or association of a JPA entity. Validating this lazy property or association would mean that its state would have to be accessed, triggering a load from the database."
msgstr ""

#. Tag: para
#: bootstrapping.xml:197
#, no-c-format
msgid "Which properties can be accessed and which ones not is controlled by querying the <classname>TraversableResolver</classname> interface. <xref linkend=\"example-using-custom-traversable-resolver\"/> shows how to use a custom traversable resolver implementation."
msgstr ""

#. Tag: title
#: bootstrapping.xml:203
#, no-c-format
msgid "Using a custom <classname>TraversableResolver</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:206
#, no-c-format
msgid ""
      "package org.hibernate.validator.referenceguide.chapter08;\n"
      "\n"
      "public class MyTraversableResolver implements TraversableResolver {\n"
      "\n"
      "        @Override\n"
      "        public boolean isReachable(\n"
      "                        Object traversableObject,\n"
      "                        Node traversableProperty,\n"
      "                        Class&lt;?&gt; rootBeanType,\n"
      "                        Path pathToTraversableObject,\n"
      "                        ElementType elementType) {\n"
      "                //...\n"
      "        }\n"
      "\n"
      "        @Override\n"
      "        public boolean isCascadable(\n"
      "                        Object traversableObject,\n"
      "                        Node traversableProperty,\n"
      "                        Class&lt;?&gt; rootBeanType,\n"
      "                        Path pathToTraversableObject,\n"
      "                        ElementType elementType) {\n"
      "                //...\n"
      "        }\n"
      "}"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:208
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .traversableResolver( new MyTraversableResolver() )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:211
#, no-c-format
msgid "Hibernate Validator provides two <classname>TraversableResolver</classname>s out of the box which will be enabled automatically depending on your environment. The first is <classname>DefaultTraversableResolver</classname> which will always return <literal>true</literal> for <methodname>isReachable()</methodname> and <methodname>isTraversable()</methodname>. The second is <classname>JPATraversableResolver</classname> which gets enabled when Hibernate Validator is used in combination with JPA 2."
msgstr ""

#. Tag: classname
#: bootstrapping.xml:223
#, no-c-format
msgid "ConstraintValidatorFactory"
msgstr ""

#. Tag: para
#: bootstrapping.xml:225
#, no-c-format
msgid "<classname>ConstraintValidatorFactory</classname> is the extension point for customizing how constraint validators are instantiated and released."
msgstr ""

#. Tag: para
#: bootstrapping.xml:229
#, no-c-format
msgid "The default <classname>ConstraintValidatorFactory</classname> provided by Hibernate Validator requires a public no-arg constructor to instantiate <classname>ConstraintValidator</classname> instances (see <xref linkend=\"section-constraint-validator\"/>). Using a custom <classname>ConstraintValidatorFactory</classname> offers for example the possibility to use dependency injection in constraint validator implementations."
msgstr ""

#. Tag: para
#: bootstrapping.xml:237
#, no-c-format
msgid "To configure a custom constraint validator factory call <methodname>Configuration#constraintValidatorFactory()</methodname> (see <xref linkend=\"example-using-custom-constraint-validator-factory\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:243
#, no-c-format
msgid "Using a custom <classname>ConstraintValidatorFactory</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:246
#, no-c-format
msgid ""
      "package org.hibernate.validator.referenceguide.chapter08;\n"
      "\n"
      "public class MyConstraintValidatorFactory implements ConstraintValidatorFactory {\n"
      "\n"
      "        @Override\n"
      "        public &lt;T extends ConstraintValidator&lt;?, ?&gt;&gt; T getInstance(Class&lt;T&gt; key) {\n"
      "                //...\n"
      "        }\n"
      "\n"
      "        @Override\n"
      "        public void releaseInstance(ConstraintValidator&lt;?, ?&gt; instance) {\n"
      "                //...\n"
      "        }\n"
      "}"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:248
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .constraintValidatorFactory( new MyConstraintValidatorFactory() )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:252
#, no-c-format
msgid "Any constraint implementations relying on <classname>ConstraintValidatorFactory</classname> behaviors specific to an implementation (dependency injection, no no-arg constructor and so on) are not considered portable."
msgstr ""

#. Tag: para
#: bootstrapping.xml:259
#, no-c-format
msgid "<classname>ConstraintValidatorFactory</classname> implementations should not cache validator instances as the state of each instance can be altered in the <methodname>initialize()</methodname> method."
msgstr ""

#. Tag: classname
#: bootstrapping.xml:267
#, no-c-format
msgid "ParameterNameProvider"
msgstr ""

#. Tag: para
#: bootstrapping.xml:269
#, no-c-format
msgid "In case a method or constructor parameter constraint is violated, the <classname>ParameterNameProvider</classname> interface is used to retrieve the parameter's name and make it available to the user via the constraint violation's property path."
msgstr ""

#. Tag: para
#: bootstrapping.xml:274
#, no-c-format
msgid "The default implementation returns parameter names in the form <literal>arg0</literal>, <literal>arg1</literal> etc., while custom implementations could e.g. be based on parameter annotations, debug symbols or a feature for retrieving parameter names at runtime possibly provided by future Java versions."
msgstr ""

#. Tag: para
#: bootstrapping.xml:280
#, no-c-format
msgid "Custom <classname>ParameterNameProvider</classname> implementations are used as demonstrated in <xref linkend=\"example-using-custom-parameter-name-provider\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:285
#, no-c-format
msgid "Using a custom <classname>ParameterNameProvider</classname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:288
#, no-c-format
msgid ""
      "package org.hibernate.validator.referenceguide.chapter08;\n"
      "\n"
      "public class MyParameterNameProvider implements ParameterNameProvider {\n"
      "\n"
      "        @Override\n"
      "        public List&lt;String&gt; getParameterNames(Constructor&lt;?&gt; constructor) {\n"
      "                //...\n"
      "        }\n"
      "\n"
      "        @Override\n"
      "        public List&lt;String&gt; getParameterNames(Method method) {\n"
      "                //...\n"
      "        }\n"
      "}"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:290
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .parameterNameProvider( new MyParameterNameProvider() )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: title
#: bootstrapping.xml:295
#, no-c-format
msgid "Adding mapping streams"
msgstr ""

#. Tag: para
#: bootstrapping.xml:297
#, no-c-format
msgid "As discussed earlier you can configure the constraints applying for your Java beans using XML based constraint mappings."
msgstr ""

#. Tag: para
#: bootstrapping.xml:300
#, no-c-format
msgid "Besides the mapping files specified in <filename>META-INF/validation.xml</filename> you can add further mappings via <methodname>Configuration#addMapping()</methodname> (see <xref linkend=\"example-adding-mapping-streams\"/>). Note that the passed input stream(s) must adhere to the XML schema for constraint mappings presented in <xref linkend=\"section-mapping-xml-constraints\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:308
#, no-c-format
msgid "Adding constraint mapping streams"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:310
#, no-c-format
msgid ""
      "InputStream constraintMapping1 = ...;\n"
      "InputStream constraintMapping2 = ...;\n"
      "ValidatorFactory validatorFactory = Validation.byDefaultProvider()\n"
      "                .configure()\n"
      "                .addMapping( constraintMapping1 )\n"
      "                .addMapping( constraintMapping2 )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:313
#, no-c-format
msgid "You should close any passed input stream after the validator factory has been created."
msgstr ""

#. Tag: title
#: bootstrapping.xml:318
#, no-c-format
msgid "Provider-specific settings"
msgstr ""

#. Tag: para
#: bootstrapping.xml:320
#, no-c-format
msgid "Via the configuration object returned by <methodname>Validation#byProvider()</methodname> provider specific options can be configured."
msgstr ""

#. Tag: para
#: bootstrapping.xml:324
#, no-c-format
msgid "In case of Hibernate Validator this allows you to enable the fail fast mode and pass one or more programmatic constraint mappings as demonstrated in <xref linkend=\"example-hibernate-validator-specific-options\"/>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:330
#, no-c-format
msgid "Setting Hibernate Validator specific options"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:332
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byProvider( HibernateValidator.class )\n"
      "                .configure()\n"
      "                .failFast( true )\n"
      "                .addMapping( (ConstraintMapping) null )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:335
#, no-c-format
msgid "Alternatively, provider-specific options can be passed via <methodname>Configuration#addProperty()</methodname>. Hibernate Validator supports enabling the fail fast mode that way, too:"
msgstr ""

#. Tag: title
#: bootstrapping.xml:340
#, no-c-format
msgid "Enabling a Hibernate Validator specific option via <methodname>addProperty()</methodname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:343
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.byProvider( HibernateValidator.class )\n"
      "                .configure()\n"
      "                .addProperty( \"hibernate.validator.fail_fast\", \"true\" )\n"
      "                .buildValidatorFactory();\n"
      "Validator validator = validatorFactory.getValidator();"
msgstr ""

#. Tag: para
#: bootstrapping.xml:346
#, no-c-format
msgid "Refer to <xref linkend=\"section-fail-fast\"/> and <xref linkend=\"section-programmatic-api\"/> to learn more about the fail fast mode and the constraint declaration API."
msgstr ""

#. Tag: title
#: bootstrapping.xml:353
#, no-c-format
msgid "Configuring a <classname>Validator</classname>"
msgstr ""

#. Tag: para
#: bootstrapping.xml:355
#, no-c-format
msgid "When working with a configured validator factory it can occasionally be required to apply a different configuration to a single <classname>Validator</classname> instance. <xref linkend=\"example-using-context\"/> shows how this can be achieved by calling <methodname>ValidatorFactory#usingContext()</methodname>."
msgstr ""

#. Tag: title
#: bootstrapping.xml:362
#, no-c-format
msgid "Configuring a <classname>Validator</classname> via <methodname>usingContext()</methodname>"
msgstr ""

#. Tag: programlisting
#: bootstrapping.xml:365
#, no-c-format
msgid ""
      "ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();\n"
      "\n"
      "Validator validator = validatorFactory.usingContext()\n"
      "                .messageInterpolator( new MyMessageInterpolator() )\n"
      "                .traversableResolver( new MyTraversableResolver() )\n"
      "                .getValidator();"
msgstr ""

