public class OFMStorageManager extends OFModule implements IStorageService
Modifier and Type | Field and Description |
---|---|
private com.mongodb.DB |
db |
private com.mongodb.MongoClient |
mongoClient |
private org.codehaus.jackson.map.ObjectMapper |
om |
private Storage |
storage |
controller
Constructor and Description |
---|
OFMStorageManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> query) |
boolean |
delete(java.lang.String dbName,
java.lang.String collection,
java.lang.String r) |
void |
dropDB(java.lang.String dbName) |
void |
dropIndex(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> key) |
void |
ensureIndex(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> key) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getIndex(java.lang.String dbName,
java.lang.String collection) |
OFModel[] |
getModels()
returns the array of all
OFModel objects associated with this module. |
protected boolean |
handleDisconnect(Connection conn)
Process the disconnection event from a switch.
|
protected boolean |
handleHandshakedEvent(Connection conn,
MessageContext context)
An abstract method that all subclasses should implement.
|
protected boolean |
handleMessage(Connection conn,
MessageContext context,
org.openflow.protocol.OFMessage msg,
java.util.List<org.openflow.protocol.OFMessage> outgoing)
Handle incoming messages that pass the test of filters.
|
protected void |
initialize()
method that initializes this module.
|
boolean |
insert(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> query)
inserts a Map
|
boolean |
insert(java.lang.String dbName,
java.lang.String collection,
java.lang.String r)
inserts a JSON style String object into a persistent storage
return true when successful and false in other cases
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
retrieve(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> query) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
retrieveAll(java.lang.String dbName,
java.lang.String collection) |
java.util.List<java.lang.String> |
retrieveAsString(java.lang.String dbName,
java.lang.String collection,
java.lang.String query) |
java.util.List<java.lang.String> |
retrieveAsStringAll(java.lang.String dbName,
java.lang.String collection) |
java.util.List<java.lang.String> |
retrieveDBs() |
boolean |
update(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> key,
java.util.Map<java.lang.String,java.lang.Object> query) |
boolean |
update(java.lang.String dbName,
java.lang.String collection,
java.lang.String key,
java.lang.String query) |
boolean |
upsert(java.lang.String dbName,
java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> key,
java.util.Map<java.lang.String,java.lang.Object> query) |
boolean |
upsert(java.lang.String dbName,
java.lang.String collection,
java.lang.String key,
java.lang.String query) |
getController, getModule, init, processDisconnect, processHandshakeFinished, processMessage, registerFilter, registerModule
private com.mongodb.MongoClient mongoClient
private com.mongodb.DB db
private org.codehaus.jackson.map.ObjectMapper om
private Storage storage
protected void initialize()
OFModule
OFMLinkDiscovery.initialize()
.initialize
in class OFModule
public boolean insert(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> query) throws StorageException
insert
in interface IStorageService
dbName
- name of the databasecollection
- name of collection for the databasequery
- MapStorageException
public boolean insert(java.lang.String dbName, java.lang.String collection, java.lang.String r) throws StorageException
insert
in interface IStorageService
dbName
- name of the databasecollection
- name of collection for the databasequery
- JSON style String data to be insertedStorageException
public boolean delete(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> query) throws StorageException
delete
in interface IStorageService
StorageException
public boolean delete(java.lang.String dbName, java.lang.String collection, java.lang.String r) throws StorageException
delete
in interface IStorageService
StorageException
public boolean update(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> key, java.util.Map<java.lang.String,java.lang.Object> query) throws StorageException
update
in interface IStorageService
StorageException
public boolean update(java.lang.String dbName, java.lang.String collection, java.lang.String key, java.lang.String query) throws StorageException
update
in interface IStorageService
StorageException
public boolean upsert(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> key, java.util.Map<java.lang.String,java.lang.Object> query) throws StorageException
upsert
in interface IStorageService
StorageException
public boolean upsert(java.lang.String dbName, java.lang.String collection, java.lang.String key, java.lang.String query) throws StorageException
upsert
in interface IStorageService
StorageException
public java.util.List<java.lang.String> retrieveAsStringAll(java.lang.String dbName, java.lang.String collection) throws StorageException
retrieveAsStringAll
in interface IStorageService
StorageException
public java.util.List<java.lang.String> retrieveAsString(java.lang.String dbName, java.lang.String collection, java.lang.String query) throws StorageException
retrieveAsString
in interface IStorageService
StorageException
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> retrieve(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> query) throws StorageException
retrieve
in interface IStorageService
StorageException
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> retrieveAll(java.lang.String dbName, java.lang.String collection) throws StorageException
retrieveAll
in interface IStorageService
StorageException
public void ensureIndex(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> key) throws StorageException
ensureIndex
in interface IStorageService
StorageException
public void dropIndex(java.lang.String dbName, java.lang.String collection, java.util.Map<java.lang.String,java.lang.Object> key) throws StorageException
dropIndex
in interface IStorageService
StorageException
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getIndex(java.lang.String dbName, java.lang.String collection) throws StorageException
getIndex
in interface IStorageService
StorageException
public java.util.List<java.lang.String> retrieveDBs() throws StorageException
retrieveDBs
in interface IStorageService
StorageException
public void dropDB(java.lang.String dbName) throws StorageException
dropDB
in interface IStorageService
StorageException
protected boolean handleHandshakedEvent(Connection conn, MessageContext context)
OFModule
OFModule.processHandshakeFinished(Connection, MessageContext)
.
Normally, most of modules have very simple implementation for this method,
only returning true.handleHandshakedEvent
in class OFModule
conn
- connection that the event has occurredcontext
- message context for the handshaking messagesprotected boolean handleMessage(Connection conn, MessageContext context, org.openflow.protocol.OFMessage msg, java.util.List<org.openflow.protocol.OFMessage> outgoing)
OFModule
OFModule.processMessage(Connection, MessageContext, OFMessage, List)
.handleMessage
in class OFModule
conn
- connection that the message has arrivedcontext
- message context for the messagemsg
- the actual message objectoutgoing
- responses for the message arrived, which is filled by the handleMessage implementationprotected boolean handleDisconnect(Connection conn)
OFModule
OFModule.processDisconnect(Connection)
.
All subclasses of OFModule should implement this method.handleDisconnect
in class OFModule
conn
- connection that the event has occurred