From 93c20a20604d18d50bebf5f138e04590c42b395d Mon Sep 17 00:00:00 2001 From: Cleverson Sacramento Date: Wed, 29 Apr 2015 15:18:29 -0300 Subject: [PATCH] FWK-217: Movendo as anotações do Managment para o pacote correto --- impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java | 78 ------------------------------------------------------------------------------ impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java | 109 ------------------------------------------------------------------------------------------------------------- impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java | 75 --------------------------------------------------------------------------- impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java | 78 ------------------------------------------------------------------------------ impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/StaticScoped.java | 61 ------------------------------------------------------------- impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java | 61 ------------------------------------------------------------- impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedOperation.java | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedProperty.java | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationParameter.java | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationType.java | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 340 insertions(+), 462 deletions(-) delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/StaticScoped.java delete mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java create mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedOperation.java create mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedProperty.java create mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationParameter.java create mode 100644 impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationType.java diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java deleted file mode 100644 index 2c28e1c..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.enterprise.util.Nonbinding; - -import br.gov.frameworkdemoiselle.DemoiselleException; - -/** - *

- * Indicates that a method is a managed operation, meaning you can manage some aspect of the application by - * calling it from a external management client. - *

- *

- * This annotation can't be used together with {@link ManagedProperty}, doing so will throw a - * {@link DemoiselleException}. - *

- * - * @author SERPRO - */ -@Documented -@Target({ ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -public @interface ManagedOperation { - - /** - * Description that will be used to publish the operation to clients. Defaults to an empty description. - */ - @Nonbinding - String description() default ""; - - /** - * Type of operation. Defaults to {@link OperationType#UNKNOWN}. - */ - @Nonbinding - OperationType type() default OperationType.UNKNOWN; - -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java deleted file mode 100644 index 4d46eb0..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.enterprise.util.Nonbinding; - -/** - *

- * Indicates that a field must be exposed as a property to management clients. - *

- *

- * The property will be writable if there's a public setter method declared for the field and readable if there's a - * getter method. You can override this behaviour by passing a value to the {@link #accessLevel()} property. - *

- *

- * It's a runtime error to annotate a field with no getter and no setter method. - *

- *

- * It's also a runtime error to declare a field as a property and one or both of it's getter and setter methods as an - * operation using the {@link ManagedOperation} annotation. - *

- * - * @author SERPRO - */ -@Documented -@Target({ ElementType.FIELD }) -@Retention(RetentionPolicy.RUNTIME) -public @interface ManagedProperty { - - /** - * @return The description of this property exposed to management clients. - */ - @Nonbinding - String description() default ""; - - @Nonbinding - ManagedPropertyAccess accessLevel() default ManagedPropertyAccess.DEFAULT; - - /** - *

- * Access level of a managed property. - *

- *

- * These values only affect access via external management clients, the application is still able to inject and use - * the normal visibility of the property by Java standards. - *

- * - * @author serpro - */ - enum ManagedPropertyAccess { - - /** - * Restricts a property to be only readable even if a setter method exists. - */ - READ_ONLY - - /** - * Restricts a property to be only writeable even if a getter method exists. - */ - , WRITE_ONLY - - /** - * Says that the read or write access will be determined by the presence of a getter method - * (getProperty()) or setter method (setProperty(propertyValue)) for a property. - */ - , DEFAULT; - } - -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java deleted file mode 100644 index b5b1330..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.enterprise.util.Nonbinding; - -/** - *

- * Optional annotation to write additional detail about an operation's parameter. - *

- *

- * This annotation is ignored for non-operation methods. - *

- * - * @author SERPRO - */ -@Documented -@Target({ ElementType.PARAMETER }) -@Retention(RetentionPolicy.RUNTIME) -public @interface OperationParameter { - - /** - * AmbiguousQualifier that will be used to publish this operation's parameter to clients. - */ - @Nonbinding - String name(); - - /** - * Optional description that will be used to publish this operation's parameter to clients. Defaults to an empty - * description. - */ - @Nonbinding - String description() default ""; - -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java deleted file mode 100644 index 74fef9f..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - - -/** - *

- * Define the operation type for an operation inside a ManagementController class. - *

- *

- * This is an optional annotation and it's significanse will change based on the management extension used. Most - * extensions will just publish this information to the client so it can better show to the user the inner workings of - * the annotated operation. - *

- * - * @author SERPRO - */ -public enum OperationType { - - /** - * ManagedOperation is write-only, it causes the application to change some of it's behaviour but doesn't return any - * kind of information - */ - ACTION, - - /** - * ManagedOperation is read-only, it will operate over data provided by the application and return some information, - * but will not change the application in any way. - */ - INFO, - - /** - * ManagedOperation is read-write, it will both change the way the application work and return some information - * regarding the result of the operation. - */ - ACTION_INFO, - - /** - * The effect of calling this operation is unknown. This is the default type and if this type is assigned to an - * operation, the user must rely on the {@link ManagedOperation#description()} attribute to learn about how the - * operation works. - */ - UNKNOWN -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/StaticScoped.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/StaticScoped.java deleted file mode 100644 index 7913090..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/StaticScoped.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.enterprise.context.NormalScope; - -/** - *This scope stores the classes just as if it was a static attribute. - * - * @author SERPRO - */ -@Inherited -@Target({ METHOD, TYPE, FIELD }) -@Retention(RUNTIME) -@NormalScope -public @interface StaticScoped { - -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java deleted file mode 100644 index 75ca760..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ViewScoped.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.enterprise.context.NormalScope; - -/** - * This scope maintains the context for viewed page; when the viewed page change, the data will be lost. - * - * @author SERPRO - */ -@Inherited -@Target({ METHOD, TYPE, FIELD }) -@Retention(RUNTIME) -@NormalScope(passivating = true) -public @interface ViewScoped { - -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedOperation.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedOperation.java new file mode 100644 index 0000000..0c0d8d8 --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedOperation.java @@ -0,0 +1,78 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.management; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.enterprise.util.Nonbinding; + +import br.gov.frameworkdemoiselle.DemoiselleException; + +/** + *

+ * Indicates that a method is a managed operation, meaning you can manage some aspect of the application by + * calling it from a external management client. + *

+ *

+ * This annotation can't be used together with {@link ManagedProperty}, doing so will throw a + * {@link DemoiselleException}. + *

+ * + * @author SERPRO + */ +@Documented +@Target({ ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface ManagedOperation { + + /** + * Description that will be used to publish the operation to clients. Defaults to an empty description. + */ + @Nonbinding + String description() default ""; + + /** + * Type of operation. Defaults to {@link OperationType#UNKNOWN}. + */ + @Nonbinding + OperationType type() default OperationType.UNKNOWN; + +} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedProperty.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedProperty.java new file mode 100644 index 0000000..2a5217f --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedProperty.java @@ -0,0 +1,109 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.management; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.enterprise.util.Nonbinding; + +/** + *

+ * Indicates that a field must be exposed as a property to management clients. + *

+ *

+ * The property will be writable if there's a public setter method declared for the field and readable if there's a + * getter method. You can override this behaviour by passing a value to the {@link #accessLevel()} property. + *

+ *

+ * It's a runtime error to annotate a field with no getter and no setter method. + *

+ *

+ * It's also a runtime error to declare a field as a property and one or both of it's getter and setter methods as an + * operation using the {@link ManagedOperation} annotation. + *

+ * + * @author SERPRO + */ +@Documented +@Target({ ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface ManagedProperty { + + /** + * @return The description of this property exposed to management clients. + */ + @Nonbinding + String description() default ""; + + @Nonbinding + ManagedPropertyAccess accessLevel() default ManagedPropertyAccess.DEFAULT; + + /** + *

+ * Access level of a managed property. + *

+ *

+ * These values only affect access via external management clients, the application is still able to inject and use + * the normal visibility of the property by Java standards. + *

+ * + * @author serpro + */ + enum ManagedPropertyAccess { + + /** + * Restricts a property to be only readable even if a setter method exists. + */ + READ_ONLY + + /** + * Restricts a property to be only writeable even if a getter method exists. + */ + , WRITE_ONLY + + /** + * Says that the read or write access will be determined by the presence of a getter method + * (getProperty()) or setter method (setProperty(propertyValue)) for a property. + */ + , DEFAULT; + } + +} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationParameter.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationParameter.java new file mode 100644 index 0000000..528812d --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationParameter.java @@ -0,0 +1,75 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.management; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.enterprise.util.Nonbinding; + +/** + *

+ * Optional annotation to write additional detail about an operation's parameter. + *

+ *

+ * This annotation is ignored for non-operation methods. + *

+ * + * @author SERPRO + */ +@Documented +@Target({ ElementType.PARAMETER }) +@Retention(RetentionPolicy.RUNTIME) +public @interface OperationParameter { + + /** + * AmbiguousQualifier that will be used to publish this operation's parameter to clients. + */ + @Nonbinding + String name(); + + /** + * Optional description that will be used to publish this operation's parameter to clients. Defaults to an empty + * description. + */ + @Nonbinding + String description() default ""; + +} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationType.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationType.java new file mode 100644 index 0000000..6b2f935 --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/OperationType.java @@ -0,0 +1,78 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.management; + + +/** + *

+ * Define the operation type for an operation inside a ManagementController class. + *

+ *

+ * This is an optional annotation and it's significanse will change based on the management extension used. Most + * extensions will just publish this information to the client so it can better show to the user the inner workings of + * the annotated operation. + *

+ * + * @author SERPRO + */ +public enum OperationType { + + /** + * ManagedOperation is write-only, it causes the application to change some of it's behaviour but doesn't return any + * kind of information + */ + ACTION, + + /** + * ManagedOperation is read-only, it will operate over data provided by the application and return some information, + * but will not change the application in any way. + */ + INFO, + + /** + * ManagedOperation is read-write, it will both change the way the application work and return some information + * regarding the result of the operation. + */ + ACTION_INFO, + + /** + * The effect of calling this operation is unknown. This is the default type and if this type is assigned to an + * operation, the user must rely on the {@link ManagedOperation#description()} attribute to learn about how the + * operation works. + */ + UNKNOWN +} -- libgit2 0.21.2