Examples of XMLDriver


Examples of org.jsynthlib.driver.Xmldriver

        }
    }

    @Override
    public Xmldriver handleDriver(String driverName) {
        Xmldriver driver = drivers.addNewXmldriver();
        driver.setName(driverName);
        return driver;
    }
View Full Code Here

Examples of org.jsynthlib.driver.Xmldriver

    @Override
    public Xmlparam handleParamInternal(Xmleditor editor,
            WidgetAdapter adapter, String uniqueName) {
        XmlCursor cursor = editor.newCursor();
        cursor.toParent();
        Xmldriver driver = (Xmldriver) cursor.getObject();
        cursor.dispose();
        assertTrue("Check driver " + driver.getName(),
                testedItems.containsKey(driver));

        Xmlparams params = getParams(editor);
        final Xmlparam param = getParamByLabel(params, uniqueName);
        log.info("Testing param " + uniqueName);
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

  {
    // Use the class loader that loaded the OpenBP core to resolve XML mappings
    XMLDriver.setDefaultClassLoader(getClass().getClassLoader());

    // Load standard mappings
    XMLDriver driver = XMLDriver.getInstance();
    String encoding = SettingUtil.getStringSetting(XML_ENCODING_PROP);
    if (encoding != null)
    {
      driver.setEncoding(encoding);
    }
    boolean prettyPrint = SettingUtil.getBooleanSetting(XML_PRETTYPRINT_PROP, false);
    driver.setPrettyPrint(prettyPrint);
    if (!driver.loadMappings(mappedClasses))
      throw new OpenBPException("Initialization.Mapping", "Errors occurred while loading the core mappings. See the log file for details.");
  }
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

   * This directory contains a sub directory for each plugin.
   * Each sub directory contains a plugin profile ending with '.plugin.xml' and any jar files needed by the plugin.
   */
  public void loadPluginsFromResource()
  {
    XMLDriver xmlDriver = XMLDriver.getInstance();
    try
    {
      Class [] profileClasses = { PluginProfile.class, };
      xmlDriver.loadMappings(profileClasses);
    }
    catch (XMLDriverException e)
    {
      ExceptionUtil.printTrace(e);
      return;
    }

    ResourceMgr resMgr = ResourceMgr.getDefaultInstance();
    String resourcePattern = CockpitConstants.PLUGIN + "/*/*.plugin.xml";
    Resource[] resources = null;

    try
    {
      resources = resMgr.findResources(resourcePattern);
    }
    catch (ResourceMgrException e)
    {
      return;
    }

    for (int i = 0; i < resources.length; i++)
    {
      PluginProfile profile = null;
      try
      {
        profile = (PluginProfile) xmlDriver.deserializeResource(PluginProfile.class, resources[i]);
      }
      catch (XMLDriverException e)
      {
        LogUtil.error(getClass(), "Error reading plugin profile $0.", resources[i].getDescription(), e);
        continue;
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

   * Loads all generator descriptors.
   */
  private void loadGenerators()
  {
    // Load the standard mappings for the standard XML driver
    XMLDriver xmlDriver = XMLDriver.getInstance();
    try
    {
      xmlDriver.loadMappings(standardMappedClasses);
    }
    catch (XMLDriverException e)
    {
      ExceptionUtil.printTrace(e);
      return;
    }

    generatorList = new ArrayList();

    ClassLoader classLoader = getClass().getClassLoader();
    String classesDir = Application.getRootDir() + StringUtil.FOLDER_SEP + CockpitConstants.GENERATOR + StringUtil.FOLDER_SEP + "classes";
    if (new File(classesDir).isDirectory())
    {
      // Generator classes directory exists, set up class loader
      XClassLoaderConfiguration config = new XClassLoaderConfiguration();
      config.setName("Generator template class loader");
      config.setParentClassLoader(getClass().getClassLoader());
      config.addRepository(classesDir);
      try
      {
        classLoader = new XClassLoader(config);
      }
      catch (Exception e)
      {
        ExceptionUtil.printTrace(e);
        return;
      }
    }

    ResourceMgr resMgr = ResourceMgr.getDefaultInstance();
    String resourcePattern = CockpitConstants.GENERATOR + "/*.xml";
    Resource[] resources = null;

    try
    {
      resources = resMgr.findResources(resourcePattern);
    }
    catch (ResourceMgrException e)
    {
      return;
    }
    if (resources.length == 0)
      return;

    for (int i = 0; i < resources.length; i++)
    {
      Generator generator = null;
      try
      {
        generator = (Generator) xmlDriver.deserializeResource(Generator.class, resources[i]);
      }
      catch (XMLDriverException e)
      {
        ExceptionUtil.printTrace(e);
        continue;
      }
      generator.setGeneratorMgr(this);
      generator.setClassLoader(classLoader);

      // Create a generator-local XML driver and load the standard mappings
      XMLDriver generatorXmlDriver = new XMLDriver(classLoader);
      try
      {
        generatorXmlDriver.loadMappings(standardMappedClasses);
        generator.setXmlDriver(generatorXmlDriver);
      }
      catch (XMLDriverException e)
      {
        ExceptionUtil.printTrace(e);
        continue;
      }

      // Create the customizer if required
      try
      {
        generator.createCustomizer();
      }
      catch (Exception e)
      {
        ExceptionUtil.printTrace(e);
        continue;
      }

      // Load the XML files specified by the customizer
      try
      {
        // Load the mapping for specific generator settings defined by the customizer of the generator
        GeneratorCustomizer customizer = generator.getCustomizer();
        if (customizer != null)
        {
          Class [] dependentClasses = customizer.getDependentSettingsClasses();
          if (dependentClasses != null)
          {
            for (int iClasses = 0; iClasses < dependentClasses.length; ++iClasses)
            {
              generatorXmlDriver.loadMapping(dependentClasses [iClasses]);
            }
          }

          Class settingsClass = customizer.getSettingsClass();
          if (settingsClass != null)
          {
            generatorXmlDriver.loadMapping(settingsClass);
          }
        }
      }
      catch (XMLDriverException e)
      {
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

    }

    if (resources.length == 0)
      throw new ModelException("MissingItemTypeDescriptors", "No item type files found matching '" + resourcePattern + "'.");

    XMLDriver driver = XMLDriver.getInstance();
    ItemTypeDescriptor itd;

    for (int i = 0; i < resources.length; i++)
    {
      // Deserialize item descriptor file
      try
      {
        itd = (ItemTypeDescriptor) driver.deserializeResource(ItemTypeDescriptor.class, resources[i]);
      }
      catch (XMLDriverException pe)
      {
        throw new ModelException("Initialization", "Error reading component type descriptor resource '" + resources[i].getDescription()
          + "': " + pe.getMessage());
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

   * Loads all skin files in the $OpenBP/cockpit/skin directory.
   */
  private void loadSkins()
  {
    // Load mappings for generic skin descriptor files
    XMLDriver xmlDriver = XMLDriver.getInstance();
    xmlDriver.loadMapping(org.openbp.cockpit.modeler.figures.generic.XFigureDescriptor.class);
    xmlDriver.loadMapping(org.openbp.cockpit.modeler.skins.LinkDescriptor.class);
    xmlDriver.loadMapping(org.openbp.cockpit.modeler.skins.SymbolDescriptor.class);
    xmlDriver.loadMapping(org.openbp.cockpit.modeler.skins.Skin.class);

    ResourceMgr resMgr = ResourceMgr.getDefaultInstance();
    String resourcePattern = CockpitConstants.SKIN + "/*.xml";
    Resource[] resources = null;

    try
    {
      resources = resMgr.findResources(resourcePattern);
    }
    catch (ResourceMgrException e)
    {
      throw new ModelException("MissingItemTypeDescriptors", "No item type files found matching '" + resourcePattern + "'.");
    }

    if (resources.length == 0)
      throw new ModelException("MissingItemTypeDescriptors", "No skin definitions found in resource path '" + CockpitConstants.SKIN + "'.");

    ArrayList errorMsgs = new ArrayList();
    for (int i = 0; i < resources.length; i++)
    {
      Skin skin = null;

      // Load the descriptor
      try
      {
        skin = (Skin) xmlDriver.deserializeResource(Skin.class, resources[i]);
      }
      catch (XMLDriverException e)
      {
        ExceptionUtil.printTrace(e);
        continue;
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

    {
      // No descriptors present
      return;
    }

    XMLDriver xmlDriver = XMLDriver.getInstance();

    // Load the descriptors from the descriptor directory
    for (int i = 0; i < resources.length; i++)
    {
      ObjectDescriptor descriptor = null;
      String resourceName = resources[i].getDescription().toString();

      // Load the descriptor
      try
      {
        descriptor = (ObjectDescriptor) xmlDriver.deserializeFile(ObjectDescriptor.class, resourceName);
      }
      catch (XMLDriverException e)
      {
        LogUtil.error(getClass(), "Error loading custom object descriptor $0.", resourceName, e);
        continue;
      }

      // Load the descriptor
      try
      {
        descriptor = (ObjectDescriptor) xmlDriver.deserializeResource(ObjectDescriptor.class, resources[i]);
      }
      catch (XMLDriverException e)
      {
        LogUtil.error(getClass(), "Error loading custom object descriptor $0.", resourceName, e);
        continue;
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

  /**
   * Constructor.
   */
  public ExternalAssociationPlugin()
  {
    XMLDriver xmlDriver = XMLDriver.getInstance();

    // Load mappings for the association beans
    try
    {
      xmlDriver.loadMapping(org.openbp.cockpit.plugins.association.AssociationBean.class);
      xmlDriver.loadMapping(org.openbp.cockpit.plugins.association.MimeTypeAssociation.class);
    }
    catch (XMLDriverException e)
    {
      ExceptionUtil.printTrace(e);
      return;
View Full Code Here

Examples of org.openbp.common.io.xml.XMLDriver

   * @param modelDescriptorResource Resource that identifies the model descriptor file
   * @return The new model or null (error messages go to the message container)
   */
  protected Model readModelDescriptor(Resource modelDescriptorResource)
  {
    XMLDriver driver = XMLDriver.getInstance();

    // Deserialize model descriptor file (model.xml)
    Model model = null;
    try
    {
      model = (Model) driver.deserializeResource(ModelImpl.class, modelDescriptorResource);
    }
    catch (XMLDriverException pe)
    {
      getMsgContainer().addMsg(model, "Error reading model descriptor file $0 in model manager $1.", new Object[]
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.