Commit | Line | Data |
4536f655 |
1 | # File: Stem/Hub.pm |
2 | |
3 | # This file is part of Stem. |
4 | # Copyright (C) 1999, 2000, 2001 Stem Systems, Inc. |
5 | |
6 | # Stem is free software; you can redistribute it and/or modify |
7 | # it under the terms of the GNU General Public License as published by |
8 | # the Free Software Foundation; either version 2 of the License, or |
9 | # (at your option) any later version. |
10 | |
11 | # Stem is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | # GNU General Public License for more details. |
15 | |
16 | # You should have received a copy of the GNU General Public License |
17 | # along with Stem; if not, write to the Free Software |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | |
20 | # For a license to use the Stem under conditions other than those |
21 | # described here, to purchase support for this software, or to purchase a |
22 | # commercial warranty contract, please contact Stem Systems at: |
23 | |
24 | # Stem Systems, Inc. 781-643-7504 |
25 | # 79 Everett St. info@stemsystems.com |
26 | # Arlington, MA 02474 |
27 | # USA |
28 | |
29 | package Stem::Hub ; |
30 | |
31 | use Stem::Trace 'log' => 'stem_status', 'sub' => 'TraceStatus' ; |
32 | use Stem::Trace 'log' => 'stem_error' , 'sub' => 'TraceError' ; |
33 | |
34 | use strict ; |
35 | use Carp ; |
36 | use Sys::Hostname ; |
37 | |
38 | use Stem::Vars ; |
39 | |
40 | $Stem::Vars::Hub_name = '' ; |
41 | $Stem::Vars::Program_name = $0 ; |
42 | $Stem::Vars::Host_name = hostname() ; |
43 | |
44 | Stem::Route::register_class( __PACKAGE__, 'hub' ) ; |
45 | |
46 | my $attr_spec = [ |
47 | |
48 | { |
49 | 'name' => 'reg_name', |
50 | 'help' => <<HELP, |
51 | The registration name is used to name this Hub. |
52 | HELP |
53 | }, |
54 | |
55 | ] ; |
56 | |
57 | |
58 | ########### |
59 | # This POD section is autoegenerated. Any edits to it will be lost. |
60 | |
61 | =head2 Constructor Attributes for Class Stem::Hub |
62 | |
63 | =over 4 |
64 | |
65 | |
66 | =item * Attribute - B<reg_name> |
67 | |
68 | =over 4 |
69 | |
70 | |
71 | =item Description: |
72 | The registration name is used to name this Hub. |
73 | |
74 | |
75 | =back |
76 | |
77 | =back |
78 | |
79 | =cut |
80 | |
81 | # End of autogenerated POD |
82 | ########### |
83 | |
84 | |
85 | |
86 | |
87 | sub new { |
88 | |
89 | my( $class ) = shift ; |
90 | |
91 | my $self = Stem::Class::parse_args( $attr_spec, @_ ) ; |
92 | return $self unless ref $self ; |
93 | |
94 | $Stem::Vars::Hub_name = $Env{ 'hub_name' } || |
95 | $self->{ 'reg_name' } || |
96 | $Stem::Vars::Program_name ; |
97 | |
98 | TraceStatus "hub name is '$Stem::Vars::Hub_name'" ; |
99 | |
100 | ########################### |
101 | ########################### |
102 | # add code to open hub log |
103 | # |
104 | ########################### |
105 | ########################### |
106 | |
107 | return ; |
108 | } |
109 | |
110 | sub status_cmd { |
111 | |
112 | my $hub = $Stem::Vars::Hub_name || 'NONE' ; |
113 | |
114 | return <<STATUS ; |
115 | |
116 | Hub Status |
117 | |
118 | Name: $hub |
119 | Host: $Stem::Vars::Host_name |
120 | Program: $Stem::Vars::Program_name |
121 | |
122 | STATUS |
123 | |
124 | } |
125 | |
126 | 1 ; |