asgaard.skid
Interface RemoteBroker

All Known Implementing Classes:
BeanBroker, Skid

public abstract interface RemoteBroker
extends java.rmi.Remote

This is the remote interface for the BeanBroker


Method Summary
 void addEvent(RemoteBean producer, RemoteBean event)
          Adding an Event and replicating it to all suscribed Objects.
 boolean beanExist(int key)
          Returns whether an Bean is available within the Broker or not.
 java.lang.String checkUser(java.lang.String userName, java.lang.String encr)
          Checks if the given username exists or not
 RemoteBean getBean(int key)
          Searches for a Bean by a given key.
 RemoteBean[] getBean(int[] key)
          Searches for Beans by a given set of keys.
 int[] getBeanKey(java.lang.String aClass, java.lang.String[] paramName, java.lang.Object[] searchValue, byte[] searchOp)
          Searches for a Bean by a given key.
 BeanKeyCall getBeanKeyCall(java.lang.Class aClass)
          Returns the Key-Call-Adapter for a asked Class (represented by it's key).
 int getClassKey(java.lang.Class aClass)
          Class-Key of the Bean, differ between different classes.
 int getClassKey(RemoteBean aBean)
          Class-Key of the Bean, differ between different classes.
 SkidEvent[] getEvent(RemoteBean consumer, long newer)
          Returns the Events for a consumer object which are newer than the given time
 BeanLink[] getLink(BeanLinkFilter filter)
          Searches for a set of Links using the filter - capabilities of BeanLink.
 BeanLink getLink(int from, int to, int by)
          Searches for a specific Link using it's primary key.
 java.lang.Object getUser(java.lang.Object o, java.lang.String name, java.lang.String encr)
          Excanges an user with an authorised object (hardcoded)
 java.lang.Object getUser(java.lang.String name, java.lang.String encr)
          Excanges an user with an authorised object (hardcoded)
 java.lang.Object invokeCall(java.lang.Class beanClass, java.lang.String name, java.lang.Object[] args, java.lang.String[] classnames)
          Invokes the called method of the filterinterface.
 boolean linkExist(int from, int to, int by)
          Returns if a specific Key exists, hiding all Exceptions.
 boolean logMsg(java.lang.String server, java.lang.String point, byte typ, boolean ok, java.lang.String msg)
          Puts a Message to the LOG-Server if available and returns whether it was sent or not
 java.lang.Object[] putBean(RemoteBean aObj)
          Puts the Bean into the Chache and saves it do not use manually.
 boolean putLink(BeanLink link)
          Adds a new Relation between Beans.
 boolean putUser(java.lang.Object o)
          Excanges an user with an authorised object (hardcoded)
 void setEvent(RemoteBean producer, RemoteBean event, RemoteBean consumer, byte fromState, byte toState)
          Changing the State of an specific event.
 void suscribeEvent(RemoteBean producer, RemoteBean event, RemoteBean consumer)
          Adding an Event-Pattern and suscribing this type of event.
 void testMode(boolean on)
          Switches the test - mode on / off.
 

Method Detail

getClassKey

public int getClassKey(RemoteBean aBean)
                throws java.rmi.RemoteException
Class-Key of the Bean, differ between different classes.
Parameters:
aBean - a Bean asked for the class-id

getClassKey

public int getClassKey(java.lang.Class aClass)
                throws java.rmi.RemoteException
Class-Key of the Bean, differ between different classes.
Parameters:
aClass - the Bean-Class asked for the class-id

getUser

public java.lang.Object getUser(java.lang.Object o,
                                java.lang.String name,
                                java.lang.String encr)
                         throws SkidException,
                                java.rmi.RemoteException,
                                java.sql.SQLException
Excanges an user with an authorised object (hardcoded)

getUser

public java.lang.Object getUser(java.lang.String name,
                                java.lang.String encr)
                         throws SkidException,
                                java.rmi.RemoteException,
                                java.sql.SQLException
Excanges an user with an authorised object (hardcoded)

putUser

public boolean putUser(java.lang.Object o)
                throws SkidException,
                       java.rmi.RemoteException,
                       java.sql.SQLException
Excanges an user with an authorised object (hardcoded)

checkUser

public java.lang.String checkUser(java.lang.String userName,
                                  java.lang.String encr)
                           throws SkidException,
                                  java.rmi.RemoteException,
                                  java.sql.SQLException
Checks if the given username exists or not
Parameters:
userName - name of the user
encr - the encrypted password (optional)
Throws:
java.rmi.RemoteException - if RMI doesen't work
java.sql.SQLException - the db doesen't work

putBean

public java.lang.Object[] putBean(RemoteBean aObj)
                           throws java.lang.Exception,
                                  java.rmi.RemoteException
Puts the Bean into the Chache and saves it do not use manually. Checks the Timestamps according to a update-policy given by the Bean and saves al modifications permanently. To enforce a Bean's saving use the Bean's saving method. flush

Remark: A System-Object cannot be modified and carries the created-Timestamp 0

Parameters:
aObj - the calling Bean
Returns:
wether an update is possible or not.
Throws:
java.lang.Exception - if an error occoured during the writeback.
See Also:
asgaard.skid.RemoteBean#saveflush

getBeanKey

public int[] getBeanKey(java.lang.String aClass,
                        java.lang.String[] paramName,
                        java.lang.Object[] searchValue,
                        byte[] searchOp)
                 throws SkidException,
                        java.rmi.RemoteException
Searches for a Bean by a given key.
Parameters:
aClass - the searched class
paramName - list of the parameter to search for
searchValues - values to fit
search-operator -  
Returns:
a set of Bean as result of the search
Throws:
java.lang.Exception - if anything fails

getBean

public RemoteBean getBean(int key)
                   throws java.lang.Exception,
                          java.rmi.RemoteException
Searches for a Bean by a given key.
Parameters:
key - the primary key of the object
Returns:
the searched Bean if the key exist
Throws:
java.lang.Exception - if anything fails

getBean

public RemoteBean[] getBean(int[] key)
                     throws java.lang.Exception,
                            java.rmi.RemoteException
Searches for Beans by a given set of keys. Simply calles the primitive getBean method.
Parameters:
key - the primary key of the object
Returns:
the searched Bean if the key exist
Throws:
java.lang.Exception - if anything fails

beanExist

public boolean beanExist(int key)
                  throws java.rmi.RemoteException
Returns whether an Bean is available within the Broker or not.
Parameters:
key - the unique key of the Bean
Returns:
true for an existing Bean with the given key

getBeanKeyCall

public BeanKeyCall getBeanKeyCall(java.lang.Class aClass)
                           throws java.lang.Exception
Returns the Key-Call-Adapter for a asked Class (represented by it's key).
Parameters:
classkey - the id of the class
Throws:
java.lang.Exception - if the key's couldn't be mapped

putLink

public boolean putLink(BeanLink link)
                throws java.lang.Exception,
                       java.rmi.RemoteException
Adds a new Relation between Beans.
Parameters:
link - one relation
Returns:
wether an update is possible or not.
Throws:
java.lang.Exception - if the key is not valid or anything else fails

getLink

public BeanLink getLink(int from,
                        int to,
                        int by)
                 throws java.lang.Exception,
                        java.rmi.RemoteException
Searches for a specific Link using it's primary key.
Parameters:
from - key of the origin Bean
to - key of the target Bean
by - key of the link-Bean (kind of Link)
Returns:
the link if found
Throws:
java.lang.Exception - if anything goes wrong.

getLink

public BeanLink[] getLink(BeanLinkFilter filter)
                   throws java.lang.Exception,
                          java.rmi.RemoteException
Searches for a set of Links using the filter - capabilities of BeanLink.
Parameters:
filter - the BeanLink used as Filter
Returns:
the links if any found
Throws:
java.lang.Exception - if anything goes wrong.

linkExist

public boolean linkExist(int from,
                         int to,
                         int by)
                  throws java.rmi.RemoteException
Returns if a specific Key exists, hiding all Exceptions.
Parameters:
from - key of the origin Bean
to - key of the target Bean
by - key of the link-Bean (kind of Link)
Returns:
the link if found

addEvent

public void addEvent(RemoteBean producer,
                     RemoteBean event)
              throws java.lang.Exception,
                     java.rmi.RemoteException
Adding an Event and replicating it to all suscribed Objects.
Parameters:
producer - of the event (not null)
event - the kond of the event (not null)
Throws:
java.lang.Exception - if it doesen't work

setEvent

public void setEvent(RemoteBean producer,
                     RemoteBean event,
                     RemoteBean consumer,
                     byte fromState,
                     byte toState)
              throws java.lang.Exception,
                     java.rmi.RemoteException
Changing the State of an specific event.
Parameters:
producer - of the event (not null)
event - the kond of the event (not null)
consumer - of the event (not null)
fromState - ols State of the event
toState - ols State of the event
Throws:
java.lang.Exception - if it doesen't work

suscribeEvent

public void suscribeEvent(RemoteBean producer,
                          RemoteBean event,
                          RemoteBean consumer)
                   throws java.lang.Exception,
                          java.rmi.RemoteException
Adding an Event-Pattern and suscribing this type of event.
Parameters:
producer - of the event (not null)
event - the kond of the event (not null)
consumer - of the event (not null)
Throws:
java.lang.Exception - if it doesen't work

getEvent

public SkidEvent[] getEvent(RemoteBean consumer,
                            long newer)
                     throws java.lang.Exception,
                            java.rmi.RemoteException
Returns the Events for a consumer object which are newer than the given time
Parameters:
consumer - of the events
newer - than the given time
Throws:
java.lang.Exception -  

invokeCall

public java.lang.Object invokeCall(java.lang.Class beanClass,
                                   java.lang.String name,
                                   java.lang.Object[] args,
                                   java.lang.String[] classnames)
                            throws java.lang.Exception
Invokes the called method of the filterinterface. The BeanKeyCall-Objects are cached by the BeanBroker and available via this one-method interface
Parameters:
beanClass - the class which the asked BeanKeyCall object is for
name - the name of the Method
args - the Arguments
Returns:
a result returned (if any)
Throws:
java.lang.IllegalAccessException - if the underlying method is inaccessible.
java.lang.IllegalArgumentException - if the number of actual and formal parameters differ, or if an unwrapping conversion fails.
InvocationTargetException - if the underlying method throws an exception.
java.lang.NullPointerException - if the specified object is null.
java.lang.NoSuchMethodException - if there is no Method with this name
See Also:
Method.invoke(java.lang.Object, java.lang.Object[])

testMode

public void testMode(boolean on)
              throws java.rmi.RemoteException
Switches the test - mode on / off. All changes at the Database between on and off will be deleted.

logMsg

public boolean logMsg(java.lang.String server,
                      java.lang.String point,
                      byte typ,
                      boolean ok,
                      java.lang.String msg)
               throws java.rmi.RemoteException
Puts a Message to the LOG-Server if available and returns whether it was sent or not
Parameters:
server - The calling Java-Serverclass
point - The Method / place where the statement was created
typ - The Type of the LOG-Statement
ok - Was the ServicePoint passed successfuly
msg - Human redable Message of the Statement
See Also:
LogMsg