3

I am trying to create a custom API based on an API tutorial on https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype

Tools: OpenDaylight Lithium, Eclipse, Maven 3.3.9

I am able to compile the folder in api but not in impl (FlowImpl.java).

This is the error message:

[INFO] Starting audit...
/home/shaoxu/Desktop/distribution-karaf-0.3.3-Lithium-SR3/flow/impl/src/main/java/org/opendaylight/flow/impl/FlowImpl.java:1: Line does not match expected header line of '^/[*]+$'.
Audit done.
[INFO] There is 1 error reported by Checkstyle 6.2 with check-license.xml ruleset.
[ERROR] src/main/java/org/opendaylight/flow/impl/FlowImpl.java[1] (header) RegexpHeader: Line does not match expected header line of '^/[*]+$'.

There is no error message in Eclipse.

This is the source code:

package org.opendaylight.flow.impl;

import java.util.concurrent.Future;

import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.flow.rev150105.FlowPathOutputBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;

public  class FlowImpl implements FlowService {

      @Override
        public Future<RpcResult<FlowPathOutput>> flowPath(FlowPathInput input) {
          FlowPathOutputBuilder flowBuilder = new FlowPathOutputBuilder();
          flowBuilder.setPath(input.getNodes());
            return RpcResultBuilder.success(flowBuilder.build()).buildFuture();
        }

}

What is the error?

Stephen Kitt
  • 2,786
  • 22
  • 32
Luis Koh
  • 71
  • 6

2 Answers2

4

The error you're getting is caused by an enforced format for a copyright/license header at the start of every file in OpenDaylight:

/*
 * Copyright (c) 2016 ... and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

If you used the archetype, this header should have been generated for you. There are two ways of fixing the problem: either add the license header as above (if you're happy with the license), or disable the license check — if you want to do the latter, edit your question and add the POM you're using for impl so I can explain how to go about it.

You mention you're using Lithium, I'd strongly recommend switching to Beryllium or even Boron for new development. The wiki pages are currently mostly up-to-date for Beryllium.

Stephen Kitt
  • 2,786
  • 22
  • 32
0

In my Beryllium, I usually skip checkstyle tests when running my build. Add -Dcheckstyle.skip=true parameter to your command to do the maven build.