Examples of ResourceAttributes


Examples of org.apache.naming.resources.ResourceAttributes

                    entry.source = getURL(new File(files[i], path));
                    entry.codeBase = entry.source;
                } catch (MalformedURLException e) {
                    return null;
                }
                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 org.apache.oodt.profile.ResourceAttributes

    profAttrs.setRegAuthority("CAS");
    profAttrs.setType(PROF_TYPE);

    prof.setProfileAttributes(profAttrs);

    ResourceAttributes resAttrs = new ResourceAttributes();
    resAttrs.setDescription(p.getProductType().getDescription());
    resAttrs.setIdentifier(p.getProductId());
    resAttrs.setResClass(p.getProductType().getName());
    resAttrs.setTitle(p.getProductName());
    resAttrs.getPublishers().add("CAS");
    resAttrs.getResLocations().add(
        dataDelivBaseUrl + "?productID=" + p.getProductId());

    prof.setResourceAttributes(resAttrs);

    // build up profile elements
View Full Code Here

Examples of org.apache.oodt.profile.ResourceAttributes

  }

  private Profile toProfile(ResultSet rs, Mapping map, String resLocationSpec) {
    Profile profile = new Profile();
    ResourceAttributes resAttr = profile.getResourceAttributes();
    ProfileAttributes profAttr = profile.getProfileAttributes();
    resAttr.setResClass("system.profile");
    profAttr.setStatusID("active");
    profAttr.setType("profile");

    Metadata met = new Metadata();

    for (Iterator<String> i = map.getFieldNames().iterator(); i.hasNext();) {
      String fldName = i.next();
      MappingField fld = map.getFieldByName(fldName);
      ProfileElement elem = new EnumeratedProfileElement(profile);
      elem.setName(fld.getName());

      try {
        if (fld.getType().equals(FieldType.CONSTANT)) {
          elem.getValues().add(fld.getConstantValue());
        } else {
          String elemDbVal = rs.getString(fld.getDbName());
          for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j.hasNext();) {
            MappingFunc func = j.next();
            CDEValue origVal = new CDEValue(fld.getName(), elemDbVal);
            CDEValue newVal = func.inverseTranslate(origVal);
            elemDbVal = newVal.getVal();
          }

          elem.getValues().add(elemDbVal);
        }
      } catch (SQLException e) {
        e.printStackTrace();
        LOG.log(Level.WARNING, "Unable to obtain field: ["
            + map.getFieldLocalName(fld) + "] from result set: message: "
            + e.getMessage());
      }

      met.addMetadata(elem.getName(), (String) elem.getValues().get(0));

      profile.getProfileElements().put(fld.getName(), elem);
    }

    if (resLocationSpec != null) {
      resAttr.getResLocations().add(
          PathUtils.replaceEnvVariables(resLocationSpec, met));
    }

    return profile;
  }
View Full Code Here

Examples of org.apache.oodt.profile.ResourceAttributes

  private static final Logger LOG = Logger.getLogger(ProfileUtils.class
      .getName());

  public static ResourceAttributes getResourceAttributes(OpendapConfig conf,
      String opendapUrl, DConnect dConn, Metadata datasetMet) {
    ResourceAttributes resAttr = new ResourceAttributes();
    for (ConstantSpec spec : conf.getConstSpecs()) {
      if (spec.getType().equals(RES_ATTR_SPEC_TYPE)) {
        try {         
                           
          // first process expanded '[@...]' instructions
View Full Code Here

Examples of org.apache.oodt.profile.ResourceAttributes

  }

  private Profile toProfile(ResultSet rs, Mapping map, String resLocationSpec) {
    Profile profile = new Profile();
    ResourceAttributes resAttr = profile.getResourceAttributes();
    ProfileAttributes profAttr = profile.getProfileAttributes();
    resAttr.setResClass("system.profile");
    profAttr.setStatusID("active");
    profAttr.setType("profile");

    Metadata met = new Metadata();

    for (Iterator<String> i = map.getFieldNames().iterator(); i.hasNext();) {
      String fldName = i.next();
      MappingField fld = map.getFieldByName(fldName);
      ProfileElement elem = new EnumeratedProfileElement(profile);
      elem.setName(fld.getName());

      try {
        if (fld.getType().equals(FieldType.CONSTANT)) {
          elem.getValues().add(fld.getConstantValue());
        } else {
          String elemDbVal = rs.getString(fld.getDbName());
          for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j.hasNext();) {
            MappingFunc func = j.next();
            CDEValue origVal = new CDEValue(fld.getName(), elemDbVal);
            CDEValue newVal = func.translate(origVal);
            elemDbVal = newVal.getVal();
          }

          elem.getValues().add(elemDbVal);
        }
      } catch (SQLException e) {
        e.printStackTrace();
        LOG.log(Level.WARNING, "Unable to obtain field: ["
            + fld.getLocalName() + "] from result set: message: "
            + e.getMessage());
      }

      met.addMetadata(elem.getName(), (String) elem.getValues().get(0));

      profile.getProfileElements().put(fld.getName(), elem);
    }

    if (resLocationSpec != null) {
      resAttr.getResLocations().add(
          PathUtils.replaceEnvVariables(resLocationSpec, met));
    }

    return profile;
  }
View Full Code Here

Examples of org.apache.oodt.profile.ResourceAttributes

  private static final Logger LOG = Logger.getLogger(ProfileUtils.class
      .getName());

  public static ResourceAttributes getResourceAttributes(OpendapConfig conf,
      String opendapUrl, DConnect dConn, Metadata datasetMet) {
    ResourceAttributes resAttr = new ResourceAttributes();
    for (ConstantSpec spec : conf.getConstSpecs()) {
      if (spec.getType().equals(RES_ATTR_SPEC_TYPE)) {
        try {
          setResourceAttributes(resAttr, spec.getName(), PathUtils
              .replaceEnvVariables(spec.getValue(), datasetMet, true));
        } catch (Exception e) {
          e.printStackTrace();
          LOG.log(Level.WARNING, "Error setting field: [" + spec.getName()
              + "] in resource attributes: Message: " + e.getMessage());
        }
      }
    }

    // set the identifier
    if (resAttr.getIdentifier() == null
        || (resAttr.getIdentifier() != null && (resAttr.getIdentifier().equals(
            "") || resAttr.getIdentifier().equals("UNKNOWN")))) {
      resAttr.setIdentifier(UUID.randomUUID().toString());
    }

    // set res location
    if (resAttr.getResLocations() == null
        || (resAttr.getResLocations() != null && resAttr.getResLocations()
            .size() == 0)) {
      resAttr.getResLocations().add(opendapUrl);
    }

    return resAttr;
  }
View Full Code Here

Examples of org.eclipse.core.resources.ResourceAttributes

      FileOutputStream wgaxmlstream = null;
      try {
          IFile wgaConfig = getWGABase().getFile(new Path("wgaconfig.xml"));
          if (wgaConfig.exists() && wgaConfig.isReadOnly()) {
                    ResourceAttributes attributes = wgaConfig.getResourceAttributes();
                    attributes.setReadOnly(false);
                    wgaConfig.setResourceAttributes(attributes);               
          }
        wgaxmlstream = new FileOutputStream(wgaConfig.getLocation().toFile());
        WGAConfiguration.write(config, wgaxmlstream);
        _wgaBase.refreshLocal(IResource.DEPTH_ONE, null);
View Full Code Here

Examples of org.eclipse.core.resources.ResourceAttributes

  public void flushConfig() throws CoreException {
    FileOutputStream configFileStream = null;
    try {
      IFile configFile = getConfigFile();
      if (configFile.isReadOnly()) {
        ResourceAttributes attributes = configFile.getResourceAttributes(); // ResourceAttributes.fromFile(configFile.getLocation().toFile());
        attributes.setReadOnly(false);
        configFile.setResourceAttributes(attributes);
      }

      // we might have to update root url bc. of distribution changes
      if (getRootURL() != null) {
View Full Code Here

Examples of org.eclipse.core.resources.ResourceAttributes

       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
                fProject.setResourceAttributes(attribs);
              }
             
              IProjectDescription desc = fProject.getDescription();
              ICommand[] commands = desc.getBuildSpec();           
View Full Code Here

Examples of org.eclipse.core.resources.ResourceAttributes

       final IProject fProject = project;
       final String fId = id;
       IWorkspaceRunnable operation = new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {                       
            if (fProject.isAccessible()) {
              ResourceAttributes attribs = fProject.getResourceAttributes();
              if (attribs != null && attribs.isReadOnly()) {
                attribs.setReadOnly(false);
                fProject.setResourceAttributes(attribs);
              }
              IProjectDescription desc = fProject.getDescription();
              ICommand[] commands = desc.getBuildSpec();
              List<ICommand> newCommands = new ArrayList<ICommand>();
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.