[jboss-as7-dev] VFS question and how to extract contents of deployment root
Scott Marlow
smarlow at redhat.com
Thu Nov 15 14:43:53 EST 2012
One problem that I have noticed with MountHandle.getMountSource() is
that it doesn't seem to exist for exploded deployments (AS7 ResourceRoot
getMountHandle() returns null).
For my current (exploded) test case,
deploymentRoot.getRoot().getPhysicalFile() seems to return the complete
persistence unit root.
On 11/15/2012 11:44 AM, Scott Marlow wrote:
> It looks like VirtualFile.getPhysicalFile() uses the FileSystem API.
> How does the FileSystem.getFile() compare to the
> MountHandle.getMountSource()?
>
> Javadoc from VirtualFile.getPhysicalFile:
>
> "
> Get a physical file for this virtual file. Depending on the underlying
> file system type, this may simply return an already-existing file; it
> may create a copy of a file; or it may reuse a preexisting copy of the
> file. Furthermore, the retured file may or may not have any
> relationship to other files from the same or any other virtual directory.
>
> @return the physical file
> "
>
> MountHandle.getMountSource() javadoc:
>
> "Get the source file used for the mount.
> "
>
>
> On 11/15/2012 09:45 AM, Scott Marlow wrote:
>> I think that a FileSystem is probably already created for the mount
>> point (since the application deployment is already mounted when I need
>> to access it).
>>
>> How can I gain access to the already mounted FileSystem instance?
>>
>> On 11/15/2012 06:25 AM, Ales Justin wrote:
>>>> Does that require a VFS change to allow the AS7/JPA subsystem to access FileSystem? Or is there a back door to get to it?
>>>
>>> No change needed, that's already part of VFS3.
>>> You just need to get a hold of the right params - mount point and target.
>>> Imo, it should be doable in AS7 subsystem.
>>>
>>>> On 11/14/2012 11:42 AM, Ales Justin wrote:
>>>>> Re-sending ...
>>>>>
>>>>>> What about using FileSystem's API?
>>>>>>
>>>>>> File getFile(VirtualFile mountPoint, VirtualFile target) throws IOException;
>>>>>>
>>>>>> -Ales
>>>>>>
>>>>>> On Nov 14, 2012, at 5:40 PM, Scott Marlow <smarlow at redhat.com> wrote:
>>>>>>
>>>>>>> It looks like the deployment root has the mounted VFS handle. From what
>>>>>>> I read in JBVFS-147 comments, there should only be one mounter of each
>>>>>>> deployment. So, I probably need to borrow the (private) mount handle
>>>>>>> from org.jboss.as.server.deployment.module.MountHandle.
>>>>>>>
>>>>>>> Something like the following:
>>>>>>> (MountHandle)((BasicMountHandle)
>>>>>>> (deploymentRoot.getMountHandle().handle)).getMountSource() evaluates to
>>>>>>> my unit test
>>>>>>> /home/smarlow/work/as7/build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/standalone/tmp/vfs/deployment7c320fbb00ead579/ejbjar.jar-47d0861a51443513/ejbjar.jar
>>>>>>> which has what I need.
>>>>>>>
>>>>>>> On 11/13/2012 08:29 AM, Scott Marlow wrote:
>>>>>>>> One thing that I don't want to do, is to walk through deployments and
>>>>>>>> make separate file copies of the contents (that would slow the
>>>>>>>> deployment phase down).
>>>>>>>>
>>>>>>>> I also don't want to give up on converting VFS urls to FILE urls.
>>>>>>>>
>>>>>>>> Any other suggestions?
>>>>>>>>
>>>>>>>> Scott
>>>>>>>>
>>>>>>>> On 11/07/2012 03:53 PM, Scott Marlow wrote:
>>>>>>>>> We need a proper implementation of JPA getPersistenceUnitRootUrl():
>>>>>>>>>
>>>>>>>>> "
>>>>>>>>> javax.persistence.spi.PersistenceUnitInfo.getPersistenceUnitRootUrl()
>>>>>>>>>
>>>>>>>>> Returns the URL for the jar file or directory that is the root of the
>>>>>>>>> persistence unit. (If the persistence unit is rooted in the
>>>>>>>>> WEB-INF/classes directory, this will be the URL of that directory.)
>>>>>>>>>
>>>>>>>>> The URL will either be a file: URL referring to a jar file
>>>>>>>>> or referring to a directory that contains an exploded jar
>>>>>>>>> file, or some other URL from which an InputStream in jar
>>>>>>>>> format can be obtained.
>>>>>>>>> "
>>>>>>>>>
>>>>>>>>> VFSFile.getPhysicalFile() doesn't seem to extract the children, so that
>>>>>>>>> isn't helpful by itself.
>>>>>>>>>
>>>>>>>>> Do we have something like VFSFile.getPhysicalFile() that gets a physical
>>>>>>>>> file representation of all of the files in a deployment root?
>>>>>>>>>
>>>>>>>>> Scott
>>>>>>>>> _______________________________________________
>>>>>>>>> jboss-as7-dev mailing list
>>>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> jboss-as7-dev mailing list
>>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> jboss-as7-dev mailing list
>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> jboss-as7-dev mailing list
>>>>> jboss-as7-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
More information about the jboss-as7-dev
mailing list