phpDocumentor ModuleWriting
[ class tree: ModuleWriting ] [ index: ModuleWriting ] [ all elements ]

Class: Device_TestModule

Source Location: /devices/test_module/TestModule.php

Class Device_TestModule

Class Overview

This is the main implementation class of the module

The name of the class must the the 'Device_' followed by the name of the module file (without the '.php' extension), so in this case the file is "TestModule.php" and the class is Device_TestModule.

The class should only define one public method: writeInstaller.

All other methods and properties should be private. This example sets zipInstaller method to protected, so that it can be seen in the documentation.

Located in /devices/test_module/TestModule.php [line 45]

DeviceConfig
   |
   --Device_TestModule
Author(s): Information Tags:

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From DeviceConfig

DeviceConfig::$attributes
DeviceConfig::$FPATH
DeviceConfig::$lang_index
DeviceConfig::$module_path
DeviceConfig::$selected_eap
DeviceConfig::$sign

Inherited From DeviceConfig

DeviceConfig::copyFile()
Copy a file from the module location to the temporary directory.
DeviceConfig::dumpAttibutes()
dumps attributes for debugging purposes
DeviceConfig::saveCertificateFiles()
Save certificate files in either DER or PEM format
DeviceConfig::setup()
Set up working environment for a device module
DeviceConfig::translateFile()
Copy a file from the module location to the temporary directory aplying translation.
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]
Method Summary
Device_TestModule   __construct()   Constructs a Device object.
void   writeInstaller()   prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer
void   zipInstaller()   zip files and return the archive name

[ Top ]
Methods
Constructor __construct  [line 56]

  Device_TestModule __construct( string $device  )

Constructs a Device object.

It is CRUTCIAL that the constructor sets $this->supportedEapMethods to an array of methods available for the particular device.

Parameters:
string   $device:  a pointer to a device module, which must be an index of one of the devices defined in the Devices array in devices.php.

API Tags:
Access:  public

Information Tags:
Final:  not to be redefined

[ Top ]
writeInstaller  [line 68]

  void writeInstaller( $profile  )

prepare a zip archive containing files and settings which normally would be used inside the module to produce an installer

  1. function writeInstaller(Profile $profile{
  2.    /* run innitial setup
  3.       this will:
  4.        - create the temporary directory and save its path as $this->FPATH
  5.        - process the CA certificates and store results in $this->attributes['internal:CAs'][0]
  6.             $this->attributes['internal:CAs'][0] is an array of processed CA certificates
  7.             a processed certifincate is an array 
  8.                'pem' points to pem feromat certificate
  9.                'der' points to der format certificate
  10.                'md5' points to md5 fingerprint
  11.                'sha1' points to sha1 fingerprint
  12.                'name' points to the certificate subject
  13.        - save the info_file (if exists) and put the name in $this->attributes['internal:info_file_name'][0]
  14.    */
  15. debug(4,"Test Module Installer start\n");
  16.    // create certificate files and save their names in $CA_files arrary
  17.      $CA_files $this->saveCertificateFiles('der');
  18. // tkip-profile is currently used only by Windows
  19. //     $tkip_profile_name = 'eduroam (TKIP)';
  20.   
  21.     // copy a fixed file from the module Files directory
  22.        if($this->copyFile('Module.howto'))
  23.           debug(2"copying of Module.howto failed\n");
  24.     // copy a fixed file from the module Files directory and saveunde a different name
  25.        if$this->copyFile('test_file','copied_test_file'))
  26.           debug(2"copying of Module.howto to copied_test_file failed\n");
  27.        $this->dumpAttibutes('profile_attributes');
  28.     $installer_path =  $this->zipInstaller($this->attributes);
  29.     return($installer_path);
  30.    }

Parameters:
Profile   $profile: 

API Tags:
Access:  public


Redefinition of:
DeviceConfig::writeInstaller()
placeholder for the main device method

[ Top ]
zipInstaller  [line 105]

  void zipInstaller( $attr  )

zip files and return the archive name

inline

  1. function zipInstaller($attr{
  2.     $e preg_replace('/ +/','_',$attr['internal:inst_name'][0]).'.zip';
  3.     $o system('zip -q '.$e.' *');
  4.     return $e;
  5.   }
return string

Parameters:
   $attr: 

API Tags:
Access:  protected


[ Top ]

Documentation generated on Fri, 05 Aug 2011 15:56:30 +0200 by phpDocumentor 1.4.3