Examples of IStorage


Examples of org.maqetta.server.IStorage

    @Override
    public void handleCommand(HttpServletRequest req, HttpServletResponse resp, IUser user) throws IOException {
        String path = req.getParameter("id");
        String base = req.getParameter("base");
       
        IStorage userSettings = user.getWorkbenchSettings(base);
        IStorage settingsFile = userSettings.newInstance(userSettings, path + IDavinciServerConstants.SETTINGS_EXTENSION);
   
        if(!user.isValid(settingsFile.getAbsolutePath()) ) return;
       
       
        InputStream inputStream;
        if (settingsFile.exists()) {
            inputStream = new BufferedInputStream(settingsFile.getInputStream());

        } else {
            inputStream = new ByteArrayInputStream("".getBytes());
        }
        Command.transferStreams(inputStream, resp.getOutputStream(), true);
View Full Code Here

Examples of org.maqetta.server.IStorage

*/
public class Unmarshaller {
  public CommentsDocument unmarshall(IDavinciProject project) {
    CommentsDocument commentsDoc = new CommentsDocument(project);
    try {
      IStorage file = project.getCommentsFileStorage();

      Document document = initCommentsFile(file);
      Node node = document.getFirstChild();
      NodeList children = node.getChildNodes();
      Comment comm;
View Full Code Here

Examples of org.maqetta.server.IStorage

  public static Document initCommentsFile(IStorage commentFile)
      throws IOException, TransformerFactoryConfigurationError,
      TransformerException, ParserConfigurationException, SAXException {
    if (null == commentFile)
      return null;
    IStorage parent = commentFile.getParentFile();
    DocumentBuilderFactory builderFactory = DocumentBuilderFactory
        .newInstance();
    DocumentBuilder builder = builderFactory.newDocumentBuilder();

    if (!parent.exists())
      parent.mkdirs();
    if (!commentFile.exists()) {
      // If not exist, just create it.
      commentFile.createNewFile();
    } else {
      // If exist, parse it.
View Full Code Here

Examples of org.maqetta.server.IStorage

public class GetWorkbenchState extends Command {

    @Override
    public void handleCommand(HttpServletRequest req, HttpServletResponse resp, IUser user) throws IOException {
        IStorage userSettings = user.getWorkbenchSettings();
        IStorage settingsFile = userSettings.newInstance(userSettings, IDavinciServerConstants.WORKBENCH_STATE_FILE);
        InputStream inputStream;
        if (settingsFile.exists()) {
            inputStream = settingsFile.getInputStream();

        } else {
            inputStream = new ByteArrayInputStream("{}".getBytes());
        }
        Command.transferStreams(inputStream, resp.getOutputStream(), true);
View Full Code Here

Examples of org.maqetta.server.IStorage

   * overrides GetInitializationInfo.
   */

    @Override
    public void handleCommand(HttpServletRequest req, HttpServletResponse resp, IUser user) throws IOException {
        IStorage userSettings = user.getWorkbenchSettings();
        IStorage settingsFile = userSettings.newInstance(userSettings, IDavinciServerConstants.WORKBENCH_STATE_FILE);
        InputStream inputStream;
        int i;
        StringBuffer buffer = new StringBuffer();
        if (settingsFile.exists()) {
            inputStream = settingsFile.getInputStream();
        } else {
            inputStream = new ByteArrayInputStream("{}".getBytes());
        }
      do {
        i = inputStream.read();
View Full Code Here

Examples of org.maqetta.server.IStorage

    return folderName.equals(IDavinciServerConstants.SETTINGS_DIRECTORY_NAME);
  }
 
  public ILibraryFinder[] getFinders(String base){
    ILibraryFinder[] finders = ServerManager.getServerManager().getLibraryManager().getLibraryFinders();
    IStorage baseFile = this.userDirectory.newInstance(this.userDirectory, base);
    Vector<ILibraryFinder> allLibs = new Vector();
    for(int i=0;i<finders.length;i++){
      ILibraryFinder finder = finders[i].getInstance(baseFile.toURI(), baseFile.getName());
      allLibs.add(finder);
    }
    return allLibs.toArray(new ILibraryFinder[allLibs.size()]);
  }
View Full Code Here

Examples of org.maqetta.server.IStorage

  }
 
  public ILibInfo[] getExtendedSettings(String base){
   
    ILibraryFinder[] finders = ServerManager.getServerManager().getLibraryManager().getLibraryFinders();
    IStorage baseFile = this.userDirectory.newInstance(this.userDirectory, base);
    Vector<ILibInfo> allLibs = new Vector();
    for(int i=0;i<finders.length;i++){
      ILibraryFinder finder = finders[i].getInstance(baseFile.toURI(), baseFile.getName());
      ILibInfo[] libs = finder.getLibInfo();
      allLibs.addAll(Arrays.asList(libs));
    }
    return (ILibInfo[]) allLibs.toArray(new ILibInfo[allLibs.size()]);
  }
View Full Code Here

Examples of org.maqetta.server.IStorage

          for (Iterator iterator = extensions.iterator(); iterator.hasNext();) {
              IConfigurationElement libraryElement = (IConfigurationElement) iterator.next();
              String path = libraryElement.getAttribute(IDavinciServerConstants.EP_ATTR_INITIAL_USER_FILE_PATH);
              String name = libraryElement.getDeclaringExtension().getContributor().getName();
              Bundle bundle = Activator.getActivator().getOtherBundle(name);
              IStorage file = null;
        try {
         
          file = new StorageFileSystem(project.getURI().getPath()+ "/" + basePath);
          if(!isValid(file.getAbsolutePath())) return null;
        } catch (URISyntaxException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
              VResourceUtils.copyDirectory(file, path, bundle);
View Full Code Here

Examples of org.maqetta.server.IStorage

   */
  /* (non-Javadoc)
   * @see org.davinci.server.user.IUser#addBaseSettings(java.lang.String)
   */
  public void addBaseSettings(String base) throws IOException {
    IStorage baseFile = userDirectory.newInstance(this.userDirectory, base);
    if(!isValid(baseFile.getAbsolutePath())) return;
    IStorage settings = userDirectory.newInstance(baseFile, IDavinciServerConstants.SETTINGS_DIRECTORY_NAME);
    settings.mkdirs();
   
    LibrarySettings ls = this.getLibSettings(base);
    ls.save();
    ILibraryFinder[] finders = this.getFinders(base);
    for(int i=0;i<finders.length;i++){
View Full Code Here

Examples of org.maqetta.server.IStorage

          IPath me = new Path(this.userDirectory.getAbsolutePath());
          IVResource parent = this.workspace;
          for (int i = me.matchingFirstSegments(a); i < segments.length; i++) {
              int segsToEnd = segments.length - i - 1;
              String s = a.removeLastSegments(segsToEnd).toOSString();
              IStorage f = this.userDirectory.newInstance(s);
              parent = new VFile(f, parent, segments[i]);
          }
         
          if(parent==this.workspace)
              parent = new VFile(this.userDirectory, this.workspace);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.