[JBoss-dev] CVS update: contrib/iiop/src/main/org/jboss/iiop/rmi ContainerAnalysis.java

2001-11-21 Thread Francisco Reverbel

  User: reverbel
  Date: 01/11/21 04:43:03

  Modified:iiop/src/main/org/jboss/iiop/rmi ContainerAnalysis.java
  Log:
  Analysis changed to look at inherited methods of remote interfaces
  (the IIOP container invoker needs to know about inherited methods).
  
  Bug fix: attribute detection now compares getter/setter method names.
  
  Revision  ChangesPath
  1.5   +32 -8 contrib/iiop/src/main/org/jboss/iiop/rmi/ContainerAnalysis.java
  
  Index: ContainerAnalysis.java
  ===
  RCS file: 
/cvsroot/jboss/contrib/iiop/src/main/org/jboss/iiop/rmi/ContainerAnalysis.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ContainerAnalysis.java2001/10/30 12:34:58 1.4
  +++ ContainerAnalysis.java2001/11/21 12:43:03 1.5
  @@ -42,7 +42,7 @@
*  Specification, version 1.1 (01-06-07).
*  
*  @author a href=mailto:[EMAIL PROTECTED];Ole Husgaard/a
  - *  @version $Revision: 1.4 $
  + *  @version $Revision: 1.5 $
