public class CobblerSnippet
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o) |
static CobblerSnippet |
createOrUpdate(boolean create,
java.lang.String name,
java.lang.String contents,
Org org)
Cobbler Snippet method to be called
when creating or updating the actual instance of a cobbler snippet.
|
void |
delete()
Method to allow you to delete the snippet.
|
boolean |
equals(java.lang.Object o) |
static java.io.File |
getCobblerSnippetsDir()
Method to return the main cobbler snippets dir
(i.e.
|
java.lang.String |
getContents()
Getter for contents
|
java.lang.String |
getDisplayName()
Returns the display name used by the UI
Seems like a useful method reused in different places
in the UI thought this would be a good place..
|
java.lang.String |
getDisplayPath()
The path for display purposes
|
java.lang.String |
getFragment()
The actual cobbler fragment associated to this snippet
|
java.lang.String |
getName()
Returns just the name of the snippet file (same as basename)
i.e.
|
Org |
getOrg()
Returns the org associated to this snippet
or null if none is associated
|
java.io.File |
getPath()
Getter for name
|
java.lang.String |
getPrefix()
Returns the name of the directory hosting the snippet file (same as dirname)
i.e.
|
static java.lang.String |
getPrefixFor(Org org)
Returns the name of the dir that should be hosting scripts
for the snippet.
|
static java.io.File |
getSpacewalkSnippetsDir()
Method to return the base spacewalk snippets dir
(i.e.
|
int |
hashCode() |
boolean |
isEditable()
Note: only snippets under
${spacewalk.snippets.dir}/${org.id}/${name}
are editable..
|
static CobblerSnippet |
loadEditable(java.lang.String nameIn,
Org orgIn)
Constructor to load a spacewalk Editable (as in Org Based) cobbler snippet..
|
static CobblerSnippet |
loadEditableIfExists(java.lang.String nameIn,
Org orgIn)
Performs the same function as loadEditable, except it will return null instead
of a bad snippet
|
static CobblerSnippet |
loadReadOnly(java.io.File pathIn)
Constructor load a non editable spacewalk cobbler snippets
as in all the snippets that reside under
/var/lib/cobbler/snippets/ except
/var/lib/cobbler/snippets/spacewalk
Idea here is that this list is read only
and operations such as write operations cannot be performed..
|
static java.lang.String |
makeFragment(java.lang.String path)
Returns a Cobbler snippet fragment with the given path
|
void |
rename(java.lang.String name)
Renames cobbler snippet to a new name..
|
void |
writeContents(java.lang.String contents)
Basically writes the snippet contents sent to this method
to the disk..
|
public static java.io.File getCobblerSnippetsDir()
public static java.io.File getSpacewalkSnippetsDir()
public static CobblerSnippet createOrUpdate(boolean create, java.lang.String name, java.lang.String contents, Org org)
create
- True if we are creating a new editable snippet
False updating an existing editable snippetname
- the name of the snippet.contents
- the contents of the snippet.org
- the org of the editable snippet.public void rename(java.lang.String name)
name
- the name fo the new cobbler snippetpublic static CobblerSnippet loadEditable(java.lang.String nameIn, Org orgIn)
nameIn
- the snippet name ${name} in
${spacewalk.snippets.dir}/${org.id}/${name}orgIn
- the org in ${spacewalk.snippets.dir}/${org.id}/${name}public static CobblerSnippet loadEditableIfExists(java.lang.String nameIn, Org orgIn)
nameIn
- the snippet name ${name} in
${spacewalk.snippets.dir}/${org.id}/${name}orgIn
- the org in ${spacewalk.snippets.dir}/${org.id}/${name}public static CobblerSnippet loadReadOnly(java.io.File pathIn)
pathIn
- /var/lib/cobbler/snippets/foo/barpublic java.lang.String getDisplayPath()
public Org getOrg()
public java.io.File getPath()
public java.lang.String getContents()
public void writeContents(java.lang.String contents)
contents
- the contents of the snippetpublic void delete()
public boolean isEditable()
public java.lang.String getName()
public java.lang.String getPrefix()
public java.lang.String getDisplayName()
public java.lang.String getFragment()
public static java.lang.String makeFragment(java.lang.String path)
path
- the path to make a snippet ofpublic static java.lang.String getPrefixFor(Org org)
org
- the org hosting the snippet, or null if its a common orgpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable