Examples of MultiMap


Examples of org.apache.ldap.common.util.MultiMap

     * Returns LDIF string of {@link Attributes} object.
     */
    public String getAsText()
    {
        LdifComposer composer = new LdifComposerImpl();
        MultiMap map = new MultiMap()
        {
            // FIXME Stop forking commons-collections.
            private final MultiHashMap map = new MultiHashMap();

            public Object remove( Object arg0, Object arg1 )
            {
                return map.remove( arg0, arg1 );
            }

            public int size()
            {
                return map.size();
            }

            public Object get( Object arg0 )
            {
                return map.get( arg0 );
            }

            public boolean containsValue( Object arg0 )
            {
                return map.containsValue( arg0 );
            }

            public Object put( Object arg0, Object arg1 )
            {
                return map.put( arg0, arg1 );
            }

            public Object remove( Object arg0 )
            {
                return map.remove( arg0 );
            }

            public Collection values()
            {
                return map.values();
            }

            public boolean isEmpty()
            {
                return map.isEmpty();
            }

            public boolean containsKey( Object key )
            {
                return map.containsKey( key );
            }

            public void putAll( Map arg0 )
            {
                map.putAll( arg0 );
            }

            public void clear()
            {
                map.clear();
            }

            public Set keySet()
            {
                return map.keySet();
            }

            public Set entrySet()
            {
                return map.entrySet();
            }
        };
       
        Attributes attrs = ( Attributes ) getValue();
        try
        {
            NamingEnumeration e = attrs.getAll();
            while( e.hasMore() )
            {
                Attribute attr = ( Attribute ) e.next();
                NamingEnumeration e2 = attr.getAll();
                while( e2.hasMoreElements() )
                {
                    Object value = e2.next();
                    map.put( attr.getID(), value );
                }
            }

            return composer.compose( map );
        }
View Full Code Here

Examples of org.apache.muse.util.MultiMap

    {
        super.initialize();
       
        _installDir = getInitializationParameter("httpd-install-dir");
       
        MultiMap configParams = null;
       
        try
        {
            configParams = readConfigFile(_installDir + "/conf/httpd.conf");
        }
View Full Code Here

Examples of org.apache.muse.util.MultiMap

        throws IOException
    {
        BufferedReader reader = new BufferedReader(new FileReader(filePath));
        String nextLine = null;
       
        MultiMap configParams = new MultiMap();
       
        while ((nextLine = reader.readLine()) != null)
        {
            nextLine = nextLine.trim();
           
            if (nextLine.length() == 0 ||
                nextLine.charAt(0) == '#' ||
                nextLine.charAt(0) == '<')
                continue;
           
            int space = nextLine.indexOf(' ');
            String name = nextLine.substring(0, space);
            String value = nextLine.substring(space + 1);
            configParams.put(name, value);
        }
       
        return configParams;
    }
View Full Code Here

Examples of org.apache.tomcat.lite.http.MultiMap

            wrap(req.queryString(), httpReq.queryString());

            req.setServerPort(httpReq.getServerPort());
            req.serverName().setString(req.localName().toString());

            MultiMap mimeHeaders = httpReq.getMimeHeaders();
            MimeHeaders coyoteHeaders = req.getMimeHeaders();
            for (int i = 0; i < mimeHeaders.size(); i++ ) {
                Entry entry = mimeHeaders.getEntry(i);
                MessageBytes val =
                    coyoteHeaders.addValue(entry.getName().toString());
                val.setString(entry.getValue().toString());
            }
        }
View Full Code Here

Examples of org.broad.igv.util.collections.MultiMap

        }

        String sampleId = tokens[sampleColumn].trim();
        String type = tokens[typeColumn].trim();

        MultiMap<String, String> attributes = new MultiMap();
        int n = Math.min(headers.length, tokens.length);
        for (int i = 0; i < n; i++) {
            String key = headers[i];
            String value = tokens[i];
            if (value.length() > 0) {
                attributes.put(key, value);
            }
        }


        Mutation mut = new Mutation(sampleId, chr, start, end, type);
View Full Code Here

