org.jboss.system.server.profileservice.repository
Class AbstractVFSProfileSource

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.AbstractVFSProfileSource
Direct Known Subclasses:
AbstractDeploymentRepository, AbstractImmutableProfile

public abstract class AbstractVFSProfileSource
extends Object

A abstract VFS based source for profile deployments.

Version:
$Revision: 89033 $
Author:
Emanuel Muckenhuber

Field Summary
protected  org.jboss.logging.Logger log
          The logger.
protected  Collection<URI> uris
          The repository uris.
 
Constructor Summary
AbstractVFSProfileSource(URI[] uris)
           
 
Method Summary
protected  boolean acceptsDeployment(String name)
          Check if the deployment should be added.
 void addDeployment(String vfsPath, org.jboss.profileservice.spi.ProfileDeployment d)
          Add a deployment to this profile source.
protected  void addedDeployment(List<org.jboss.virtual.VirtualFile> list, org.jboss.virtual.VirtualFile component)
          Scan a given virtualFile for deployments.
protected  void addedDeployments(List<org.jboss.virtual.VirtualFile> list, org.jboss.virtual.VirtualFile root)
          Scan the children of the root for deployments.
protected  String addVirtualFileCache(org.jboss.virtual.VirtualFile vf)
          Add a virtualFile to the local virtualFileCache
protected static org.jboss.profileservice.spi.ProfileDeployment createDeployment(org.jboss.virtual.VirtualFile vf)
          Create a ProfileDeployment, based on the virtual file.
 void destroy()
           
protected  List<String> findDeploymentContent(String name)
          Try to find a deployment, based on the cached virtual roots of deployments we have.
protected  org.jboss.virtual.VirtualFile getCachedVirtualFile(String name)
          Get a cached virtual file.
protected  org.jboss.virtual.VirtualFile getCachedVirtualFile(URI uri)
          Get a cached virtual file.
 org.jboss.profileservice.spi.ProfileDeployment getDeployment(String vfsPath)
          Get the deployment
 org.jboss.virtual.VirtualFileFilter getDeploymentFilter()
           
 Set<String> getDeploymentNames()
           
 Collection<org.jboss.profileservice.spi.ProfileDeployment> getDeployments()
           
 long getLastModified()
           
 URI[] getRepositoryURIs()
           
 boolean isRecursiveScan()
           
protected  void loadApplications(org.jboss.virtual.VirtualFile applicationDir)
          Load all the applications under the applicationDir.
 org.jboss.profileservice.spi.ProfileDeployment removeDeployment(String vfsPath)
          Remove a deployment from this source.
 void setDeploymentFilter(org.jboss.virtual.VirtualFileFilter deploymentFilter)
           
 void setRecursiveScan(boolean recursiveScan)
           
protected  void updateLastModfied()
          Internally update the lastModified timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uris

protected final Collection<URI> uris
The repository uris.


log

protected final org.jboss.logging.Logger log
The logger.

Constructor Detail

AbstractVFSProfileSource

public AbstractVFSProfileSource(URI[] uris)
Method Detail

getDeploymentFilter

public org.jboss.virtual.VirtualFileFilter getDeploymentFilter()

setDeploymentFilter

public void setDeploymentFilter(org.jboss.virtual.VirtualFileFilter deploymentFilter)

isRecursiveScan

public boolean isRecursiveScan()

setRecursiveScan

public void setRecursiveScan(boolean recursiveScan)

getRepositoryURIs

public URI[] getRepositoryURIs()

getDeploymentNames

public Set<String> getDeploymentNames()

getDeployments

public Collection<org.jboss.profileservice.spi.ProfileDeployment> getDeployments()

getLastModified

public long getLastModified()

destroy

public void destroy()

addDeployment

public void addDeployment(String vfsPath,
                          org.jboss.profileservice.spi.ProfileDeployment d)
                   throws Exception
Add a deployment to this profile source.

Parameters:
vfsPath - the deployment name
d - the deployment
Throws:
Exception

getDeployment

public org.jboss.profileservice.spi.ProfileDeployment getDeployment(String vfsPath)
                                                             throws org.jboss.profileservice.spi.NoSuchDeploymentException
Get the deployment

Parameters:
vfsPath - the deployment
Returns:
the deployment or null if it does not exist
Throws:
org.jboss.profileservice.spi.NoSuchDeploymentException

removeDeployment

public org.jboss.profileservice.spi.ProfileDeployment removeDeployment(String vfsPath)
                                                                throws Exception
Remove a deployment from this source.

Parameters:
vfsPath - the deployment name
Returns:
the deployment
Throws:
org.jboss.profileservice.spi.NoSuchProfileException - if the deployment does not exist
Exception

loadApplications

protected void loadApplications(org.jboss.virtual.VirtualFile applicationDir)
                         throws Exception
Load all the applications under the applicationDir.

Parameters:
applicationDir - the application directory
Throws:
IOException
Exception

addedDeployments

protected void addedDeployments(List<org.jboss.virtual.VirtualFile> list,
                                org.jboss.virtual.VirtualFile root)
                         throws IOException,
                                URISyntaxException
Scan the children of the root for deployments.

Parameters:
list - a list of virtual files, where new deployments are added to
root - the root to scan
Throws:
IOException
URISyntaxException

addedDeployment

protected void addedDeployment(List<org.jboss.virtual.VirtualFile> list,
                               org.jboss.virtual.VirtualFile component)
                        throws IOException,
                               URISyntaxException
Scan a given virtualFile for deployments.

Parameters:
list - a list of virtual files, where new deployments are added to
component - the root file
Throws:
IOException
URISyntaxException

acceptsDeployment

protected boolean acceptsDeployment(String name)
Check if the deployment should be added.

Parameters:
name - the deployment name
Returns:

findDeploymentContent

protected List<String> findDeploymentContent(String name)
Try to find a deployment, based on the cached virtual roots of deployments we have.

Parameters:
name - the deployment name
Returns:
a collection of matching names

addVirtualFileCache

protected String addVirtualFileCache(org.jboss.virtual.VirtualFile vf)
                              throws MalformedURLException,
                                     URISyntaxException
Add a virtualFile to the local virtualFileCache

Parameters:
vf - the virtual file
Returns:
the name
Throws:
MalformedURLException
URISyntaxException

getCachedVirtualFile

protected org.jboss.virtual.VirtualFile getCachedVirtualFile(String name)
Get a cached virtual file.

Parameters:
name - the name
Returns:
the virtual file or null, if it does not exist

getCachedVirtualFile

protected org.jboss.virtual.VirtualFile getCachedVirtualFile(URI uri)
                                                      throws IOException
Get a cached virtual file. This will add the uri to the virtualFile if it does not exist.

Parameters:
uri - the uri
Returns:
the virtual file
Throws:
IOException

createDeployment

protected static org.jboss.profileservice.spi.ProfileDeployment createDeployment(org.jboss.virtual.VirtualFile vf)
                                                                          throws Exception
Create a ProfileDeployment, based on the virtual file.

Parameters:
vf - the deployment root
Returns:
the profile deployment
Throws:
Exception

updateLastModfied

protected void updateLastModfied()
Internally update the lastModified timestamp.



Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.