Package org.jboss.aop

Examples of org.jboss.aop.Advised


/*     */     long versionId;
/*     */     try {
/*  66 */       version = new MarshalledValue(this.currentObject).get();
/*  67 */       if ((version instanceof Advised))
/*     */       {
/*  70 */         Advised versionAdvised = (Advised)version;
/*  71 */         Advised currentAdvised = (Advised)this.currentObject;
/*  72 */         versionAdvised._setInstanceAdvisor(currentAdvised._getInstanceAdvisor());
/*     */       }
/*  74 */       versionId = ++this.versionIdGenerator;
/*     */     }
/*     */     finally
/*     */     {
View Full Code Here


/*     */       }
/*     */
/* 152 */       return obj;
/*     */     }
/*     */
/* 155 */     Advised advised = (Advised)obj;
/* 156 */     SimpleMetaData metaData = advised._getInstanceAdvisor().getMetaData();
/*     */     GUID guid;
/* 158 */     synchronized (metaData)
/*     */     {
/* 160 */       if (isVersioned(advised)) return obj;
/* 161 */       guid = tag(advised);
/*     */     }
/* 163 */     System.out.println("VersionManager: " + guid);
/* 164 */     DistributedPOJOState manager = new DistributedPOJOState(guid, this.timeout, advised, this, this.synchManager);
/* 165 */     StateManager.setStateManager(advised, manager);
/* 166 */     StateChangeInterceptor interceptor = new StateChangeInterceptor(manager);
/* 167 */     manager.acquireWriteLock();
/* 168 */     advised._getInstanceAdvisor().appendInterceptor(interceptor);
/*     */     try
/*     */     {
/* 171 */       Field[] advisedFields = ((ClassAdvisor)advised._getAdvisor()).getAdvisedFields();
/* 172 */       for (int i = 0; i < advisedFields.length; i++)
/*     */       {
/* 174 */         Field field = advisedFields[i];
/* 175 */         if (!Modifier.isStatic(field.getModifiers())) {
/* 176 */           Object fieldVal = field.get(advised);
/* 177 */           if (fieldVal != null)
/*     */           {
/* 179 */             if ((fieldVal instanceof Advised))
/*     */             {
/* 181 */               Advised fieldAdvised = (Advised)fieldVal;
/* 182 */               makeVersioned(fieldAdvised, newObjects);
/* 183 */               fieldVal = new VersionReference(getGUID(fieldAdvised), fieldAdvised);
/*     */             }
/* 185 */             else if ((fieldVal instanceof List))
/*     */             {
View Full Code Here

/*    */   }
/*    */
/*    */   public static void makePerFieldVersioned(Object target) throws Exception
/*    */   {
/* 69 */     if (!(target instanceof Advised)) throw new IllegalArgumentException("Cannot do per field versioning with a non-Advised object");
/* 70 */     Advised advised = (Advised)target;
/* 71 */     getLocalVersionManager().makeVersioned(advised);
/*    */   }
View Full Code Here

/*     */   {
/* 104 */     log.trace("building a " + this.classname + " of guid " + this.guid);
/* 105 */     this.versionManager = versionManager;
/* 106 */     this.synchManager = manager;
/* 107 */     Class clazz = Thread.currentThread().getContextClassLoader().loadClass(this.classname);
/* 108 */     Advised advised = (Advised)clazz.newInstance();
/* 109 */     this.advisedRef = new WeakReference(advised);
/* 110 */     versionManager.addVersioning(this, advised);
/* 111 */     manager.putState(this.guid, this);
/* 112 */     manager.putObject(this.guid, advised);
/*     */
/* 114 */     Iterator it = this.fieldMap.values().iterator();
/* 115 */     while (it.hasNext())
/*     */     {
/* 117 */       DistributedFieldUpdate update = (DistributedFieldUpdate)it.next();
/* 118 */       ClassAdvisor advisor = (ClassAdvisor)advised._getAdvisor();
/* 119 */       log.trace("build field " + advisor.getAdvisedFields()[update.getFieldIndex()].getName());
/* 120 */       Object val = update.getNonDereferencedValue();
/* 121 */       if ((val != null) && ((val instanceof VersionReference)))
/*     */       {
/* 123 */         VersionReference ref = (VersionReference)val;
View Full Code Here

/* 172 */     Integer index = new Integer(fieldInvocation.getIndex());
/* 173 */     Object val = fieldInvocation.getValue();
/*     */
/* 175 */     if ((val instanceof Advised))
/*     */     {
/* 177 */       Advised advisedValue = (Advised)val;
/* 178 */       val = this.versionManager.makeVersioned(advisedValue);
/*     */     }
/*     */
/* 181 */     Transaction tx = this.tm.getTransaction();
/* 182 */     if (tx == null)
View Full Code Here

/* 253 */       Integer index = (Integer)entry.getKey();
/* 254 */       DistributedFieldUpdate update = (DistributedFieldUpdate)entry.getValue();
/* 255 */       DistributedFieldUpdate orig = (DistributedFieldUpdate)this.fieldMap.get(index);
/* 256 */       if (update.getVersionId() <= orig.getVersionId())
/*     */       {
/* 258 */         Advised advised = null;
/* 259 */         if (this.advisedRef != null)
/*     */         {
/* 261 */           advised = (Advised)this.advisedRef.get();
/*     */         }
/* 263 */         if (advised != null)
/*     */         {
/* 265 */           ClassAdvisor advisor = (ClassAdvisor)advised._getAdvisor();
/* 266 */           Field field = advisor.getAdvisedFields()[index.intValue()];
/* 267 */           throw new OptimisticLockFailure("optimistic lock failure for field " + field.getName() + " of class " + field.getDeclaringClass().getName());
/*     */         }
/*     */       }
/*     */     }
View Full Code Here

/*     */     {
/*  59 */       Object callingObject = ((CallerInvocation)invocation).getCallingObject();
/*     */
/*  61 */       if (callingObject == null) return invocation.invokeNext();
/*     */
/*  63 */       Advised advised = (Advised)callingObject;
/*  64 */       InstanceAdvisor advisor = advised._getInstanceAdvisor();
/*  65 */       Interceptor interceptor = (Interceptor)advisor.getPerInstanceAspect(this.aspectDefinition);
/*  66 */       return interceptor.invoke(invocation);
/*     */     }
/*     */
/*  71 */     Object targetObject = invocation.getTargetObject();
/*  72 */     if (targetObject == null) return invocation.invokeNext();
/*     */
/*  74 */     InstanceAdvisor instanceAdvisor = null;
/*  75 */     if ((targetObject instanceof Advised))
/*     */     {
/*  77 */       Advised advised = (Advised)targetObject;
/*  78 */       instanceAdvisor = advised._getInstanceAdvisor();
/*     */     }
/*     */     else
/*     */     {
/*  82 */       Advisor advisor = invocation.getAdvisor();
/*  83 */       if (advisor == null)
View Full Code Here

/*     */     {
/* 118 */       Object callingObject = ((CallerInvocation)invocation).getCallingObject();
/*     */
/* 120 */       if (callingObject == null) return invocation.invokeNext();
/*     */
/* 122 */       Advised advised = (Advised)callingObject;
/* 123 */       InstanceAdvisor advisor = advised._getInstanceAdvisor();
/* 124 */       aspect = advisor.getPerInstanceJoinpointAspect(this.joinpoint, this.aspectDefinition);
/*     */     }
/*     */     else
/*     */     {
/* 128 */       Object targetObject = invocation.getTargetObject();
/* 129 */       if (targetObject == null) return invocation.invokeNext();
/*     */
/* 131 */       InstanceAdvisor instanceAdvisor = null;
/* 132 */       if ((targetObject instanceof Advised))
/*     */       {
/* 134 */         Advised advised = (Advised)targetObject;
/* 135 */         instanceAdvisor = advised._getInstanceAdvisor();
/*     */       }
/*     */       else
/*     */       {
/* 139 */         Advisor advisor = invocation.getAdvisor();
/* 140 */         if (advisor == null)
View Full Code Here

/*     */     {
/*  66 */       Object callingObject = ((CallerInvocation)invocation).getCallingObject();
/*     */
/*  68 */       if (callingObject == null) return invocation.invokeNext();
/*     */
/*  70 */       Advised advised = (Advised)callingObject;
/*  71 */       InstanceAdvisor advisor = advised._getInstanceAdvisor();
/*  72 */       aspect = advisor.getPerInstanceAspect(this.aspectDefinition);
/*     */     }
/*     */     else
/*     */     {
/*  76 */       Object targetObject = invocation.getTargetObject();
/*  77 */       if (targetObject == null) return invocation.invokeNext();
/*     */
/*  79 */       InstanceAdvisor instanceAdvisor = null;
/*  80 */       if ((targetObject instanceof Advised))
/*     */       {
/*  82 */         Advised advised = (Advised)targetObject;
/*  83 */         instanceAdvisor = advised._getInstanceAdvisor();
/*     */       }
/*     */       else
/*     */       {
/*  87 */         Advisor advisor = invocation.getAdvisor();
/*  88 */         if (advisor == null)
View Full Code Here

/*     */     {
/* 111 */       Object callingObject = ((CallerInvocation)invocation).getCallingObject();
/*     */
/* 113 */       if (callingObject == null) return invocation.invokeNext();
/*     */
/* 115 */       Advised advised = (Advised)callingObject;
/* 116 */       InstanceAdvisor advisor = advised._getInstanceAdvisor();
/* 117 */       Interceptor interceptor = (Interceptor)advisor.getPerInstanceJoinpointAspect(this.joinpoint, this.aspectDefinition);
/* 118 */       return interceptor.invoke(invocation);
/*     */     }
/*     */
/* 123 */     Object targetObject = invocation.getTargetObject();
/* 124 */     if (targetObject == null) return invocation.invokeNext();
/*     */
/* 126 */     Advised advised = (Advised)targetObject;
/* 127 */     InstanceAdvisor advisor = advised._getInstanceAdvisor();
/* 128 */     Interceptor interceptor = (Interceptor)advisor.getPerInstanceJoinpointAspect(this.joinpoint, this.aspectDefinition);
/* 129 */     return interceptor.invoke(invocation);
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.Advised

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.