Package nexj.core.scripting

Examples of nexj.core.scripting.SchemeParser


      {
         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


   /**
    * @see nexj.core.tools.GenericREPL#getParser()
    */
   protected Parser getParser()
   {
      return new SchemeParser(m_machine.getGlobalEnvironment());
   }
View Full Code Here

   {
      super.setUp();

      m_metadata = Repository.getMetadata();
      m_context = new InvocationContext(m_metadata);
      m_parser = new SchemeParser(m_context.getMachine().getGlobalEnvironment());
      m_compiler = new Compiler();

      try
      {
         m_context.initialize(null);
View Full Code Here

   }

   public void testDynamicChangeRequest() throws MarshallerException, IOException
   {
      XMLUnmarshaller unmarshaller = new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()));
      SchemeParser parser = new SchemeParser(new InvocationContext(Repository.getMetadata())
         .getMachine().getGlobalEnvironment());
      StringReader reader = new StringReader("<Change-Request xmlns=\"" + XML.NS_URI_TNS
         + "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><objects x" + "si:type=\"User\"><"
         + XML.BASE_PREFIX + "oid>10e8359492f25f4be49109b9979e684ff3</" + XML.BASE_PREFIX
         + "oid><" + XML.BASE_PREFIX + "event>welcome</" + XML.BASE_PREFIX
         + "event><fullName>fullname</fullName></objects><attributes>(password)</" + "attributes></Change-Request>");
      XMLChangeRequest changeRequest = (XMLChangeRequest)unmarshaller.deserialize(reader);
      MockServer server = new MockServer();

      changeRequest.invoke(server);

      Request request = server.getRequest();
      Request.Invocation action = request.getInvocation(0);

      assertEquals(1, request.getInvocationCount());
      assertNull(action.getEventName());
      assertEquals("User", request.getObject(0).getClassName());
      assertEquals("welcome", request.getObject(0).getEventName());
      assertEquals(OID.fromBinary(Binary.parse("10e8359492f25f4be49109b9979e684ff3")),
         request.getObject(0).getOID());
      assertEquals(1, request.getObject(0).getValueCount());
      assertEquals("fullname", request.getObject(0).findValue("fullName"));
      assertEquals(parser.parse(new StringReader("(password)"), null), action.getAttributes());
      assertEquals(0, request.getFilterCount());

      assertNull(changeRequest.getMetaclass());
   }
View Full Code Here

   }
  
   public void testDynamicReadRequest() throws MarshallerException, IOException
   {
      XMLUnmarshaller unmarshaller = new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()));
      SchemeParser parser = new SchemeParser(new InvocationContext(Repository.getMetadata())
         .getMachine().getGlobalEnvironment());
      StringReader reader = new StringReader("<Read-Request xmlns=\"" + XML.NS_URI_TNS + "\">"
         + "<class>User-test</class><attributes>(fullName)</attributes>"
         + "<where></where><orderBy></orderBy><count>8</count><offset>0</offset></Read-Request>");
      XMLReadRequest readRequest = (XMLReadRequest)unmarshaller.deserialize(reader);
      MockServer server = new MockServer(new Object[1]);

      readRequest.invoke(server);

      Request request = server.getRequest();
      Request.Invocation action = request.getInvocation(0);

      assertEquals(1, request.getInvocationCount());
      assertEquals("User-test", request.getObject(0).getClassName());
      assertNull(request.getObject(0).getEventName());
      assertNull(request.getObject(0).getOID());
      assertEquals("read", action.getEventName());
      assertEquals(6, action.getArguments().length);
      assertEquals(parser.parse(new StringReader("(fullName)"), null), action.getArguments()[0]);
      assertNull(action.getArguments()[1]);
      assertNull(action.getArguments()[2]);
      assertEquals(8, ((Integer)action.getArguments()[3]).intValue());
      assertEquals(0, ((Integer)action.getArguments()[4]).intValue());
      assertEquals(Boolean.FALSE, action.getArguments()[5]);
