Package de.hpi.eworld.core.extensionpoints

Examples of de.hpi.eworld.core.extensionpoints.PersistenceProviderInterface


    if (arg instanceof ObserverNotification) {
      final ObserverNotification notification = (ObserverNotification) arg;
      final NotificationType type = notification.getType();
      try {
        if (type.equals(NotificationType.loadFromFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          final Collection<?> items = (Collection<?>) notification.getObj2();
          if (this == plugin) {
            loadFromFile(items);
          }
        } else if (type.equals(NotificationType.clearModel)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          if (this == plugin) {
            clearModel();
          }
        }
        if (type.equals(NotificationType.saveToFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          @SuppressWarnings("unchecked")
          final Collection<Object> items = (Collection<Object>) notification.getObj2();
          if (this == plugin) {
            saveToFile(items);
          }
View Full Code Here


    if (arg instanceof ObserverNotification) {
      final ObserverNotification notification = (ObserverNotification) arg;
      final NotificationType type = notification.getType();
      try {
        if (type.equals(NotificationType.loadFromFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          final Collection<?> items = (Collection<?>) notification.getObj2();
          if (this == plugin) {
            loadFromFile(items);
          }
        } else if (type.equals(NotificationType.clearModel)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          if (this == plugin) {
            clearModel();
          }
        }
        if (type.equals(NotificationType.saveToFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          @SuppressWarnings("unchecked")
          final Collection<Object> items = (Collection<Object>) notification.getObj2();
          if (this == plugin) {
            saveToFile(items);
          }
View Full Code Here

      log.info("Discovered plugin for extension point " + ext.getExtendedPointId() + " with id: " + ext.getId());

      try {
        Class<?> persistenceCls = loadPlugin(ext);
        // Create Tool instance.
        PersistenceProviderInterface persistenceProvider = (PersistenceProviderInterface) persistenceCls.newInstance();
        // Initialize class instance according to interface contract
        PersistenceManager.getInstance().registerForPersistency(ext.getDeclaringPluginDescriptor().getId(), persistenceProvider);
        persistenceProvider.init(PersistenceManager.getInstance());
      } catch (Throwable t) {
        displayPluginLoadErrorMsg(t, ext);
        log.error("Error while trying to initialize persistence provider plugin", t);
      }
    }
View Full Code Here

        in.close();
        return;
      }

      if (plugins.keySet().contains(ppc.getPluginName())) {
        final PersistenceProviderInterface accordingPlugin = plugins.get(ppc.getPluginName());
        setChanged();
        notifyObservers(new ObserverNotification(NotificationType.loadFromFile, accordingPlugin, ppc.getItems()));
        clearChanged();
      }
    }
View Full Code Here

TOP

Related Classes of de.hpi.eworld.core.extensionpoints.PersistenceProviderInterface

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.