package xmlfilecheck::xsdxsltcheck;

use 5.008005;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use xmlfilecheck::xsdxsltcheck ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.


# Preloaded methods go here.

package xsdxsltcheck;

use 5.008005;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

our @EXPORT = qw(xsdcheck xsltcheck FGDC2MRFcheck xsl4mrf2fgdccheck);

our $VERSION = '0.01';

sub xsdcheck {
my $check=shift @_;
my $xsd = "/mt/apps/gpms/xsd";

if (-e "$xsd/Atlas.xsd"){
my $answer="OK";
}else{
print "$xsd/Atlas.xsd could not be found!";
exit(1);
};

if (-e "$xsd/CitationInformation.xsd"){
}else{
print "$xsd/CitationInformation.xsd";
exit(1);
};

if (-e "$xsd/ContactInformation.xsd"){
}else{
print "$xsd/DataQualityInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/DataQualityInformation.xsd"){
}else{
print "$xsd/DataQualityInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/DistributionInformation.xsd"){
}else{
print "$xsd/DistributionInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Edges.xsd"){
}else{
print "$xsd/Edges.xsd!!\n";
exit(1);
};

if (-e "$xsd/EntityAndAttributeInformation.xsd"){
}else{
print "$xsd/EntityAndAttributeInformation.xsd!!\n";
exit(1);
};

if (-e "$xsd/IdentificationInformation.xsd"){
}else{
print "$xsd/IdentificationInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Legacy.xsd"){
}else{
print "$xsd/Legacy.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Map.xsd"){
}else{
print "$xsd/Map.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/MetadataReferenceInformation.xsd"){
}else{
print "$xsd/MetadataReferenceInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/MiscTypesAndGroups.xsd"){
}else{
print "$xsd/MiscTypesAndGroups.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Planned.xsd"){
}else{
print "$xsd/Planned.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/SpatialDataOrganizationInformation.xsd"){
}else{
print "$xsd/SpatialDataOrganizationInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/SpatialReferenceInformation.xsd"){
}else{
print "$xsd/SpatialReferenceInformation.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Tabular.xsd"){
}else{
print "$xsd/Tabular.xsd could not be found!!\n";
exit(1);
};

if (-e "$xsd/Vector.xsd"){
}else{
print "$xsd/Vector.xsd could not be found!!\n";
exit(1);
};

#};

};



sub xsltcheck{

my $xslt ="/mt/apps/gpms/xsl";

my $checkxslt=shift @_;

if (-e "$xslt/DataQualityInformation.xsl"){
}else{
print "$xslt/DataQualityInformation.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/DistributionInformation.xsl"){
}else{
print "$xslt/DistributionInformation.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/EntityAndAttributeInformation.xsl"){
}else{
print "$xslt/EntityAndAttributeInformation.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/IdentificationInformation.xsl"){
}else{
print "$xslt/IdentificationInformation.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/MetadataReferenceInformation.xsl"){
}else{
print "$xslt/MetadataReferenceInformation.xsl  could not be found!!\n";
exit(1);
};

if (-e "$xslt/MIF2MRF.xsl"){
}else{
print "$xslt/MIF2MRF.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/SpatialDataOrganizationInformation.xsl"){
}else{
print "$xslt/SpatialDataOrganizationInformation.xsl could not be found!!\n";
exit(1);
};

if (-e "$xslt/SpatialReferenceInformation.xsl"){
}else{
print "$xslt/SpatialReferenceInformation.xsl could not be found!!\n";
exit(1);
};


};


sub FGDC2MRFcheck {
my $FGDC2MRF = "/mt/apps/gpms/FGDC2MRF";

if (-e "$FGDC2MRF/01_idinfo_planned.xsl"){
}else{
print "$FGDC2MRF/01_idinfo_planned.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/01_idinfo.xsl"){
}else{
print "$FGDC2MRF/01_idinfo.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/02_dataqual_map.xsl"){
}else{
print "$FGDC2MRF/02_dataqual_map.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/02_dataqual_tab.xsl"){
}else{
print "$FGDC2MRF/02_dataqual_tab.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/02_dataqual.xsl"){
}else{
print "$FGDC2MRF/02_dataqual.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/03_spdoinfo.xsl"){
}else{
print "$FGDC2MRF/03_spdoinfo.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/04_spref.xsl"){
}else{
print "$FGDC2MRF/04_spref.xsl could not be found!!\n";
exit(1);
};


if (-e "$FGDC2MRF/05_eainfo.xsl"){
}else{
print "$FGDC2MRF/05_eainfo.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/06_distinfo.xsl"){
}else{
print "$FGDC2MRF/06_distinfo.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/07_metainfo.xsl"){
}else{
print "$FGDC2MRF/07_metainfo.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_atlas.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_atlas.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_edges.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_edges.xsl  could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_legacy.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_legacy.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_map.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_map.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_planned.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_planned.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_tabular.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_tabular.xsl could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif_vector.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif_vector.xsl  could not be found!!\n";
exit(1);
};

if (-e "$FGDC2MRF/FGDC2mif.xsl"){
}else{
print "$FGDC2MRF/FGDC2mif.xsl could not be found!!\n";
exit(1);
};



};

