Adding an artifact
From Skyway Wiki
- In the plug-in manifest editor, add an extension for the org.skyway.core.jetArtifactDefinitionSet extension point.
- Select the (set) child node (this was automatically added for you) and enter the id of the artifact set you want to contribute to. The artifact set for the Skyway web deployment facet is org.skyway.integration.java.spring.artifactset.
- Right click this (set) node and choose New/type.
- Enter the model class that should trigger creation of your new artifact. The most common core Skyway model classes are:
- org.skyway.core.model.data.DataType
- org.skyway.core.model.data.DataStore
- org.skyway.core.model.data.NamedQuery
- org.skyway.core.model.action.Action
- org.skyway.core.model.service.Operation
- org.skyway.core.model.service.Service
- org.skyway.core.model.service.Exception
- org.skyway.core.model.Project
- org.skyway.core.model.web.WebController
- org.skyway.core.model.web.Conversation
- org.skyway.core.model.Folder
- Right click the the (type) node and choose New/jetArtifactDefinition.
- Configure your jet artifact definition:
- template: Select your JET template. The JET templates are typically located in the /templates folder and have a .jet file extension.
- type: Specify the artifact definition class. This is your implementation of the IArtifactDefinition interface. Normally, it's sufficient to sub-class org.skyway.core.generation.java.JavaArtifactDefinition (for Java source files) or org.skyway.core.generation.jet.PlainArtifactDefinition (for configuration files). If you search for sub-classes of these two types, there are plenty of examples.
- org.skyway.core.generation.java.WebFolderArtifactDefinition is a good example of an artifact that's only generated for very specific instances of its associated core model object. This is done using org.skyway.core.generation.jet.JETArtifactDefinition#isInterestedIn(org.skyway.core.generation.IArtifactBuildItem).
- org.skyway.core.generation.java.PrimaryKeyArtifactDefinition is a good example of the most common use case, which is generating a new java class for a model object. This is done using org.skyway.core.generation.java.JavaArtifactDefinition#getFileName(org.skyway.core.model.ICoreReference).
- org.skyway.core.generation.java.ObjectInterfaceArtifactDefinition is a good example of another common use case, which is generating a new java class in a package other than the default. This is done using org.skyway.core.generation.java.JavaArtifactDefinition#getRelativeDestinationPath(org.skyway.core.model.ICoreReference). Keep in mind that this package must be in sync with the package declaration at the top of your JET template.
- destination: Specify the path of the artifact, relative to the root path, which is controlled by your IArtifactLocationManager implementation. If you're just tweaking existing templates, you'll need to look at the applicable location manager class to determine the root object of your artifact. Typically, it's /generated for source files and /config for configuration files. If this is true and you specify newconfigfile.xml as your destination, your artifact will be generated to /config/newconfigfile.xml. The destination is usually left blank for source files because the location is dictated by the package.