This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BZ 1076126] - RFE: Canned dynaGroup expressions provided by plugin
Added concept of 'additional descriptor' (optional zml file living in plugin's META-INF folder side-by-side to plugin descriptor). This file is parsed only by server when plugin is discovered. Within this xml file, we currently store predefined expressions for read dynaGroup definitions. Such expressions can install dynaGroup definitions automatically. This commit contains also logic which takes care about dynaGroupDefs created using such expressions. When plugin updates such expression, dynaGroup is updated (same for delete). GroupDefinition table has now "weak" reference to expression (Plugin:ExprId) Predefined dynaGroup expressions hardcoded in SingleGroupDefinitionView.java have been replaced by cannedExpressions provided by plugins. From user perspective, almost nothing changed, except cannedExpressions contain more than just expression string, so when user selects template/expression fields like name,description,recursive,recalcInterval are pre-populated as well. Added 3 expressions. First groups managed servers by server-group name (deploys DG) 2nd groups managed servers by hostname (aka domain) (deploys DG) 3rd groups enabled deployments per server-groups For expressions with 'createByDefault=true': dynagroups being created are attached to plugin (having non-null cannedExpression). Whenever this dynagroup is changed (via API or UI) it get's detached from plugin (setting cannedExpression to null). Also on plugin upgrade or first install, if we find a detached dynagroup having same name as we are about to create, we just log INFO message - this happens when DG got previously detached.
- Loading branch information
Libor Zoubek
committed
Apr 22, 2014
1 parent
769bb64
commit 414a2a6
Showing
24 changed files
with
851 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
modules/core/client-api/src/main/resources/rhq-canned-groups.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
|
||
<!-- | ||
~ RHQ Management Platform | ||
~ Copyright (C) 2005-2014 Red Hat, Inc. | ||
~ All rights reserved. | ||
~ | ||
~ This program is free software; you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License, version 2, as | ||
~ published by the Free Software Foundation, and/or the GNU Lesser | ||
~ General Public License, version 2.1, also as published by the Free | ||
~ Software Foundation. | ||
~ | ||
~ 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 General Public License and the GNU Lesser General Public License | ||
~ for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ and the GNU Lesser General Public License along with this program; | ||
~ if not, write to the Free Software Foundation, Inc., | ||
~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
|
||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
targetNamespace="urn:xmlns:rhq-canned-groups" xmlns:canned-groups="urn:xmlns:rhq-canned-groups" | ||
xmlns:cg="urn:xmlns:rhq-canned-groups" | ||
elementFormDefault="qualified" jaxb:version="2.0" | ||
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" blockDefault=""> | ||
|
||
<xs:annotation> | ||
<xs:documentation>Schema for the definition of canned DynaGroup expressions | ||
</xs:documentation> | ||
<xs:appinfo> | ||
<jaxb:schemaBindings> | ||
<jaxb:package name="org.rhq.core.clientapi.descriptor.group.expressions" /> | ||
</jaxb:schemaBindings> | ||
</xs:appinfo> | ||
</xs:annotation> | ||
|
||
<xs:simpleType name="idType"> | ||
<xs:restriction base="xs:string"> | ||
<xs:minLength value="1"/> | ||
<xs:maxLength value="80" /> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
|
||
<xs:element name="expressions"> | ||
<xs:annotation> | ||
<xs:documentation> | ||
Top level element holding set of DynaGroup expressions | ||
</xs:documentation> | ||
<xs:appinfo> | ||
<jaxb:class name="CannedGroupExpressions"/> | ||
</xs:appinfo> | ||
</xs:annotation> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="definition" minOccurs="1" maxOccurs="unbounded"> | ||
<xs:annotation> | ||
<xs:documentation> | ||
DynaGroup expression definition | ||
</xs:documentation> | ||
<xs:appinfo> | ||
<jaxb:property name="groupDefinitions" /> | ||
</xs:appinfo> | ||
</xs:annotation> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="id" type="cg:idType" minOccurs="1" maxOccurs="1" /> | ||
<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" /> | ||
<xs:element name="createByDefault" type="xs:boolean" minOccurs="0" maxOccurs="1" /> | ||
<xs:element name="recalcInMinutes" type="xs:positiveInteger" minOccurs="1" maxOccurs="1" /> | ||
<xs:element name="recursive" type="xs:boolean" minOccurs="0" maxOccurs="1" /> | ||
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" /> | ||
<xs:element name="expression" type="xs:string" minOccurs="1" maxOccurs="unbounded" /> | ||
</xs:sequence> | ||
</xs:complexType> | ||
|
||
</xs:element> | ||
</xs:sequence> | ||
|
||
</xs:complexType> | ||
<xs:unique name="unique-id"> | ||
<xs:selector xpath="GroupDefinition"/> | ||
<xs:field xpath="@id"/> | ||
</xs:unique> | ||
</xs:element> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/core/domain/src/main/java/org/rhq/core/domain/plugin/CannedGroupAddition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* RHQ Management Platform | ||
* Copyright (C) 2005-2014 Red Hat, Inc. | ||
* All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License, version 2, as | ||
* published by the Free Software Foundation, and/or the GNU Lesser | ||
* General Public License, version 2.1, also as published by the Free | ||
* Software Foundation. | ||
* | ||
* 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 General Public License and the GNU Lesser General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* and the GNU Lesser General Public License along with this program; | ||
* if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.rhq.core.domain.plugin; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author lzoubek@redhat.com | ||
* | ||
*/ | ||
public class CannedGroupAddition { | ||
|
||
private List<CannedGroupExpression> expressions; | ||
|
||
public void setExpressions(List<CannedGroupExpression> expressions) { | ||
this.expressions = expressions; | ||
} | ||
|
||
public List<CannedGroupExpression> getExpressions() { | ||
if (expressions == null) { | ||
expressions = new ArrayList<CannedGroupExpression>(); | ||
} | ||
return expressions; | ||
} | ||
} |
Oops, something went wrong.