Package nexj.core.util

Examples of nexj.core.util.Lookup


            {
               Object oPostData = m_request.getAttribute(WebServer.POST_BODY_PARAMETER);

               if (oPostData instanceof String[] && ((String[])oPostData)[0] != null)
               {
                  Lookup postDataMap = HTTPUtil.parseQuery(((String[])oPostData)[0], null);

                  for (Lookup.Iterator iter = postDataMap.iterator(); iter.hasNext();)
                  {
                     iter.next();

                     m_paramMap.put(iter.getKey(), iter.getValue());
                  }
View Full Code Here


    */
   protected void invoke() throws ServletException, IOException
   {
      RPCUtil.checkPrivilege(m_context);

      final Lookup paramMap = (isMultipart()) ? getMultipartParameters(null, 0) : null;

      m_bURLEncoded = (getParameter("url-encoded") != null || paramMap != null && paramMap.get("url-encoded") != null);
      m_response.setContentType((m_bURLEncoded) ? "text/plain; charset=UTF-8" : m_sContentType);

      CharacterStreamServer server = (CharacterStreamServer)m_server.getInstance(m_context);

      if (server instanceof HTTPServer)
      {
         ((HTTPServer)server).invoke(m_servlet, m_request, m_response);
      }

      if (paramMap != null)
      {
         Object req = paramMap.get("request");

         if (!(req instanceof String[]) || ((String[])req).length != 1)
         {
            throw new RequestException("err.rpc.attachment");
         }
View Full Code Here

   protected Function compile(Object fun, final String sName, final String sQualifier, Machine machine)
   {
      if (!(fun instanceof Function))
      {
         GlobalEnvironment env = machine.getGlobalEnvironment();
         Lookup posMap = env.getTextPositionMap();

         env.defineVariable(SYS_CURRENT_CLASS, this);

         try
         {
            if (sName != null && posMap != null && posMap.size() != 0)
            {
               TextPosition pos = (TextPosition)posMap.valueIterator().next();
               StringBuilder buf = new StringBuilder(64);
               String sURL = pos.getURL();

               if (sURL != null)
               {
View Full Code Here

         addAccessor(m_keysAccessor);
         addAccessor(m_valuesAccessor);

         // use a temporary pointer in the event that an exception causes an early exit from
         // function, the actual m_attributeMap isn't left half initialized (yes it happend)
         Lookup attributeMap = new HashTab/*<Attribute, ObjectAccessor>*/();

         if (m_metaclass != null)
         {
            for (Iterator/*<Attribute>*/ itr = m_metaclass.getAttributeIterator(); itr.hasNext();)
            {
               Attribute attribute = (Attribute)itr.next();
  
               if (attribute.getVisibility() != Metaclass.PUBLIC)
               {
                  continue; // ignore non-publicly visible attributes
               }

               String sTmpName = XSDGenerator.computeElementName(attribute);
               QName qType = getQualifiedType(attribute.getType());
               Unmarshaller unmarshaller =
                  unmsh.getUnmarshaller(qType.getNamespaceURI(), qType.getLocalPart(), null);

               if (unmarshaller != null)
               {
                  QName type = XML.getTNSType(sTmpName);
                  ObjectInstanceAccessor accessor = (attribute.isCollection())
                     ? new ObjectListAccessor(type, false, true, unmarshaller, false)
                     : new ObjectInstanceAccessor(type, false, true, unmarshaller, false);

                  addAccessor(accessor);
                  attributeMap.put(attribute, accessor);
               }
            }
         }

         m_attributeMap = attributeMap;
View Full Code Here

    * Create a lookup of the current marker values.
    * @return A map containing the current marker values;
    */
   public Lookup saveMarkerState()
   {
      Lookup markerLookup = new HashTab(m_markerList.size() / 2);

      for (int i = 0; i < m_markerList.size(); i += 2)
      {
         markerLookup.put(m_markerList.get(i), m_markerList.get(i + 1));
      }

      return markerLookup;
   }
View Full Code Here

      int nCookie = pushMarker(MetadataValidationException.TYPE_NAME, "Metadata");

      try
      {
         final Element[] elementArray = new Element[1];
         Lookup resourceMap = new HashTab(1);

         m_listing = new XMLMetadataListing();

         if (bRoot)
         {
            setSearchMode(SEARCH_ROOT_ONLY);
            resourceMap.put(m_sMetadataFileName,
               new XMLResource(m_sMetadataFileName,  new URL(m_rootURL, m_sMetadataFileName), true));
            m_listing.setRootResourceMap(resourceMap);
         }
         else
         {
            setSearchMode(SEARCH_BASE_ONLY);
            resourceMap.put(m_sMetadataFileName,
               new XMLResource(m_sMetadataFileName, new URL(m_baseURL, m_sMetadataFileName), false));
            m_listing.setBaseResourceMap(resourceMap);
         }

         m_listing.setResourceMap(resourceMap);
View Full Code Here

    * @param sMarkerTypeName The metadata marker type name for MetadataValidationException.
    * @param sMarkerPropertyName The metadata marker property name for MetadataValidationException.
    */
   public void addResources(Lookup resourceMap, String sExt, String sMarkerTypeName, String sMarkerPropertyName)
   {
      Lookup extensionMap = getListing().getExtensionMap();

      if (extensionMap == null)
      {
         return;
      }

      List resList = (List)extensionMap.get(sExt);

      if (resList != null)
      {
         for (Iterator itr = resList.iterator(); itr.hasNext(); )
         {
View Full Code Here

    * @param progress The progress listener. Can be null.
    */
   public void loadResources(String sExt, String sMarkerTypeName, String sMarkerPropertyName,
      ResourceNameHandler handler, ProgressListener progress)
   {
      Lookup resourceMap = new LinkedHashTab(256);

      addResources(resourceMap, sExt, sMarkerTypeName, sMarkerPropertyName);

      int nCount = 0;

      for (Lookup.Iterator itr = resourceMap.iterator(); itr.hasNext();)
      {
         String sBaseName = (String)itr.next();
         String sFullName = (String)itr.getValue();
         String sResourceNameSaved = m_sCurResourceName;
         int nCookie = pushMarker(MetadataValidationException.RESOURCE_NAME, sFullName);

         pushMarker(MetadataValidationException.TYPE_NAME, sMarkerTypeName);
         pushMarker(sMarkerPropertyName, sBaseName);
         m_sCurResourceName = sFullName;

         try
         {
            if (progress != null)
            {
               progress.progress("info.meta.loadingResource", new Object[]{sFullName},
                  (double)nCount++ / resourceMap.size());
            }

            handler.handleResource(sBaseName, sFullName);
         }
         catch (UncheckedException e)
View Full Code Here

         return null;
      }

      if (m_nSearchMode == SEARCH_ALL)
      {
         Lookup resourceMap = listing.getResourceMap();

         resource = (resourceMap == null) ? null : (XMLResource)resourceMap.get(sName);
      }
      else
      {
         if (m_nSearchMode != SEARCH_BASE_ONLY)
         {
            Lookup rootMap = listing.getRootResourceMap();

            resource = (rootMap == null) ? null : (XMLResource)rootMap.get(sName);
         }

         if (resource == null && m_nSearchMode != SEARCH_ROOT_ONLY)
         {
            Lookup baseMap = listing.getBaseResourceMap();

            resource = (baseMap == null) ? null : (XMLResource)baseMap.get(sName);
         }
      }

      if (resource == null && m_addedResourceURLMap != null)
      {
View Full Code Here

    */
   public List exportData(Set dataSourceSet, Lookup whereMap, boolean bExclusive)
   {
      Metadata metadata = m_context.getMetadata();
      List resultList = new ArrayList();
      Lookup identityMap = new IdentityHashTab();
      Lookup classMap = new HashTab();

      for (Iterator itr = metadata.getMetaclassIterator(); itr.hasNext();)
      {
         Metaclass metaclass = (Metaclass)itr.next();
         PersistenceMapping mapping = metaclass.getPersistenceMapping();
         Object where = resolve(metaclass, whereMap);

         if (mapping == null ||
            dataSourceSet != null && !dataSourceSet.contains(mapping.getDataSource()) ||
            where == null && bExclusive ||
            Boolean.FALSE.equals(where) ||
            !isWritable(mapping))
         {
            continue;
         }

         Metaclass root = metaclass.getPersistenceRoot();
         Pair attributes = null;

         for (int i = 0, n = metaclass.getInstanceAttributeCount(); i < n; ++i)
         {
            Attribute attribute = metaclass.getInstanceAttribute(i);
            Metaclass declarator = attribute.getDeclarator();

            if (attribute.isPersistent() &&
               attribute.getWhere() == null &&
               (!attribute.isCollection() || attribute.getReverse() == null) &&
               attribute != mapping.getLockingAttribute() &&
               (declarator == metaclass ||
                  declarator.getPersistenceMapping() == null ||
                  declarator.getPersistenceMapping().isCompatible(metaclass.getPersistenceMapping())) &&
               isWritable(metaclass.getPersistenceMapping().getAttributeMapping(attribute)))
            {
               attributes = new Pair(attribute.getSymbol(), attributes);
            }
         }

         if (metaclass != root)
         {
            attributes = new Pair(new Pair(Symbol.ATAT, new Pair(metaclass.getSymbol(), attributes)));
         }

         classMap.put(root, Pair.append((Pair)classMap.get(root), attributes));
      }

      for (Iterator itr = classMap.iterator(); itr.hasNext();)
      {
         Metaclass metaclass = (Metaclass)itr.next();

         if (s_logger.isDebugEnabled())
         {
            s_logger.debug("Reading class \"" + metaclass.getName() + "\"");
         }

         Pair attributes = (Pair)classMap.get(metaclass);

         resultList.add(new Pair(read(metaclass, attributes, resolve(metaclass, whereMap)), attributes));
      }

      List list = new ArrayList();
View Full Code Here

TOP

Related Classes of nexj.core.util.Lookup

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.