Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial import
  • Loading branch information
jooooooon committed Oct 6, 2011
0 parents commit 9b5e37f
Show file tree
Hide file tree
Showing 73 changed files with 31,905 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
target*
.project*
.classpath*
.settings*
.scala_dependencies*
*logback.xml
.idea*

661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions LICENSE_EXCEPTION
@@ -0,0 +1,27 @@
Copyright 2011 Normation SAS

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

In accordance with the terms of section 7 (7. Additional Terms.) of
the GNU Affero GPL v3, the copyright holders add the following
Additional permissions:
Notwithstanding to the terms of section 5 (5. Conveying Modified Source
Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
licence, when you create a Related Module, this Related Module is
not considered as a part of the work and may be distributed under the
license agreement of your choice.
A "Related Module" means a set of sources files including their
documentation that, without modification of the Source Code, enables
supplementary functions or services in addition to those offered by
the Software.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
50 changes: 50 additions & 0 deletions inventory-api/pom.xml
@@ -0,0 +1,50 @@
<!--
Copyright 2011 Normation SAS
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
In accordance with the terms of section 7 (7. Additional Terms.) of
the GNU Affero GPL v3, the copyright holders add the following
Additional permissions:
Notwithstanding to the terms of section 5 (5. Conveying Modified Source
Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
licence, when you create a Related Module, this Related Module is
not considered as a part of the work and may be distributed under the
license agreement of your choice.
A "Related Module" means a set of sources files including their
documentation that, without modification of the Source Code, enables
supplementary functions or services in addition to those offered by
the Software.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
-->

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<parent>
<groupId>com.normation.inventory</groupId>
<artifactId>inventory-parent</artifactId>
<version>0.10.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.normation.inventory</groupId>
<artifactId>inventory-api</artifactId>
<version>0.10.1-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>com.normation</groupId>
<artifactId>utils</artifactId>
<version>0.10.1-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,71 @@
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* In accordance with the terms of section 7 (7. Additional Terms.) of
* the GNU Affero GPL v3, the copyright holders add the following
* Additional permissions:
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
* licence, when you create a Related Module, this Related Module is
* not considered as a part of the work and may be distributed under the
* license agreement of your choice.
* A "Related Module" means a set of sources files including their
* documentation that, without modification of the Source Code, enables
* supplementary functions or services in addition to those offered by
* the Software.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
*
*************************************************************************************
*/

package com.normation.inventory.domain

import InventoryConstants._
import net.liftweb.common._
import com.normation.utils.HashcodeCaching

/**
* The enumeration holding the values for the agent
*
*/
sealed abstract class AgentType {
def toString() : String

def toRulesPath() : String
}

final case object NOVA_AGENT extends AgentType with HashcodeCaching {
override def toString() = A_NOVA_AGENT
override def toRulesPath() = "/cfengine-nova"
}

final case object COMMUNITY_AGENT extends AgentType with HashcodeCaching {
override def toString() = A_COMMUNITY_AGENT
override def toRulesPath() = "/cfengine-community"
}

object AgentType {
def allValues = NOVA_AGENT :: COMMUNITY_AGENT :: Nil

def fromValue(string : String) : Box[AgentType] = {
string match {
case A_NOVA_AGENT => Full(NOVA_AGENT)
case A_COMMUNITY_AGENT => Full(COMMUNITY_AGENT)
case _ => Failure("Wrong type of value for the agent %s".format(string))
}
}
}
@@ -0,0 +1,88 @@
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* In accordance with the terms of section 7 (7. Additional Terms.) of
* the GNU Affero GPL v3, the copyright holders add the following
* Additional permissions:
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
* licence, when you create a Related Module, this Related Module is
* not considered as a part of the work and may be distributed under the
* license agreement of your choice.
* A "Related Module" means a set of sources files including their
* documentation that, without modification of the Source Code, enables
* supplementary functions or services in addition to those offered by
* the Software.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
*
*************************************************************************************
*/

package com.normation.inventory.domain


import com.normation.utils.Utils._
import com.normation.utils.HashcodeCaching

/**
* A file that contains all the simple data types, like Version,
* MemorySize, Manufacturer, etc.
*/


/**
* A simple class to denote a manufacturer
* TODO : Should be merge with SoftwareEditor
*/
final case class Manufacturer(name:String) extends HashcodeCaching { assert(!isEmpty(name)) }

/**
* A simple class to denote a softwareeditor
*/
final case class SoftwareEditor(val name:String) extends HashcodeCaching { assert(!isEmpty(name)) }

/**
* A simple class to denote a software cryptographic public key
*/
final case class PublicKey(val key : String) extends HashcodeCaching { assert(!isEmpty(key)) }


/**
* A simple class to denote version
* Sub-class may be done to be specialized, like for
* example "linux kernel version", "debian package version",
* "ms patch version", etc.
*
* Comparison are really important in Version
*/
final class Version(val value:String) extends Comparable[Version] {
require(nonEmpty(value))

override def compareTo(other:Version) = this.value.compareTo(other.value)
override def toString() = "[%s]".format(value)

//subclass have to override that
def canEqual(other:Any) = other.isInstanceOf[Version]

override def hashCode() = 31 * value.hashCode

override def equals(other:Any) = other match {
case that:Version => (that canEqual this) && this.value == that.value
case _ => false
}

}
@@ -0,0 +1,42 @@
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* In accordance with the terms of section 7 (7. Additional Terms.) of
* the GNU Affero GPL v3, the copyright holders add the following
* Additional permissions:
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
* licence, when you create a Related Module, this Related Module is
* not considered as a part of the work and may be distributed under the
* license agreement of your choice.
* A "Related Module" means a set of sources files including their
* documentation that, without modification of the Source Code, enables
* supplementary functions or services in addition to those offered by
* the Software.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
*
*************************************************************************************
*/

package com.normation.inventory.domain

import com.normation.utils.HashcodeCaching

case class FullInventory(
node:NodeInventory,
machine:Option[MachineInventory]
) extends HashcodeCaching
@@ -0,0 +1,52 @@
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* In accordance with the terms of section 7 (7. Additional Terms.) of
* the GNU Affero GPL v3, the copyright holders add the following
* Additional permissions:
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
* licence, when you create a Related Module, this Related Module is
* not considered as a part of the work and may be distributed under the
* license agreement of your choice.
* A "Related Module" means a set of sources files including their
* documentation that, without modification of the Source Code, enables
* supplementary functions or services in addition to those offered by
* the Software.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
*
*************************************************************************************
*/

package com.normation.inventory.domain

import com.normation.utils.Utils._
import com.normation.utils.HashcodeCaching

trait Uuid {
val value:String
require(nonEmpty(value), "An UUID can not have a null or empty value (value: %s)".format(value))
}

case class NodeId(val value:String) extends Uuid with HashcodeCaching

case class MachineUuid(val value:String) extends Uuid with HashcodeCaching

case class SoftwareUuid(val value:String) extends Uuid with HashcodeCaching

case class MotherBoardUuid(val value:String) extends Uuid with HashcodeCaching

@@ -0,0 +1,43 @@
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* In accordance with the terms of section 7 (7. Additional Terms.) of
* the GNU Affero GPL v3, the copyright holders add the following
* Additional permissions:
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3
* licence, when you create a Related Module, this Related Module is
* not considered as a part of the work and may be distributed under the
* license agreement of your choice.
* A "Related Module" means a set of sources files including their
* documentation that, without modification of the Source Code, enables
* supplementary functions or services in addition to those offered by
* the Software.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>.
*
*************************************************************************************
*/

package com.normation.inventory.domain

object InventoryConstants {

val A_NOVA_AGENT = "Nova"
val A_COMMUNITY_AGENT = "Community"
}


0 comments on commit 9b5e37f

Please sign in to comment.