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.admin.domain.service;
17  
18  import java.io.Serializable;
19  
20  import de.smartics.properties.resource.domain.ArtifactId;
21  
22  /**
23   * Responsible to read application identifier properties.
24   */
25  public class ApplicationIdConfigurationLoader implements Serializable
26  {
27    // ********************************* Fields *********************************
28  
29    // --- constants ------------------------------------------------------------
30  
31    /**
32     * The class version identifier.
33     * <p>
34     * The value of this constant is {@value}.
35     * </p>
36     */
37    private static final long serialVersionUID = 1L;
38  
39    /**
40     * The identifier to specify the group the application belongs to.
41     * <p>
42     * The value of this constant is {@value}.
43     * </p>
44     */
45    public static final String GROUP_ID =
46        "de.smartics.properties.application.groupId";
47  
48    /**
49     * The identifier of the application within the group.
50     * <p>
51     * The value of this constant is {@value}.
52     * </p>
53     */
54    public static final String ARTIFACT_ID =
55        "de.smartics.properties.application.artifactId";
56  
57    /**
58     * The version of the application.
59     * <p>
60     * The value of this constant is {@value}.
61     * </p>
62     */
63    public static final String VERSION =
64        "de.smartics.properties.application.version";
65  
66    /**
67     * The archive type the application is distributed. This may be a POM that
68     * defines the dependencies for a logical application.
69     * <p>
70     * The value of this constant is {@value}.
71     * </p>
72     */
73    public static final String ARCHIVE_TYPE =
74        "de.smartics.properties.application.archiveType";
75  
76    /**
77     * The optional classifier to identify the distribution bundle.
78     * <p>
79     * The value of this constant is {@value}.
80     * </p>
81     */
82    public static final String CLASSIFIER =
83        "de.smartics.properties.application.classifier";
84  
85    // --- members --------------------------------------------------------------
86  
87    // ****************************** Initializer *******************************
88  
89    // ****************************** Constructors ******************************
90  
91    /**
92     * Default constructor.
93     */
94    public ApplicationIdConfigurationLoader()
95    {
96    }
97  
98    // ****************************** Inner Classes *****************************
99  
100   // ********************************* Methods ********************************
101 
102   // --- init -----------------------------------------------------------------
103 
104   // --- get&set --------------------------------------------------------------
105 
106   // --- business -------------------------------------------------------------
107 
108   /**
109    * Loads the application identifier configuration.
110    *
111    * @return the application identifier configuration.
112    */
113   public ArtifactId load()
114   {
115     try
116     {
117       final ApplicationIdConfigurationPropertiesLoader propertiesLoader =
118           new ApplicationIdConfigurationPropertiesLoader();
119       final ArtifactId artifactId = propertiesLoader.load();
120       return artifactId;
121     }
122     catch (final IllegalStateException e)
123     {
124       final ApplicationIdConfigurationJndiLoader jndiLoader =
125           new ApplicationIdConfigurationJndiLoader();
126       final ArtifactId artifactId = jndiLoader.load();
127       return artifactId;
128     }
129   }
130 
131   // --- object basics --------------------------------------------------------
132 
133 }