org.codehaus.mojo.unix.sysvpkg.PkginfoFile Maven / Gradle / Ivy
The newest version!
package org.codehaus.mojo.unix.sysvpkg;
/*
* The MIT License
*
* Copyright 2009 The Codehaus.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import fj.*;
import static fj.Function.*;
import fj.data.List;
import fj.data.*;
import static fj.data.Option.*;
import fj.data.TreeMap;
import static fj.Ord.*;
import org.codehaus.mojo.unix.java.*;
import static org.codehaus.mojo.unix.java.StringF.*;
import org.codehaus.mojo.unix.util.fj.*;
import org.codehaus.plexus.util.*;
import java.io.*;
import java.util.*;
/**
* A pkginfo file. See man -s 4 pkginfo
.
*
* @author Trygve Laugstøl
*/
public class PkginfoFile
{
public final String arch;
// TODO: This should be a list according to the man page
public final String category;
public final String name;
public final String pkg;
public final String version;
public final Option pstamp;
public final Option desc;
public final Option email;
public final List classes;
public PkginfoFile( String arch, String category, String name, String pkg, String version, Option pstamp,
Option desc, Option email, List classes )
{
this.arch = arch;
this.category = category;
this.name = name;
this.pkg = pkg;
this.version = version;
this.pstamp = pstamp;
this.desc = desc;
this.email = email;
this.classes = classes;
}
public PkginfoFile( String arch, String category, String name, String pkg, String version )
{
this( arch, category, name, pkg, version, Option.none(), Option.none(),
Option.none(), List.nil() );
}
public static final F5 constructor =
new F5()
{
public PkginfoFile f( String arch, String category, String name, String pkg, String version )
{
return new PkginfoFile( arch, category, name, pkg, version );
}
};
public PkginfoFile category( String category )
{
return new PkginfoFile( arch, category, name, pkg, version, pstamp, desc, email, classes );
}
public PkginfoFile pstamp( Option pstamp )
{
return new PkginfoFile( arch, category, name, pkg, version, pstamp, desc, email, classes );
}
public PkginfoFile desc( Option desc )
{
return new PkginfoFile( arch, category, name, pkg, version, pstamp, desc, email, classes );
}
public PkginfoFile email( Option email )
{
return new PkginfoFile( arch, category, name, pkg, version, pstamp, desc, email, classes );
}
public PkginfoFile classes( List classes )
{
return new PkginfoFile( arch, category, name, pkg, version, pstamp, desc, email, classes );
}
public List toList()
{
F, String> folder = List.foldLeft().f( joiner.f( " " ) ).f( "" );
F, String> stringF = FunctionF.compose( curry( concat, "CLASSES=" ), trim, folder );
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy