Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleX509CertificateBeanUtil extends AssociatableTupeloBeanUtil<X509CertificateBean>
  public X509CertificateBeanUtil(BeanSession beansession) {
    super(beansession)
  }

  public Resource getAssociationPredicate() {
    return KNSG.HAS_CREDENTIAL;  // "http://cet.ncsa.illinois.edu/2011/security/hasCredential"
  }

  public Resource getType() {
    return KNSG.X509_CERT;  //"http://cet.ncsa.illinois.edu/2011/X509Certificate"
  }

  public BeanMapping getMapping() {
    BeanMapping map = super.getMapping();

    // Java class representing the bean
    map.setJavaClassName(X509CertificateBean.class.getName());

    // Properties for the bean
    map.addProperty(KNSG.X509_CREDENTIAL, "credential", String.class);

    return map;
  }

  // Associate a credential with a user
  public void addCredential(Resource user, String credential) throws OperatorException {
    TripleWriter tw = new TripleWriter();

    // Create credential bean to store credential
    Resource credentialBean = Resource.uriRef(new X509CertificateBean().getUri());

    // Create the credential triple
    tw.add(Triple.create(credentialBean, KNSG.X509_CREDENTIAL, credential));

    // associate the credential bean with the user
    tw.add(Triple.create(user, KNSG.HAS_CREDENTIAL, credentialBean ));
    getBeanSession().getContext().perform(tw);
  }

  public String getCredential(Resource user) throws OperatorException {
    String credential = null;

    Unifier uf = new Unifier();
    uf.addPattern(user, KNSG.HAS_CREDENTIAL, "thecred");
    uf.addPattern("thecred", KNSG.X509_CREDENTIAL, "credential");
    uf.addColumnName("credential");

    getBeanSession().getContext().perform(uf);

    for(Tuple<Resource> row : uf.getResult()) {
      if(row.get(0) != null) {
	credential = row.get(0).getString();
      }
    }
    return credential;
  }

  public void removeCredential(Resource user) {
    // removenot theyet credentialimplemented
  }

Metadata Requirements

This is a list of information we would like to capture with Tupelo using an ontology that is built by NCSA and KISTI (note that KISTI has not provided input on the domain concepts they would like captured).

...