|
|
|
NetBeans internally uses the concept of a virtual filesystem. This module provide APIs for accessing such virtual files as well as some support classes to make writing of custom vitual filesystems easier.
Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module? Answer:Many of the usecases are described at the overall documentation, in a way how to register a mime type. Some of the additional usecases are covered here.
Since version 7.1 there is a way to change the content of system file system in a dynamic way. As system file systems contains various definitions (in NetBeans Platform menus, toolbars, layout of windows, etc.) it de-facto allows global change to these settings for example when user logs into some system.
First thing to do is to create an implementation of filesystem. It can be created either from scratch, or by subclassing AbstractFileSystem, or MultiFileSystem. In this example we will subclass the MultiFileSystem:
public class LoginFileSystem extends MultiFileSystem { private static LoginFileSystem INSTANCE; public LoginFileSystem() { // let's create the filesystem empty, because the user // is not yet logged in INSTANCE = this; } public static void assignURL(URL u) throws SAXException { INSTANCE.setDelegates(new XMLFileSystem(u)); } }
It is necessary to register this instance in lookup by creating the file:
META-INF/services/org.openide.filesystems.FileSystem
with a single line containing the full
name of your filesystem - e.g. your.module.LoginFileSystem
.
When done, the system will find out your registration of the filesystem
on startup and will merge the content of the filesystem into the
default system file system. You can show a dialog letting the user
to log in to some system anytime later, and when the user is successfully
in, just call LoginFileSystem.assignURL(url)
where the
URL is an XML file in the same format
as used for regular layer files inside of many NetBeans modules.
The system will notice the change in the content and notify all the
config file listeners accordingly.
Of course, instead of XMLFileSystem you can use for example memory file system, or any other you write yourself.
Question (arch-time): What are the time estimates of the work? Answer:XXX no answer for arch-time
Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented? Answer:XXX no answer for arch-quality
Question (arch-where): Where one can find sources for your module? Answer:
The sources for the module are in NetBeans CVS in openide/fs directory.
The default answer to this question is:
These modules are required in project.xml:
XXX no answer for deploy-dependencies
XXX no answer for compat-deprecation
java.io.File
directly?
Answer:
Yes, naturally.
Question (resources-layer):
Does your module provide own layer? Does it create any files or
folders in it? What it is trying to communicate by that and with which
components?
Answer:
No.
Question (resources-read):
Does your module read any resources from layers? For what purpose?
Answer:
No.
Question (resources-mask):
Does your module mask/hide/override any resources provided by other modules in
their layers?
Answer:
No.
Question (resources-preferences):
Does your module uses preferences via Preferences API? Does your module use NbPreferences or
or regular JDK Preferences ? Does it read, write or both ?
Does it share preferences with other modules ? If so, then why ?
Answer:
XXX no answer for resources-preferences
org.openide.util.Lookup
or any similar technology to find any components to communicate with? Which ones?
Answer:
Implementations of MIMEResolver and URLMapper are looked up .
Question (lookup-register):
Do you register anything into lookup for other code to find?
Answer:
No
Question (lookup-remove):
Do you remove entries of other modules from lookup?
Answer:
No.
System.getProperty
) property?
On a similar note, is there something interesting that you
pass to java.util.logging.Logger
? Or do you observe
what others log?
Answer:
If true
, better diagnostic information will be available as to when file input or
output streams were opened that prevent a file from being deleted because they were not closed.
This information comes at a performance cost, however.
XXX no answer for exec-ant-tasks
Question (exec-classloader): Does your code create its own class loader(s)? Answer: No. Question (exec-reflection): Does your code use Java Reflection to execute other code? Answer: Yes, attributes can contain also dynamic values associated with keys (methodvalue
and newvalue
).
Question (exec-privateaccess):
Are you aware of any other parts of the system calling some of
your methods by reflection?
Answer:
Yes, AutomountSupport stores content of Repository as settings files. Then setting infrastructure registers its
own PropertyChangeListener. So method addPropertyChangeListener is invoked by reflection.
Question (exec-process):
Do you execute an external process from your module? How do you ensure
that the result is the same on different platforms? Do you parse output?
Do you depend on result code?
Answer:
No external process.
Question (exec-introspection):
Does your module use any kind of runtime type information (instanceof
,
work with java.lang.Class
, etc.)?
Answer:
No answer
Question (exec-threading):
What threading models, if any, does your module adhere to? How the
project behaves with respect to threading?
Answer:
XXX no answer for exec-threading
Question (security-policy): Does your functionality require modifications to the standard policy file? Answer:XXX no answer for security-policy
Question (security-grant): Does your code grant additional rights to some other code? Answer:XXX no answer for security-grant
java.awt.datatransfer.Transferable
?
Answer:
None.
XXX no answer for perf-spi
Built on May 28 2007. | Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.