X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-broker-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2Fimpl%2FDataBrokerModule.java;fp=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-broker-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2Fimpl%2Fdata%2FDataBrokerModule.java;h=852f6b6e879bb3d26799a9ae12f2265d774aa7f8;hp=7b93e5f08f19df227bef6f3d6d6fb6bdfabf67e1;hb=refs%2Fchanges%2F12%2F112%2F1;hpb=0cc147bcc963544380071b7d101ece8bbea55849 diff --git a/opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/data/DataBrokerModule.java b/opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/DataBrokerModule.java similarity index 86% rename from opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/data/DataBrokerModule.java rename to opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/DataBrokerModule.java index 7b93e5f08f..852f6b6e87 100644 --- a/opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/data/DataBrokerModule.java +++ b/opendaylight/sal/yang-prototype/sal/sal-broker-impl/src/main/java/org/opendaylight/controller/sal/core/impl/DataBrokerModule.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.sal.core.impl.data; +package org.opendaylight.controller.sal.core.impl; import java.util.ArrayList; import java.util.Collections; @@ -13,9 +13,11 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import org.opendaylight.controller.sal.common.DataStoreIdentifier; +import org.opendaylight.controller.sal.common.util.Rpcs; import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession; import org.opendaylight.controller.sal.core.api.Broker.ProviderSession; @@ -27,7 +29,6 @@ import org.opendaylight.controller.sal.core.api.data.DataProviderService; import org.opendaylight.controller.sal.core.api.data.DataValidator; import org.opendaylight.controller.sal.core.api.data.DataCommitHandler.CommitTransaction; import org.opendaylight.controller.sal.core.api.data.DataProviderService.DataRefresher; -import org.opendaylight.controller.sal.core.impl.RpcUtils; import org.opendaylight.controller.sal.core.spi.BrokerModule; import org.opendaylight.controller.yang.common.RpcError; import org.opendaylight.controller.yang.common.RpcResult; @@ -36,33 +37,40 @@ import org.opendaylight.controller.yang.data.api.CompositeNodeModification; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.ImmutableSet; public class DataBrokerModule implements BrokerModule { private static final Logger log = LoggerFactory .getLogger(DataBrokerModule.class); + private static final Set> SUPPORTED_PROVIDER_FUNCTIONALITY = ImmutableSet + .of((Class) DataValidator.class, + DataRefresher.class, DataCommitHandler.class); + + private static final Set> PROVIDED_SESSION_SERVICES = ImmutableSet + .of((Class) DataBrokerService.class, + DataProviderService.class); + private Map storeContext; + private ExecutorService executor; + private SequentialCommitHandlerCoordinator coordinator = new SequentialCommitHandlerCoordinator(); @Override public Set> getProvidedServices() { - // FIXME: Refactor - Set> ret = new HashSet>(); - ret.add(DataBrokerService.class); - ret.add(DataProviderService.class); - return ret; + return PROVIDED_SESSION_SERVICES; } @Override public Set> getSupportedProviderFunctionality() { - // FIXME Refactor - Set> ret = new HashSet>(); - ret.add(DataValidator.class); - ret.add(DataCommitHandler.class); - ret.add(DataRefresher.class); - return ret; + return SUPPORTED_PROVIDER_FUNCTIONALITY; + } + + @Override + public Set> getSupportedConsumerFunctionality() { + return Collections.emptySet(); } @Override @@ -85,25 +93,24 @@ public class DataBrokerModule implements BrokerModule { } private DataProviderService newDataProviderService(ConsumerSession session) { - // TODO Implement this method - throw new UnsupportedOperationException("Not implemented"); + return new DataProviderSession(); } private DataBrokerService newDataConsumerService(ConsumerSession session) { - // TODO Implement this method - throw new UnsupportedOperationException("Not implemented"); + return new DataConsumerSession(); } - @Override - public Set> getSupportedConsumerFunctionality() { - // TODO Implement this method - throw new UnsupportedOperationException("Not implemented"); + private StoreContext context(DataStoreIdentifier store) { + return storeContext.get(store); } private static class StoreContext { - private Set commitHandlers = new HashSet(); - private Set validators = new HashSet(); - private Set refreshers = new HashSet(); + private Set commitHandlers = Collections + .synchronizedSet(new HashSet()); + private Set validators = Collections + .synchronizedSet(new HashSet()); + private Set refreshers = Collections + .synchronizedSet(new HashSet()); } private class DataConsumerSession implements DataBrokerService { @@ -153,10 +160,12 @@ public class DataBrokerModule implements BrokerModule { throw new UnsupportedOperationException("Not implemented"); } - } + @Override + public Set getDataStores() { + // TODO Auto-generated method stub + return null; + } - private StoreContext context(DataStoreIdentifier store) { - return storeContext.get(store); } private class DataProviderSession extends DataConsumerSession implements @@ -265,7 +274,7 @@ public class DataBrokerModule implements BrokerModule { } CommitTransaction transaction = new SequentialCommitTransaction( store, transactions); - return RpcUtils.getRpcResult(successful, transaction, errors); + return Rpcs.getRpcResult(successful, transaction, errors); } @Override @@ -306,7 +315,7 @@ public class DataBrokerModule implements BrokerModule { break; } - return RpcUtils.getRpcResult(successful, null, errors); + return Rpcs.getRpcResult(successful, null, errors); } @Override @@ -330,7 +339,7 @@ public class DataBrokerModule implements BrokerModule { break; } - return RpcUtils.getRpcResult(successful, null, errors); + return Rpcs.getRpcResult(successful, null, errors); } @Override @@ -374,7 +383,7 @@ public class DataBrokerModule implements BrokerModule { break; } - return RpcUtils.getRpcResult(successful, null, errors); + return Rpcs.getRpcResult(successful, null, errors); } @Override @@ -408,4 +417,3 @@ public class DataBrokerModule implements BrokerModule { } } } -