/**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public void eUnset(int featureID) {
   switch (featureID) {
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DELEGATES:
       getDelegates().clear();
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__IS_DELEGATED_BY:
       getIsDelegatedBy().clear();
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__NAME:
       setName(NAME_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DESCRIPTION:
       setDescription(DESCRIPTION_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__CATEGORY:
       setCategory(CATEGORY_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__SOURCE_DESCR:
       setSourceDescr(SOURCE_DESCR_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__OWNER_DESCR:
       setOwnerDescr(OWNER_DESCR_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ID:
       setID(ID_EDEFAULT);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ANY:
       setAny((EObject) null);
       return;
   }
   super.eUnset(featureID);
 }
 @Test
 public void testNewAnnotationConfiguration() {
   IConfiguration configuration = service.newAnnotationConfiguration();
   Assert.assertNotNull(configuration);
   Object target = ((IFacade) configuration).getTarget();
   Assert.assertNotNull(target);
   Assert.assertTrue(target instanceof AnnotationConfiguration);
 }
 @Test
 public void testNewJDBCReader() {
   IConfiguration configuration = FACADE_FACTORY.createConfiguration(new Configuration());
   IReverseEngineeringStrategy engineeringStrategy =
       FACADE_FACTORY.createReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy());
   IJDBCReader jdbcReaderFacade = service.newJDBCReader(configuration, engineeringStrategy);
   Assert.assertNotNull(jdbcReaderFacade);
   JDBCReader reader = (JDBCReader) ((IFacade) jdbcReaderFacade).getTarget();
   Assert.assertNotNull(reader);
 }
 @Test
 public void testNewDatabaseCollector() {
   Configuration cfg = new Configuration();
   IJDBCReader jdbcReader =
       FACADE_FACTORY.createJDBCReader(
           JDBCReaderFactory.newJDBCReader(
               cfg.getProperties(), cfg.buildSettings(), new DefaultReverseEngineeringStrategy()));
   IDatabaseCollector databaseCollectorFacade = service.newDatabaseCollector(jdbcReader);
   Assert.assertNotNull(databaseCollectorFacade);
   DatabaseCollector databaseCollector =
       (DatabaseCollector) ((IFacade) databaseCollectorFacade).getTarget();
   Assert.assertNotNull(databaseCollector);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @SuppressWarnings("unchecked")
 @Override
 public void eSet(int featureID, Object newValue) {
   switch (featureID) {
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DELEGATES:
       getDelegates().clear();
       getDelegates().addAll((Collection<? extends Element>) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__IS_DELEGATED_BY:
       getIsDelegatedBy().clear();
       getIsDelegatedBy().addAll((Collection<? extends Element>) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__NAME:
       setName((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__DESCRIPTION:
       setDescription((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__CATEGORY:
       setCategory((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__SOURCE_DESCR:
       setSourceDescr((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__OWNER_DESCR:
       setOwnerDescr((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ID:
       setID((String) newValue);
       return;
     case ContentfwkPackage.INFORMATION_SYSTEM_SERVICE__ANY:
       setAny((EObject) newValue);
       return;
   }
   super.eSet(featureID, newValue);
 }
Example #6
0
  @SuppressWarnings("unchecked")
  public DescriptionImpl(
      final URI baseURI,
      final TDefinitions definition,
      final NamespaceMapperImpl namespaceMapper,
      final SchemaLocatorImpl schemaLocator,
      final Map<FeatureConstants, Object> features,
      Map<URI, AbsItfDescription> descriptionImports,
      Map<URI, AbsItfSchema> schemaImports,
      WSDLReaderImpl reader)
      throws WSDLException, WSDLImportException {

    super(baseURI, definition, namespaceMapper, schemaLocator, features);

    // get the documentation
    this.documentation =
        new org.ow2.easywsdl.wsdl.impl.wsdl11.DocumentationImpl(
            this.model.getDocumentation(), this);

    // get the reader
    if (reader == null) {
      this.reader = new WSDLReaderImpl();
    } else {
      this.reader = reader;
    }

    boolean find = false;
    for (final TDocumented part : this.model.getAnyTopLevelOptionalElement()) {
      // get imports
      if (part instanceof TImport) {
        final Import impt =
            new org.ow2.easywsdl.wsdl.impl.wsdl11.ImportImpl(
                (TImport) part,
                this,
                descriptionImports,
                schemaImports,
                this.documentURI,
                this.reader);
        this.imports.add(impt);
        find = true;
      }
    }
    if (!find) {
      Iterator<Object> it = this.model.getAny().iterator();
      while (it.hasNext()) {
        Object part = it.next();

        // get import
        if (part instanceof Element) {
          if ((((Element) part).getLocalName().equals("import"))
              && verifWSDL11Ns(((Element) part).getNamespaceURI())) {
            TImport tImpt =
                ImportImpl.replaceDOMElementByTImport(this, (Element) part, this.reader);
            it = this.model.getAny().iterator();
            final Import impt =
                new org.ow2.easywsdl.wsdl.impl.wsdl11.ImportImpl(
                    (TImport) tImpt,
                    this,
                    descriptionImports,
                    schemaImports,
                    this.documentURI,
                    this.reader);
            this.imports.add(impt);
          }
        }
      }
    }

    this.addImportElementsInAllList();
    this.addIncludeElementsInAllList();

    find = false;
    for (final TDocumented part : this.model.getAnyTopLevelOptionalElement()) {
      // get types
      if (part instanceof TTypes) {
        this.types =
            new org.ow2.easywsdl.wsdl.impl.wsdl11.TypesImpl(
                (TTypes) part, this, schemaImports, this.reader);
        find = true;
        break;
      }
    }
    if (!find) {
      Iterator<Object> it = this.model.getAny().iterator();
      while (it.hasNext()) {
        Object part = it.next();

        // get import
        if (part instanceof Element) {

          if ((((Element) part).getLocalName().equals("types"))
              && verifWSDL11Ns(((Element) part).getNamespaceURI())) {
            if (reader == null) {
              reader = new WSDLReaderImpl();
            }
            TTypes tTypes = TypesImpl.replaceDOMElementByTTypes(this, (Element) part, reader);
            it = this.model.getAny().iterator();
            this.types =
                new org.ow2.easywsdl.wsdl.impl.wsdl11.TypesImpl(
                    (TTypes) tTypes, this, schemaImports, this.reader);
          }
        }
      }
    }

    this.messages = this.findAllMessages(this);

    find = false;
    for (final TDocumented part : this.model.getAnyTopLevelOptionalElement()) {
      // get interfaces
      if (part instanceof TPortType) {
        final InterfaceType itf =
            new org.ow2.easywsdl.wsdl.impl.wsdl11.InterfaceTypeImpl((TPortType) part, this);
        this.interfaces.add(itf);
        find = true;
      }
    }
    if (!find) {
      Iterator<Object> it = this.model.getAny().iterator();
      while (it.hasNext()) {
        Object part = it.next();

        // get import
        if (part instanceof Element) {
          if ((((Element) part).getLocalName().equals("portType"))
              && verifWSDL11Ns(((Element) part).getNamespaceURI())) {
            if (reader == null) {
              reader = new WSDLReaderImpl();
            }
            TPortType tPortType =
                InterfaceTypeImpl.replaceDOMElementByTPortType(this, (Element) part, reader);
            it = this.model.getAny().iterator();
            final InterfaceType itf =
                new org.ow2.easywsdl.wsdl.impl.wsdl11.InterfaceTypeImpl(
                    (TPortType) tPortType, this);
            this.interfaces.add(itf);
          }
        }
      }
    }

    find = false;
    for (final TDocumented part : this.model.getAnyTopLevelOptionalElement()) {
      // get bindings
      if (part instanceof TBinding) {
        final Binding b = new org.ow2.easywsdl.wsdl.impl.wsdl11.BindingImpl((TBinding) part, this);
        this.bindings.add(b);
        find = true;
      }
    }
    if (!find) {
      Iterator<Object> it = this.model.getAny().iterator();
      while (it.hasNext()) {
        Object part = it.next();

        // get import
        if (part instanceof Element) {
          if ((((Element) part).getLocalName().equals("binding"))
              && verifWSDL11Ns(((Element) part).getNamespaceURI())) {
            if (reader == null) {
              reader = new WSDLReaderImpl();
            }
            TBinding tBinding =
                BindingImpl.replaceDOMElementByTBinding(this, (Element) part, reader);
            it = this.model.getAny().iterator();
            final Binding b =
                new org.ow2.easywsdl.wsdl.impl.wsdl11.BindingImpl((TBinding) tBinding, this);
            this.bindings.add(b);
          }
        }
      }
    }

    find = false;
    for (final TDocumented part : this.model.getAnyTopLevelOptionalElement()) {
      // get services
      if (part instanceof TService) {
        final Service s = new org.ow2.easywsdl.wsdl.impl.wsdl11.ServiceImpl((TService) part, this);
        this.services.add(s);
        find = true;
      }
    }
    if (!find) {
      Iterator<Object> it = this.model.getAny().iterator();
      while (it.hasNext()) {
        Object part = it.next();

        // get import
        if (part instanceof Element) {
          if ((((Element) part).getLocalName().equals("service"))
              && verifWSDL11Ns(((Element) part).getNamespaceURI())) {
            if (reader == null) {
              reader = new WSDLReaderImpl();
            }
            TService tService =
                ServiceImpl.replaceDOMElementByTService(this, (Element) part, reader);
            it = this.model.getAny().iterator();
            final Service s =
                new org.ow2.easywsdl.wsdl.impl.wsdl11.ServiceImpl((TService) tService, this);
            this.services.add(s);
          }
        }
      }
    }
  }
  public void updated(Dictionary settings) throws ConfigurationException {
    // if non-null settings come in, we have to instantiate the service and
    // apply these settings
    ((ServiceImpl) m_service).initService();
    Object service = m_service.getService();

    Dictionary oldSettings = null;
    synchronized (this) {
      oldSettings = m_settings;
    }

    if (oldSettings == null && settings == null) {
      // CM has started but our configuration is not still present in the CM database: ignore
      return;
    }

    if (service != null) {
      String callback = (m_callback == null) ? "updated" : m_callback;
      Method m;
      try {
        m = service.getClass().getDeclaredMethod(callback, new Class[] {Dictionary.class});

        // if exception is thrown here, what does that mean for the
        // state of this dependency? how smart do we want to be??
        // it's okay like this, if the new settings contain errors, we
        // remain in the state we were, assuming that any error causes
        // the "old" configuration to stay in effect.
        // CM will log any thrown exceptions.
        m.invoke(service, new Object[] {settings});
      } catch (InvocationTargetException e) {
        // The component has thrown an exception during it's callback invocation.
        if (e.getTargetException() instanceof ConfigurationException) {
          // the callback threw an OSGi ConfigurationException: just re-throw it.
          throw (ConfigurationException) e.getTargetException();
        } else {
          // wrap the callback exception into a ConfigurationException.
          throw new ConfigurationException(
              null,
              "Service " + m_service + " with " + this.toString() + " could not be updated",
              e.getTargetException());
        }
      } catch (Throwable t) {
        // wrap any other exception as a ConfigurationException.
        throw new ConfigurationException(
            null, "Service " + m_service + " with " + this.toString() + " could not be updated", t);
      }
    } else {
      m_logger.log(
          Logger.LOG_ERROR,
          "Service "
              + m_service
              + " with configuration dependency "
              + this
              + " could not be instantiated.");
      return;
    }

    // If these settings did not cause a configuration exception, we determine if they have
    // caused the dependency state to change
    synchronized (this) {
      m_settings = settings;
    }

    if ((oldSettings == null) && (settings != null)) {
      m_service.dependencyAvailable(this);
    }
    if ((oldSettings != null) && (settings == null)) {
      m_service.dependencyUnavailable(this);
    }
    if ((oldSettings != null) && (settings != null)) {
      m_service.dependencyChanged(this);
    }
  }