H-Sphere Developer Guide

Global Resources And Resource Dependencies

(version 2.5 and higher)

 

In version 2.5, the working scheme for global resources in H-Sphere was improved. To simplify describing and provide flexible access mechanism, it was logically split into two tiers: 'globals' and 'resource dependencies'. Globals are parent resources such as MySQL, MSSQL, VPS, etc. Resource dependencies list resources that require other (parent) resources enabled.

 

globals.xml

This file lists global resources. Location: ~cpanel/shiva/psoft/hsphere/globals.xml
Example of globals.xml

DTD scheme:

<!DOCTYPE globals [
<!ELEMENT globals (section+)>
<!ELEMENT section ((object | set)*)>
<!ELEMENT object (check_config?)>
<!ELEMENT set (check_config?)>
<!ELEMENT check_config (property+ | variant+)>
<!ELEMENT variant (property+)>
<!ELEMENT property EMPTY>

<!ATTLIST section id CDATA #REQUIRED>
<!ATTLIST section label CDATA #IMPLIED>
<!ATTLIST section description CDATA #IMPLIED>
<!ATTLIST section show (globals | plans | invisible) "*">
<!ATTLIST section store (settings | plans | custom) "*">
<!ATTLIST section online_help CDATA #IMPLIED>
<!ATTLIST object name CDATA #REQUIRED>
<!ATTLIST object label CDATA #IMPLIED>
<!ATTLIST object label_enabled CDATA #IMPLIED>
<!ATTLIST object label_disabled CDATA #IMPLIED>
<!ATTLIST object default (enabled | disabled) "enabled">
<!ATTLIST set name CDATA #REQUIRED>
<!ATTLIST set label CDATA #REQUIRED>
<!ATTLIST set default (enabled | disabled) "enabled">
<!ATTLIST set class CDATA #REQUIRED>
<!ATTLIST set managed (globally | reseller) "globally">
<!ATTLIST property key CDATA #REQUIRED>
<!ATTLIST property value CDATA "*">
]>

Elements and attributes:

  • section: the way to combine several 'global' objects or sets into a group and to show in the CP interface in suitable form
    • id: mnemonic identifier; mandatory attribute, the rest are non-mandatory
    • label: a key having correspondences in the language bundle files
    • description: a key, like the above one, for the text describing some peculiarities of the section
    • online_help: a key having correspondence in the online_help.xml file. You may choose which one of 'description' or 'online_help' is more suitable in each particular case.
    • show: by default is set to show always. If necessary, you may restrict this rule by specifying one of the following values:
      • globals: to show in master admin's 'globals' menu
      • plans: to show in reseller plan wizards only
      • invisible: to exclude the section from standard page flow and show it somewhere else on the page calling it by hand (e.g.: admin.getGlobalSection)
    • store: by default, it is set to store section object status as in the 'settings' table of the 'plan_value" table for reseller plans. Be careful with this attribute, it should mainly correspond to the attribute 'show'. If you, for instance, set it to 'settings', however the section exists in reseller plan wizards, the values won't be stored in the 'plan_value' table. Vice versa, if the attribute is set to "*", whereas the section is absent on the 'globals' page, you will lose all values in the 'settings' table, and each request to check whether an object is disabled or enabled will return the value basing on the 'default' status described below.
  • object: an H-Sphere resource or a simple value. An example of 'global' object is 'cp_ssl_ip_based'. By default, all global objects are "enabled" if their status is not set neither in the 'settings' table nor in 'plan_value'.
    • default: if necessary, you may change it to 'disabled'
    • name: mandatory attribute, the rest attributes are non-mandatory
    • label: the same as for 'section'
    • label_enabled, label_disabled: replace the 'label' attribute and are used to show the object as radio button instead of checkbox
  • set: the way to describe a group of entities where each of them contains a unique key, description and status. An example of a set is "Logical Server Groups". Each server group has a key which is group id, description and status. Due to significant difficulties to describe each global set in XML, the behavior of this type of 'globals' is realized by a Java class specified with attribute 'class'. The other attributes 'label' and 'default' are described above.
    • managed: this attribute shows if this global resource, being managed by admin, is also manageable by reseller: managed="reseller". In particular, this is implemented in dedicated server template where resellers can set prices for templates provided by main hosting provider (admin).
      If managed is not set, it is considered to be "globally" by default (i.e., not manageable by resellers).
  • check_config: each of the objects/sets described above may require additional checks whether it is configured to work properly in the ~cpanel/shiva/psoft_config/hsphere.properties file. To provide this, the additional structure is added:
    <check_config>
          <property key="..."/>
          <property key="..."/>
          ....
    </check_config>
    

    The above structure requires that each of the listed property keys is specified in hsphere.properties and has non-zero values. Beside this, you may restrict the requirements by adding the value attribute which defines the exact property value to be specified.

    There is also a more flexible scheme if you need to provide alternative variants of property key sets:

    <check_config>
        <!-- Variant 1 -->
        <variant>
            <property key="..."/>
            <property key="..."/>
            ....
        </variant>
        <!-- Variant 2 -->
        <variant>
            <property key="..."/>
            <property key="..."/>
            ....
        </variant>
    ...
    </check_config>
    

    This means that an object has either Variant 1 of each of the specified properties set, or Variant 2 with its list of properties set, etc.

    Note: The same scheme works for describing resource dependencies in resource_dependences.xml (see below). For example:

    <resource name="hosting">
        <variant>
            <requires name="domain" relation="parent"/>
        </variant>
        <variant>
            <requires name="parked_domain" relation="parent"/>
        </variant>
        <variant>
            <requires name="3ldomain" relation="parent"/>
        </variant>
    </resource>
    

    Here, the hosting resource can be a child resource for either domain (Transfered Domain), or 3ldomain (Third-Level Domain), or parked_domain (Parked Domain) resources.

 

