Package org.jboss.iiop.rmi.marshal.strategy

Examples of org.jboss.iiop.rmi.marshal.strategy.SkeletonStrategy


         OperationAnalysis op = attrs[i].getAccessorAnalysis();

         logger.debug("    " + op.getJavaName()
                      + "\n                " + op.getIDLName());
         beanMethodMap.put(op.getIDLName(),
                           new SkeletonStrategy(op.getMethod()));
         op = attrs[i].getMutatorAnalysis();
         if (op != null) {
            logger.debug("    " + op.getJavaName()
                         + "\n                " + op.getIDLName());
            beanMethodMap.put(op.getIDLName(),
                              new SkeletonStrategy(op.getMethod()));
         }
      }

      OperationAnalysis[] ops = interfaceAnalysis.getOperations();
      for (int i = 0; i < ops.length; i++) {
         logger.debug("    " + ops[i].getJavaName()
                      + "\n                " + ops[i].getIDLName());
         beanMethodMap.put(ops[i].getIDLName(),
                           new SkeletonStrategy(ops[i].getMethod()));
      }

      // Initialize repository ids of remote interface
      beanRepositoryIds = interfaceAnalysis.getAllTypeIds();

      // Create home method mappings for container invoker
      logger.debug("Home methods:");

      interfaceAnalysis =
            InterfaceAnalysis.getInterfaceAnalysis(
                  ((EJBProxyFactoryContainer)container).getHomeClass());

      homeMethodMap = new HashMap();

      attrs = interfaceAnalysis.getAttributes();
      for (int i = 0; i < attrs.length; i++) {
         OperationAnalysis op = attrs[i].getAccessorAnalysis();

         logger.debug("    " + op.getJavaName()
                      + "\n                " + op.getIDLName());
         homeMethodMap.put(op.getIDLName(),
                           new SkeletonStrategy(op.getMethod()));
         op = attrs[i].getMutatorAnalysis();
         if (op != null) {
            logger.debug("    " + op.getJavaName()
                         + "\n                " + op.getIDLName());
            homeMethodMap.put(op.getIDLName(),
                              new SkeletonStrategy(op.getMethod()));
         }
      }

      ops = interfaceAnalysis.getOperations();
      for (int i = 0; i < ops.length; i++) {
         logger.debug("    " + ops[i].getJavaName()
                      + "\n                " + ops[i].getIDLName());
         homeMethodMap.put(ops[i].getIDLName(),
                           new SkeletonStrategy(ops[i].getMethod()));
      }

      // Initialize repository ids of home interface
      homeRepositoryIds = interfaceAnalysis.getAllTypeIds();
View Full Code Here


      for (int i = 0; i < attrs.length; i++) {
         OperationAnalysis op = attrs[i].getAccessorAnalysis();

         log.debug("    " + op.getJavaName() + ": " + op.getIDLName());
         methodMap.put(op.getIDLName(),
                           new SkeletonStrategy(op.getMethod()));
         op = attrs[i].getMutatorAnalysis();
         if (op != null) {
            log.debug("    " + op.getJavaName() + ": " + op.getIDLName());
            methodMap.put(op.getIDLName(),
                              new SkeletonStrategy(op.getMethod()));
         }
      }

      OperationAnalysis[] ops = interfaceAnalysis.getOperations();
      for (int i = 0; i < ops.length; i++) {
         log.debug("    " + ops[i].getJavaName() + ": " + ops[i].getIDLName());
         methodMap.put(ops[i].getIDLName(),
                           new SkeletonStrategy(ops[i].getMethod()));
      }
   }
