karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tang Yong <tangy...@cn.fujitsu.com>
Subject About Karaf Cave's Populating from an external repository
Date Tue, 29 Jan 2013 03:00:34 GMT
Hi JB
CC Cave Team

Today, I used the cave's trunk to populate a repo from an external
repository[1],

karaf@root> cave:populate-repository cave-repo
http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ant/

[1]:
http://karaf.apache.org/manual/cave/3.0.0-SNAPSHOT/user-guide/populate-repository.html

I found two issues as following:

1) about populating from an external repository by a http proxy
I access internet's resources by a http proxy. While populating from an
external repository, please seeing CaveRepositoryImpl class's
populateFromHttp method ,

HttpClient httpClient = new DefaultHttpClient();

HttpGet httpGet = new HttpGet(url);
HttpResponse response = httpClient.execute(httpGet);
...

Here, we have not set any http proxy and will cause unknownhost related
exception.So, the above codes should firstly detect whether an user has
set a http proxy, then, if setting, adding the following logic,

HttpClient httpClient = new DefaultHttpClient();

//Detecting whether an user has set http proxy from system property
file or jvm system property
...

//If setting http proxy, TangYong Added
HttpHost proxy = new HttpHost("XXXX", YYYY, "http");

httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

HttpGet httpGet = new HttpGet(url);
HttpResponse response = httpClient.execute(httpGet);
...

2) about populated resource type
While accessing
http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ant/,

once accessing
http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ant/1.8.4_1/org.apache.servicemix.bundles.ant-1.8.4_1-src.zip,
the following exception will happen, then, repo resources's updating
will be stopped, so this should be handled properly.

org.jsoup.UnsupportedMimeTypeException: Unhandled content type. Must be
text/*, application/xml, or application/xhtml+xml.
Mimetype=application/zip,
URL=http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ant/1.8.4_1/org.apache.servicemix.bundles.ant-1.8.4_1-src.zip
	at
org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:436)[174:org.jsoup:1.7.1]
	at
org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:393)[174:org.jsoup:1.7.1]
	at
org.jsoup.helper.HttpConnection.execute(HttpConnection.java:159)[174:org.jsoup:1.7.1]
	at
org.jsoup.helper.HttpConnection.get(HttpConnection.java:148)[174:org.jsoup:1.7.1]
	at
org.apache.karaf.cave.server.storage.CaveRepositoryImpl.populateFromHttp(CaveRepositoryImpl.java:378)[176:org.apache.karaf.cave.server.storage:3.0.0.SNAPSHOT]
	at
org.apache.karaf.cave.server.storage.CaveRepositoryImpl.populateFromHttp(CaveRepositoryImpl.java:385)[176:org.apache.karaf.cave.server.storage:3.0.0.SNAPSHOT]
	at
org.apache.karaf.cave.server.storage.CaveRepositoryImpl.populateFromHttp(CaveRepositoryImpl.java:385)[176:org.apache.karaf.cave.server.storage:3.0.0.SNAPSHOT]
	at
org.apache.karaf.cave.server.storage.CaveRepositoryImpl.populate(CaveRepositoryImpl.java:290)[176:org.apache.karaf.cave.server.storage:3.0.0.SNAPSHOT]
	at
org.apache.karaf.cave.server.command.PopulateRepositoryCommand.doExecute(PopulateRepositoryCommand.java:43)[178:org.apache.karaf.cave.server.command:3.0.0.SNAPSHOT]
	at
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.0]
	at
org.apache.karaf.shell.console.jline.Console.run(Console.java:175)[14:org.apache.karaf.shell.console:2.3.0]
	at java.lang.Thread.run(Thread.java:722)[:1.7.0_09]

Thanks
--Tang


Mime
View raw message