Examples of Transformation


Examples of net.sf.graphiti.model.Transformation

      String name = element.getAttribute("name");
      String type = element.getName();
      if (type.equals("transformation")) {
        ITransformation instance = (ITransformation) element
            .createExecutableExtension("class");
        transformations.add(new Transformation(instance));
      } else if (type.equals("xslt")) {
        transformations.add(new Transformation(name));
      } else {
        throw new IllegalArgumentException("Unknown type: " + type);
      }
    }
  }
View Full Code Here

Examples of net.sf.nfp.mini.misc.Transformation

    margin = font.stringWidth("00.0");
    detailsHeight = font.getHeight() + 2;
    Log.log("font.getHeight()="+font.getHeight());
    Log.log("detailsHeight="+detailsHeight );
    height = getHeight() - detailsHeight;
    tx = new Transformation(0, (getWidth() - margin) / 6, margin,
        getWidth());
    ty = new Transformation(Observation.MIN_TEMP, Observation.MAX_TEMP,
        height, 0);
    ity = new Transformation(0, height, Observation.MAX_TEMP,
        Observation.MIN_TEMP);
    backgroundStripeHeight = Math.abs(ty.get(Observation.MIN_TEMP)
        - ty.get(Observation.MIN_TEMP + 10));
  }
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

         {
            logger.debug("Transforming a message with transformation " + transformation.getName());
            logger.dump(obj);
         }

         Transformation oldTransformation = transformation;

         if (!StringUtil.isEmpty(obj.getClassName()) && m_bPolymorphic)
         {
            TransformationEndpoint derivedEndpoint = transformation.getSource().getEndpoint(obj.getClassName());
            Transformation derivedTransformation = findDerivedTransformation(transformation, derivedEndpoint);

            if (oldTransformation.getDerivation() == Transformation.DERIVATION_FINAL && derivedTransformation != oldTransformation)
            {
               throw new IntegrationException("err.integration.messageTypeMismatch",
                  new Object[] {oldTransformation.toString(), oldTransformation.getSource().toString(), derivedEndpoint.toString()});
            }

            if (derivedTransformation != null && derivedTransformation != oldTransformation)
            {
               transformation = derivedTransformation;

               if (logger.isDebugEnabled())
               {
                  logger.debug("Using derived transformation \"" + derivedTransformation.getName() + "\"");
               }
            }
         }

         if (oldTransformation.getDerivation() == Transformation.DERIVATION_ABSTRACT)
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

    * @return The transformed message.
    * @throws IntegrationException If a transformation error occurs.
    */
   public TransferObject transformNested(PropertyMap tobj, String sTransformationName, Pair arguments) throws IntegrationException
   {
      Transformation transformation = m_context.getMetadata().getTransformation(sTransformationName);
      TransferObject outputSaved = m_output;
      Object[] sourceArraySaved = m_sourceArray;
      Lookup listMapSaved = m_listMap;
      ListKey listKeySaved = m_listKey;
      Object[] scriptArraySaved = m_scriptArray;
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

    */
   public static Transformation findDerivedTransformation(Transformation txf, TransformationEndpoint endpoint)
   {
      if (endpoint != null && txf.getDerivation() != Transformation.DERIVATION_FINAL)
      {
         Transformation result = txf.findTransformation(endpoint);

         if (result == null)
         {
            return findDerivedTransformation(txf, endpoint.getBaseEndpoint());
         }
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

   protected void seed(String sTransformation, final Function enabled, final Function delete, ResourceLoader loader)
   {
      final Metadata metadata = m_context.getMetadata();
      final MessageParser parser = (MessageParser)metadata.getFormat("XML").getParser().getInstance(m_context);
      final MessageFormatter formatter = (MessageFormatter)metadata.getFormat("Object").getFormatter().getInstance(m_context);
      final Transformation transformation = metadata.getTransformation(sTransformation);
      final Transformer transformer = new Transformer(m_context);
      final UnitOfWork uow = m_context.getUnitOfWork();
      final boolean bRawSaved = uow.isRaw();

      try
      {
         uow.setRaw(true);

         final List tobjList = new ArrayList();

         loader.seedResources(((XMLMetadata)metadata).getHelper(), new CharacterStreamHandler()
         {
            public void handleCharacterStream(Reader reader, String sName) throws IOException
            {
               try
               {
                  TransferObject tobj = parser.parse(new ReaderInput(reader), (Message)transformation.getSource());

                  tobj.setValue("name", sName);

                  if (enabled != null && !Intrinsic.isTrue(m_context.getMachine().invoke(enabled, tobj, (Object[])null)))
                  {
                     return;
                  }

                  if (delete != null)
                  {
                     m_context.getMachine().invoke(delete, tobj, (Object[])null);
                  }

                  tobj = transformer.transform(tobj, transformation);
                  tobjList.add(tobj);
               }
               catch (Exception e)
               {
                  s_logger.error("Unable to seed resource \"" + sName + "\"", e);

                  if (e instanceof RuntimeException)
                  {
                     throw (RuntimeException)e;
                  }

                  throw new UncheckedException("err.runtime.seed", new Object[]{sName}, e);
               }
            }
         });

         // Commit the deletes
         uow.commit(false);

         for (Iterator itr = tobjList.iterator(); itr.hasNext();)
         {
            formatter.format((TransferObject)itr.next(), (Message)transformation.getDestination(), new ObjectOutput());
         }

         // Commit the inserts/updates
         uow.commit(false);
      }
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

         m_helper.fixup(m_postInheritanceTransformationFixupList.iterator());
         m_postInheritanceTransformationFixupList = null;

         for (Iterator itr = m_metadata.getTransformationIterator(); itr.hasNext(); )
         {
            Transformation transformation = (Transformation)itr.next();

            try
            {
               transformation.finish(m_machine);
            }
            catch (UncheckedException ex)
            {
               m_helper.addException(ex);
            }
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

    */
   protected void loadTransformation(Element transformationElement, String sName)
   {
      XMLMetadataHelper.verifyRootElement(transformationElement, "Transformation");

      final Transformation transformation = new Transformation(sName);
      final String sURLPrefix = "transformation:" + sName;

      transformation.setCategory(XMLUtil.getStringAttr(transformationElement, "category"));
      transformation.setResourceName(m_helper.getCurResourceName());
      transformation.setSource(getTransformationEndpoint(XMLUtil.getReqStringAttr(transformationElement, "source"), sName));
      transformation.setDestination(getTransformationEndpoint(XMLUtil.getReqStringAttr(transformationElement, "destination"), sName));

      String sArguments = XMLUtil.getStringAttr(transformationElement, "args");

      if (sArguments != null)
      {
         StringTokenizer tokenizer = new StringTokenizer(sArguments);

         while (tokenizer.hasMoreTokens())
         {
            transformation.addArgument(tokenizer.nextToken());
         }
      }

      final String sBase = XMLUtil.getStringAttr(transformationElement, "base");

      if (sBase != null)
      {
         addTransformationFixup(new ContextFixup(m_helper)
         {
            public void fixup()
            {
               Transformation baseTransformation = m_metadata.getTransformation(sBase);

               transformation.setBaseTransformation(baseTransformation);
               baseTransformation.addDerivedTransformation(transformation);
            }
         });
      }

      String sDerivation = XMLUtil.getStringAttr(transformationElement, "derivation", "virtual");
View Full Code Here

Examples of nexj.core.meta.integration.Transformation

    * @return The transformation object.
    * @throws MetadataLookupException if the transformation does not exist.
    */
   public Transformation getTransformation(String sName)
   {
      Transformation transformation = (Transformation) m_transformationMap.get(sName);

      if (transformation != null)
      {
         return transformation;
      }
View Full Code Here

Examples of org.andromda.core.configuration.Transformation

                    final TransformerFactory factory = TransformerFactory.newInstance();
                    final TransformerURIResolver resolver = new TransformerURIResolver();
                    factory.setURIResolver(resolver);
                    for (final Iterator xsltIterator = xslts.iterator(); xsltIterator.hasNext();)
                    {
                        final Transformation transformation = (Transformation)xsltIterator.next();
                        final URL xslt = new URL(transformation.getUri());
                        resolver.setLocation(xslt);
                        if (xslt != null)
                        {
                            AndroMDALogger.info("Applying transformation --> '" + xslt + "'");
                            final Source xsltSource = new StreamSource(xslt.openStream());
                            final javax.xml.transform.Transformer transformer = factory.newTransformer(xsltSource);
                            final ByteArrayOutputStream output = new ByteArrayOutputStream();
                            final Result result = new StreamResult(output);
                            transformer.transform(modelSource, result);
                            final byte[] outputResult = output.toByteArray();
                            stream = new ByteArrayInputStream(outputResult);
   
                            // if we have an output location specified, write the result
                            final String outputLocation = transformation.getOutputLocation();
                            if (StringUtils.isNotBlank(outputLocation))
                            {
                                final File fileOutput = new File(outputLocation);
                                final File parent = fileOutput.getParentFile();
                                if (parent != null)
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.