fabric8io / django

Camel iPaaS functionality
0 stars 4 forks source link

search-connector command #27

Closed davsclaus closed 8 years ago

davsclaus commented 8 years ago

So you can find a connector and add to the project.

It should look for -connector JARs

davsclaus commented 8 years ago

[14:51:02] jstrachan on top of your head - did we have some code somewhere in fabric8 that does a maven search - to find camel connectors [14:52:10] ah lets see what forge may have also [14:52:16] yeah - we do the same for the index builder for helm charts / kubernetes manifests [14:53:18] https://github.com/jstrachan/fabric8-maven-plugin/blob/6161efb03d130d867dc34adfea4a8d24b46834e8/plugin/src/main/java/io/fabric8/maven/plugin/HelmIndexMojo.java#L103-L103 [14:53:29] ah yeah that sounds right - the old hawtio v1 code is maybe outdated a bit [14:53:39] and the maven java api is maybe clunky [14:53:43] thats the code to search for artifacts given a query - we have one for helm tarballs or kuberetes/openshift manifests [14:53:49] I ended up just usign REST IIRC [14:54:13] https://github.com/jstrachan/fabric8-maven-plugin/blob/7d9acf23c3deefd9105f1f85594f77a6df14c1a4/plugin/src/main/java/io/fabric8/maven/plugin/AbstractArtifactSearchMojo.java#L172-L172 [14:54:18] the maven library was a bit ikcy

davsclaus commented 8 years ago

nexus 2 rest api http://www.sonatype.org/nexus/2015/08/13/using-the-rest-api-in-nexus-2/

davsclaus commented 8 years ago

I get a classload error in fabric8-forge on the web with logger / forge

Caused by:
java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:335)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:283)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
    at io.fabric8.kubernetes.client.Config.<clinit>(Config.java:40)
    at io.fabric8.kubernetes.client.ConfigBuilder.<init>(ConfigBuilder.java:16)
    at io.fabric8.kubernetes.client.ConfigBuilder.<init>(ConfigBuilder.java:13)
    at io.fabric8.kubernetes.client.BaseClient.<init>(BaseClient.java:37)
    at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:103)
    at io.fabric8.cdi.bean.KubernetesClientBean.create(KubernetesClientBean.java:31)
    at io.fabric8.cdi.bean.KubernetesClientBean.create(KubernetesClientBean.java:23)
    at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
    at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
    at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
    at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:99)
    at io.fabric8.kubernetes.client.KubernetesClient$418356913$Proxy$_$$_WeldClientProxy.getNamespace(Unknown Source)
    at io.fabric8.cdi.Services.toServiceUrl(Services.java:36)
    at io.fabric8.cdi.producers.ServiceUrlProducer.produce(ServiceUrlProducer.java:47)
    at io.fabric8.cdi.producers.ServiceUrlProducer.produce(ServiceUrlProducer.java:26)
    at io.fabric8.cdi.bean.ProducerBean.create(ProducerBean.java:43)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
    at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
    at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:744)
    at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:844)
    at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
    at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:362)
    at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:373)
    at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
    at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
    at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
    at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:117)
    at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
    at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
    at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
    at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:140)
    at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
    at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
    at io.fabric8.forge.ipaas.repository.NexusConnectionRepository$Proxy$_$$_WeldClientProxy.search(Unknown Source)
    at io.fabric8.forge.ipaas.ConnectionSearchCommand.execute(ConnectionSearchCommand.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87)
    at org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:42)
    at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103)
    at io.fabric8.forge.ipaas.ConnectionSearchCommand_$$_javassist_5e0355bd-abf0-4315-a8cc-2f450703b719.execute(ConnectionSearchCommand_$$_javassist_5e0355bd-abf0-4315-a8cc-2f450703b719.java)
    at org.jboss.forge.addon.ui.impl.controller.SingleCommandControllerImpl.execute(SingleCommandControllerImpl.java:94)

I may temporary just use ENV to lookup the nexus service.

davsclaus commented 8 years ago

There is a search-connector-command now that searches nexus.

It currently return verbose details. We can reduce the information returned to what is needed in the UI. The details returned is the same details you get with the connector-details command, which includes all the options and so on. However we could remove that so the returned search result is only the meta-data about the connector.

In the example below there are 2 connectors (foo and bar)

[ {
  "baseScheme" : "log",
  "baseGroupId" : "org.apache.camel",
  "baseArtifactId" : "camel-core",
  "baseVersion" : "2.17.3",
  "baseJavaType" : "org.apache.camel.component.log.LogComponent",
  "name" : "Bar",
  "scheme" : "bar",
  "javaType" : "org.bar.connector.BarComponent",
  "groupId" : "io.fabric8.django",
  "artifactId" : "bar-connector",
  "version" : "1.0.0",
  "description" : "Love going to bars",
  "labels" : [ "bar", "beer" ],
  "source" : "To",
  "endpointOptions" : [ "loggerName", "level" ],
  "endpointValues" : {
    "multiline" : "true",
    "showAll" : "true",
    "style" : "Tab"
  }
}, {
  "baseScheme" : "timer",
  "baseGroupId" : "org.apache.camel",
  "baseArtifactId" : "camel-core",
  "baseVersion" : "2.17.3",
  "baseJavaType" : "org.apache.camel.component.timer.TimerComponent",
  "name" : "Foo",
  "scheme" : "foo",
  "javaType" : "org.foo.connector.FooComponent",
  "groupId" : "io.fabric8.django",
  "artifactId" : "foo-connector",
  "version" : "1.0.0",
  "description" : "Something cool",
  "labels" : [ "foo", "timer" ],
  "source" : "From",
  "endpointOptions" : [ "timerName", "period" ],
  "endpointValues" : {
    "fixedRate" : "true",
    "period" : "5000"
  }
} ]
davsclaus commented 8 years ago

Currently to add connectors manually to the nexus repo you can do this from the nexus repo.

Open nexus in the cluster. And login with admin/admin123. Checkout the django-examples repo to your laptop: https://github.com/fabric8io/django-examples Build the project with mvn clean install from the root path.

Then you can install the foo, bar and wine connectors from the nexus ui as shown: add-connector2

And then click Add Artifact button.

Its important that the GAV and other input details is as shown in the screenshot. When you use the wizard to select the built JAR from your local computer. Make sure to pick the xxx-camel-connector JAR. And then edit the values as Nexus guess wrong in some places.

davsclaus commented 8 years ago

And then click Upload Artifact(s) button in the bottom. You should then find the connector if you click the Browse Index tab.

And make sure to use the Release repository.