Package org.apache.jetspeed.capabilities

Examples of org.apache.jetspeed.capabilities.MimeType


            JSClient jsC = new JSClient(c);
            // find the mimeTypes
            Iterator _itM = c.getMimetypes().iterator();
            while (_itM.hasNext())
            {
                MimeType _m = (MimeType) _itM.next();
                JSMimeType _mt = (JSMimeType) refs.mimeMap.get(_m.getName());
                if (_mt != null) jsC.getMimeTypes().add(_mt);
            }
           
            Integer id = new Integer(c.getPreferredMimeTypeId());
            JSMimeType _mt = (JSMimeType) refs.mimeMapInt.get(id);
View Full Code Here


                JSMediaType _jsM = new JSMediaType(_mt);
                // find the mimeTypes
                Iterator _itM = _mt.getMimetypes().iterator();
                while (_itM.hasNext())
                {
                    MimeType _m = (MimeType) _itM.next();
                    JSMimeType _mttype = (JSMimeType) refs.mimeMap.get(_m.getName());
                    if (_mttype != null) _jsM.getMimeTypes().add(_mttype);
                }
                // find the capabilities
                Iterator _itC = _mt.getCapabilities().iterator();
                while (_itC.hasNext())
View Full Code Here

        Vector temp = new Vector();
        // Add Mimetypes to map and create query
        while (mimetypes.hasNext())
        {
            MimeType mt = (MimeType) mimetypes.next();

            // Add mimetype to query
            // Note: mimetypes is a member of MediaTypeImpl
            // criteria.addEqualTo("mimetypes.name", mt.getName());
            //stuff.add(new Integer(mt.getMimetypeId()));
            temp.add(mt.getName());
        }
       
        Collection co = null;
        if (temp.size() > 0)
        {
View Full Code Here

     * @see org.apache.jetspeed.capabilities.Capabilities#createMimeType(String)
     */
  public MimeType createMimeType(String mimeType)
   throws ClassNotFoundException
      {
    MimeType mimeTypeobj = null;
    if (mimeType != null)
    {
      //try to find it in space
      mimeTypeobj = this.getMimeType(mimeType);
      if (mimeTypeobj != null)
        return mimeTypeobj;
    }
        try
        {
          mimeTypeobj = (MimeType) beanFactory.getBean(
                    this.mimeTypeBeanName, MimeType.class);
          mimeTypeobj.setName(mimeType);
            return mimeTypeobj;
        } catch (Exception e)
        {
            log.error("Failed to create capability instance for " + this.mimeTypeBeanName
                    + " error : " + e.getLocalizedMessage());
View Full Code Here

    public MimeType getPreferredType()
    {
        // Return the value that matches the preferredMimeType defined in the Client
        int prefMimeTypeId = this.client.getPreferredMimeTypeId();

        MimeType mt = null;       
        Iterator e = this.mimeTypeMap.values().iterator();
        while (e.hasNext())
        {           
            mt = (MimeType) e.next();
           
            if (mt.getMimetypeId() == prefMimeTypeId)
                return mt;
        }
        log.error("Could not find preferred Mime Type for " + prefMimeTypeId);       

        // Should never reach this point. A preferred value needs to be set
View Full Code Here

                    {
                        map.addMediaType((MediaType) media.next());
                    }

                    // Validate preferred Mimetype
                    MimeType mimeTypeEntry = map.getPreferredType();
                    if (mimeTypeEntry == null)
                    {
                        throw new RuntimeException("Unable to get preferred Mimetype for client: "+entry.getName());                       
                    }

                    // Set preferred Mediatype for Mimetype
                    MediaType mediaTypeEntry = getMediaTypeForMimeType(mimeTypeEntry.getName());
                    if (mediaTypeEntry == null)
                    {
                        throw new RuntimeException("Unable to find preferred Mediatype for Mimetype/client: "+mimeTypeEntry.getName()+"/"+entry.getName());
                    }
                    map.setPreferredMediaType(mediaTypeEntry);

                    // Add map to cache
                    synchronized (capabilityMapCache)
View Full Code Here

        Vector temp = new Vector();
        // Add Mimetypes to map and create query
        while (mimetypes.hasNext())
        {
            MimeType mt = (MimeType) mimetypes.next();

            // Add mimetype to query
            // Note: mimetypes is a member of MediaTypeImpl
            // criteria.addEqualTo("mimetypes.name", mt.getName());
            //stuff.add(new Integer(mt.getMimetypeId()));
            temp.add(mt.getName());
        }
       
        Collection co = null;
        if (temp.size() > 0)
        {
View Full Code Here

     * @see org.apache.jetspeed.capabilities.Capabilities#createMimeType(String)
     */
  public MimeType createMimeType(String mimeType)
   throws ClassNotFoundException
      {
    MimeType mimeTypeobj = null;
    if (mimeType != null)
    {
      //try to find it in space
      mimeTypeobj = this.getMimeType(mimeType);
      if (mimeTypeobj != null)
        return mimeTypeobj;
    }
        try
        {
          mimeTypeobj = (MimeType) beanFactory.getBean(
                    this.mimeTypeBeanName, MimeType.class);
          mimeTypeobj.setName(mimeType);
            return mimeTypeobj;
        } catch (Exception e)
        {
            log.error("Failed to create capability instance for " + this.mimeTypeBeanName
                    + " error : " + e.getLocalizedMessage());
View Full Code Here

            {
                JSMimeType jsMimeType = (JSMimeType) mimeTypeIterator.next();
                // create a new Mime Type
                try
                {
                    MimeType mimeType = caps.createMimeType(jsMimeType.getName());
                    /**
                     * THE KEY_OVERWRITE_EXISTING test is not required for mime
                     * types, since they carry no other information than the
                     * name Used here for consistency, though
                     */
                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
                            || (mimeType.getMimetypeId() == 0))
                    {
                        caps.storeMimeType(mimeType);
                    }

                }
View Full Code Here

                            {
                                Iterator<String> _it1 = list.iterator();
                                int added = 0;
                                while (_it1.hasNext())
                                {
                                    MimeType _mt = caps.createMimeType((String) _it1.next());
                                    if (_mt != null)
                                        mediaType.addMimetype(_mt);
                                    added++;
                                }
                            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.capabilities.MimeType

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.