Examples of ResourceAttributes


Examples of ch.ethz.inf.vs.californium.server.resources.ResourceAttributes

  public static boolean matches(Resource resource, List<String> queries) {
   
    if (resource==null) return false;
    if (queries==null || queries.size()==0) return true;
   
    ResourceAttributes attributes = resource.getAttributes();
    String path = resource.getPath()+resource.getName();
   
    for (String s : queries) {
      int delim = s.indexOf("=");
      if (delim != -1) {
       
        // split name-value-pair
        String attrName = s.substring(0, delim);
        String expected = s.substring(delim+1);

        if (attrName.equals(LinkFormat.LINK)) {
          if (expected.endsWith("*")) {
            return path.startsWith(expected.substring(0, expected.length()-1));
          } else {
            return path.equals(expected);
          }
        } else if (attributes.containsAttribute(attrName)) {
          // lookup attribute value
          for (String actual : attributes.getAttributeValues(attrName)) {
         
            // get prefix length according to "*"
            int prefixLength = expected.indexOf('*');
            if (prefixLength >= 0 && prefixLength < actual.length()) {
         
              // reduce to prefixes
              expected = expected.substring(0, prefixLength);
              actual = actual.substring(0, prefixLength);
            }
           
            // handle case like rt=[Type1 Type2]
            if (actual.indexOf(" ") > -1) { // if contains white space
              String[] parts = actual.split(" ");
              for (String part : parts) { // check each part for match
                if (part.equals(expected)) {
                  return true;
                }
              }
            }
           
            // compare strings
            if (expected.equals(actual)) {
              return true;
            }
          }
        }
      } else {
        // flag attribute
        if (attributes.getAttributeValues(s).size()>0) {
          return true;
        }
      }
    }
    return false;
View Full Code Here

Examples of com.adito.properties.impl.resource.ResourceAttributes

            PropertyClassManager.getInstance().registerPropertyClass(new SystemConfiguration());
            PropertyClassManager.getInstance().registerPropertyClass(new UserAttributes());
            PropertyClassManager.getInstance().registerPropertyClass(new PolicyAttributes());
            PropertyClassManager.getInstance().registerPropertyClass(new RealmProperties());
            PropertyClassManager.getInstance().registerPropertyClass(new ApplicationParameters());
            PropertyClassManager.getInstance().registerPropertyClass(new ResourceAttributes());

            // Load the property database and categories
            // Use the default system database if no other has been registered
            try {
                ProfilesFactory.getInstance().open(this);
View Full Code Here

Examples of com.evernote.edam.type.ResourceAttributes

                            facet.alternateDataBodyHash = alternateData.getBodyHash();
                        if (alternateData.isSetSize())
                            facet.alternateDataSize = alternateData.getSize();
                    }
                    if (resource.isSetAttributes()) {
                        final ResourceAttributes resourceAttributes = resource.getAttributes();
                        if (resourceAttributes.isSetAltitude())
                            facet.altitude = resourceAttributes.getAltitude();
                        if (resourceAttributes.isSetAttachment())
                            facet.isAttachment = resourceAttributes.isAttachment();
                        if (resourceAttributes.isSetCameraMake())
                            facet.cameraMake = resourceAttributes.getCameraMake();
                        if (resourceAttributes.isSetCameraModel())
                            facet.cameraModel = resourceAttributes.getCameraModel();
                        if (resourceAttributes.isSetFileName())
                            facet.fileName = resourceAttributes.getFileName();
                        if (resourceAttributes.isSetLatitude())
                            facet.latitude = resourceAttributes.getLatitude();
                        if (resourceAttributes.isSetLongitude())
                            facet.longitude = resourceAttributes.getLongitude();
                        if (resourceAttributes.isSetRecoType())
                            facet.recoType = resourceAttributes.getRecoType();
                        if (resourceAttributes.isSetSourceURL())
                            facet.sourceURL = resourceAttributes.getSourceURL();
                        if (resourceAttributes.isSetTimestamp())
                            facet.timestamp = resourceAttributes.getTimestamp();
                        if (resourceAttributes.isSetTimestamp() &&
                            resourceAttributes.isSetLongitude() &&
                            resourceAttributes.isSetLatitude()&&
                            resource.isSetNoteGuid()){
                            // resource locations are associated with their parent note's guid
                            addGuestLocation(updateInfo, facet.latitude, facet.longitude, facet.altitude,
                                             facet.timestamp, resource.getNoteGuid());
                        }
View Full Code Here

Examples of com.google.gwt.thirdparty.org.apache.naming.resources.ResourceAttributes

                    entry = (ResourceEntry)AccessController.doPrivileged(dp);
                 } else {
                    entry = findResourceInternal(files[i], path);
                 }

                ResourceAttributes attributes =
                    (ResourceAttributes) resources.getAttributes(fullPath);
                contentLength = (int) attributes.getContentLength();
                entry.lastModified = attributes.getLastModified();

                if (resource != null) {

                    try {
                        binaryStream = resource.streamContent();
View Full Code Here

Examples of jpl.eda.profile.ResourceAttributes

    String artistName) {
    Profile p = new Profile();
    ProfileAttributes pa=new ProfileAttributes(id, "1.0", "profile", "active", "unclassified", /*parent*/null,
      /*children*/EL, "1.3.6.1.4.1.7655", /*revNotes*/EL);
    p.setProfileAttributes(pa);
    ResourceAttributes ra=new ResourceAttributes(p, id, trackName, Collections.singletonList("audio/mpeg"), /*desc*/null,
      Collections.singletonList(artistName), /*subjects*/EL, /*pubs*/EL, /*contrib*/EL, /*dates*/EL, /*types*/EL,
      /*sources*/EL, /*langs*/EL, /*relations*/EL, /*covs*/EL, /*rights*/EL,
      Collections.singletonList("Tutorial.Music"), "granule", "system.productServer",
      Collections.singletonList("urn:eda:rmi:MyProductServer"));
    p.setResourceAttributes(ra);
View Full Code Here

Examples of org.apache.naming.resources.ResourceAttributes

                        }

                        item.setLevel(level);
                        item.setCompileTime(-1);
                        try {
                            ResourceAttributes jspAttributes = (ResourceAttributes) ctx.getResources().getAttributes(name);
                            item.setSize(jspAttributes.getContentLength());
                            item.setLastModified(jspAttributes.getLastModified());
                        } catch (NamingException e) {
                            logger.error("Cannot lookup attributes for " + name);
                        }

View Full Code Here

Examples of org.apache.naming.resources.ResourceAttributes

            entry = treeLookup(name);
        }
        if (entry == null)
            throw new NamingException(sm.getString("resources.notFound", name));

        ResourceAttributes attrs = new ResourceAttributes();
        attrs.setCreationDate(new Date(entry.getLastModified()));
        attrs.setName(entry.getName());
        if (entry.isFile())
            attrs.setResourceType("");
        attrs.setContentLength(entry.getSize());
        attrs.setLastModified(entry.getLastModified());

        return attrs;

    }
