示例#1
0
  /**
   * Retrieves the JAIN SLEE specs descriptor
   *
   * @return
   */
  public SbbDescriptor getSpecsDescriptor() {
    if (specsDescriptor == null) {
      Set<LibraryID> libraryIDSet = new HashSet<LibraryID>();
      for (MLibraryRef mLibraryRef : getDescriptor().getLibraryRefs()) {
        libraryIDSet.add(mLibraryRef.getComponentID());
      }
      LibraryID[] libraryIDs = libraryIDSet.toArray(new LibraryID[libraryIDSet.size()]);

      Set<SbbID> sbbIDSet = new HashSet<SbbID>();
      for (MSbbRef mSbbRef : getDescriptor().getSbbRefs()) {
        sbbIDSet.add(mSbbRef.getComponentID());
      }
      SbbID[] sbbIDs = sbbIDSet.toArray(new SbbID[sbbIDSet.size()]);

      Set<ProfileSpecificationID> profileSpecSet = new HashSet<ProfileSpecificationID>();
      for (MProfileSpecRef mProfileSpecRef : getDescriptor().getProfileSpecRefs()) {
        profileSpecSet.add(mProfileSpecRef.getComponentID());
      }
      ProfileSpecificationID[] profileSpecs =
          profileSpecSet.toArray(new ProfileSpecificationID[profileSpecSet.size()]);

      Set<EventTypeID> eventTypeSet = new HashSet<EventTypeID>();
      for (MEventEntry mEventEntry : getDescriptor().getEventEntries().values()) {
        eventTypeSet.add(mEventEntry.getEventReference().getComponentID());
      }
      EventTypeID[] eventTypes = eventTypeSet.toArray(new EventTypeID[eventTypeSet.size()]);

      Set<ResourceAdaptorTypeID> raTypeIDSet = new HashSet<ResourceAdaptorTypeID>();
      Set<String> raLinksSet = new HashSet<String>();
      for (MResourceAdaptorTypeBinding mResourceAdaptorTypeBinding :
          getDescriptor().getResourceAdaptorTypeBindings()) {
        raTypeIDSet.add(mResourceAdaptorTypeBinding.getResourceAdaptorTypeRef());
        for (MResourceAdaptorEntityBinding mResourceAdaptorEntityBinding :
            mResourceAdaptorTypeBinding.getResourceAdaptorEntityBinding()) {
          raLinksSet.add(mResourceAdaptorEntityBinding.getResourceAdaptorEntityLink());
        }
      }
      ResourceAdaptorTypeID[] raTypeIDs =
          raTypeIDSet.toArray(new ResourceAdaptorTypeID[raTypeIDSet.size()]);
      String[] raLinks = raLinksSet.toArray(new String[raLinksSet.size()]);

      specsDescriptor =
          new SbbDescriptor(
              getSbbID(),
              getDeployableUnit().getDeployableUnitID(),
              getDeploymentUnitSource(),
              libraryIDs,
              sbbIDs,
              eventTypes,
              profileSpecs,
              getDescriptor().getAddressProfileSpecRef(),
              raTypeIDs,
              raLinks);
    }
    return specsDescriptor;
  }
示例#2
0
 private void buildEventHandlerRefs() {
   eventHandlerMethods = new HashMap<EventTypeID, EventHandlerMethod>();
   for (MEventEntry eventEntry : getDescriptor().getEventEntries().values()) {
     if (eventEntry.isReceived()) {
       String eventHandlerMethodName = "on" + eventEntry.getEventName();
       for (Method method : concreteSbbClass.getMethods()) {
         if (method.getName().equals(eventHandlerMethodName)) {
           EventHandlerMethod eventHandlerMethod = new EventHandlerMethod(method);
           if (method.getParameterTypes().length == 3) {
             eventHandlerMethod.setHasEventContextParam(true);
           }
           if (getDescriptor().getSbbActivityContextInterface() != null) {
             eventHandlerMethod.setHasCustomACIParam(true);
           }
           eventHandlerMethods.put(
               eventEntry.getEventReference().getComponentID(), eventHandlerMethod);
           break;
         }
       }
     }
   }
 }
示例#3
0
  private void buildInitialEventSelectorRefs() {
    initialEventSelectorMethods = new HashMap<String, Method>();
    Class<?>[] argtypes = new Class[] {InitialEventSelector.class};
    for (MEventEntry eventEntry : getDescriptor().getEventEntries().values()) {
      if (eventEntry.isReceived()
          && eventEntry.isInitialEvent()
          && eventEntry.getInitialEventSelectorMethod() != null
          && !this.initialEventSelectorMethods.containsKey(
              eventEntry.getInitialEventSelectorMethod())) {

        for (Method method : concreteSbbClass.getMethods()) {
          if (method.getName().equals(eventEntry.getInitialEventSelectorMethod())
              && Arrays.equals(method.getParameterTypes(), argtypes)) {
            this.initialEventSelectorMethods.put(
                eventEntry.getInitialEventSelectorMethod(), method);
            break;
          }
        }
      }
    }
  }