sub xsl4mrf2fgdccheck{
my $xsl4mrf2fgdc= "/mt/apps/gpms/xsl/xsl4mrf2fgdc";

if (-e "$xsl4mrf2fgdc/01_Identification_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/01_Identification_Information.xsl could not be found!!\n";
exit(1);
};


if (-e "$xsl4mrf2fgdc/02_Data_Quality_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/02_Data_Quality_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/03_Spatial_Data_Organization_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/03_Spatial_Data_Organization_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/04_Spatial_Reference_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/04_Spatial_Reference_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/05_Entity_And_Attribute_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/05_Entity_And_Attribute_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/06_Distribution_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/06_Distribution_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/07_Metadata_Reference_Information.xsl"){
}else{
print "$xsl4mrf2fgdc/07_Metadata_Reference_Information.xsl could not be found!!\n";
exit(1);
};

if (-e "$xsl4mrf2fgdc/MRF2FGDC.xsl"){
}else{
print "$xsl4mrf2fgdc/MRF2FGDC.xsl could not be found!!\n";
exit(1);
};


};


1;
__END__
# Below is stub documentation for your module. You'd better edit it!

 NAME

xmlfilecheck::xsdxsltcheck - Perl extension for checking that the appropriate xsd and xslt files exist in the /mt/apps/gpms/  directory. These files are needed to run FGDC_TVBatch and MIF_TVBatch. 

SYNOPSIS

  use xmlfilecheck::xsdxsltcheck;
  
If you are not an administrator or if the module is a standard Perl module(which it is not), you can do the following:
use lib "/home/mccre004/GPMSscripts/module/xmlfilecheck-xsdxsltcheck/lib"
use xsdxsltcheck;

Where /home/mccre004/GPMSscripts/module is the locatation xsdxsltcheck module on your directory.

DESCRIPTION

The xsdxsltcheck.pm module checks that the appropriate xslt and xsds files exist in order to run FGDC_TVBatch and MIF_TVBatch.If the files do not exist, the user is warned. This module contains four subroutines: xsdcheck, xsltcheck, FGDC2MRFcheck and  xsl4mrf2fgdccheck.

The xsdcheck subroutine checks for the existance of all the xsd files in the /mt/apps/gpms/xsd directory. These files are used to make sure that the xml input files comply to the GPMS standard. These files are need by both FGDC_TVBatch and MIF_TVBatch. The files the subroutine checks for are: Atlas.xsd, CitationInformation.xsd, ContactInformation.xsd,                         DataQualityInformation.xsd, DistributionInformation.xsd, Edges.xsd, EntityAndAttributeInformation.xsd,                        IdentificationInformation.xsd, Legacy.xsd, Map.xsd, MetadataReferenceInformation.xsd, MiscTypesAndGroups.xsd, Planned.xsd,    SpatialDataOrganizationInformation.xsd, SpatialReferenceInformation.xsd, Tabular.xsd and Vector.xsd.

The xsltcheck subroutine checks for the existance of all xslt files in the /mt/apps/gpms/xsl directory. These files are used  to transform the mif file into the MRF format and are used by both FGDC_TVBatch and MIF_TVBAtch. The files this subroutine    checks for are: DataQualityInformation.xsl, DistributionInformation.xsl, EntityAndAttributeInformation.xsl,                   IdentificationInformation.xsl, MetadataReferenceInformation.xsl, MIF2MRF.xsl, SpatialDataOrganizationInformation.xsl and      SpatialReferenceInformation.xsl.

The FGDC2MRFcheck subroutine checks for the existance of all the xslt files in the /mt/apps/gpms/FGDC2MRF directory. These    files transform an xml file in the FGDC import format into a file in the mif format. These files are only used by the         FGDC_TVBatch script. The files that this subroutine checks for are 01_idinfo_planned.xsl, 01_idinfo.xsl, 02_dataqual_map.xsl, 02_dataqual_tab.xsl, 02_dataqual.xsl, 03_spdoinfo.xsl, 04_spref.xsl, 05_eainfo.xsl, 06_distinfo.xsl, 07_metainfo.xsl,         FGDC2mif_atlas.xsl, FGDC2mif_edges.xsl, FGDC2mif_legacy.xsl, FGDC2mif_map.xsl, FGDC2mif_planned.xsl, FGDC2mif_tabular.xsl,    FGDC2mif_vector.xsl and FGDC2mif.xsl.

The xsl4mrf2fgdccheck checks for the existance of all the xslt files in the /mt/apps/gpms/xsl/xsl4mrf2fgdc directory. These   files transform MRF files into FGDC output files. The files that this subroutine checks for are:                              01_Identification_Information.xsl, 02_Data_Quality_Information.xsl, 03_Spatial_Data_Organization_Information.xsl,             04_Spatial_Reference_Information.xsl, 05_Entity_And_Attribute_Information.xsl, 06_Distribution_Information.xsl,               07_Metadata_Reference_Information.xsl and MRF2FGDC.xsl.

EXPORT
None by default.

SEE ALSO: The GPMS Standard.

AUTHOR

Matt Mccready, <lt>matthew.j.mccready@census.gov<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Matt Mccready

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.


=cut
