05-31-2012 10:33 AM
Hi, I have developed my own nuxeo component exposed as service with my "nuxeo ide", but it is not injected in the bean action where it is used. I have this files in my plugin:
component xml:
code in MyService:
public class MyService extends DefaultComponent implements MyManager {
public static final ComponentName ID = new ComponentName(
"my.component.MyService");
private static final Log log = LogFactory.getLog(TypeService.class);
protected Bundle bundle;
public Bundle getBundle() {
return bundle;
}
/**
* Component activated notification. Called when the component is activated.
* All component dependencies are resolved at that moment. Use this method
* to initialize the component.
* <p>
* The default implementation of this method is storing the Bundle owning
* that component in a class field. You can use the bundle object to lookup
* for bundle resources:
* <code>URL url = bundle.getEntry("META-INF/some.resource");</code>, load
* classes or to interact with OSGi framework.
* <p>
* Note that you must always use the Bundle to lookup for resources in the
* bundle. Do not use the classloader for this.
*
* @param context
* the component context. Use it to get the current bundle
* context
*/
@Override
public void activate(ComponentContext context) {
this.bundle = context.getRuntimeContext().getBundle();
}
/**
* Component deactivated notification. Called before a component is
* unregistered. Use this method to do cleanup if any and free any resources
* held by the component.
*
* @param context
* the component context. Use it to get the current bundle
* context
*/
@Override
public void deactivate(ComponentContext context) {
this.bundle = null;
}
/**
* Application started notification. Called after the application started.
* You can do here any initialization that requires a working application
* (all resolved bundles and components are active at that moment)
*
* @param context
* the component context. Use it to get the current bundle
* context
* @throws Exception
*/
@Override
public void applicationStarted(ComponentContext context) throws Exception {
// do nothing by default. You can remove this method if not used.
}
@Override
public String getStr() {
// TODO Auto-generated method stub
return "test";
}
}
code in interface:
public interface MyManager {
String getStr();
}
in myActionBean:
@In(create = true)
protected transient TypeManager typeManager; //its working
@In(create = true)
protected transient MyManager myManager; //its not working when I use. Example: myManager.getStr();
this error message is showed:
@In attribute requires non-null value: myActionBean.myManager Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value:
05-31-2012 11:01 AM
You need to use the Seam Service Bean wizard. It will expose your service as a seam component.
05-31-2012 11:01 AM
You need to use the Seam Service Bean wizard. It will expose your service as a seam component.
05-31-2012 01:08 PM
Thanks doguin but "Seam Service Bean Wizard" is part of "seam plugin" for eclipse or it is part of Nuxeo Plugin? because I do not see it in my ide nuxeo. Anyway, I have resolved this problem developing a seam component that initializes my service using nuxeo api.
05-31-2012 01:12 PM
You did exactly what the wizard does
05-31-2012 04:24 PM
uhmm ok, excellent. I going to review well those ide options. I have been reading this
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.