Examples of org.browsermob.proxy.jetty.util.MultiMap

        }
        LineInput in=new LineInput(request.getInputStream());
        String content_type=srequest.getContentType();
        String boundary="--"+value(content_type.substring(content_type.indexOf("boundary=")));
        byte[] byteBoundary=(boundary+"--").getBytes(StringUtil.__ISO_8859_1);
        MultiMap params = new MultiMap();
       
        // Get first boundary
        String line=in.readLine();
        if(!line.equals(boundary))
        {
            log.warn(line);
            throw new IOException("Missing initial multi part boundary");
        }
       
        // Read each part
        boolean lastPart=false;
        String content_disposition=null;
        while(!lastPart)
        {
            while((line=in.readLine())!=null)
            {
                // If blank line, end of part headers
                if(line.length()==0)
                    break;
                // place part header key and value in map
                int c=line.indexOf(':',0);
                if(c>0)
                {
                    String key=line.substring(0,c).trim().toLowerCase();
                    String value=line.substring(c+1,line.length()).trim();
                    if(key.equals("content-disposition"))
                        content_disposition=value;
                }
            }
            // Extract content-disposition
            boolean form_data=false;
            if(content_disposition==null)
            {
                throw new IOException("Missing content-disposition");
            }
           
            StringTokenizer tok=new StringTokenizer(content_disposition,";");
            String name=null;
            String filename=null;
            while(tok.hasMoreTokens())
            {
                String t=tok.nextToken().trim();
                String tl=t.toLowerCase();
                if(t.startsWith("form-data"))
                    form_data=true;
                else if(tl.startsWith("name="))
                    name=value(t);
                else if(tl.startsWith("filename="))
                    filename=value(t);
            }
           
            // Check disposition
            if(!form_data)
            {
                log.warn("Non form-data part in multipart/form-data");
                continue;
            }
            if(name==null||name.length()==0)
            {
                log.warn("Part with no name in multipart/form-data");
                continue;
            }
           
            OutputStream out=null;
            File file=null;
            try
            {
                if (filename!=null && filename.length()>0)
                {
                    file = File.createTempFile("MultiPart", "", tempdir);
                    out = new FileOutputStream(file);
                    request.setAttribute(name,file);
                    params.put(name, filename);
                }
                else
                    out=new ByteArrayOutputStream();
               
                int state=-2;
                int c;
                boolean cr=false;
                boolean lf=false;
               
                // loop for all lines`
                while(true)
                {
                    int b=0;
                    while((c=(state!=-2)?state:in.read())!=-1)
                    {
                        state=-2;
                        // look for CR and/or LF
                        if(c==13||c==10)
                        {
                            if(c==13)
                                state=in.read();
                            break;
                        }
                        // look for boundary
                        if(b>=0&&b<byteBoundary.length&&c==byteBoundary[b])
                            b++;
                        else
                        {
                            // this is not a boundary
                            if(cr)
                                out.write(13);
                            if(lf)
                                out.write(10);
                            cr=lf=false;
                            if(b>0)
                                out.write(byteBoundary,0,b);
                            b=-1;
                            out.write(c);
                        }
                    }
                    // check partial boundary
                    if((b>0&&b<byteBoundary.length-2)||(b==byteBoundary.length-1))
                    {
                        if(cr)
                            out.write(13);
                        if(lf)
                            out.write(10);
                        cr=lf=false;
                        out.write(byteBoundary,0,b);
                        b=-1;
                    }
                    // boundary match
                    if(b>0||c==-1)
                    {
                        if(b==byteBoundary.length)
                            lastPart=true;
                        if(state==10)
                            state=-2;
                        break;
                    }
                    // handle CR LF
                    if(cr)
                        out.write(13);
                    if(lf)
                        out.write(10);
                    cr=(c==13);
                    lf=(c==10||state==10);
                    if(state==10)
                        state=-2;
                }
            }
            finally
            {
                IO.close(out);
            }
           
            if (file==null)
            {
                byte[] bytes = ((ByteArrayOutputStream)out).toByteArray();
                params.add(name,bytes);
            }
        }

        chain.doFilter(new Wrapper(srequest,params),response);
       
View Full Code Here

Examples of org.datanucleus.util.MultiMap

        {
            // Already loaded
            return;
        }

        datastoreMappingsByJDBCType = new MultiMap();
        datastoreMappingsBySQLType = new MultiMap();
        datastoreMappingsByJavaType = new MultiMap();
        ConfigurationElement[] elems =
            mgr.getConfigurationElementsForExtension("org.datanucleus.store.rdbms.rdbms_mapping", null, null);
        if (elems != null)
        {
            for (int i=0;i<elems.length;i++)
View Full Code Here

Examples of org.eclipse.jetty.util.MultiMap

        InputStream in = new BufferedInputStream(request.getInputStream());
        String content_type=srequest.getContentType();

        //Get current parameters so we can merge into them
        MultiMap params = new MultiMap();
        for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet())
        {
            Object value = entry.getValue();
            if (value instanceof String[])
                params.addValues(entry.getKey(), (String[])value);
            else
                params.add(entry.getKey(), value);
        }

        MultipartConfigElement config = new MultipartConfigElement(tempdir.getCanonicalPath(), _maxFileSize, _maxRequestSize, _fileOutputBuffer);
        MultiPartInputStreamParser mpis = new MultiPartInputStreamParser(in, content_type, config, tempdir);
        mpis.setDeleteOnExit(_deleteFiles);
        request.setAttribute(MULTIPART, mpis);
        try
        {
            Collection<Part> parts = mpis.getParts();
            if (parts != null)
            {
                Iterator<Part> itor = parts.iterator();
                while (itor.hasNext() && params.size() < _maxFormKeys)
                {
                    Part p = itor.next();
                    MultiPartInputStreamParser.MultiPart mp = (MultiPartInputStreamParser.MultiPart)p;
                    if (mp.getFile() != null)
                    {
                        request.setAttribute(mp.getName(),mp.getFile());
                        if (mp.getContentDispositionFilename() != null)
                        {
                            params.add(mp.getName(), mp.getContentDispositionFilename());
                            if (mp.getContentType() != null)
                                params.add(mp.getName()+CONTENT_TYPE_SUFFIX, mp.getContentType());
                        }
                    }
                    else
                    {
                        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                        IO.copy(p.getInputStream(), bytes);
                        params.add(p.getName(), bytes.toByteArray());
                        if (p.getContentType() != null)
                            params.add(p.getName()+CONTENT_TYPE_SUFFIX, p.getContentType());
                    }
                }
            }

            // handle request
View Full Code Here

Examples of org.jpox.util.MultiMap

     */
    public void addFetchGroup(FetchGroup group)
    {
        if (fetchGroupByNameClass == null)
        {
            fetchGroupByNameClass = new MultiMap();
        }

        Collection coll = (Collection)fetchGroupByNameClass.get(group.getName());
        if (coll != null)
        {
View Full Code Here

Examples of org.jpox.util.MultiMap

     * Begin a transaction that changes the StoreData cache
     */
    public void begin()
    {
        savedStoreDataByClass = new HashMap(storeDataByClass);
        savedStoreDataByAppIdClass = new MultiMap(storeDataByAppIdClass);
    }
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.