*/
   public abstract class ContainerAnalysis
  extends ClassAnalysis
  @@ -366,7 +366,7 @@
   
 for (int i = 0; i  intfs.length; ++i) {
if (cls.isInterface() 
  - java.rmi.RemoteException.class.isAssignableFrom(cls)) {
  + java.rmi.Remote.class.isAssignableFrom(cls)) {
   // Ignore java.rmi.Remote for interfaces
   if (intfs[i] == java.rmi.Remote.class)
  continue;
  @@ -392,8 +392,14 @@
   */
  protected void analyzeMethods()
  {
  -  //methods = cls.getMethods();
  -  methods = cls.getDeclaredMethods();
  +  // The dynamic stub and skeleton strategy generation mechanism
  +  // requires the inclusion of inherited methods in the analysis of
  +  // remote interfaces. To speed things up, inherited methods are
  +  // not considered in the analysis of a class or non-remote interface.
  +  if (cls.isInterface()  java.rmi.Remote.class.isAssignableFrom(cls))
  + methods = cls.getMethods();
  +  else
  + methods = cls.getDeclaredMethods();
 m_flags = new byte[methods.length];
 mutators = new int[methods.length];

  @@ -405,9 +411,11 @@
  methods[i].getName() + \.);
   
if (isAccessor(methods[i])  (m_flags[i]M_READ) == 0) {
  +String attrName = attributeReadName(methods[i].getName());
   Class iReturn = methods[i].getReturnType();
   for (int j = i+1; j  methods.length; ++j) {
  -   if (isMutator(methods[j])  (m_flags[j]M_WRITE) == 0) {
  +   if (isMutator(methods[j])  (m_flags[j]M_WRITE) == 0 
  +   attrName.equals(attributeWriteName(methods[j].getName( {
 Class[] jParams = methods[j].getParameterTypes();
 if (jParams.length == 1  jParams[0] == iReturn) {
m_flags[i] |= M_READ;
  @@ -418,9 +426,11 @@
  }
   }
} else if (isMutator(methods[i])  (m_flags[i]M_WRITE) == 0) {
  +String attrName = attributeWriteName(methods[i].getName());
   Class[] iParams = methods[i].getParameterTypes();
   for (int j = i+1; j  methods.length; ++j) {
  -   if (isAccessor(methods[j])  (m_flags[j]M_READ) == 0) {
  +   if (isAccessor(methods[j])  (m_flags[j]M_READ) == 0 
  +   attrName.equals(attributeReadName(methods[j].getName( {
 Class jReturn = methods[j].getReturnType();
 if (iParams.length == 1  iParams[0] == jReturn) {
m_flags[i] |= M_WRITE;
  @@ -473,6 +483,20 @@
  }
   
  /**
  +*  Convert an attribute write method name in Java format to
  +*  an attribute name in Java format.
  +*/
  +   protected String attributeWriteName(String name)
  +   {
  +  if (name.startsWith(set))
  + name = name.substring(3);
  +  else
  + throw new IllegalArgumentException(Not an accessor:  + name);
  +
  +  return name;
  +   }
  +
  +   /**
   *  Analyse constants.
   *  This will fill in the codeconstants/code array.
   */
  @@ -531,8 +555,8 @@
   
 for (int i = 0; i  methods.length; ++i) {
   System.err.println(m_flags[+i+]= + m_flags[i]);
  - if ((m_flags[i]M_INHERITED) != 0)
  -continue;
  + //if ((m_flags[i]M_INHERITED) != 0)
  + //  continue;
   
if ((m_flags[i]  (M_READ|M_READONLY)) != 0) {
   // Read method of an attribute.
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: contrib/iiop/src/main/org/jboss/iiop/rmi ContainerAnalysis.java

2001-10-30 Thread Francisco Reverbel

  User: reverbel
  Date: 01/10/30 04:34:58

  Modified:iiop/src/main/org/jboss/iiop/rmi ContainerAnalysis.java
  Log:
  Fixing minor bugs in toHexString() (a typo), analyzeMethods() (misplaced
  initialization of the mutators array), and fixupOverloadedOperationNames()
  (argument types are now separated by double underscores).
  
  Revision  ChangesPath
  1.4   +9 -5  contrib/iiop/src/main/org/jboss/iiop/rmi/ContainerAnalysis.java
  
  Index: ContainerAnalysis.java
  ===
  RCS file: 
/cvsroot/jboss/contrib/iiop/src/main/org/jboss/iiop/rmi/ContainerAnalysis.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContainerAnalysis.java2001/08/10 16:14:31 1.3
  +++ ContainerAnalysis.java2001/10/30 12:34:58 1.4
  @@ -42,7 +42,7 @@
*  Specification, version 1.1 (01-06-07).
*  
*  @author a href=mailto:[EMAIL PROTECTED];Ole Husgaard/a
  - *  @version $Revision: 1.3 $
  + *  @version $Revision: 1.4 $
*/
   public abstract class ContainerAnalysis
  extends ClassAnalysis
  @@ -270,7 +270,7 @@
 String s = Integer.toHexString(i).toUpperCase();

 if (s.length()  8)
  - return .substring(8 - s.length()) + s;
  + return .substring(0, 8 - s.length()) + s;
 else
return s;
  }
  @@ -282,7 +282,7 @@
 String s = Long.toHexString(l).toUpperCase();

 if (s.length()  16)
  - return .substring(16 - s.length()) + s;
  + return .substring(0, 16 - s.length()) + s;
 else
return s;
  }
  @@ -398,10 +398,11 @@
 mutators = new int[methods.length];

 // Find read-write properties
  +  for (int i = 0; i  methods.length; ++i)
  + mutators[i] = -1; // no mutator here
 for (int i = 0; i  methods.length; ++i) {
   System.err.println(analyzeMethods(): method[+i+].getName()=\ +
  methods[i].getName() + \.);
  - mutators[i] = -1; // no mutator here
   
if (isAccessor(methods[i])  (m_flags[i]M_READ) == 0) {
   Class iReturn = methods[i].getReturnType();
  @@ -587,12 +588,15 @@
// Calculate new IDL name
ParameterAnalysis[] parms = oa.getParameters();
StringBuffer b = new StringBuffer(oa.getIDLName());
  - b.append('_');
  + if (parms.length == 0)
  +b.append(__);
for (int j = 0; j  parms.length; ++j) {
   String s = parms[j].getTypeIDLName();
   
   if (s.startsWith(::))
  s = s.substring(2);
  +
  +b.append('_');
   
   while (!.equals(s)) {
  int idx = s.indexOf(::);
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development