Merge "Reuse PEM provider in netconf-testtool."
[controller.git] / opendaylight / adsal / protocol_plugins / stub / src / main / java / org / opendaylight / controller / protocol_plugins / stub / internal / StubNodeFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.protocol_plugins.stub.internal;
9
10 import org.opendaylight.controller.sal.core.ConstructionException;
11 import org.opendaylight.controller.sal.utils.INodeFactory;
12 import org.opendaylight.controller.sal.core.Node;
13
14 public class StubNodeFactory implements INodeFactory {
15     void init() {
16     }
17
18     /**
19      * Function called by the dependency manager when at least one dependency
20      * become unsatisfied or when the component is shutting down because for
21      * example bundle is being stopped.
22      *
23      */
24     void destroy() {
25     }
26
27     /**
28      * Function called by dependency manager after "init ()" is called and after
29      * the services provided by the class are registered in the service registry
30      *
31      */
32     void start() {
33     }
34
35     /**
36      * Function called by the dependency manager before the services exported by
37      * the component are unregistered, this will be followed by a "destroy ()"
38      * calls
39      *
40      */
41     void stop() {
42     }
43
44     public Node fromString(String nodeType, String nodeId){
45         if(nodeType.equals("STUB")) {
46             try {
47                 return new Node("STUB", Integer.parseInt(nodeId));
48             } catch(ConstructionException e) {
49                 return null;
50             }
51         }
52         return null;
53     }
54 }