resource_dependences.xml

This file describes relationships between parent and dependent resources. Location: ~cpanel/shiva/psoft/hsphere/resource_dependences.xml
Example of resource_dependences.xml

This xml file is based on the following DTD:


<!DOCTYPE dependences [
  <!ELEMENT dependences (resource+)>
  <!ELEMENT resource (requires+ | variant+)>
  <!ELEMENT variant (requires+)>
  <!ELEMENT requires EMPTY>

  <!ATTLIST resource name CDATA #REQUIRED>
  <!ATTLIST requires name CDATA #REQUIRED>
  <!ATTLIST requires relation (parent) #IMPLIED>
]>

 

List of Resource Dependencies

Note: This table of resource dependencies is listed here as an example for H-Sphere 2.5 Beta 1. It will be modified with subsequent H-Sphere versions.

 

Dependent Resource Parent Resource(s)
miva empresa
oscommerce MySQL
miva_lic_manager miva
urchin_lic_manager urchin
MySQLDatabase MySQL
MySQLUser MySQL
mysqldb_quota MySQL
MSSQLLogin MSSQL
MSSQLDatabase MSSQL
MSSQLUser MSSQL
MSSQLQuota MSSQL
pgsqldatabase pgsql
pgsqluser pgsql
pgsqldb_quota pgsql
real_user realserver_user
real_server_traffic realserver_user
winquota realserver_user
cfentry cf
mnogosearch MySQL
phpbb php, MySQL
asp_secured asp
sshresource sshmanager
vps_ip vps
vps_mem_limit vps
vps_proc_limit vps
vps_ip_traffic vps
kanoodlemanager kanoodle
ds_custom_build ds_enable
ds_manager ds_enable
ds_reboot_enable ds_enable
ds_backup_enable ds_enable
allow_ds_resell ds_enable
allow_own_ds ds_enable
ds ds_enable
ds_bandwidth ds
cf_dsn_record odbc, cf

 



© Copyright 1998-2006. Positive Software Corporation.
All rights reserved.