Package org.apache.uima.aae.deployment

Examples of org.apache.uima.aae.deployment.AEDeploymentMetaData


    }
    multiPageEditor.setFileDirty();
  }

  protected void changeToAsyncAggregate(boolean toAsyncAggreagte) {
    AEDeploymentMetaData metaData = (AEDeploymentMetaData) currentMetaDataObject;
    if (toAsyncAggreagte) {
      // Resolve delegates
      try {
        metaData.resolveDelegates(multiPageEditor.cde.createResourceManager(), false);
      } catch (InvalidXMLException e) {
        e.printStackTrace();
        Utility.popMessage(Messages.getString("InvalidXMLException"), //$NON-NLS-1$
                multiPageEditor.cde.getMessagesToRootCause(e), MessageDialog.ERROR);
        multiPageEditor.switchToBadSource(false);
        return;
      }
      if (metaData.getNumberOfInstances() != 1) {
        metaData.setNumberOfInstances(1);
      }
    }
    metaData.setAsync(toAsyncAggreagte);

    masterPart.refresh();
    multiPageEditor.setFileDirty();
  }
View Full Code Here


   * @see org.eclipse.ui.forms.IDetailsPageProvider#getPageKey(java.lang.Object)
   */
  public Object getPageKey(Object object) {
    updateStatus(null, IMessageProvider.ERROR);
    if (object instanceof AEDeploymentMetaData) {
      AEDeploymentMetaData metaData = (AEDeploymentMetaData) object;

      Class cls = null;
      if ( metaData.isTopAnalysisEngine() ) {
        // Top AE
        // Trace.err("Top AE: " + metaData.getKey());
        cls = AsyncPrimitiveErrorConfiguration.class;
      } else {
        // Delegate
View Full Code Here

    return EmptyDetailsPage.class;
  }
  public Object getPageKey_OLD(Object object) {
    updateStatus(null, IMessageProvider.ERROR);
    if (object instanceof AEDeploymentMetaData) {
      AEDeploymentMetaData metaData = (AEDeploymentMetaData) object;

      Class cls = null;
      ResourceSpecifier rs = metaData.getResourceSpecifier();
      if (rs != null) {
        if (rs instanceof AnalysisEngineDescription) {
          if ( metaData.isTopAnalysisEngine() ) {
            // Prmitive
            cls = AsyncPrimitiveErrorConfiguration.class;
          } else {
            // Aggregate
            cls = AsyncAggregateErrorConfiguration.class;
          }
        }
      } else {
        String parentKey = null;
        if (metaData.getParent() != null) {
          parentKey = metaData.getParent().getKey();         
        } else {
          if (metaData.isTopAnalysisEngine()) {
            updateStatus("The top descriptor is not specified.", IMessageProvider.ERROR);
            return null;
          }
        }
        if (parentKey == null) {
          parentKey = "Top Analysis Engine";
        }
        updateStatus("The analysis engine's key=\"" + metaData.getKey()
                + "\" is not valid for the aggregate \"" + parentKey + "\"", IMessageProvider.ERROR);
      }
      return cls;

    } else if (object instanceof RemoteAEDeploymentMetaData) {
      RemoteAEDeploymentMetaData metaData = (RemoteAEDeploymentMetaData) object;

      Class cls = null;
      ResourceSpecifier rs = metaData.getResourceSpecifier();
      if (rs != null) {
        if (rs instanceof AnalysisEngineDescription) {
          cls = AsyncAggregateErrorConfiguration.class;
        }
      } else {
        String parentKey = metaData.getParent().getKey();
        if (parentKey == null) {
          parentKey = "Top Analysis Engine";
        }
        updateStatus("The analysis engine's key=\"" + metaData.getKey()
                + "\" is not valid for the aggregate \"" + parentKey + "\"", IMessageProvider.ERROR);
      }
      return cls;
      // return AsyncPrimitiveErrorConfiguration.class;
    } else {
View Full Code Here

   * @return AEDeploymentMetaData
   */
  static public AEDeploymentMetaData createAEDeploymentMetaData(
          RemoteAEDeploymentMetaData remoteMetaData) {
    ResourceSpecifierFactory factory = UIMAFramework.getResourceSpecifierFactory();
    AEDeploymentMetaData metaData = (AEDeploymentMetaData) factory
            .createObject(AEDeploymentMetaData.class);
    metaData.setParent(remoteMetaData.getParent());
    metaData.setKey(remoteMetaData.getKey());
    try {
      metaData.setResourceSpecifier(remoteMetaData.getResourceSpecifier(), null, false);
    } catch (InvalidXMLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // Need to call AFTER metaData.setResourceSpecifier
    metaData.setCasMultiplierPoolSize(remoteMetaData.getCasMultiplierPoolSize());

      // Clone AsyncAggregateErrorConfiguration
      metaData.setAsyncAEErrorConfiguration((AsyncAEErrorConfiguration) remoteMetaData
              .getAsyncAEErrorConfiguration().clone());
      // Set TimeOut for Delegate
      metaData.getAsyncAEErrorConfiguration().getGetMetadataErrors().setTimeout(AEDeploymentConstants.DEFAULT_GETMETADATA_NO_TIMEOUT);

    return metaData;
  }
View Full Code Here

    Map mapDelegateAEs = aeDescription.getDelegateAnalysisEngineSpecifiers(aResourceManager);
    List<XMLizable> list = getDelegates().getDelegates();
    for (XMLizable xmlizable : list) {
      if (xmlizable instanceof AEDeploymentMetaData) {
        AEDeploymentMetaData meta = (AEDeploymentMetaData) xmlizable;
        if (mapDelegateAEs.containsKey(meta.getKey())) {
          // Recursive
          // Trace.err(4, "Match2: " + meta.getKey());
          ResourceSpecifier rs = (ResourceSpecifier) mapDelegateAEs.get(meta.getKey());
          meta.setResourceSpecifier(rs, aResourceManager, recursive);
        } else {
          // Trace.err("NOT match: " + meta.getKey());
          throw new DDEInvalidXMLException(DDEInvalidXMLException.DELEGATE_KEY_NOT_FOUND, new
                  Object[] {meta.getKey(), aeDescription.getSourceUrlString() });
        }

      } else if (xmlizable instanceof RemoteAEDeploymentMetaData) {
        RemoteAEDeploymentMetaData meta = (RemoteAEDeploymentMetaData) xmlizable;
        if (mapDelegateAEs.containsKey(meta.getKey())) {
          // Trace.err(4, "match: " + meta.getKey());
          ResourceSpecifier rs = (ResourceSpecifier) mapDelegateAEs.get(meta.getKey());
          meta.setResourceSpecifier(rs, aResourceManager, recursive);

        } else {
          Trace.err("NOT Match: " + meta.getKey());
          throw new DDEInvalidXMLException(DDEInvalidXMLException.DELEGATE_KEY_NOT_FOUND, new
                  Object[] {meta.getKey(), aeDescription.getSourceUrlString() });
        }
      }

    } // for
  }
View Full Code Here

    }
    multiPageEditor.setFileDirty();
  }

  protected void changeToAsyncAggregate(boolean toAsyncAggreagte) {
    AEDeploymentMetaData metaData = (AEDeploymentMetaData) currentMetaDataObject;
    if (toAsyncAggreagte) {
      // Resolve delegates
      try {
        metaData.resolveDelegates(multiPageEditor.cde.createResourceManager(), false);
      } catch (InvalidXMLException e) {
        e.printStackTrace();
        Utility.popMessage(Messages.getString("InvalidXMLException"), //$NON-NLS-1$
                multiPageEditor.cde.getMessagesToRootCause(e), MessageDialog.ERROR);
        multiPageEditor.switchToBadSource(false);
        return;
      }
      if (metaData.getNumberOfInstances() != 1) {
        metaData.setNumberOfInstances(1);
      }
    }
    metaData.setAsync(toAsyncAggreagte);
   
    // Enable/Disable CAS Pool Size Control
    multiPageEditor.getOverviewPage().enableCasPoolSizeSettings(toAsyncAggreagte);
    if (!toAsyncAggreagte) {
      // Set CAS pool size to the number of instances
      multiPageEditor.getOverviewPage().setCasPoolSize(metaData.getNumberOfInstances());

      // Set number of listeners to default value (=1)
      inputQueueScaleout.setSelection(1);
      replyQueueListenersForCoLocated.setSelection(1);
    }
View Full Code Here

  public Object[] getChildren(Object parent) {
    Object[] objs = null;
    int count = 0;
    if (parent instanceof AEDeploymentMetaData) {
      AEDeploymentMetaData metaData = (AEDeploymentMetaData) parent;

//      if (metaData.getAsyncAEErrorConfiguration() == null) {
//        // Create a new Error Config
//        if (metaData.getResourceSpecifier() != null) {
//          ResourceSpecifier rs = metaData.getResourceSpecifier();
//          if (rs instanceof AnalysisEngineDescription) {
//            Class cls;
//            if (((AnalysisEngineDescription) rs).isPrimitive()) {
//              // Prmitive
//              cls = AsyncPrimitiveErrorConfiguration.class;
//            } else {
//              // Aggregate
//              cls = AsyncAggregateErrorConfiguration.class;
//            }
//
//            Object obj = UIMAFramework.getResourceSpecifierFactory().createObject(cls);
//            if (obj != null) {
//              Trace.err("OK to create " + cls.getName() + " for " + metaData.getKey());
//              metaData.setAsyncAEErrorConfiguration((AsyncAEErrorConfiguration) obj);
//            } else {
//              Trace.err("CANNOT create " + cls.getName() + " for " + metaData.getKey());
//            }
//          } else {
//            Trace.bug("Should be AnalysisEngineDescription: " + rs.getClass().getName());
//          }
//        } else {
//          Trace.bug("ResourceSpecifier == null for " + metaData.getKey());
//        }
//      }

      if (metaData.isAsync()) {
        if (metaData.getDelegates() != null) {
          List list = metaData.getDelegates().getDelegates();
          return list.toArray();
        }
      }
    } else if (parent instanceof RemoteAEDeploymentMetaData) {
      RemoteAEDeploymentMetaData metaData = (RemoteAEDeploymentMetaData) parent;
View Full Code Here

    return getChildren(parent).length > 0;
  }

  public Object[] getElements(Object inputElement) {
    if (inputElement instanceof AEDeploymentDescription) {
      AEDeploymentMetaData metaData = null;
      try {
        metaData = ((AEDeploymentDescription) inputElement).getAeService()
                .getAnalysisEngineDeploymentMetaData();
//        if (metaData != null && metaData.getAsyncAEErrorConfiguration() == null) {
//          // Create a new Error Config
View Full Code Here

    Map mapDelegateAEs = aeDescription.getDelegateAnalysisEngineSpecifiers(aResourceManager);
    List<XMLizable> list = getDelegates().getDelegates();
    for (XMLizable xmlizable : list) {
      if (xmlizable instanceof AEDeploymentMetaData) {
        AEDeploymentMetaData meta = (AEDeploymentMetaData) xmlizable;
        if (mapDelegateAEs.containsKey(meta.getKey())) {
          // Recursive
          // Trace.err(4, "Match2: " + meta.getKey());
          ResourceSpecifier rs = (ResourceSpecifier) mapDelegateAEs.get(meta.getKey());
          meta.setResourceSpecifier(rs, aResourceManager, recursive);
        } else {
          // Trace.err("NOT match: " + meta.getKey());
          throw new DDEInvalidXMLException(DDEInvalidXMLException.DELEGATE_KEY_NOT_FOUND, new
                  Object[] {meta.getKey(), aeDescription.getSourceUrlString() });
        }

      } else if (xmlizable instanceof RemoteAEDeploymentMetaData) {
        RemoteAEDeploymentMetaData meta = (RemoteAEDeploymentMetaData) xmlizable;
        if (mapDelegateAEs.containsKey(meta.getKey())) {
          // Trace.err(4, "match: " + meta.getKey());
          ResourceSpecifier rs = (ResourceSpecifier) mapDelegateAEs.get(meta.getKey());
          meta.setResourceSpecifier(rs, aResourceManager, recursive);

        } else {
          Trace.err("NOT Match: " + meta.getKey());
          throw new DDEInvalidXMLException(DDEInvalidXMLException.DELEGATE_KEY_NOT_FOUND, new
                  Object[] {meta.getKey(), aeDescription.getSourceUrlString() });
        }
      }

    } // for
  }
View Full Code Here

   * @return AEDeploymentMetaData
   */
  static public AEDeploymentMetaData createAEDeploymentMetaData(
          RemoteAEDeploymentMetaData remoteMetaData) {
    ResourceSpecifierFactory factory = UIMAFramework.getResourceSpecifierFactory();
    AEDeploymentMetaData metaData = (AEDeploymentMetaData) factory
            .createObject(AEDeploymentMetaData.class);
    metaData.setParent(remoteMetaData.getParent());
    metaData.setKey(remoteMetaData.getKey());
    try {
      metaData.setResourceSpecifier(remoteMetaData.getResourceSpecifier(), null, false);
    } catch (InvalidXMLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // Need to call AFTER metaData.setResourceSpecifier
    metaData.setCasMultiplierPoolSize(remoteMetaData.getCasMultiplierPoolSize());

      // Clone AsyncAggregateErrorConfiguration
      metaData.setAsyncAEErrorConfiguration((AsyncAEErrorConfiguration) remoteMetaData
              .getAsyncAEErrorConfiguration().clone());
      // Set TimeOut for Delegate
      metaData.getAsyncAEErrorConfiguration().getGetMetadataErrors().setTimeout(AEDeploymentConstants.DEFAULT_GETMETADATA_NO_TIMEOUT);

    return metaData;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.deployment.AEDeploymentMetaData

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.