View Full Code Here

  
   public OutputStream _invoke(String opName, InputStream in, ResponseHandler handler) throws SystemException
   {
      log.trace("invoke: " + opName);
     
      SkeletonStrategy op = (SkeletonStrategy) methodMap.get(opName);
      if (op == null)
      {
         log.debug("Unable to find opname '" + opName + "' valid operations:" + methodMap.keySet());
         throw new BAD_OPERATION(opName);
      }

      org.omg.CORBA_2_3.portable.OutputStream out;
      try
      {
         Object id = ReferenceData.extractObjectId(poaCurrent.get_object_id());
         log.trace("id = " + id);
        
         Transaction tx = null;
         if (inboundTxCurrent != null)
            tx = inboundTxCurrent.getCurrentTransaction();
         log.trace("tx = " + tx);
        
         if(sasCurrent != null)
         {
            byte username[] = sasCurrent.get_incoming_username();
            byte credentials[] = sasCurrent.get_incoming_password();
            byte principalName[] = sasCurrent.get_incoming_principal_name();
           
            if(username != null && username.length > 0)
            {
               String name = new String(username, "UTF-8");
               int domainIndex = name.lastIndexOf("@");
               if(domainIndex > 0)
                  name = name.substring(0, domainIndex);
               log.debug("username = " + name);
               Principal principal = new SimplePrincipal(name);
               SecurityAssociation.setPrincipal(principal);
            }
           
            if(credentials != null && credentials.length > 0)
            {
               SecurityAssociation.setCredential(new String(credentials, "UTF-8").toCharArray());
            }
           
            if(principalName != null && principalName.length > 0)
               log.warn("principalName = " + new String(principalName, "UTF-8")); // FIXME: implement principalName support
         }
        
         Object args[] = op.readParams((org.omg.CORBA_2_3.portable.InputStream) in);
        
         Object retVal = invoke(tx, id, op.getMethod(), args);
        
         out = (org.omg.CORBA_2_3.portable.OutputStream) handler.createReply();
         if(op.isNonVoid())
            op.writeRetval(out, retVal);
      }
      catch(Throwable t)
      {
         // TODO: check log level before stacktrace?
         t.printStackTrace();
         if(t instanceof Exception)
         {
            Exception e = (Exception) t;
            RmiIdlUtil.rethrowIfCorbaSystemException(e);
            out = (org.omg.CORBA_2_3.portable.OutputStream) handler.createExceptionReply();
            op.writeException(out, e);
         }
         else
            throw new RuntimeException("NYI");
      }
      return out;
View Full Code Here

      // make java:comp work
      ENCFactory.pushContextId(containerName);
     
      try {
        
         SkeletonStrategy op = (SkeletonStrategy) methodInvokerMap.get(opName);
         if (op == null) {
            logger.debug("Unable to find opname '" + opName + "' valid operations:" + methodInvokerMap.keySet());
            throw new BAD_OPERATION(opName);
         }

         org.omg.CORBA_2_3.portable.OutputStream out;
         try {
            Object retVal;
           
            // The EJBHome method getHomeHandle() receives special
            // treatment because the container does not implement it.
            // The remaining EJBObject methods (getEJBMetaData,
            // remove(java.lang.Object), and remove(javax.ejb.Handle))
            // are forwarded to the container.
           
            if (opName.equals("_get_homeHandle"))
            {
               retVal = homeHandle;
            }
            else
            {
               Transaction tx = null;
               if (inboundTxCurrent != null)
                  tx = inboundTxCurrent.getCurrentTransaction();
               SimplePrincipal principal = null;
               char[] password = null;
               if (sasCurrent != null)
               {
                  byte[] username = sasCurrent.get_incoming_username();
                  byte[] credential = sasCurrent.get_incoming_password();
                  String name = new String(username, "UTF-8");
                  int domainIndex = name.indexOf('@');
                  if (domainIndex > 0)
                     name = name.substring(0, domainIndex);
                  if (name.length() == 0)
                  {
                     byte[] incomingName =
                        sasCurrent.get_incoming_principal_name();
                     if (incomingName.length > 0)
                     {
                        name = new String(incomingName, "UTF-8");
                        domainIndex = name.indexOf('@');
                        if (domainIndex > 0)
                           name = name.substring(0, domainIndex);
                        principal = new SimplePrincipal(name);
                        // username==password is a hack until
                        // we have a real way to establish trust
                        password = name.toCharArray();                 
                     }
                  }
                  else
                  {
                     principal = new SimplePrincipal(name);
                     password = new String(credential, "UTF-8").toCharArray();
                  }
               }

               Object[] params = op.readParams(
                                  (org.omg.CORBA_2_3.portable.InputStream)in);
               Invocation inv = new Invocation(null,
                                               op.getMethod(),
                                               params,
                                               tx,
                                               principal, /* identity */
                                               password  /* credential*/);
               inv.setValue(InvocationKey.INVOKER_PROXY_BINDING,
                            "iiop",
                            PayloadKey.AS_IS);
               inv.setType(InvocationType.HOME);
              
               SecurityContext sc = SecurityContextFactory.createSecurityContext("CORBA_REMOTE");
               sc.getUtil().createSubjectInfo(principal, password, null);
               inv.setSecurityContext(sc);
              
               retVal = mbeanServer.invoke(containerName,
                                           "invoke",
                                           new Object[] {inv},
                                           Invocation.INVOKE_SIGNATURE);
            }
            out = (org.omg.CORBA_2_3.portable.OutputStream)
               handler.createReply();
            if (op.isNonVoid()) {
               op.writeRetval(out, retVal);
            }
         }
         catch (Exception e) {
            if (traceEnabled) {
               logger.trace("Exception in EJBHome invocation", e);
            }
            if (e instanceof MBeanException) {
               e = ((MBeanException)e).getTargetException();
            }
            RmiIdlUtil.rethrowIfCorbaSystemException(e);
            out = (org.omg.CORBA_2_3.portable.OutputStream)
               handler.createExceptionReply();
            op.writeException(out, e);
         }
         return out;
      }
      finally {
         // pop ENC context
View Full Code Here

     
      ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(containerClassLoader);
     
      try {
         SkeletonStrategy op =
            (SkeletonStrategy) methodInvokerMap.get(opName);
         if (op == null) {
            throw new BAD_OPERATION(opName);
         }
        
         Invocation inv = new Invocation(null,
                                         op.getMethod(),
                                         arguments,
                                         tx,
                                         null, /* identity */
                                         null  /* credential */);
         inv.setValue(InvocationKey.INVOKER_PROXY_BINDING,
View Full Code Here

      ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(containerClassLoader);
      try
      {
         SkeletonStrategy op = (SkeletonStrategy) methodInvokerMap.get(opName);
         if (op == null)
         {
            logger.debug("Unable to find opname '" + opName + "' valid operations:" + methodInvokerMap.keySet());
            throw new BAD_OPERATION(opName);
         }

         Object id;
         try
         {
            id = ReferenceData.extractObjectId(poaCurrent.get_object_id());
            if (traceEnabled && id != null)
               logger.trace("                      id class is "
                  + id.getClass().getName());
         }
         catch (Exception e)
         {
            logger.error("Error getting EJBObject id", e);
            throw new UnknownException(e);
         }

         // make java:comp work
         ENCFactory.pushContextId(containerName);

         org.omg.CORBA_2_3.portable.OutputStream out;
         try
         {
            Object retVal;

            if (opName.equals("_get_handle"))
            {
               javax.ejb.EJBObject obj =
                  (javax.ejb.EJBObject)javax.rmi.PortableRemoteObject.narrow(_this_object(), javax.ejb.EJBObject.class);
               retVal = new HandleImplIIOP(obj);
            }
            else
            {
               Transaction tx = null;
               if (inboundTxCurrent != null)
                  tx = inboundTxCurrent.getCurrentTransaction();
               SimplePrincipal principal = null;
               char[] password = null;
               if (sasCurrent != null)
               {
                  byte[] username = sasCurrent.get_incoming_username();
                  byte[] credential = sasCurrent.get_incoming_password();
                  String name = new String(username, "UTF-8");
                  int domainIndex = name.indexOf('@');
                  if (domainIndex > 0)
                     name = name.substring(0, domainIndex);
                  if (name.length() == 0)
                  {
                     byte[] incomingName =
                        sasCurrent.get_incoming_principal_name();
                     if (incomingName.length > 0)
                     {
                        name = new String(incomingName, "UTF-8");
                        domainIndex = name.indexOf('@');
                        if (domainIndex > 0)
                           name = name.substring(0, domainIndex);
                        principal = new SimplePrincipal(name);
                        // username==password is a hack until
                        // we have a real way to establish trust
                        password = name.toCharArray();                 
                     }
                  }
                  else
                  {
                     principal = new SimplePrincipal(name);
                     password = new String(credential, "UTF-8").toCharArray();
                  }

               }
               Object[] params =
                  op.readParams((org.omg.CORBA_2_3.portable.InputStream) in);
               Invocation inv = new Invocation(id,
                  op.getMethod(),
                  params,
                  tx,
                  principal, /* identity */
                  password  /* credential */);
               inv.setValue(InvocationKey.INVOKER_PROXY_BINDING,
                  "iiop",
                  PayloadKey.AS_IS);
               inv.setType(InvocationType.REMOTE);

               SecurityContext sc = SecurityContextFactory.createSecurityContext("CORBA_REMOTE");
               sc.getUtil().createSubjectInfo(principal, password, null);
               inv.setSecurityContext(sc);

               retVal = mbeanServer.invoke(containerName,
                  "invoke",
                  new Object[]{inv},
                  Invocation.INVOKE_SIGNATURE);

            }
            out = (org.omg.CORBA_2_3.portable.OutputStream)
               handler.createReply();
            if (op.isNonVoid())
            {
               op.writeRetval(out, retVal);
            }
         }
         catch (Exception e)
         {
            if (traceEnabled)
            {
               logger.trace("Exception in EJBObject invocation", e);
            }
            if (e instanceof MBeanException)
            {
               e = ((MBeanException) e).getTargetException();
            }
            RmiIdlUtil.rethrowIfCorbaSystemException(e);
            out = (org.omg.CORBA_2_3.portable.OutputStream)
               handler.createExceptionReply();
            op.writeException(out, e);
         }
         return out;
      }
      finally
      {
View Full Code Here

      ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(containerClassLoader);

      try
      {
         SkeletonStrategy op = (SkeletonStrategy) methodInvokerMap.get(opName);
         if (op == null)
         {
            throw new BAD_OPERATION(opName);
         }

         Object id;
         try
         {
            id = ReferenceData.extractObjectId(poaCurrent.get_object_id());
            if (traceEnabled && id != null)
            {
               logger.trace("                      id class is "
                            + id.getClass().getName());
            }
         }
         catch (Exception e)
         {
            logger.error("Error getting EJBObject id", e);
            throw new UnknownException(e);
         }

         Invocation inv = new Invocation(id,
            op.getMethod(),
            arguments,
            tx,
            null, /* identity */
            null  /* credential */);
         inv.setValue(InvocationKey.INVOKER_PROXY_BINDING,
View Full Code Here

         OperationAnalysis op = attrs[i].getAccessorAnalysis();

         logger.debug("    " + op.getJavaName()
                      + "\n                " + op.getIDLName());
         beanMethodMap.put(op.getIDLName(),
                           new SkeletonStrategy(op.getMethod()));
         op = attrs[i].getMutatorAnalysis();
         if (op != null) {
            logger.debug("    " + op.getJavaName()
                         + "\n                " + op.getIDLName());
            beanMethodMap.put(op.getIDLName(),
                              new SkeletonStrategy(op.getMethod()));
         }
      }

      OperationAnalysis[] ops = interfaceAnalysis.getOperations();
      for (int i = 0; i < ops.length; i++) {
         logger.debug("    " + ops[i].getJavaName()
                      + "\n                " + ops[i].getIDLName());
         beanMethodMap.put(ops[i].getIDLName(),
                           new SkeletonStrategy(ops[i].getMethod()));
      }

      // Initialize repository ids of remote interface
      beanRepositoryIds = interfaceAnalysis.getAllTypeIds();

      // Create home method mappings for container invoker
      logger.debug("Home methods:");

      interfaceAnalysis =
            InterfaceAnalysis.getInterfaceAnalysis(
                  ((EJBProxyFactoryContainer)container).getHomeClass());

      homeMethodMap = new HashMap();

      attrs = interfaceAnalysis.getAttributes();
      for (int i = 0; i < attrs.length; i++) {
         OperationAnalysis op = attrs[i].getAccessorAnalysis();

         logger.debug("    " + op.getJavaName()
                      + "\n                " + op.getIDLName());
         homeMethodMap.put(op.getIDLName(),
                           new SkeletonStrategy(op.getMethod()));
         op = attrs[i].getMutatorAnalysis();
         if (op != null) {
            logger.debug("    " + op.getJavaName()
                         + "\n                " + op.getIDLName());
            homeMethodMap.put(op.getIDLName(),
                              new SkeletonStrategy(op.getMethod()));
         }
      }

      ops = interfaceAnalysis.getOperations();
      for (int i = 0; i < ops.length; i++) {
         logger.debug("    " + ops[i].getJavaName()
                      + "\n                " + ops[i].getIDLName());
         homeMethodMap.put(ops[i].getIDLName(),
                           new SkeletonStrategy(ops[i].getMethod()));
      }

      // Initialize repository ids of home interface
      homeRepositoryIds = interfaceAnalysis.getAllTypeIds();
View Full Code Here

/* 307 */     for (int i = 0; i < attrs.length; i++) {
/* 308 */       OperationAnalysis op = attrs[i].getAccessorAnalysis();
/*     */
/* 310 */       this.logger.debug("    " + op.getJavaName() + "\n                " + op.getIDLName());
/*     */
/* 312 */       this.beanMethodMap.put(op.getIDLName(), new SkeletonStrategy(op.getMethod()));
/*     */
/* 314 */       op = attrs[i].getMutatorAnalysis();
/* 315 */       if (op != null) {
/* 316 */         this.logger.debug("    " + op.getJavaName() + "\n                " + op.getIDLName());
/*     */
/* 318 */         this.beanMethodMap.put(op.getIDLName(), new SkeletonStrategy(op.getMethod()));
/*     */       }
/*     */
/*     */     }
/*     */
/* 323 */     OperationAnalysis[] ops = interfaceAnalysis.getOperations();
/* 324 */     for (int i = 0; i < ops.length; i++) {
/* 325 */       this.logger.debug("    " + ops[i].getJavaName() + "\n                " + ops[i].getIDLName());
/*     */
/* 327 */       this.beanMethodMap.put(ops[i].getIDLName(), new SkeletonStrategy(ops[i].getMethod()));
/*     */     }
/*     */
/* 332 */     this.beanRepositoryIds = interfaceAnalysis.getAllTypeIds();
/*     */
/* 335 */     this.logger.debug("Home methods:");
/*     */
/* 337 */     interfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(((EJBProxyFactoryContainer)this.container).getHomeClass());
/*     */
/* 341 */     this.homeMethodMap = new HashMap();
/*     */
/* 343 */     attrs = interfaceAnalysis.getAttributes();
/* 344 */     for (int i = 0; i < attrs.length; i++) {
/* 345 */       OperationAnalysis op = attrs[i].getAccessorAnalysis();
/*     */
/* 347 */       this.logger.debug("    " + op.getJavaName() + "\n                " + op.getIDLName());
/*     */
/* 349 */       this.homeMethodMap.put(op.getIDLName(), new SkeletonStrategy(op.getMethod()));
/*     */
/* 351 */       op = attrs[i].getMutatorAnalysis();
/* 352 */       if (op != null) {
/* 353 */         this.logger.debug("    " + op.getJavaName() + "\n                " + op.getIDLName());
/*     */
/* 355 */         this.homeMethodMap.put(op.getIDLName(), new SkeletonStrategy(op.getMethod()));
/*     */       }
/*     */
/*     */     }
/*     */
/* 360 */     ops = interfaceAnalysis.getOperations();
/* 361 */     for (int i = 0; i < ops.length; i++) {
/* 362 */       this.logger.debug("    " + ops[i].getJavaName() + "\n                " + ops[i].getIDLName());
/*     */
/* 364 */       this.homeMethodMap.put(ops[i].getIDLName(), new SkeletonStrategy(ops[i].getMethod()));
/*     */     }
/*     */
/* 369 */     this.homeRepositoryIds = interfaceAnalysis.getAllTypeIds();
/*     */
/* 372 */     this.logger.debug("container classloader: " + this.container.getClassLoader() + "\ncontainer parent classloader: " + this.container.getClassLoader().getParent());
View Full Code Here

/* 217 */     Thread.currentThread().setContextClassLoader(this.containerClassLoader);
/*     */
/* 220 */     ENCFactory.pushContextId(this.containerName);
/*     */     try
/*     */     {
/* 224 */       SkeletonStrategy op = (SkeletonStrategy)this.methodInvokerMap.get(opName);
/* 225 */       if (op == null) {
/* 226 */         this.logger.debug("Unable to find opname '" + opName + "' valid operations:" + this.methodInvokerMap.keySet());
/* 227 */         throw new BAD_OPERATION(opName);
/*     */       }
/*     */       org.omg.CORBA_2_3.portable.OutputStream out;
/*     */       try
/*     */       {
/*     */         java.lang.Object retVal;
/*     */         java.lang.Object retVal;
/* 240 */         if (opName.equals("_get_homeHandle"))
/*     */         {
/* 242 */           retVal = this.homeHandle;
/*     */         }
/*     */         else
/*     */         {
/* 246 */           Transaction tx = null;
/* 247 */           if (this.inboundTxCurrent != null)
/* 248 */             tx = this.inboundTxCurrent.getCurrentTransaction();
/* 249 */           SimplePrincipal principal = null;
/* 250 */           char[] password = null;
/* 251 */           if (this.sasCurrent != null)
/*     */           {
/* 253 */             byte[] username = this.sasCurrent.get_incoming_username();
/* 254 */             byte[] credential = this.sasCurrent.get_incoming_password();
/* 255 */             String name = new String(username, "UTF-8");
/* 256 */             int domainIndex = name.indexOf('@');
/* 257 */             if (domainIndex > 0)
/* 258 */               name = name.substring(0, domainIndex);
/* 259 */             if (name.length() == 0)
/*     */             {
/* 261 */               byte[] incomingName = this.sasCurrent.get_incoming_principal_name();
/*     */
/* 263 */               if (incomingName.length > 0)
/*     */               {
/* 265 */                 name = new String(incomingName, "UTF-8");
/* 266 */                 domainIndex = name.indexOf('@');
/* 267 */                 if (domainIndex > 0)
/* 268 */                   name = name.substring(0, domainIndex);
/* 269 */                 principal = new SimplePrincipal(name);
/*     */
/* 272 */                 password = name.toCharArray();
/*     */               }
/*     */             }
/*     */             else
/*     */             {
/* 277 */               principal = new SimplePrincipal(name);
/* 278 */               password = new String(credential, "UTF-8").toCharArray();
/*     */             }
/*     */           }
/*     */
/* 282 */           java.lang.Object[] params = op.readParams((org.omg.CORBA_2_3.portable.InputStream)in);
/*     */
/* 284 */           Invocation inv = new Invocation(null, op.getMethod(), params, tx, principal, password);
/*     */
/* 290 */           inv.setValue(InvocationKey.INVOKER_PROXY_BINDING, "iiop", PayloadKey.AS_IS);
/*     */
/* 293 */           inv.setType(InvocationType.HOME);
/* 294 */           retVal = this.mbeanServer.invoke(this.containerName, "invoke", new java.lang.Object[] { inv }, Invocation.INVOKE_SIGNATURE);
/*     */         }
/*     */
/* 299 */         out = (org.omg.CORBA_2_3.portable.OutputStream)handler.createReply();
/*     */
/* 301 */         if (op.isNonVoid())
/* 302 */           op.writeRetval(out, retVal);
/*     */       }
/*     */       catch (Exception e)
/*     */       {
/* 306 */         if (this.traceEnabled) {
/* 307 */           this.logger.trace("Exception in EJBHome invocation", e);
/*     */         }
/* 309 */         if ((e instanceof MBeanException)) {
/* 310 */           e = ((MBeanException)e).getTargetException();
/*     */         }
/* 312 */         RmiIdlUtil.rethrowIfCorbaSystemException(e);
/* 313 */         out = (org.omg.CORBA_2_3.portable.OutputStream)handler.createExceptionReply();
/*     */
/* 315 */         op.writeException(out, e);
/*     */       }
/* 317 */       e = out;
/*     */       return e;
/*     */     }
/*     */     finally
View Full Code Here

TOP

Related Classes of org.jboss.iiop.rmi.marshal.strategy.SkeletonStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.