IDE Setup

Install Local Maven Dependencies

The latest SDKs can be found in the Flex Nexus repository. If you do not have access to the Dalet Flex artifactory, please request the files from flex-solutions@ooyala.com. You must download the JAR and POM for your specific version of Flex, and then import them into your local maven repository.

Example: mio-api-sdk-2020.6.2.jar

Use the following command to import (absolute paths):

mvn install:install-file -Dfile=<path-to-file> -DgroupId=tv.nativ.mio -DartifactId=mio-api-sdk -Dversion=2020.6.2 -Dpackaging=jar

Maven Dependencies (pom.xml)

<dependency>
  <groupId>tv.nativ.mio</groupId>
  <artifactId>mio-api-sdk</artifactId>
  <version>2020.6.2</version>
<dependency>
<dependency>
  <groupId>org.codehaus.groovy</groupId>
  <artifactId>groovy-all</artifactId>
  <version>2.4.20</version>
<dependency>   

Complete Maven pom.xml Example

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.ooyala.flex</groupId>
  <artifactId>sdk-sample</artifactId>
  <version>1.9</version>
  <packaging>jar</packaging>

  <name>Sample Use of SDK</name>
  <description>Demonstrating use of the Flex Enterprise SDK</description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <compilerId>groovy-eclipse-compiler</compilerId>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>2.9.2-01</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.4.20-01</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>tv.nativ.mio</groupId>
      <artifactId>mio-api-sdk</artifactId>
      <version>2020.6.2</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.4.20</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>2.28.2</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>

Groovy Script Class Structure

The Flex SDK includes the PluginCommand class, which contains context and services fields to be referenced in your scripts. We’ll use these fields to interact with Dalet Flex.

package com.ooyala.flex.example

import tv.nativ.mio.api.plugin.command.PluginCommand

class MySample extends PluginCommand {
  def execute() {
    context.logInfo("Hello World!")
  }
}