View Javadoc

1   /*
2    * Copyright 2013 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://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  package de.smartics.properties.jboss.extension.resources;
17  
18  import static de.smartics.properties.jboss.extension.resources.SubsystemDefinition.SUBSYSTEM_NAME;
19  
20  import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver;
21  
22  /**
23   * Utilities to access descriptions of resources.
24   */
25  public final class DescriptionUtils
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    /**
32     * The path to the resources.
33     * <p>
34     * The value of this constant is {@value}.
35     * </p>
36     */
37    private static final String RESOURCE_NAME =
38        "de.smartics.properties.jboss.extension.LocalDescriptions";
39  
40    // --- members --------------------------------------------------------------
41  
42    // ****************************** Initializer *******************************
43  
44    // ****************************** Constructors ******************************
45  
46    private DescriptionUtils()
47    {
48    }
49  
50    // ****************************** Inner Classes *****************************
51  
52    // ********************************* Methods ********************************
53  
54    // --- init -----------------------------------------------------------------
55  
56    // --- get&set --------------------------------------------------------------
57  
58    // --- business -------------------------------------------------------------
59  
60    public static StandardResourceDescriptionResolver getResourceDescriptionResolver(
61        final String keyPrefix)
62    {
63      final String prefix =
64          SUBSYSTEM_NAME + (keyPrefix == null ? "" : '.' + keyPrefix);
65      return new StandardResourceDescriptionResolver(prefix, RESOURCE_NAME,
66          DescriptionUtils.class.getClassLoader(), true, false);
67    }
68  
69    // --- object basics --------------------------------------------------------
70  
71  }