org.ops4j.pax.reflector.impl
Class RemoteReflectorImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.ops4j.pax.reflector.impl.RemoteReflectorImpl
All Implemented Interfaces:
Serializable, Remote, RemoteReflector

public final class RemoteReflectorImpl
extends UnicastRemoteObject
implements RemoteReflector

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RemoteReflectorImpl(ReflectorService localReflector)
           
 
Method Summary
 String extractContainerPart(String objectname)
          Returns the container part of the objectname.
 String extractNamePart(String objectname)
          Returns the Name part of the objectname.
 String getMember(String membername)
          Returns the human readable form of the object instance traversed from the objectname argument.
 String getMemberClassName(String objectname)
          Returns the name of the Class of the member identified by the objectname argument.
 String[] getMemberNames(Object object)
          Returns all the membernames found in the object.
 String[] getMemberNames(String membername)
          Returns all the membernames found in the member identified by membername argument.
 Object getMemberObject(String membername)
          Returns the object of the member by the given membername.
 boolean isMemberSettable(String objectname)
          Checks with the member of the given objectname can be set to a value.
 void setMember(String membername, String value)
          Assigns the value to the member identified by the membername argument.
 void setMemberObject(String membername, Object value)
          Assigns the value to the member identified by the membername argument.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteReflectorImpl

public RemoteReflectorImpl(ReflectorService localReflector)
                    throws RemoteException
Throws:
RemoteException
Method Detail

getMember

public String getMember(String membername)
                 throws ReflectionException,
                        RemoteException
Returns the human readable form of the object instance traversed from the objectname argument.

Specified by:
getMember in interface RemoteReflector
Parameters:
membername - The name of the object of interested.
Returns:
The toString() value of the member value object.
Throws:
ReflectionException - if the member does not exist.
RemoteException - if a network problem has occurred.

getMemberObject

public Object getMemberObject(String membername)
                       throws ReflectionException,
                              RemoteException
Returns the object of the member by the given membername.

Specified by:
getMemberObject in interface RemoteReflector
Parameters:
membername - The name of the object to traverse to and return.
Returns:
The object that is returned as the value of the member, either by getter, fields or special handling, such as the value of entries of Maps and Collections.
Throws:
ReflectionException - if the member does not exist.
RemoteException - if a network problem has occurred.

setMember

public void setMember(String membername,
                      String value)
               throws ReflectionException,
                      RemoteException
Assigns the value to the member identified by the membername argument.

Specified by:
setMember in interface RemoteReflector
Parameters:
membername - The name of the member to be assigned a value.
value - The value to be assigned to the member. For primitives, the value is converted according to normal Java rules, but additionally a fully-qualified classname can be given, in which case the reflector will try to instantiate such class through the default constructor, and if successful assign the instance to the member.
Throws:
ReflectionException - If the value is not assignable to the member type or the member does not exist.
RemoteException - if a network problem has occurred.

setMemberObject

public void setMemberObject(String membername,
                            Object value)
                     throws ReflectionException,
                            RemoteException
Assigns the value to the member identified by the membername argument.

Specified by:
setMemberObject in interface RemoteReflector
Parameters:
membername - The name of the member to be assigned a value.
value - The value to be assigned to the member.
Throws:
ReflectionException - If the value is not assignable to the member type.
RemoteException - if a network problem has occurred.

getMemberNames

public String[] getMemberNames(String membername)
                        throws ReflectionException,
                               RemoteException
Returns all the membernames found in the member identified by membername argument.

If the membername is an empty string, all root object names are returned.

Specified by:
getMemberNames in interface RemoteReflector
Parameters:
membername - The name of the member to query for its members.
Returns:
The members that are found in the object identified by membername.
Throws:
ReflectionException - If the member identified by the membername does not exist.
RemoteException - if a network problem has occurred.

getMemberNames

public String[] getMemberNames(Object object)
                        throws RemoteException
Returns all the membernames found in the object.

Specified by:
getMemberNames in interface RemoteReflector
Parameters:
object - The Java instance to query for its members.
Returns:
The members that are found in the object.
Throws:
RemoteException - if a network problem has occurred.

getMemberClassName

public String getMemberClassName(String objectname)
                          throws ReflectionException,
                                 RemoteException
Returns the name of the Class of the member identified by the objectname argument.

Specified by:
getMemberClassName in interface RemoteReflector
Parameters:
objectname - The name of the member to query for its Class.
Returns:
The name of the Class of the named object.
Throws:
ReflectionException - if the named object does not exist.
RemoteException - if a network problem has occurred.

isMemberSettable

public boolean isMemberSettable(String objectname)
                         throws ReflectionException,
                                RemoteException
Checks with the member of the given objectname can be set to a value.

Specified by:
isMemberSettable in interface RemoteReflector
Parameters:
objectname - The member to be tested if it can be set by a setMemberObject() method call.
Returns:
true if the object identified by the objectname can be set.
Throws:
ReflectionException - if the objectname does not identify an existing object reference.
RemoteException - if a network problem has occurred.

extractContainerPart

public String extractContainerPart(String objectname)
                            throws RemoteException
Returns the container part of the objectname.

This method must correctly return the container part of the full objectname. For instance; getContainerPart( "someRoot.Abc.Def" ), must return "someRoot.Abc", getContainerPart( "someRoot.Abc['Def']" ), must return "someRoot.Abc", and getContainerPart( "someRoot.Abc['Def'].Rst" ), must return "someRoot.Abc['Def']".

Specified by:
extractContainerPart in interface RemoteReflector
Parameters:
objectname - The objectname to be worked upon.
Returns:
The container part of the objectname.
Throws:
RemoteException - if a network problem has occurred.

extractNamePart

public String extractNamePart(String objectname)
                       throws RemoteException
Returns the Name part of the objectname.

This method must correctly return the Name part of the full objectname. For instance; getContainerPart( "someRoot.Abc.Def" ), must return "Def", getContainerPart( "someRoot.Abc['Def']" ), must return "['Def']", and getContainerPart( "someRoot.Abc['Def'].Rst" ), must return "Rst".

Specified by:
extractNamePart in interface RemoteReflector
Parameters:
objectname - The objectname to be worked upon.
Returns:
The name part of the objectname.
Throws:
RemoteException - if a network problem has occurred.


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.