Get object instances for a class - netbeans

I have an instance file register for a custom MultiDataObject in System FileSystem entry: Loaders/text/custom-mime-type/Factories.
My application creates this objects when I open a project and my LogicalView creates the nodes for files in that project.
I need to get a list of instances for those MultiDataObject type, but I've not found way to achieve this.
I try to get this using Lookups.forPath, but anything returned.
¿Any clue for this issue?

With some reflection magic you can get them from a DataObjectPool - package private class in Data Loaders module (see openide.loaders/src/org/openide/loaders/DataObjectPool.java in NetBeans sources). There is no official API of this kind. Intentionally.
I'd say there is something wrong if you need this information. Perhaps you would get better advice if you had explained better what you want to achieve. Asking at NetBeans forum / mailing list will increase your chances even higher.

Related

Ansible CallbackBase result object content

Our dev team provides us an Ansible package to work with. I noticed thy develop a custom stdout_callback and I'm trying to understand it.
I'm looking at the code of the class CallbackBase available here and I noticed the result variable but I can't find a description of it's content.
Is there a place I can find such information?
Next question, how does Ansible call such callback? CallbackBase contains several methods but I'd like to know where those methods are called.
Thanks for your feedbacks

Clone rep:policy on AEM

I am currently working on with a solution that would be able to clone/copy/backup my existing rep:policy. 'Cause when we do some jobs it accidentally removed. I am trying to apply this kind of fix, but am failing to. It says it is an invalid path.
javax.jcr.security.AccessControlException: OakAccessControl0006: Isolated policy node. Parent is not of type [rep:AccessControllable]
final Workspace ws = session.getWorkspace();
ws.copy("/etc/commerce/products/abccompany/TvPackChannelMap/rep:policy","/tmp/nxt/TvPackChannelMap/rep:policy");
Are there other ways that I can be able to take the rep:policy thru code?
You need to make sure that your job does not touch the permissions or the rep:policy, this is the best way forward for you.
The exception could be because of /etc/commerce/products/abccompany/TvPackChannelMap/rep:policy does not exist or the user whose session you are using does not have read access to the node.
Make sure the path is correct, copy paste it to your CRX/DE to make sure it exists.
I have tried to use your code to copy a rep:policy from one node to another, works fine. But I would not* recommend copying permissions that way. The best practice is to use the Access Control Management API for all things permissions.
You can check, install and use the access control tool from netcentric. It offers a jmx interface for exporting AC entries and maybe also some APIs you could use to implement your custom solution.
The Other approach is to retrieve the ACL permissions through the query language.
For example, SELECT * FROM [rep:ACL] or SELECT * FROM [rep:ACE] where [rep:principalName] is not null should give you the results.
For more information, I would recommend you to check the ACS commons ACL Packager Implementation which is available on GitHub.
Reference Link - https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/packaging/impl/ACLPackagerServletImpl.java

Can not import and use DirectorySearch in atom.io

I'm trying to build a package for atom editor, I need to search for all local files in the project.
From https://atom.io/docs/api/v1.0.2/DirectorySearch I see DirectorySearch is an interesting class to search for specific text in local files.
There is little documentation on the page. I tried {DirectorySearch} = require 'atom' and new atom.DirectorySearch(). But they are not working, said "DirectorySearch is undefined".
I searched in atom's repository, but it seems that they only defined it. There is no usage of DirectorySearch. I also searched on Google and Stack Overflow but with no luck.
I'm using Version 1.0.2 on Mac OSX 10.
Can someone tell me how to import and use this class?
According to https://discuss.atom.io/t/how-to-import-and-use-directorysearch-in-atom/19205
Looking at the source it doesn't seem you can require it, but there's an instance of DefaultDirectorySearcher created in the workspace and available at atom.workspace.defaultDirectorySearcher that is used in the scan method as a fallback when a searcher for a directory haven't been specified.
If you want to search text in files, atom.workspace.scan should be enough.
You can also register a custom directory searcher using the atom.directory-searcher service, as far as I can tell, the object needs to implement the following methods to comply to the searcher interface:
-canSearchDirectory (directory:Directory) -> Boolean
-search(directories:Array, regex:RegExp, searchOptions:Object) -> CancellablePromise
The DirectorySearch class that appears in the docs is actually the CancellablePromise returned by the directory searcher.

Eclipse builder: How does it work?

Does anyone know any details on the underlying eclipse builder that sends jobs to the compiler and get its report? and how to tap to it? The level of abstraction that the builder extension offers is too high and the information insufficient. So I implemented an IResourceChangeListener and played with the ResourceDelta in order to get the messages from an IMarker. It works perfectly, however I realized the message is just returning a string. So my question is, how do I do in order to get the type/reference of the object where the error is, what type of error, what class it should belongs to and all available info.
Thanks.
Have you looked at the builder documentation?
And there is also This article by John.
I think between those two and looking at the code you will find everything you need to know.

Using GWT + Twitter4j

I am trying to build a simple gwt project that fetches tweets and displays them.The server passes back the tweets of type twitter4j.Tweet to the client.
Both modules import twitter4j.Tweet.
But when I run I get the following error:
--- ERROR: Line 37: No source code is available for type twitter4j.Tweet; did you forget to inherit a required module?.
I seem to have problems in inheriting twitter4j. All the posts I have seen about inheriting a jar file are not clear about how to do so. I understand I must write an inheritance instruction into gwt.xml file, something like
---
but if I try
---
it does not work. Can anyone please explain?
In a post I found on the Web one person suggested not to inherit it but:
-- Don't put twitter4j to your gwt.xml. Just add it your project class path. and make all functionalities like status updating and all in your serviceImpl. Try
This confuses me even more. I have added the jar file to my project libraries. But it does not work
I suspect I am missing something quite elementary here, but I am totally stuck. Is there something like a GWT path?
Many thanks for any help
Keep in mind that everything in your client package is compiled to JavaScript and executed in the user's browser. Thus, you'll only be able to use twitter4j's classes on the server-side of your application; you'll have to create some sort of light-weight GWT-serializable "proxy object" to pass data back and forth between your client and server tiers.
Since you can't use twitter4j on the client side of your app, you will not need anything in your .gwt.xml file referencing it. Instead, you'll add twitter4j to your classpath and do all your updating on the server side (as mentioned toward the bottom of your question). You do mention that it "does not work," but there's not enough information in your question to try to figure out why.