<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
-
- <!-- FIXME: this should not be necessary and it hurts shareability -->
- <exclusions>
- <exclusion>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>object-cache-api</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable {
- final AtomicReference<SchemaContext> currentContext = new AtomicReference<SchemaContext>();
+ private final AtomicReference<SchemaContext> currentContext = new AtomicReference();
private final ListenerRegistration<SchemaContextListener> schemaContextListenerListenerRegistration;
- private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.<CapabilityListener>newHashSet());
- private SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
+ private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.newHashSet());
+ private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
public SchemaContext getCurrentContext() {
Preconditions.checkState(currentContext.get() != null, "Current context not received");
// FIXME is notifying all the listeners from this callback wise ?
final Set<Capability> addedCaps = MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider);
for (final CapabilityListener listener : listeners1) {
- listener.onCapabilitiesChanged(addedCaps, Collections.<Capability>emptySet());
+ listener.onCapabilitiesChanged(addedCaps, Collections.emptySet());
}
}
public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
listener.onCapabilitiesChanged(MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider), Collections.<Capability>emptySet());
listeners1.add(listener);
- return new AutoCloseable() {
- @Override
- public void close() throws Exception {
- listeners1.remove(listener);
- }
- };
+ return () -> listeners1.remove(listener);
}
}
\ No newline at end of file
final Module module, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency) {
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
- (SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
+ (SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.absent() :
Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
InputStream sourceStream = null;
}
Set<NetconfOperation> getOperations() {
- return Sets.<NetconfOperation>newHashSet(
+ return Sets.newHashSet(
new Commit(netconfSessionIdForReporting, transactionProvider),
new DiscardChanges(netconfSessionIdForReporting, transactionProvider),
new EditConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
return runningTransaction;
}
- public synchronized boolean commitRunningTransaction(DOMDataReadWriteTransaction tx) throws DocumentedException {
- allOpenReadWriteTransactions.remove(tx);
-
- CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit();
- try {
- future.checkedGet();
- } catch (TransactionCommitFailedException e) {
- LOG.debug("Transaction {} failed on", tx, e);
- throw new DocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting,
- ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error);
- }
-
- return true;
- }
-
public synchronized void abortRunningTransaction(DOMDataReadWriteTransaction tx) {
LOG.debug("Aborting current running Transaction");
Preconditions.checkState(runningTransaction != null, NO_TRANSACTION_FOUND_FOR_SESSION + netconfSessionIdForReporting);
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/Commit.java
public class Commit extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Commit.class);
boolean commitStatus = transactionProvider.commitTransaction();
LOG.trace("Commit completed successfully {}", commitStatus);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
@Override
throw new DocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed,
ErrorSeverity.error, errorInfo);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
@Override
executeOperations(changeTracker);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
private void executeOperations(final DataTreeChangeTracker changeTracker) throws DocumentedException {
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME Duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/Lock.java
public class Lock extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Lock.class);
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME Duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/UnLock.java
public class Unlock extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Unlock.class);