Package overit.geocall.platform
Class Layer
java.lang.Object
overit.geocall.platform.Package
overit.geocall.platform.Layer
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LoggerLayer,UXLayer
This class defines an application layer, i.e. the software layer that will contain the various application components
(Task, DAO, graphics components, ...) and any customizations that will help to create the solution for the customer.
It is possible to define a layer by creating a
Or you can define a layer programmatically by creating a new instance of
In the same way it's possible to define packages containing the language files
Registering a layer and correctly defining its name and domain is essential for correct resolution of the components. Failure to register may result in several problems; a reference to a component defined in an unregistered layer will not take into account any customizations, or worse, may raise an exception if the referenced component is not contained in any of the other layers.
It is possible to define a layer by creating a
Layer extension by assigning it a name and, eventually, a
domain in case the layer root does not match the package in which the class is located.
Remember to annotate the class with the @Package annotation.
Or you can define a layer programmatically by creating a new instance of
Layer and registering it by
calling the CustomLayer.addLayer(Layer) method.
Layer layer = new Layer("name", "layer/domain/path");
CustomLayer.addLayer(layer);
Each layer already defines a level in which you can define your business objects such as:
BusinessTask, DAO, interface pages; however you can extend
or overwrite the functionality defined in the dependent layers, defining customizations.
Customizations allow you to redefine the components contained in a package of another layer by adapting them
to the customer's needs.
package overit.geocallapp.wfm.managing;
{@literal @}Package
public class ManagingPackage extends CustomPackage {
public ManagingPackage() {
super("overit/geocall/basic/managing/");
}
}
The above example shows how to make the components contained in the package overit.geocallapp.wfm.managing
customize the same name components declared in the package overit/geocall/basic/managing/.
In the same way it's possible to define packages containing the language files
package overit.geocallapp.wfm.lang;
{@literal @}Package
public class WFMLangPackage extends LangPackage {
public WFMLangPackage() {}
}
the themes
package overit.geocallapp.wfm.theme;
{@literal @}Package
public class WFMThemePackage extends ThemePackage {
public WFMThemePackage() {}
}
or the SQL scripts needed to configure the database.
package overit.geocallapp.wfm.install.script;
{@literal @}Package
public class WFMScriptPackage extends ScriptPackage {
public WFMScriptPackage() {
super("");
}
}
The association between CustomPackage and Layer occurs automatically as long as the class that defines its implementation:
- is positioned within the domain defined by the Layer
- contains the annotation
@Package
Registering a layer and correctly defining its name and domain is essential for correct resolution of the components. Failure to register may result in several problems; a reference to a component defined in an unregistered layer will not take into account any customizations, or worse, may raise an exception if the referenced component is not contained in any of the other layers.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConcurrentHashMap<String, Class<?>> protected final ConcurrentHashMap<String, Class<?>> protected final ArrayList<CustomPackage> protected Grantsprotected final ConcurrentHashMap<String, Landing> protected final Set<LandingTree> protected LangPackageprotected Permissionsprotected final ClassInstances<ScriptPackage> protected ThemePackage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddComponent(String name, Class<?> component) Register a new library component (e.g. a graphics component) within the current layer.final voidaddCustomization(String originalPath, Class<?> custom) Adds a class as customization of another resource identified by the originalPath path.final voidaddCustomization(CustomPackage customPackage) Adds a package that customizes the components defined in another package belonging to some overlay.final voidAdds a collection of functions.final voidAdds a Landing page.final voidAdds a LandingTree instance from which will extract the landing pages related to an XML resource.final voidAdds the dependency of the current layer to the layers identified by the classes passed as a parameter.final voidAdds the dependency of the current layer to the layers identified by the names passed as a parameter.final voidAdds a collection of functions.final voidaddScriptPackage(ScriptPackage scriptPackage) Adds a package containing SQL scripts to the current layer.booleanMethod used to retrieve the classes of the library components registered into this layer (e.g. a graphics component)Method used to retrieve the classes that customize an over layer's resource.Method used to retrieve the packages that customize an over layer's package.retrieves the functions granted by this layer.Method used to retrieve the package containing the translation files that belong to this layergetOvers()Method used to retrieve the classes of the layer from which this depends.retrieves thePermissioncollection of functions possibly used inside the layer.getScriptPackage(Class<? extends ScriptPackage> cls) Retrieves the instance of the script package from its class.getScriptPackage(String name) Retrieves the instance of the script package from its name.Method used to retrieve the packages containing the SQL script that belong to this layerMethod used to retrieve the package containing the themes that belong to this layerinthashCode()final voidsetLangPackage(LangPackage langPackage) Sets the package that contains the language files used for the translations.final voidsetThemePackage(ThemePackage themePackage) Sets the package that contains the css files used for the thematization.Methods inherited from class overit.geocall.platform.Package
getAlias, getName, getPosition, invariant, setAlias, setPosition, validatePosition
-
Field Details
-
overClasses
-
overNames
-
customPackages
-
customClasses
-
components
-
scriptPackages
-
themePackage
-
langPackage
-
permissions
-
grants
-
landings
-
landingTrees
-
-
Constructor Details
-
Layer
Create a new layer by specifying its name. This constructor can be called from layer extensions, instead ofLayer(String, String), because it is easier to use since the domain is automatically calculated according to the subclass package.- Parameters:
name- string that uniquely identifies the layer. Null value is not allowed.
-
Layer
Create a new layer by specifying its name and domain. The domain directories must be separated with the/character, the domain must start without the/character and must end with.
The following example shows the definition of a new layer, called wfm, whose domain is theoverit.geocallapp.wfmpackageLayer layer = new Layer("wfm", "overit/geocallapp/wfm/");- Parameters:
name- string that uniquely identifies the layer. Null value is not allowed.domain- path that identifies the position of the layer, i.e. the root from which to solve any components, customizations. Null value is not allowed.
-
-
Method Details
-
addOver
Adds the dependency of the current layer to the layers identified by the classes passed as a parameter. Any class for which there is no correspondence with any other registered layer will not be taken into account.- Parameters:
classes- classes of the layers towards which to define a dependency
-
addOver
Adds the dependency of the current layer to the layers identified by the names passed as a parameter. Any names for which there is no correspondence with any other registered layer will not be taken into account.- Parameters:
names- names of the layers towards which to define a dependency
-
addCustomization
Adds a package that customizes the components defined in another package belonging to some overlay.- Parameters:
customPackage- the instance that points to the package containing the component's customizations. Null value are not allowed.- Throws:
InvalidParameterException- if thepackage's positionrefers to a location positioned outside the current layer
-
addCustomization
Adds a class as customization of another resource identified by the originalPath path.- Parameters:
originalPath- path of the original resource you want to customize. directories must be separated with the / character, the string must not start with / and must end with /. Null value are not allowed.custom- the class that contains the customization. Null value are not allowed.- Throws:
InvalidParameterException- if the class refers to a resource positioned outside the current layer
-
addComponent
Register a new library component (e.g. a graphics component) within the current layer. If there's another component with the same name, it will be overwritten.- Parameters:
name- the component's namecomponent- the component's class- Throws:
InvalidParameterException- if the class refers to a location positioned outside the current layer
-
addScriptPackage
Adds a package containing SQL scripts to the current layer.- Parameters:
scriptPackage- the instance that points to the package containing the sql script files. Null value * are not allowed.- Throws:
InvalidParameterException- if thepackage's positionrefers to a location positioned outside the current layerIllegalArgumentException- in case there are multiple script packages registered with this class
-
setThemePackage
Sets the package that contains the css files used for the thematization. Each layer has only one package containing the themes; it is not possible, therefore, to define files with the partial css to be added up to those of another layer.- Parameters:
themePackage- the instance that points to the package containing the themes files. Null value * are not allowed.- Throws:
InvalidParameterException- if thepackage's positionrefers to a location positioned outside the current layer
-
setLangPackage
Sets the package that contains the language files used for the translations. Each layer has only one package containing the translations; it is not possible, therefore, to define files with the partial translations to be added up to those of another layer.- Parameters:
langPackage- the instance that points to the package containing the translation files. Null value * are not allowed.- Throws:
InvalidParameterException- if thepackage's positionrefers to a location positioned outside the current layer
-
addPermissions
Adds a collection of functions. The functions added to a layer are intendend to have different names otherwise the conflict resolution in not defined.- Parameters:
ff- the instance of functions to be added. Null value is not allowed.
-
addGrants
Adds a collection of functions. The functions added to a layer are intendend to have different names otherwise the conflict resolution in not defined.- Parameters:
gg- the instance of grants to be added. Null value is not allowed.
-
addLanding
Adds a Landing page. The landing added to a layer are intended to have different names otherwise the conflict resolution in not defined.- Parameters:
l- the instance of landing to be added. Null value is not allowed.
-
addLandingTree
Adds a LandingTree instance from which will extract the landing pages related to an XML resource.- Parameters:
lt- the instance of LandingTree to be added. Null value is not allowed.
-
getPermissions
retrieves thePermissioncollection of functions possibly used inside the layer.- Returns:
- the layer's functions.
-
getGrants
retrieves the functions granted by this layer.- Returns:
- the layer's grants.
-
getOvers
Method used to retrieve the classes of the layer from which this depends.- Returns:
- the over layer's classes. The empty list means that this layer doesn't depends from any other layer.
-
getCustomPackages
Method used to retrieve the packages that customize an over layer's package.- Returns:
- the custom packages of this layer. The empty list means that this layer has no customizations.
-
getCustomClasses
Method used to retrieve the classes that customize an over layer's resource.- Returns:
- the custom classes defined by this layer. The empty map means that this layer has no class customizations.
-
getComponents
Method used to retrieve the classes of the library components registered into this layer (e.g. a graphics component)- Returns:
- the map containing the names and the classes of the components registered into this layer. The empty list means that this layer has library components.
-
getScriptPackages
Method used to retrieve the packages containing the SQL script that belong to this layer- Returns:
- the script packages of this layer. The empty list means that this layer has no sql script packages.
-
getScriptPackage
Retrieves the instance of the script package from its name.- Parameters:
name- name of the script package you want to get the instance of- Returns:
- the instance of the script package or null in case there is no package associated with this name
-
getScriptPackage
Retrieves the instance of the script package from its class.- Parameters:
cls- class of the script package you want to get the instance of- Returns:
- the instance of the script package or null in case there is no package associated with this class
- Throws:
IllegalArgumentException- in case there are multiple script package registered with this class
-
getThemePackage
Method used to retrieve the package containing the themes that belong to this layer- Returns:
- the theme package of this layer or null if this layer has no themes.
-
getLangPackage
Method used to retrieve the package containing the translation files that belong to this layer- Returns:
- the language package of this layer or null if this layer has no translation.
-
hashCode
public int hashCode() -
equals
-