Skip to main content
Administrator Guide
Last Updated: 2023-06-23
Concept: Custom Element Packaging

Concept: Custom Element Packaging

Java Class Annotations

If you want to reuse a custom assembly element in different projects, use annotations to have the element display on the
Palette
.
To do so, select the
Annotate Java class to appear in palette
check box when you create the Java class and Spring bean. Studio adds an
@Component
annotation in the generated Java class, which is located in your assembly project's
src
folder. Example:
import com.capeclear.assembly.annotation.Component; import com.capeclear.assembly.annotation.ComponentMethod; import com.capeclear.assembly.annotation.Property; import static com.capeclear.assembly.annotation.Component.Type.*; @Component( name = "TimeStamperCustomMediationStepImpl", type = mediation, toolTip = "This custom code step adds the current time on the first line of the message.", scope = "singleton", smallIconPath = "icons/TimeStamperCustomMediationStepImpl_16.png", largeIconPath = "icons/TimeStamperCustomMediationStepImpl_24.png" )
You can manually edit this information.
Note that Studio stores icons for the custom element in the project's
src/icons
folder. There are 2 versions, 16x16 and 24x24 pixels. To use custom icons, replace the _16.png and _24.png files with your own images.

Exposing Customized Assembly Element Properties

If your custom Java code has properties that you want users to set, you can display them on the
Bean
tab of the custom element's
Properties
view.
To do so, provide getter and setter methods that follow the bean pattern. Example: for property
abc
, provide getter and setter methods such as
getAbc
and
setAbc
.
Then add the
@Property
annotation to either the
set
or the
get
method. The
name
value defines the label for the property in the
Properties
view and the
toolTip
value defines the text that Studio displays when you mouse-over the label. You can control the order in which properties are listed using an order value. Lower values display first. An
editelement
value specifies the type of button displayed next to the property input field, as follows:
// Displays a text box with a Select button to enable you to select a Spring bean. @Property(name="Text", edit=Edit.BEAN_REF) // Displays a text box with a Select button to enable you to select a Java class. @Property(name="Text", edit=Edit.CLASS) // Displays a text box with a dialog box that enables you to specify a cron expression. @Property(name="Text", edit=Edit.CRON) // Displays a text box without a button. @Property(name="Text", edit=Edit.DEFAULT) // Displays a Browse button to enable you to specify a file. @Property(name="Text", edit=Edit.FILE) // Displays a Browse button to enable you to specify a folder. @Property(name="Text", edit=Edit.FOLDER)
Studio looks for customization classes on the project classpath of the project that contains the assembly.xml file being edited. To distribute your custom component to multiple assembly projects, package the customization in binary form as a JAR file containing the class files and icon images. Other users can include this JAR within the project’s classpath to make it available in their Assembly Editor.
The Assembly Editor automatically loads any customized components it finds in its classpath at startup. Right-click on the assembly diagram background and select
Refresh Customizations
to reload any recently added custom components.