Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.apache.felix.karaf.deployer.blueprint;
A URL handler that will transform a JBI artifact to an OSGi bundle on the fly. Needs to be registered in the OSGi registry.
	private static Log logger = LogFactory.getLog(BlueprintURLHandler.class);
	private static String SYNTAX = "blueprint: bp-xml-uri";
	private URL blueprintXmlURL;

Open the connection for the given URL.

url the url from which to open a connection.
a connection on the specified URL.
Throws: if an error occurs or if the URL is malformed.
	public URLConnection openConnection(URL urlthrows IOException {
		if (url.getPath() == null || url.getPath().trim().length() == 0) {
			throw new MalformedURLException ("Path can not be null or empty. Syntax: " +  );
		 = new URL(url.getPath());
		.debug("Blueprint xml URL is: [" +  + "]");
		return new Connection(url);
	public URL getBlueprintXmlURL() {
    public class Connection extends URLConnection {
        public Connection(URL url) {
        public void connect() throws IOException {
        public InputStream getInputStream() throws IOException {
            try {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                return new ByteArrayInputStream(os.toByteArray());
            } catch (Exception e) {
                .error("Error opening blueprint xml url"e);
                throw (IOExceptionnew IOException("Error opening blueprint xml url").initCause(e);
New to GrepCode? Check out our FAQ X