Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit a54c601b5ce7196af541f6c1f5bc757d4c49a1f7 @dominikschulz committed with Nov 24, 2012
@@ -0,0 +1,14 @@
+blib*
+.build/
+Makefile
+Makefile.old
+Build
+Build.bat
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+cover_db
+pod2htm*.tmp
+Monitoring-Spooler-*
+Debian_CPANTS.txt
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+# ABSTRACT: the monitoring spooler api cgi endpoint
+# PODNAME: mon-spooler-api.cgi
+use strict;
+use warnings;
+
+use Plack::Loader;
+
+my $app = Plack::Util::load_psgi('mon-spooler-api.psgi');
+Plack::Loader::->auto->run($app);
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+# ABSTRACT: the monitoring spooler api plack endpoint
+# PODNAME: mon-spooler-api.psgi
+use strict;
+use warnings;
+
+use lib '../lib';
+
+use Monitoring::Spooler::Web::API;
+
+my $Frontend = Monitoring::Spooler::Web::API::->new();
+my $app = sub {
+ my $env = shift;
+
+ return $Frontend->run($env);
+};
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+# ABSTRACT: the monitoring spooler frontend cgi endpoint
+# PODNAME: mon-spooler.cgi
+use strict;
+use warnings;
+
+use Plack::Loader;
+
+my $app = Plack::Util::load_psgi('mon-spooler.psgi');
+Plack::Loader::->auto->run($app);
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+# ABSTRACT: the monitoring spooler cli
+# PODNAME: mon-spooler.pl
+use strict;
+use warnings;
+
+use Monitoring::Spooler::Cmd;
+
+# All the magic is done using MooseX::App::Cmd, App::Cmd and MooseX::Getopt
+my $MonSpooler = Monitoring::Spooler::Cmd::->new();
+$MonSpooler->run();
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+# ABSTRACT: the monitoring spooler frontend plack endpoint
+# PODNAME: mon-spooler.cgi
+use strict;
+use warnings;
+
+use lib '../lib';
+
+use Plack::Builder;
+use Monitoring::Spooler::Web::Frontend;
+
+my $Frontend = Monitoring::Spooler::Web::Frontend::->new();
+my $app = sub {
+ my $env = shift;
+
+ return $Frontend->run($env);
+};
+
+my $static_path = $Frontend->config()->get('Monitoring::Spooler::Frontend::StaticPath');
+if(!-d $static_path) {
+ # TODO use ShareDir ...
+ $static_path = 'res/';
+}
+
+builder {
+ enable 'Plack::Middleware::Static',
+ path => qr{^/(images|js|css)/}, root => $static_path;
+ $app;
+};
@@ -0,0 +1,41 @@
+<Monitoring>
+ <Spooler>
+ NegatingTrigger = 1
+ DBFile = /var/lib/mon-spooler/db.sqlite3
+ <Frontend>
+ TemplatePath = /var/lib/mon-spooler/tpl
+ StaticPath = /var/lib/mon-spooler/res
+ </Frontend>
+ <Transport>
+ <Sipgate>
+ Username = Test
+ Password = Test
+ Priority = 1
+ </Sipgate>
+ <Smstrade>
+ Apikey = xyz
+ Route = basic
+ Priority = 99
+ </Smstrade>
+ <FreeSwitch>
+ hostname = localhost
+ port = 8021
+ password = pass
+ priority = 1
+ url = sofia/gateway/provider.tld
+ # url = freetdm/1/
+ defaultaudio = /var/lib/mon-spooler/audio/default_alarm_multi.wav
+ </FreeSwitch>
+ <Pjsua>
+ sipid = sip:user@sipgate.de
+ registrar = sip:sipgate.de
+ realm = *
+ username = user
+ password = pass
+ outbound = sip:sipgate.de
+ stunsrv = stun.sipgate.net:10000
+ Priority = 99
+ </Pjsua>
+ </Transport>
+ </Spooler>
+</Monitoring>
@@ -0,0 +1,51 @@
+name = Monitoring-Spooler
+author = Dominik Schulz <tex@cpan.org>
+license = Perl_5
+copyright_holder = Dominik Schulz
+copyright_year = 2012
+
+version = 0.01
+
+[GatherDir]
+exclude_filename = README.pod
+exclude_match = ^doc.*
+exclude_match = ^cover.*
+
+[PruneCruft]
+[Authority]
+[PkgVersion]
+[MetaJSON]
+[ExtraTests]
+[PodSyntaxTests]
+[NoTabsTests]
+[EOLTests]
+
+[Manifest]
+[MakeMaker]
+
+[AutoPrereqs]
+[Prereqs / BuildRequires]
+[Prereqs]
+[Prereqs / Recommends]
+
+[Git::CheckFor::CorrectBranch]
+release_branch = master
+
+[@Git]
+tag_format = version_%v
+
+[GitHub::Meta]
+repo = Monitoring-Spooler
+
+[Twitter]
+hash_tags = #cpan
+
+[PodWeaver]
+
+[MetaYAML]
+[License]
+[ReadmeFromPod]
+
+[CheckChangeLog]
+[ConfirmRelease]
+[UploadToCPAN]
@@ -0,0 +1,5 @@
+use strict;
+use warnings;
+package Monitoring::Spooler;
+
+1;
@@ -0,0 +1,49 @@
+package Monitoring::Spooler::Cmd;
+
+use 5.010_000;
+use mro 'c3';
+use feature ':5.10';
+
+use Moose;
+use namespace::autoclean;
+
+# use IO::Handle;
+# use autodie;
+# use MooseX::Params::Validate;
+# use Carp;
+# use English qw( -no_match_vars );
+# use Try::Tiny;
+
+our $VERSION = '@VERSION@';
+
+# extends ...
+extends 'MooseX::App::Cmd';
+# has ...
+# with ...
+# initializers ...
+
+# your code here ...
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Monitoring::Spooler::Cmd - Command base class.
+
+=head1 SYNOPSIS
+
+ use Monitoring::Spooler::Cmd;
+ my $Mod = Monitoring::Spooler::Cmd::->new();
+
+=head1 DESCRIPTION
+
+This class is the base class for any command implemented by its subclasses.
+
+It is a mere requirement by App::Cmd. Don't mess with it.
+
+=cut
@@ -0,0 +1,105 @@
+package Monitoring::Spooler::Cmd::Command;
+# ABSTRACT: baseclass for and CLI command
+
+use 5.010_000;
+use mro 'c3';
+use feature ':5.10';
+
+use Moose;
+use namespace::autoclean;
+
+# use IO::Handle;
+# use autodie;
+# use MooseX::Params::Validate;
+# use Carp;
+# use English qw( -no_match_vars );
+# use Try::Tiny;
+use DBI;
+use Config::Tree;
+use Log::Tree;
+use Monitoring::Spooler::DB;
+
+# extends ...
+extends 'MooseX::App::Cmd::Command';
+# has ...
+has '_config' => (
+ 'is' => 'rw',
+ 'isa' => 'Config::Tree',
+ 'lazy' => 1,
+ 'builder' => '_init_config',
+ 'accessor' => 'config',
+);
+
+has '_logger' => (
+ 'is' => 'rw',
+ 'isa' => 'Log::Tree',
+ 'lazy' => 1,
+ 'builder' => '_init_logger',
+ 'accessor' => 'logger',
+);
+
+has '_dbh' => (
+ 'is' => 'rw',
+ 'isa' => 'Monitoring::Spooler::DB',
+ 'lazy' => 1,
+ 'builder' => '_init_dbh',
+ 'accessor' => 'dbh',
+);
+# with ...
+# initializers ...
+sub _init_dbh {
+ my $self = shift;
+
+ my $DBH = Monitoring::Spooler::DB::->new({
+ 'config' => $self->config(),
+ 'logger' => $self->logger(),
+ });
+
+ return $DBH;
+}
+
+sub _init_config {
+ my $self = shift;
+
+ my $Config = Config::Tree::->new({
+ 'locations' => [qw(conf /etc/mon-spooler)],
+ });
+
+ return $Config;
+}
+
+sub _init_logger {
+ my $self = shift;
+
+ my $Logger = Log::Tree::->new('mon-spooler');
+
+ return $Logger;
+}
+
+# your code here ...
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Monitoring::Spooler::Cmd::Command - Base class for any command.
+
+=head1 SYNOPSIS
+
+ use Monitoring::Spooler::App;
+ my $Mod = Monitoring::Spooler::App::->new();
+
+=head1 DESCRIPTION
+
+Some description.
+
+=method _check_tables
+
+Create all necessary tables if they don't already exist.
+
+=cut
Oops, something went wrong.

0 comments on commit a54c601

Please sign in to comment.