Package javax.ejb

Examples of javax.ejb.EJBLocalObject


    public boolean remove(Object o) {
        logger.finest("---EJBHashSet.remove---"); // NOI18N
        assertIsValid();
        assertInTransaction();
        helper.assertInstanceOfLocalInterfaceImpl(o);
        EJBLocalObject lo = (EJBLocalObject) o;
        return pcSet.remove(helper.convertEJBLocalObjectToPC(lo, pm, true));
    }
View Full Code Here


    public boolean contains(Object o) {
        logger.finest("---EJBHashSet.contains---"); // NOI18N
        assertIsValid();
        assertInTransaction();
        helper.assertInstanceOfLocalInterfaceImpl(o);
        EJBLocalObject lo = (EJBLocalObject) o;
        return pcSet.contains(helper.convertEJBLocalObjectToPC(lo, pm, true));
    }
View Full Code Here

   * <p>Alternatively, override getSessionBeanInstance and
   * releaseSessionBeanInstance to change EJB instance creation,
   * for example to hold a single shared EJB instance.
   */
  public Object invoke(MethodInvocation invocation) throws Throwable {
    EJBLocalObject ejb = null;
    try {
      ejb = getSessionBeanInstance();
      Method method = invocation.getMethod();
      if (method.getDeclaringClass().isInstance(ejb)) {
        // directly implemented
        return method.invoke(ejb, invocation.getArguments());
      }
      else {
        // not directly implemented
        Method ejbMethod = ejb.getClass().getMethod(method.getName(), method.getParameterTypes());
        return ejbMethod.invoke(ejb, invocation.getArguments());
      }
    }
    catch (InvocationTargetException ex) {
      Throwable targetEx = ex.getTargetException();
View Full Code Here

            new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap,
                                                localIntf);
        localObjImpl = handler;
       
        try {
            EJBLocalObject localObjectProxy = (EJBLocalObject) ejbLocalObjectProxyCtor.newInstance(new Object[]{handler});
            handler.setProxy(localObjectProxy);
        } catch (ClassCastException e) {
            String msg = localStrings.getLocalString("ejb.basecontainer_invalid_local_interface",
                    "Local component interface [{0}] is invalid since it does not extend javax.ejb.EJBLocalObject.", localIntf);
            throw new IllegalArgumentException(msg, e);
View Full Code Here

            new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap,
                                                localIntf);
        localObjImpl = handler;
       
        try {
            EJBLocalObject localObjectProxy = (EJBLocalObject) ejbLocalObjectProxyCtor.newInstance(new Object[]{handler});
            handler.setProxy(localObjectProxy);
        } catch (ClassCastException e) {
            String msg = localStrings.getLocalString("ejb.basecontainer_invalid_local_interface",
                    "Local component interface [{0}] is invalid since it does not extend javax.ejb.EJBLocalObject.", localIntf);
            throw new IllegalArgumentException(msg, e);
View Full Code Here

                    // boolean isIdentical(EJBLocalObject)
   
                    // Convert the param into an EJBLocalObjectImpl.  Can't
                    // assume it's an EJBLocalObject for an ejb that was deployed
                    // using dynamic proxies.
                    EJBLocalObject other = (EJBLocalObject) args[0];
                    EJBLocalObjectImpl otherImpl =
                        EJBLocalObjectImpl.toEJBLocalObjectImpl(other);
                       
                    methodIndex = container.EJBLocalObject_isIdentical;
                    container.onEjbMethodStart(methodIndex);
View Full Code Here

        /**
         * Have to remove through EJB[Local}Object interface since the proxy contains the 'removed' flag
         * to be set on removal.
         */
        if(component.getLocalClass() != null) {
            final EJBLocalObject ejbObject = component.getEjbLocalObject(relatedId);
            ejbObject.remove();
        } else {
            final EJBObject ejbObject = component.getEJBObject(relatedId);
            ejbObject.remove();
        }
    }
View Full Code Here

        if (!relatedEntity.getLocalInterface().isInstance(o)) {
            throw new IllegalArgumentException("Argument must be of type " + entity.getLocalInterface().getName());
        }

        EJBLocalObject local = (EJBLocalObject) o;
        try {
            return local.getPrimaryKey();
        } catch (NoSuchObjectLocalException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
View Full Code Here

            }
        }

        public void cascadeDelete(CmpEntityBeanContext ctx) throws RemoveException {
            if (manager.registerCascadeDelete(ctx.getPrimaryKey(), ctx.getPrimaryKey())) {
                EJBLocalObject value = (EJBLocalObject) getValue(ctx);
                if (value != null) {
                    changeValue(null);

                    final Object relatedId = value.getPrimaryKey();
                    final JDBCStoreManager2 relatedManager = (JDBCStoreManager2) relatedEntity.getManager();

                    if (!relatedManager.isCascadeDeleted(relatedId)) {
                        value.remove();
                    }
                }

                manager.unregisterCascadeDelete(ctx.getPrimaryKey());
            }
View Full Code Here

     *
     * @param fk - foreign key value.
     * @return related local object instance.
     */
    public EJBLocalObject getRelatedEntityByFK(Object fk) {
        EJBLocalObject relatedLocalObject = null;
        final CmpEntityBeanComponent relatedContainer = getRelatedComponent();

        if (hasFKFieldsMappedToCMPFields && relatedManager.getReadAheadCache().getPreloadDataMap(fk, false) == null) {  // not in preload cache
            try {
                relatedLocalObject = relatedContainer.getEjbLocalObject(fk);
View Full Code Here

TOP

Related Classes of javax.ejb.EJBLocalObject

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.