CloudTran Home

 
  
 
Contents  >   11.  CloudTran Profile Reference
 


11.19 JavaBean Object

Used on
coordinator
jar
processingUnit
DescriptionThis is an extension of JavaBean for use in GigaSpace spaces. This bean will be used in a space.

Note that there isn't a concept of a JavaBean that is not intended to be put into a space. If you need such a bean, you'll need to implement it in unmodelled Java code.

Note that in the Java implementation of the GigaSystemBuilder/CloudTran, primitive types are automatically mapped to wrapped types: for example, 'int' turns into 'Integer'. This removes the need to worry about null values: the null value is that the field is null!

The additional properties defined here are from the SpaceClass annotation. See com.gigaspaces.annotation.pojo.SpaceClass Annotation Type.
Contained
Lists
1
Name  import
Type  String
Description  List of classes or packages to import. The imports get put into 'import' statements in the *.java files (and could be put in a 'using' statement in C#).

In XML, you can use one or more <import> nested elements as an alternative to the 'import=' property.

See also the import list on the Business Object Model jar, which provides additional facilities.
Unique  false
 
2
Name  typeParameter
Type  typeParameter
Description  A list of type-parameters on the reference-type.

If this is a generic type, then there will be one or more type-parameter's.

In the current implementation,

(a) type-parameters can also be specified via the name, in which case they should be in canonical form ... define. This approach should really be used as a last resort, and trigger a rethink ...! (b) once the canonical name for a reference-type is generated from a list of type-parameters, the type-parameters are ignored (in the current implementation).

Therefore, the implementation is oriented towards patterns that produce type-parameters, and modelled classes (which will then have to generate the type-parameters).
GenerateAllList  false
 
3
Name  field
Type  field
Indexed property  name
 
4
Name  method
Type  method
Description  List of methods, including constructors, on the class.
Indexed property  name
 
5
Name  intEnum
Type  intEnum
Description  List of simplified int-enums on the class or interface.
Indexed property  name
 
6
Name  annotation
Type  String
Description  An optional list, comma-separated, of Java annotations.

You can put the '@' as the first character on the annotation, but it is not necessary.

You can add the annotation as either

    • an XML element, with the CDATA being the annotation text
    • a property which can contain multiple annotations, comma-separated.
If you use the property form, you cannot add multiple element-pair values as the syntax conflicts with the comma-separation syntax. In other words, annotation="@Annotation(id=27,name='Fred')" will be parsed into two separate annotations, and then inserted into the code as "@Annotation(id=27" and "@name='Fred')", which is incorrect syntax.

Because of this, some modelling environments allow annotations to be added as a property (this is most convenient) and as a list (this allows complex annotations).
Unique  false
 
7
Name  spaceHashMap
Type  spaceHashMap
Indexed property  name
 
8
Name  spaceDelayQueue
Type  spaceDelayQueue
Indexed property  name
Inherited
properties
text (base property)

 11.19.1  Property 'abstract'
 11.19.2  Property 'beanLevelProperties'
 11.19.3  Property 'clusterInfo'
 11.19.4  Property 'defaultSpace'
 11.19.5  Property 'description'
 11.19.6  Property 'extends'
 11.19.7  Property 'fifo'
 11.19.8  Property 'includeProperties'
 11.19.9  Property 'inheritIndexes'
 11.19.10  Property 'name'
 11.19.11  Property 'package'
 11.19.12  Property 'persist'
 11.19.13  Property 'replicate'
 11.19.14  Property 'shared'

11.19.1  Property 'abstract'
DescriptionThis is the 'abstract' modifier, as used on interfaces, jwclasses and methods.
Typeboolean
Defaultfalse

11.19.2  Property 'beanLevelProperties'
DescriptionIf set, then an additional field of type Properties will be added to the bean, which will allow the injection of any dynamic properties
Typeboolean

11.19.3  Property 'clusterInfo'
DescriptionIf set, then an additional field of type ClusterInfo will be added to the bean, which will allow the injection of the cluster information.
Typeboolean

11.19.4  Property 'defaultSpace'
DescriptionFor beans that have a most-common space to live in, then put the default space here. This means that the default code to write the bean into the space will be generated in any actions.

Note that this is not normative - in other words, setting this does not define the final action of the code. The generated comment will only be generated the first time; it is not kept in sync with the model changes.

However, the correct code to write to the default space will also be generated in the comment above the hand-written code.
TypeString

11.19.5  Property 'description'
DescriptionOptional description.

Use this to
  1. document the meaning of a particular item
  2. specify functionality at the design stage for implementation later.
TypeString

11.19.6  Property 'extends'
DescriptionSpecifies the class or interface that this class or interface extends from. This field is optional.

The value of 'extends' can be

  • an external class - in which case it must have a '.' in it
  • a reference to a class or interface in another model, in 'model:object' form
  • or the name of a class or interface in this model, without either a '.' or ':'.
References to simple classes must be fully-qualified if the referenced class is not in the same package as the current class. Business objects (entities, sessions, etc.) in the businessObject model normally reference each other by name only and there is then a restriction that business object names of a certain type must be unique (e.g. you can't have two entities named 'E').

The 'extends' type is added to the 'implements' list in C# and the appended to the class name with ':' (e.g. "class C : ExtendedClass,ImplementedInterface {}" ).

In Java systems, the 'extends' keyword is used.
TypeString

11.19.7  Property 'fifo'
DescriptionThis is the FIFO (first-in, first-out) property - if set true, entries will be taken from the space in the same order they were inserted. It is present on JavaBeans and spaces, indicating that operations on these objects should use FIFO. Although you can set this on a space, you should be aware that it may needlessly reduce performance on operations where it is unnecessary.

If this value is not set, the value is searched by delegation to the model object's parents. This will continue all the way up to the application object. The application object's fifo setting therefore gives a default for the all the objects defined in the application.

The default for 'fifo' in the application object is normally false, so JavaBeans in spaces will <b><u>not</u></b> be guaranteed to be read/taken in the same order they were written. This follows the GigaSpaces defaults where 'fifo' is false.

You can override this default by setting fifo=true in resources/giga-spaces/control/application/component.properties. See customization 10.
Typeboolean

11.19.8  Property 'includeProperties'
DescriptionThis defines whether properties in this java-bean are included in the space entry. whether properties are used as space fields - i.e. included in the space entries - by default. This is true by default - properties in this java-bean are implicitly included in the space entry.

To <b>exclude</b> properties by default, set this value true.

See the property 'includeProperties' in com.gigaspaces.annotation.pojo.SpaceClass for details.

There is not enough information in the gs.xml DTD to determine the valid values here: the value entered in this property will be placed, unchecked, into the gs.xml file.
Typeboolean
Defaulttrue

11.19.9  Property 'inheritIndexes'
DescriptionIf set, this field will inherit indexes from its superclass.

See the property 'inheritIndexes' in com.gigaspaces.annotation.pojo.SpaceClass for details.
Typeboolean

11.19.10  Property 'name'
DescriptionSpecifies name of the interface or class. This should be a valid Java identifier name and will be used as-is as the interface or class name.
TypeString
Requiredtrue

11.19.11  Property 'package'
Aliasnamespace
DescriptionThis is the package attribute: it declares the name of the package that this interface (or class, or entity, etc.) belongs to.

It can be used on

  • reference types (interfaces and classes) and all their derivatives
  • associations
  • assemblies of model-objects
  • containers of same, like jars.
It uses delegation of responsibility to search its parent chain. For example, in the J2EE realm, this means that the package can be specified on (working up the containment chain):

  • an entity,
  • or its ejb-jar,
  • or the application,
  • or in the assembly
  • or in the build properties '.jwp' file.
If none of these is specified the package will be null. Null packages are not recommended but legal for simple Java builds. For larger systems, null packages are not allowed.

The combination of the package and class name (i.e. the fully-qualified Java classname) must be unique across all reference types and their derivatives in a build.
TypeString

11.19.12  Property 'persist'
DescriptionWhen the persist attribute is set, it causes objects of this class to be persisted when written into a space defined as persistent. See the GigaSpaces documentation for more information. The implicit default is false - entries of this class will not be persisted.

See customization 20 for an example you can adapt to change the default for this property for all JavaBeans.
Typeboolean

11.19.13  Property 'replicate'
DescriptionWhen the replicate attribute is set, it causes objects of this class to be replicated to a target space or spaces, when running in partial replication mode. The implicit default is false - entries of this class will not be replicated.

You can override this default using customization 20.
Typeboolean
Defaultfalse

11.19.14  Property 'shared'
DescriptionBy default in CloudTranBuilder, classes and JavaBeans are shared. This means they are put into the GSBFramework jar. If you want them to be local to the PU they are defined in, set this 'shared' property to false. In that case, they will not be visible outside the PU. If you do this, you will have to make sure that any inheritance chain is reachable. For example, if class/Bean A extends class/bean B, you can't have A being shared but B not shared, because B would not be visible to A during compilation. It is a good idea, but not required, to set shared=false on classes with init-method's and destroy-method's.
Typeboolean
Defaulttrue

Copyright (c) 2001-2011 CloudTran Inc.