Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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 given item (e.g. WorkflowStepBean, PersonBean)
  public void addCredential(CETBean item, String credential, Date expiration) throws OperatorException {
    addCredential(Resource.uriRef(item.getUri()), credential, expiration);
  }

  public void addCredential(Resource item, String credential, Date expiration) 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(item, KNSG.HAS_CREDENTIAL, credentialBean ));

    getBeanSession().getContext().perform(tw);
  }

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

    Unifier uf = new Unifier();
    uf.addPattern(item, 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 item, X509CertificateBean cred) throws OperatorException {
		
    Context context = getBeanSession().getContext();
		
    TripleWriter tw = new TripleWriter();
    tw.remove(Triple.create(item, KNSG.HAS_CREDENTIAL, Resource.uriRef(cred.getUri())));
    context.perform(tw);
  }

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).

...