org.glassfish.config.support
Annotation Type Create


@Contract
@Retention(value=RUNTIME)
@Target(value=METHOD)
@InhabitantAnnotation(value="default")
public @interface Create

Create command annotation. Methods annotated with this annotation delegates to the framework to provide a generic administrative command that create configured instances. A Create annotation is used on a method of a configured interface. The method identifies the setter of a type that can be added to the configured interface. The annotated method must follow one of the two pattern : List getXs(); or void setX(X x); the name of the method is immaterial, only the generic type of the returned List or the single parameter of the setter method are used to determine the type of configured instance the command will create. the resolver is used to find which instance of the parent type should be used to add the newly created child. The resolver can also be annotated with Param to get parameters passed to the command invocation (like a name or a target parameter). The generic command implementation will use the parameters passed to the command invocation with the Param annotations on the child type to match command parameters to configuration attributes. Sometimes, the creation of a new configuration will require more work or more attributes/elements creation than what can be provided or specified during the command invocation. In such a case, the Create annotation can specify a decorator that will be called during the generic command execution, with the newly created instance. The CreationDecorator will be looked up by its type and normal injection or parameter injection can happen. Internationalization of generic commands follow the same rule as described in the AdminCommand javadocs. The I18n annotation referenced from this annotation will be used as the top level command annotation, which should provide the command description and expected result. Parameters can be annotated with @I18n as well to override the default mapping and all resources must be located in the target type module local strings properties file.

Author:
Jerome Dochez

Required Element Summary
 I18n i18n
          Returns the i18n key that will be used to look up a localized string in the annotated type module.
 String value
          Name of the command that will be used to register this generic command implementation under.
 
Optional Element Summary
 ExecuteOn cluster
          Returns the desired behaviors in a clustered environment.
 Class<? extends CreationDecorator> decorator
          Returns a decorator type that should be looked up and called when a new configuration element of the annotated type is created.
 Class<? extends CrudResolver> resolver
          Returns the instance of the parent that should be used to add the newly created instance under.
 

Element Detail

value

@Index
public abstract String value
Name of the command that will be used to register this generic command implementation under.

Returns:
the command name as the user types it.

i18n

public abstract I18n i18n
Returns the i18n key that will be used to look up a localized string in the annotated type module.

Returns:
the key to look up localized description for the command.

resolver

public abstract Class<? extends CrudResolver> resolver
Returns the instance of the parent that should be used to add the newly created instance under. The implementation of that interface can use the command parameters to make a determination about which instance should be used.

Returns:
the parent instance.
Default:
org.glassfish.config.support.CrudResolver.DefaultResolver.class

decorator

public abstract Class<? extends CreationDecorator> decorator
Returns a decorator type that should be looked up and called when a new configuration element of the annotated type is created.

Returns:
a decorator for the annotated type
Default:
org.glassfish.config.support.CreationDecorator.NoDecoration.class

cluster

public abstract ExecuteOn cluster
Returns the desired behaviors in a clustered environment. By default, using all the ExecuteOn default values

Returns:
the cluster information
Default:
@org.glassfish.api.admin.ExecuteOn


Copyright © 2012 GlassFish Community. All Rights Reserved.