X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fapi%2Fextensibility%2FSerializerRegistry.java;h=3014191158ad4109af4d59136bd34c6e3a0de117;hb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;hp=b5eec47f341b9c57530f3adc90d7613d7a3270f2;hpb=1adc52b6fedfc7ecdb03cb6cab5ae7da3bfb52e4;p=openflowjava.git diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistry.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistry.java index b5eec47f..30141911 100644 --- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistry.java +++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerRegistry.java @@ -1,37 +1,54 @@ -/* - * Copyright (c) 2013 Pantheon Technologies s.r.o. 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 - */ -package org.opendaylight.openflowjava.protocol.api.extensibility; - - -/** - * Stores and handles serializers - * @author michal.polkorab - * - */ -public interface SerializerRegistry { - - /** - * Serializer registry provisioning - */ - public void init(); - - /** - * @param msgTypeKey lookup key - * @return serializer or NullPointerException if no serializer was found - */ - public SERIALIZER_TYPE - getSerializer(MessageTypeKey msgTypeKey); - - /** - * Registers serializer under key - * @param msgTypeKey lookup key - * @param serializer serializer implementation - */ - public void - registerSerializer(MessageTypeKey msgTypeKey, OFGeneralSerializer serializer); -} +/* + * Copyright (c) 2013 Pantheon Technologies s.r.o. 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 + */ +package org.opendaylight.openflowjava.protocol.api.extensibility; + + + + +/** + * Stores and handles serializers + * @author michal.polkorab + * + */ +public interface SerializerRegistry { + + /** + * Serializer registry provisioning + */ + public void init(); + + /** + * @param msgTypeKey lookup key + * @return serializer or NullPointerException if no serializer was found + */ + SERIALIZERTYPE + getSerializer(MessageTypeKey msgTypeKey); + + /** + * Registers serializer + * Throws IllegalStateException when there is + * a serializer already registered under given key. + * + * If the serializer implements {@link SerializerRegistryInjector} interface, + * the serializer is injected with SerializerRegistry instance. + * + * @param key used for serializer lookup + * @param serializer serializer implementation + */ + void registerSerializer(MessageTypeKey key, + OFGeneralSerializer serializer); + + /** + * Unregisters serializer + * @param key used for serializer lookup + * @param serializer serializer implementation + * @return true if serializer was removed, + * false if no serializer was found under specified key + */ + boolean unregisterSerializer(MessageTypeKey key); +}