View Full Code Here

   }
  
   public void testDynamicRestrictedChangeRequest() throws MarshallerException, IOException
   {
      XMLUnmarshaller unmarshaller = new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()));
      SchemeParser parser = new SchemeParser(new InvocationContext(Repository.getMetadata())
         .getMachine().getGlobalEnvironment());
      StringReader reader = new StringReader("<User-Change-Request xmlns=\"" + XML.NS_URI_TNS
         + "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><objects x" + "si:type=\"User\"><"
         + XML.BASE_PREFIX + "oid>10e8359492f25f4be49109b9979e684ff3</" + XML.BASE_PREFIX
         + "oid><" + XML.BASE_PREFIX + "event>welcome</" + XML.BASE_PREFIX
         + "event><fullName>fullname</fullName></objects><attributes>(password)</" + "attributes></User-Change-Request>");
      XMLChangeRequest changeRequest = (XMLChangeRequest)unmarshaller.deserialize(reader);
      MockServer server = new MockServer();

      changeRequest.invoke(server);

      Request request = server.getRequest();
      Request.Invocation action = request.getInvocation(0);

      assertEquals(1, request.getInvocationCount());
      assertEquals("User", request.getObject(0).getClassName());
      assertEquals("welcome", request.getObject(0).getEventName());
      assertEquals(OID.fromBinary(Binary.parse("10e8359492f25f4be49109b9979e684ff3")),
                   request.getObject(0).getOID());
      assertEquals(1, request.getObject(0).getValueCount());
      assertEquals("fullname", request.getObject(0).findValue("fullName"));
      assertEquals(0, request.getFilterCount());
      assertNull(action.getEventName());
      assertEquals(parser.parse(new StringReader("(password)"), null), action.getAttributes());
      assertEquals("User", changeRequest.getMetaclass().getName());
   }
View Full Code Here

   }

   public void testDynamicRestrictedReadRequest() throws MarshallerException, IOException
   {
      XMLUnmarshaller unmarshaller = new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()));
      SchemeParser parser = new SchemeParser(new InvocationContext(Repository.getMetadata())
         .getMachine().getGlobalEnvironment());
      StringReader reader = new StringReader("<User-Read-Request xmlns=\"" + XML.NS_URI_TNS + "\"><class>User-test</class>"
         + "<attributes>(fullName)</attributes><where></where><orderBy></orderBy><count>8</count>"
         + "<offset>0</offset></User-Read-Request>");
      XMLReadRequest readRequest = (XMLReadRequest)unmarshaller.deserialize(reader);
      MockServer server = new MockServer(new Object[1]);

      readRequest.invoke(server);

      Request request = server.getRequest();
      Request.Invocation action = request.getInvocation(0);

      assertEquals(1, request.getInvocationCount());
      assertEquals("User-test", request.getObject(0).getClassName());
      assertNull(request.getObject(0).getEventName());
      assertNull(request.getObject(0).getOID());
      assertEquals("read", action.getEventName());
      assertEquals(6, action.getArguments().length);
      assertEquals(parser.parse(new StringReader("(fullName)"), null), action.getArguments()[0]);
      assertNull(action.getArguments()[1]);
      assertNull(action.getArguments()[2]);
      assertEquals(8, ((Integer)action.getArguments()[3]).intValue());
      assertEquals(0, ((Integer)action.getArguments()[4]).intValue());
      assertEquals(Boolean.FALSE, action.getArguments()[5]);
View Full Code Here

      if (sQueueName == null)
      {
         return null;
      }

      SchemeParser parser = new SchemeParser(machine.getGlobalEnvironment());
      Reader reader = new TextPositionReader(new StringReader(sQueueName));
      Object expr = parser.parse(reader, activity.getFlow().getPosMap());

      if (expr instanceof Symbol && activity.getFlow().findVariable(((Symbol)expr).getName()) == null)
      {
         return sQueueName;
      }
View Full Code Here

    */
   protected Parser getParser()
   {
      if (m_parser == null)
      {
         m_parser = new SchemeParser(m_context.getMachine().getGlobalEnvironment());
      }

      return m_parser;
   }
View Full Code Here

         String sAttributes = (String)unmrsh.getTempValue(nObj, 1);

         if (sAttributes != null)
         {
            request.setAttributes((Pair)new SchemeParser(unmsh.getContext().getMachine().getGlobalEnvironment())
               .parse(new StringReader(sAttributes), null));
         }

         request.addTransferObjects((Collection)unmrsh.getTempValue(nObj, 0));
         request.setResponseType("Change-Response");
View Full Code Here

TOP

Related Classes of nexj.core.scripting.SchemeParser

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.