Package org.openbp.core.model

Examples of org.openbp.core.model.ModelException


      {
        LogUtil.error(getClass(), "Unsupported encoding for XML file.", e);
      }
      catch (XMLDriverException pe)
      {
        throw new ModelException("FileSystemOperation", "Error serializing component '" + item.getQualifier() + "'.", pe);
      }
    }

    // Replace the generator info tag in the string output
    return bytes;
View Full Code Here


    // Check if model already exists

    // First, check in current model manager
    if (allModels.get(qualifier) != null)
      throw new ModelException("Operation", "Model '" + qualifier + "' already exists");

    // Then, check in other model managers
    if (getParentModelMgr() != null)
    {
      Model existingModel = getParentModelMgr().getOptionalModelByQualifier(qualifier);;
      if (existingModel != null)
      {
        throw new ModelException("Operation", "Model '" + qualifier + "' already loaded by model manager '" + existingModel.getModelMgr().getClass().getName() + "'.");
      }
    }

    // Now that the model descriptor has been written, we can link the new model
    // into the top level/all models list.
View Full Code Here

    {
      String msg = LogUtil
        .error(
          getClass(),
          "Unable to determine the root path of the file system model manager from the setting 'openbp.FileSystemModelMgr.ModelPath' or the application root directory. Maybe the root directory was not specified using the '-DrootDir=<dir>' JVM option.");
      throw new ModelException("Init", msg);
    }
    rootPath = StringUtil.normalizePathName(rootPath);
    setModelRootPath(rootPath);

    // Issue a warning on non-existent model path, but continue anyway, directory might be created
View Full Code Here

    {
      out = new FileOutputStream(filePath);
    }
    catch (FileNotFoundException e)
    {
      throw new ModelException("FileSystemOperation", "Cannot create file '" + filePath + "': " + e.getMessage());
    }

    try
    {
      out.write(bytes);
    }
    catch (IOException ioe)
    {
      throw new ModelException("FileSystemOperation", "Cannot write to file '" + filePath + "': " + ioe.getMessage());
    }
    finally
    {
      try
      {
View Full Code Here

    {
      out = new FileOutputStream(filePath);
    }
    catch (FileNotFoundException e)
    {
      throw new ModelException("FileSystemOperation", "Cannot create file '" + filePath + "': " + e.getMessage());
    }

    try
    {
      out.write(bytes);
    }
    catch (IOException ioe)
    {
      throw new ModelException("FileSystemOperation", "Cannot write to file '" + filePath + "': " + ioe.getMessage());
    }
    finally
    {
      try
      {
View Full Code Here

    {
      new File(filePath).delete();
    }
    catch (SecurityException se)
    {
      throw new ModelException("FileSystemOperation", "Cannot remove model descriptor file '" + filePath + "': " + se.getMessage());
    }

    // Removes a model directory and all its files and subdirs.
    try
    {
      // Recursively delete the directory
      FileUtil.remove(new File(modelPath));
    }
    catch (IOException e)
    {
      throw new ModelException("FileSystemOperation", "Cannot remove model directory '" + modelPath + "': " + e.getMessage());
    }
  }
View Full Code Here

    {
      new File(filePath).delete();
    }
    catch (SecurityException se)
    {
      throw new ModelException("FileSystemOperation", "Cannot remove model descriptor file '" + filePath + "': " + se.getMessage());
    }
  }
View Full Code Here

    if (model != null)
    {
      String itemType = itemQualifier.getItemType();
      ItemTypeDescriptor itd = getItemTypeDescriptor(itemType);
      if (itd == null)
        throw new ModelException("UnknownItemType", "Unknown item type '" + itemType + "'.");

      return readItemFromStore(model, itemQualifier.getItem(), itd);
    }
    return null;
  }
View Full Code Here

      {
        itemInterface = Class.forName(itemInterfaceName);
      }
      catch (Exception e)
      {
        throw new ModelException("Initialization", "Component interface '" + itemInterfaceName + "' not found.");
      }
    }

    if (itemClass == null)
    {
      try
      {
        itemClass = Class.forName(itemClassName);
      }
      catch (Exception e)
      {
        throw new ModelException("Initialization", "Component class '" + itemClassName + "' not found.");
      }
    }

    if (itemFactory == null)
    {
      if (itemFactoryClassName != null)
      {
        try
        {
          itemFactory = (ItemFactory) ReflectUtil.instantiate(itemFactoryClassName, ItemFactory.class, "component factory");
        }
        catch (ReflectException e)
        {
          throw new ModelException("Initialization", "Error instantiating component factory.", e);
        }
      }
      else
      {
        StandardItemFactory stdFactory = new StandardItemFactory();
View Full Code Here

    InitialNode initialNode = (InitialNode) startSocket.getNode();
    if (initialNode.getEntryScope() != InitialNode.SCOPE_PUBLIC)
    {
      String msg = LogUtil.error(getClass(), "Node $0 is not a public initial node (start node reference: $1). [{2}]", initialNode.getQualifier(), startRef, context);
      throw new ModelException("NoPublicInitialNode", msg);
    }
    context.setCurrentSocket(startSocket);

    if (context.getExecutingModel() == null)
    {
View Full Code Here

TOP

Related Classes of org.openbp.core.model.ModelException

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.