Create the Skeleton of the Plug-In
You can use the Maven archetypes to develop a plug-in.
Procedure
-
Run the following command in the
command line of your machine.
mvn archetype:generate -Dfilter="com.vmware.o11n:"
With this command, Maven generates a project by using the archetype catalog on your local machine and the archetypes that are installed by the Automation Orchestrator Plug-in SDK script. The command is interactive and requires specifying several parameters.-
Select the numeric
option that corresponds to the model-driven archetype.
Choose archetype: 1: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-plugin-archetype-inventory (o11nplugin-project-archetype) 2: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-package-archetype (o11nplugin-project-archetype) 3: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-archetype-inventory-annotation (o11nplugin-project-archetype) 4: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-plugin-archetype-simple (o11nplugin-project-archetype) 5: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-archetype-spring (o11nplugin-spring-archetype) 6: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-plugin-archetype-modeldriven (o11nplugin-project-archetype) 7: https://{vro_host}/vco-repo/archetype-catalog.xml -> com.vmware.o11n:o11n-client-archetype-rest (o11nplugin-project-archetype) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 6
-
Enter the group ID
according to the naming convention that your company uses. For more
information, see the Guide to naming
conventions on groupId, artifactId and version in the
official Maven documentation.
Define value for property 'groupId': : com.vmware.o11n.plugin [INFO] Using property: groupId = com.vmware.o11n.plugin
-
Enter the
artifactId
that corresponds to the developed integration. In this example – Redis.Define value for property 'artifactId': : redis [INFO] Using property: artifactId = redis
-
Enter a name for the
package.
The package name should correspond to the
groupId
value and must be compliant with the Java packages naming convention. For more information, see Naming a Package in the official Java documentation.Define value for property 'package': com.vmware.o11n.plugin: : com.vmware.o11n.plugin.redis [INFO] Using property: package = com.vmware.o11n.plugin.redis
-
Enter name and alias of
the plug-in.
Define value for property 'pluginAlias': : Redis Define value for property 'pluginName': : Redis
The alias must not contain spaces because it is used as a prefix for the scripting objects. The archetype also uses the alias to prefix the adapter and the factory of the plug-in.Note: If the prefix contains spaces or invalid characters, Java classes with invalid names might be generated and the plug-in might not compile successfully.When you output all parameters, you are prompted to confirm the information.Confirm properties configuration: groupId: com.vmware.o11n.plugin groupId: com.vmware.o11n.plugin artifactId: redis artifactId: redis version: 1.0.0-SNAPSHOT package: com.vmware.o11n.plugin.redis package: com.vmware.o11n.plugin.redis pluginAlias: Redis pluginName: Redis repoUrl: https://{vro_host}/vco-repo vcoVersion: {vro_version}
Note: ThevcoVersion
value depends on the version of the Automation Orchestrator SDK that you use.
-
Select the numeric
option that corresponds to the model-driven archetype.
-
Navigate to the project
directory. Verify that the directory structure is similar to the following
example.
drwxr-xr-x 9 username staff 306 Feb 7 11:08 . drwxr-xr-x 46 username staff 1564 Feb 6 10:34 .. drwxr-xr-x 4 username staff 136 Feb 7 11:08 o11nplugin-redis drwxr-xr-x 4 username staff 136 Feb 7 11:08 o11nplugin-redis-core drwxr-xr-x 4 username staff 136 Feb 7 11:08 o11nplugin-redis-custom drwxr-xr-x 3 username staff 102 Feb 7 11:08 o11nplugin-redis-gen drwxr-xr-x 6 username staff 204 Feb 7 11:08 o11nplugin-redis-package -rw-r--r-- 1 username staff 2519 Feb 7 11:08 pom.xml
-
Run the following command to
build the plug-in.
mvn clean install
If the build is successful, the console displays the [INFO] BUILD SUCCESS message.Note: If you generate the Redis integration plug-in with vRealize Orchestrator 7.0, the build might fail because of a missing file. To work around the problem, you must open the {plug-in-home}/o11nplugin-redis-core/src/main/resources/com/vmware/o11n/plugin/redis/plugin.xml file and append the following content:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"> <context:component-scan base-package="com.vmware.o11n.plugin.redis" /> <import resource="classpath:com/vmware/o11n/plugin/sdk/spring/pluginEnv.xml" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.PolicyService" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.DefaultInventoryService" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.DefaultObjectFactory" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.DefaultCollectionFactory" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.DefaultProxyResolver" /> <bean class="com.vmware.o11n.sdk.modeldriven.impl.DefaultRuntimeConfiguration"> <property name="properties"> <util:properties location="com/vmware/o11n/plugin/redis_gen/runtime-config.properties" /> </property> </bean> <bean class="com.vmware.o11n.plugin.redis.RedisPluginFactory" id="pluginFactory" autowire-candidate="false" scope="prototype" /> </beans>
-
Verify the following.
-
The
PluginFactory
class must match your factory, namelyRedisPluginFactory
. - The redis_gen directory that contains the runtime-config.properties file must match the folder of your plug-in project.
-
The