App-Oozie

 view release on metacpan or  search on metacpan

lib/App/Oozie/XML.pm  view on Meta::CPAN

package App::Oozie::XML;

use 5.014;
use strict;
use warnings;

our $VERSION = '0.016'; # VERSION

use namespace::autoclean -except => [qw/_options_data _options_config/];

use App::Oozie::Constants qw(
    EMPTY_STRING
    LAST_ELEM
    MIN_OOZIE_SCHEMA_VERSION_FOR_SLA
    MIN_OOZIE_SLA_VERSION
    RE_COLON
    RE_DOT
    XML_LOCALNAME_POS
    XML_NS_FIRST_POS
    XML_UNPACK_LOCALNAME_POS
    XML_VERSION_PADDING
    XML_VERSION_POS
);
use App::Oozie::Types::Common qw( IsFile );
use App::Oozie::Util::Misc    qw( resolve_tmp_dir );

use Archive::Zip;
use Clone qw( clone );
use File::Temp ();
use Text::Trim qw( trim );
use Moo;
use MooX::Options;
use Ref::Util qw( is_ref is_hashref is_arrayref is_scalarref );
use Scalar::Util qw( blessed );
use Types::Standard qw( Str );
use XML::Compile::Cache;
use XML::Compile::Util;
use XML::LibXML;

with qw(
    App::Oozie::Role::Log
    App::Oozie::Role::Fields::Generic
);

# These are cache variables holding the Oozie spec.
#
my($XML_SCHEMA, %XML_NAMESPACE);

has prefix => (
    is  => 'rw',
    isa => Str,
);

has data => (
    is       => 'rw',
    default  => undef,
);

has writer => (
    is       => 'lazy',
    builder  => sub { $XML_SCHEMA->writer( $XML_NAMESPACE{ shift->prefix } ) },
    init_arg => undef,
);

has oozie_client_jar => (
    is       => 'rw',
    isa      => IsFile,
    required => 1,
);

has zip => (
    is      => 'ro',
    default => sub { Archive::Zip->new },
);

has schema => (
    is      => 'lazy',
    default => sub { $XML_SCHEMA },
);

has namespace => (
    is      => 'lazy',
    default => sub { \%XML_NAMESPACE },
);

sub BUILD {
    my ($self, $args) = @_;

    $XML_SCHEMA ||= $self->_build_schema;

    $self->_init_data($args)
        if defined $self->data;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.491 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )