Package nexj.core.scripting

Examples of nexj.core.scripting.Machine


    */
   protected void extractData() throws Exception
   {
      String sQuery = getRequiredProperty("query");
      String sScript = getProperty("script.url");
      Machine machine = m_context.getMachine();

      if (sScript != null)
      {
         Intrinsic.load(sScript, machine);
      }

      final Pair spec = (Pair)machine.invoke(new Compiler().compile(
         new SchemeParser(machine.getGlobalEnvironment()).parse(new StringReader(sQuery), null),
         null, machine, true), (Pair)null);

      exportData(new Exporter()
      {
         public void export(OutputStream ostream) throws Exception
View Full Code Here


   public XMLUpgradeMetadataLoader(XMLMetadata metadata, XMLMetadataHelper helper)
   {
      m_metadata = metadata;
      m_helper = helper;
      m_env = new GlobalEnvironment(m_metadata.getGlobalEnvironment());
      m_machine = new Machine(m_env, (InvocationContext)null);
   }
View Full Code Here

         {
            s_logger.dump(nQuery + ": " + m_query.getOutputQuery(nQuery));
         }
      }

      Machine machine = m_adapter.getInvocationContext().getMachine();
      VirtualMapping mapping = (VirtualMapping)m_query.getPersistenceMapping();
      ReadMapping readMapping = mapping.getReadMapping();

      assert mapping.getMetaclass() == m_query.getMetaclass();

      m_readArgArray = readMapping.getFunctionArgs(m_query, m_fragment);

      if (m_bDebug)
      {
         logQuery(Logger.DEBUG);
      }

      long lStartTime = getCurrentTime();
      Pair readClosePair = (Pair)machine.invoke(readMapping.getFunction(), m_readArgArray);

      logDuration(lStartTime, true);
      m_resultIterator = getIterator(readClosePair.getHead(), mapping.getMetaclass());
      m_closeFunction = (Function)readClosePair.getTail();
   }
View Full Code Here

            partition.setClean();
            m_partition = partition;
         }
      }

      m_machine = new Machine(env, this);
      initUnitOfWork();
      login(principal);

      // Re-check stealth privilege now that login is complete.
      if (m_bStealth)
View Full Code Here

         if (env == null)
         {
            env = new GlobalEnvironment();
         }

         m_machine = new Machine(env, this);
      }

      try
      {
         Intrinsic.load("library:scheme", "/nexj/core/meta/sys/scheme.scm", m_machine);
View Full Code Here

      m_bDocumented = ((nFlags & DOCUMENTATION_INCLUDED) != 0);
      m_bWritable = ((nFlags & WRITABLE) != 0);
      m_helper = new XMLMetadataHelper(rootURL, baseURL, m_properties, null, handler);
      m_metadata = createXMLMetadata(sURI, rootURL, baseURL, (m_bValidatedOnly) ? m_helper : null);
      m_metadata.setConfigurationURL(configURL);
      m_machine = new Machine(m_metadata.getGlobalEnvironment(),
         new InvocationContext(m_metadata, m_metadata.getGlobalEnvironment()));
      m_enumerationValueMap = new HashTab(16);
      m_inheritanceCheckList = new ArrayList();
      m_inheritanceFixupList = new ArrayList();
      m_inheritance1stPassFixupList = new ArrayList();
View Full Code Here

   public XMLUnitTestMetadataLoader(XMLMetadata metadata, XMLMetadataHelper helper)
   {
      m_metadata = metadata;
      m_helper = helper;
      m_env = new GlobalEnvironment(m_metadata.getGlobalEnvironment());
      m_machine = new Machine(m_env, (InvocationContext)null);

      InputStream istream = null;
      Reader reader = null;

      try
View Full Code Here

            context.setAudited(false);
            context.initialize(null, m_globalEnv);
            context.setLocale(m_locale);

            Machine machine = context.getMachine();

            if (bInit)
            {
               InputStream istream = null;
               Reader reader = null;
View Full Code Here

   /**
    * @return The class object state (with lazy construction).
    */
   private final Object[] getState()
   {
      Machine machine = ThreadContextHolder.getContext().getMachine();
      GlobalEnvironment env = machine.getGlobalEnvironment();
      Object[] values = (Object[])env.getState(this);

      if (values == null)
      {
         values = new Object[getStaticAttributeCount()];
         Arrays.fill(values, Undefined.VALUE);
         env.setState(this, values);

         int nCount = getInitializedStaticAttributeCount();

         if (nCount != 0)
         {
            for (int i = 0; i < nCount; ++i)
            {
               Attribute attribute = getInitializedStaticAttribute(i);

               values[attribute.getOrdinal()] = machine.invoke(attribute.getInitializerFunction(), this, (Object[])null);
            }
         }
      }

      return values;
View Full Code Here

                  return op;
               }
            }

            Machine machine = getInvocationContext().getMachine();

            if (obj instanceof Symbol)
            {
               Object value = machine.getGlobalEnvironment().findVariable((Symbol)obj);

               if (value instanceof Macro)
               {
                  obj = machine.invoke((Function)value, pair.getNext());

                  continue;
               }
            }

            if (nOutput == OUTPUT_NONE || machine.isEvalSupported(pair))
            {
               return new ConstantOperator(machine.eval(obj, pair.getNext()));
            }

            return null;
         }
View Full Code Here

TOP

Related Classes of nexj.core.scripting.Machine

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.