/** {@inheritDoc} */ public T load(String key) throws IOException { File file = buildFile(key); if (!file.exists()) { log.debug("Target file with key '{}' does not exist, path: {}", key, file.getAbsolutePath()); return null; } try (FileInputStream fis = new FileInputStream(file)) { byte[] source = ByteStreams.toByteArray(fis); try (ByteArrayInputStream bais = new ByteArrayInputStream(source)) { XMLObject xmlObject = XMLObjectSupport.unmarshallFromInputStream(parserPool, bais); xmlObject.getObjectMetadata().put(new XMLObjectSource(source)); //TODO via ctor, etc, does caller need to supply a Class so we can can test and throw an IOException, // rather than an unchecked ClassCastException? return (T) xmlObject; } catch (XMLParserException|UnmarshallingException e) { throw new IOException(String.format("Error loading file from path: %s", file.getAbsolutePath()), e); } } }
/** {@inheritDoc} */ public T load(String key) throws IOException { File file = buildFile(key); if (!file.exists()) { log.debug("Target file with key '{}' does not exist, path: {}", key, file.getAbsolutePath()); return null; } try (FileInputStream fis = new FileInputStream(file)) { byte[] source = ByteStreams.toByteArray(fis); try (ByteArrayInputStream bais = new ByteArrayInputStream(source)) { XMLObject xmlObject = XMLObjectSupport.unmarshallFromInputStream(parserPool, bais); xmlObject.getObjectMetadata().put(new XMLObjectSource(source)); //TODO via ctor, etc, does caller need to supply a Class so we can can test and throw an IOException, // rather than an unchecked ClassCastException? return (T) xmlObject; } catch (XMLParserException|UnmarshallingException e) { throw new IOException(String.format("Error loading file from path: %s", file.getAbsolutePath()), e); } } }
if (pkixInfo != null) { keyAuthorityObjectMetadata.put(pkixInfo);
/** * Look inside the {@link AttributeConsumingService} for any {@link RequestedAttribute}s and map them. * * @param acs the {@link AttributeConsumingService} to look at */ //CheckStyle: ReturnCount OFF private void handleAttributeConsumingService(final AttributeConsumingService acs) { final List<RequestedAttribute> requestedAttributes = acs.getRequestAttributes(); final RequestedAttributesMapper mapper = getRequestedAttributesMapper(); if (null == requestedAttributes || requestedAttributes.isEmpty() || null == mapper) { return; } final Multimap<String, IdPRequestedAttribute> maps = mapper.mapAttributes(requestedAttributes); if (null == maps || maps.isEmpty()) { return; } acs.getObjectMetadata().put(new AttributesMapContainer<>(maps)); } //CheckStyle: ReturnCount ON
try (ByteArrayInputStream bais = new ByteArrayInputStream(source)) { XMLObject xmlObject = unmarshallMetadata(bais); xmlObject.getObjectMetadata().put(new XMLObjectSource(source)); return xmlObject;
/** * Creates a new instance that wraps the given CAS service. * * @param service CAS service metadata object. */ public ServiceEntityDescriptor(@Nonnull final Service service) { svc = Constraint.isNotNull(service, "Service cannot be null"); objectMetadata = new LockableClassToInstanceMultiMap<>(true); if (StringSupport.trimOrNull(service.getGroup()) != null) { objectMetadata.put(new EntityGroupName(service.getGroup())); } }
return; entity.getObjectMetadata().put(new AttributesMapContainer<>(maps));
/** {@inheritDoc} */ @Override public void process(XMLObject metadataNode) throws FilterException { if (metadataNode instanceof EntityDescriptor) { XMLObject currentParent = metadataNode.getParent(); while (currentParent != null) { if (currentParent instanceof EntitiesDescriptor) { String name = StringSupport.trimOrNull(((EntitiesDescriptor)currentParent).getName()); if (name != null) { if (log.isTraceEnabled()) { log.trace("Attaching EntityGroupName '{}' to EntityDescriptor: {}", name, ((EntityDescriptor)metadataNode).getEntityID()); } metadataNode.getObjectMetadata().put(new EntityGroupName(name)); } } currentParent = currentParent.getParent(); } } }
extractPKIXValidationInfo((KeyAuthority) keyAuthority); if (pkixInfo != null) { keyAuthority.getObjectMetadata().put(pkixInfo);