Adding a new facet
From Skyway Wiki
- Add a new Eclipse facet using the org.eclipse.wst.common.project.facet.core.facets extension point. If you're modifying Skyway code generation, you probably want your new facet to "inherit" most of the functionality of an existing Skyway deployment facet. If this is true, you can likely re-use the install delegates of the existing facet. For example, if you're tweaking the org.skyway.integration.java.spring.facet, you could configure your facet as follows:
- (project-facet-version)
- install (action)
- org.skyway.deploy.spring.web.SpringWebDeploymentFacetInstallDelegate (delegate)
- org.skyway.deploy.spring.web.SpringWebActionConfigFactory (config-factory)
- uninstall (action)
- org.skyway.deploy.spring.web.SpringWebDeploymentFacetUninstallDelegate (delegate)
- org.skyway.deploy.spring.web.SpringWebActionConfigFactory (config-factory)
- (constraints)
- (and)
- (requires) - facet:jst.java, version:5.0, soft:false
- (requires) - facet:jst.web, version:2.4, soft:false
- (requires) - facet:org.skyway.core.modeling.facet, version:1.0, soft:false
- Define a new artifact definition set using the org.skyway.core.jetArtifactDefinitionSet extension point. This is discussed in depth in other articles (Adding an artifact). The main difference here is that you want to give your definition set a unique id. If you re-use the id from another definition set, then the artifacts and overrides you define are contributed to that other set, which is likely not the behavior you want. If you are creating your own facet, you only want your artifacts and overrides to apply to projects that have your facet applied.
- Create a new skyway deployment facet using the org.skyway.core.deploymentFacet extension point. This is the glue that links the "real" Eclipse facet that you just defined with one or more artifact definition sets. Configure as follows:
- facetId: Specify the unique id of the Eclipse facet you defined earlier.
- class: Specify org.skyway.core.deploy.SkywayDeploymentFacet or a sub-class if you've overridden it.
- builder: Specify org.skyway.core.generation.ArtifactBuilder or a sub-class if you've overridden it. If you're tweaking the org.skyway.integration.java.spring.facet deployment facet, you can use org.skyway.deploy.spring.web.SpringWebArtifactBuilder.
- deployer: Specify org.skyway.core.deploy.NopDeployer (this is a placeholder for future functionality).
- artifactLocationManager: Specify an implementation of org.skyway.core.generation.IArtifactLocationManager. If you're tweaking the org.skyway.integration.java.spring.facet deployment facet, you can use org.skyway.integration.java.spring.SpringArtifactLocationManager.
- artifactDefinitionFactory: Leave this blank unless you want to override the functionality of org.skyway.core.generation.jet.JETArtifactDefinitionFactory (which is the default factory).
- artifactRemover: Specify an implementation of org.skyway.core.generation.IArtifactRemover or you can use org.skyway.core.generation.DefaultArtifactRemover to get typical functionality, which is to remove any derived artifacts from your location manager's root folders on a clean builder.
- If you didn't specify an artifact definition factory (and are therefore using JETArtifactDefinitionFactory), you can right click on the (deploymentFacet) node (the one you've been editing) and choose New/artifactSet. Enter the id of an artifact set that should be used when this facet is applied to a project. You can enter as many artifact sets as you want. During code generation, the generator determines which deployment facet is applied to the project being processed. All of the artifact sets defined for that facet are aggregated. That is, they are combined and all of the overrides are processed against the aggregated set. If more than one override is found for the same template in the aggregated set, overrides for that template are ignored.