import static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.CommonRpcResult.ResultCode.Ok; \r
\r
import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;\r
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;\r
import org.opendaylight.nemo.intent.IntentResolutionException;\r
import org.opendaylight.nemo.intent.IntentResolver;\r
import org.opendaylight.nemo.intent.computation.VNMappingException;\r
/**\r
* Created by z00293636 on 2015/9/7.\r
*/\r
-public class UserManager implements NemoIntentService, AutoCloseable {\r
+public class UserManager implements NemoIntentService {\r
\r
- private DataBroker dataBroker;\r
- private RpcProviderRegistry rpcProviderRegistry;\r
+ private final DataBroker dataBroker;\r
\r
private VNSpaceManagement vnSpaceManagement;\r
private RegisterUser registerUser;\r
Boolean transaction;\r
Boolean informresolver;\r
\r
- private RpcRegistration<NemoIntentService> rpcRegistration;\r
-\r
- public UserManager(DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry,\r
- IntentResolver intentResolver)\r
+ public UserManager(DataBroker dataBroker0, IntentResolver intentResolver0)\r
{\r
- this.dataBroker = dataBroker;\r
- this.rpcProviderRegistry = rpcProviderRegistry;\r
+ this.dataBroker = dataBroker0;\r
\r
- this.intentResolver = intentResolver;\r
+ this.intentResolver = intentResolver0;\r
vnSpaceManagement = new VNSpaceManagement(dataBroker);\r
tenantManage = new TenantManage(dataBroker);\r
aaa = new AAA(tenantManage);\r
\r
transaction = false;\r
informresolver = false;\r
-\r
- rpcRegistration = rpcProviderRegistry.addRpcImplementation(NemoIntentService.class, this);\r
}\r
\r
@Override\r
\r
return RpcResultBuilder.success(outputBuilder).buildFuture();\r
}\r
-\r
- @Override\r
- public void close() throws Exception {\r
- if ( null != rpcRegistration ) {\r
- rpcRegistration.close();\r
- }\r
- }\r
}\r
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.engine.impl.rev151010;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.nemo.intent.IntentResolver;
import org.opendaylight.nemo.user.UserManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.NemoIntentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
public AutoCloseable createInstance() {
- DataBroker dataBroker = getDataBrokerDependency();
- RpcProviderRegistry rpcProviderRegistry = getRpcRegistryDependency();
-
- final IntentResolver intentResolver = new IntentResolver(dataBroker);
- final UserManager userManager = new UserManager(dataBroker, rpcProviderRegistry, intentResolver);
+ final DataBroker dataBroker = getDataBrokerDependency();
+ final RpcProviderRegistry rpcProviderRegistry = getRpcRegistryDependency();
final class NemoEngine implements AutoCloseable {
+
+ private final IntentResolver intentResolver = new IntentResolver(dataBroker);
+ private final UserManager userManager = new UserManager(dataBroker, intentResolver);
+ private final RpcRegistration<NemoIntentService> rpcRegistration;
+
+ public NemoEngine() {
+ rpcRegistration = rpcProviderRegistry.addRpcImplementation(NemoIntentService.class, userManager);
+ }
+
@Override
public void close() throws Exception {
+ if (null != rpcRegistration) {
+ rpcRegistration.close();
+ }
+
if ( null != intentResolver ) {
intentResolver.close();
}
-
- if ( null != userManager ) {
- userManager.close();
- }
-
- return;
}
}