public function main()
    {
        if (empty($this->message)) {
            throw new BuildException(
                '"message" attribute cannot be empty'
            );
        }

        $notifications = [
            $this->notification
        ];
        $options = [
            'host' => $this->host,
            'protocol' => $this->protocol,
        ];
        if (!empty($this->appicon)) {
            $options['AppIcon'] = $this->appicon;
        }

        try {
            if ($this->growl instanceof Net_Growl) {
                $growl = $this->growl;
            } else {
                $growl = Net_Growl::singleton(
                    $this->name,
                    $notifications,
                    $this->password,
                    $options
                );
            }
            $response = $growl->register();

            if ($this->protocol == 'gntp') {
                if ($response->getStatus() != 'OK') {
                    throw new BuildException(
                        'Growl Error ' . $response->getErrorCode() .
                        ' - ' . $response->getErrorDescription()
                    );
                }
            }
            $this->log(
                'Application ' . $this->name . ' registered',
                Project::MSG_VERBOSE
            );

            $logRequest = [
                'Application-Name' => $this->name,
                'Application-Icon' => $this->appicon,
                'Notification-Name' => $this->notification,
                'Notification-Title' => $this->title,
                'Notification-Text' => $this->message,
                'Notification-Priority' => $this->priority,
                'Notification-Icon' => $this->icon,
                'Notification-Sticky' => $this->sticky,
            ];
            foreach ($logRequest as $key => $value) {
                $this->log($key . ': ' . $value, Project::MSG_DEBUG);
            }

            $options = [
                'sticky' => $this->sticky,
                'priority' => $this->priority,
                'icon' => $this->icon,
            ];
            $response = $growl->publish(
                $this->notification,
                $this->title,
                $this->message,
                $options
            );

            if ($this->protocol == 'gntp') {
                if ($response->getStatus() != 'OK') {
                    throw new BuildException(
                        'Growl Error ' . $response->getErrorCode() .
                        ' - ' . $response->getErrorDescription()
                    );
                }
            }
            $this->log('Notification was sent to remote host ' . $this->host);
        } catch (Net_Growl_Exception $e) {
            throw new BuildException(
                'Growl Exception : ' . $e->getMessage()
            );
        }
    }