View Full Code Here

Examples of org.apache.naming.resources.ResourceAttributes

            }
            if (exists) {
                try {
                    attributes = resources.getAttributes(path);
                    if (attributes instanceof ResourceAttributes) {
                        ResourceAttributes tempAttrs =
                            (ResourceAttributes) attributes;
                        Date tempDate = tempAttrs.getCreationDate();
                        if (tempDate != null)
                            creationDate = tempDate.getTime();
                        tempDate = tempAttrs.getLastModifiedDate();
                        if (tempDate != null) {
                            httpDate = FastHttpDateFormat.getDate(tempDate);
                            date = tempDate.getTime();
                        } else {
                            httpDate = FastHttpDateFormat.getCurrentDate();
                        }
                        weakETag = tempAttrs.getETag();
                        strongETag = tempAttrs.getETag(true);
                        length = tempAttrs.getContentLength();
                    }
                } catch (NamingException e) {
                    // Shouldn't happen, the implementation of the DirContext
                    // is probably broken
                    exists = false;
View Full Code Here

Examples of org.apache.naming.resources.ResourceAttributes

                    entry = (ResourceEntry)AccessController.doPrivileged(dp);
                 } else {
                    entry = findResourceInternal(files[i], path);
                 }

                ResourceAttributes attributes =
                    (ResourceAttributes) resources.getAttributes(fullPath);
                contentLength = (int) attributes.getContentLength();
                entry.lastModified = attributes.getLastModified();

                if (resource != null) {


                    try {
View Full Code Here

Examples of org.apache.naming.resources.ResourceAttributes

                    entry = (ResourceEntry)AccessController.doPrivileged(dp);
                 } else {
                    entry = findResourceInternal(files[i], path);
                 }

                ResourceAttributes attributes =
                    (ResourceAttributes) resources.getAttributes(fullPath);
                contentLength = (int) attributes.getContentLength();
                entry.lastModified = attributes.getLastModified();

                if (resource != null) {


                    try {
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.