@Override public String toString() { return toExternalForm(); } }
public AbstractPersistentRepository(RepositoryStorageFactory factory) { if (factory == null) throw MESSAGES.illegalArgumentNull("factory"); this.storage = factory.create(this); }
public MemoryRepositoryStorage(XRepository repository) { if (repository == null) throw MESSAGES.illegalArgumentNull("repository"); this.repository = repository; }
@Override public final org.jboss.osgi.repository.RepositoryStorageException invalidContentURL(final String contentURL) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(invalidContentURL$str(), contentURL)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String noSuchAlgorithm = "JBOSGI020509: No such digest algorithm: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException cannotAddResourceToStorage(final Throwable th, final String mime) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(cannotAddResourceToStorage$str(), mime), th); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotObtainInputStream = "JBOSGI020511: Cannot obtain input stream for: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException invalidMavenResource(final Throwable cause, final XResource res) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(invalidMavenResource$str(), res), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotObtainRequiredAttribute = "JBOSGI020520: Cannot obtain required attribute: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException cannotCreateRepositoryStorageArea(final Throwable th) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(cannotCreateRepositoryStorageArea$str()), th); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotAddMavenResourceToStorage = "JBOSGI020518: Cannot add maven resource to storage: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException cannotAccessContentURL(final Throwable th, final String contentURL) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(cannotAccessContentURL$str(), contentURL), th); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String invalidContentURL = "JBOSGI020508: Invalid content URL: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException noSuchAlgorithm(final Throwable th, final String algorithm) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(noSuchAlgorithm$str(), algorithm), th); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotAddResourceToStorage = "JBOSGI020510: Cannot add resource to storage: %s";
@Override public final org.jboss.osgi.repository.RepositoryStorageException cannotWriteRepositoryElement(final Throwable th) { final org.jboss.osgi.repository.RepositoryStorageException result = new org.jboss.osgi.repository.RepositoryStorageException(String.format(cannotWriteRepositoryElement$str()), th); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String invalidFilterDirective = "JBOSGI020514: Invalid filter directive: %s";
private void readRequirementElement(XMLStreamReader reader, XResourceBuilder<XResource> builder) throws XMLStreamException { String namespace = reader.getAttributeValue(null, Attribute.NAMESPACE.toString()); Map<String, Object> atts = new HashMap<String, Object>(); Map<String, String> dirs = new HashMap<String, String>(); readAttributesAndDirectives(reader, atts, dirs); try { builder.addRequirement(namespace, atts, dirs); } catch (RuntimeException ex) { throw MESSAGES.cannotReadResourceElement(ex, reader.getLocation()); } }
private void readAttributeElement(XMLStreamReader reader, Map<String, Object> attributes) throws XMLStreamException { String name = reader.getAttributeValue(null, Attribute.NAME.toString()); String valstr = reader.getAttributeValue(null, Attribute.VALUE.toString()); String typespec = reader.getAttributeValue(null, Attribute.TYPE.toString()); AttributeValue value = AttributeValueHandler.readAttributeValue(typespec, valstr); attributes.put(name, value.getValue()); while (reader.hasNext() && reader.nextTag() != END_ELEMENT); }
private void readAttributesAndDirectives(XMLStreamReader reader, Map<String, Object> atts, Map<String, String> dirs) throws XMLStreamException { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { Element element = Element.forName(reader.getLocalName()); switch (element) { case ATTRIBUTE: { readAttributeElement(reader, atts); break; } case DIRECTIVE: { readDirectiveElement(reader, dirs); break; } } } }
/** * Get the digest for a given input stream using the default algorithm */ public static String getDigest(InputStream input) throws IOException, NoSuchAlgorithmException { return getDigest(input, DEFAULT_DIGEST_ALGORITHM); }
public static RepositoryReader create(InputStream input) { return new RepositoryXMLReader(input); }
public String toString() { return getLocalName(); } }
public static RepositoryWriter create(OutputStream output) { return new RepositoryXMLWriter(output); }
private void readCapabilityElement(XMLStreamReader reader, XResourceBuilder<XResource> builder) throws XMLStreamException { String namespace = reader.getAttributeValue(null, Attribute.NAMESPACE.toString()); Map<String, Object> atts = new HashMap<String, Object>(); Map<String, String> dirs = new HashMap<String, String>(); readAttributesAndDirectives(reader, atts, dirs); try { builder.addCapability(namespace, atts, dirs); } catch (RuntimeException ex) { throw MESSAGES.cannotReadResourceElement(ex, reader.getLocation()); } }
public ModuleIdentityRepository(ModuleLoader moduleLoader) { if (moduleLoader == null) throw MESSAGES.illegalArgumentNull("moduleLoader"); this.moduleLoader = moduleLoader; }
URLResource(URL contentURL) { if (contentURL == null) throw MESSAGES.illegalArgumentNull("contentURL"); this.contentURL = contentURL; }