Permalink
Browse files

Changes for Orion Server plugin. (Some extensibility changes to maqet…

…ta.core.sever)
  • Loading branch information...
1 parent a418c7c commit 652c6129dd3029ac368832efa04b20ac0a6354a4 bradley childs committed Feb 20, 2012
Showing with 1,310 additions and 135 deletions.
  1. +15 −13 maqetta.core.server/src/maqetta/core/server/user/User.java
  2. +1 −1 maqetta.core.server/src/maqetta/core/server/user/manager/PersonManagerImpl.java
  3. +9 −8 maqetta.core.server/src/maqetta/core/server/user/manager/UserManagerImpl.java
  4. +2 −5 maqetta.core.server/src/maqetta/core/server/util/VResourceUtils.java
  5. +1 −3 maqetta.core.server/src/org/davinci/server/util/XMLFile.java
  6. +1 −2 maqetta.core.server/src/org/maqetta/server/IStorage.java
  7. +24 −3 maqetta.core.server/src/org/maqetta/server/StorageFileSystem.java
  8. +12 −8 maqetta.core.server/src/org/maqetta/server/VFile.java
  9. +3 −1 maqetta.server.orion/META-INF/MANIFEST.MF
  10. +86 −1 maqetta.server.orion/plugin.xml
  11. +129 −0 maqetta.server.orion/src/maqetta/server/orion/EFSStorage.java
  12. +33 −0 maqetta.server.orion/src/maqetta/server/orion/VOrionProjectStorage.java
  13. +57 −0 maqetta.server.orion/src/maqetta/server/orion/VOrionResource.java
  14. +245 −0 maqetta.server.orion/src/maqetta/server/orion/VOrionStorage.java
  15. +150 −0 maqetta.server.orion/src/maqetta/server/orion/VOrionWorkspace.java
  16. +126 −0 maqetta.server.orion/src/maqetta/server/orion/VOrionWorkspaceStorage.java
  17. +8 −10 maqetta.server.orion/src/maqetta/server/orion/command/GetWorkbenchState.java
  18. +19 −13 maqetta.server.orion/src/maqetta/server/orion/command/SetWorkbenchState.java
  19. +18 −0 maqetta.server.orion/src/maqetta/server/orion/user/OrionPersonManager.java
  20. +0 −9 maqetta.server.orion/src/maqetta/server/orion/user/OrionPersonManagerImpl.java
  21. +264 −5 maqetta.server.orion/src/maqetta/server/orion/user/OrionUser.java
  22. +107 −0 maqetta.server.orion/src/maqetta/server/orion/user/OrionUserManager.java
  23. +0 −53 maqetta.server.orion/src/maqetta/server/orion/user/OrionUserManagerImpl.java
@@ -47,10 +47,10 @@
public class User implements IUser {
- private IStorage userDirectory;
- private Links links;
- private IPerson person;
- private IVResource workspace;
+ protected IStorage userDirectory;
+ protected Links links;
+ protected IPerson person;
+ protected IVResource workspace;
static {
Constants.LOCAL_INSTALL_USER_OBJ =
new User(new IPerson() {
@@ -64,10 +64,12 @@ public String getEmail() {
,ReviewManager.getReviewManager().getBaseDirectory());
}
-
+ public User(IPerson person) {
+ this.person = person;
+ }
public User(IPerson person, IStorage userDirectory) {
- this.person = person;
+ this(person);
this.userDirectory = userDirectory;
userDirectory.mkdirs();
rebuildWorkspace();
@@ -144,7 +146,7 @@ public void rebuildWorkspace() {
public ILibraryFinder[] getFinders(String base){
ILibraryFinder[] finders = ServerManager.getServerManger().getLibraryManager().getLibraryFinders();
- StorageFileSystem baseFile = new StorageFileSystem(this.userDirectory, base);
+ 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());
@@ -156,7 +158,7 @@ public void rebuildWorkspace() {
public ILibInfo[] getExtendedSettings(String base){
ILibraryFinder[] finders = ServerManager.getServerManger().getLibraryManager().getLibraryFinders();
- IStorage baseFile = new StorageFileSystem(this.userDirectory, base);
+ 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());
@@ -293,7 +295,7 @@ private LibrarySettings getLibSettings(String base) {
return getLibSettings(this.userDirectory.newInstance(this.userDirectory, base));
}
- private LibrarySettings getLibSettings(IStorage baseFile) {
+ protected LibrarySettings getLibSettings(IStorage baseFile) {
if(!isValid(baseFile.getAbsolutePath())) return null;
return new LibrarySettings(this.userDirectory.newInstance(baseFile, IDavinciServerConstants.SETTINGS_DIRECTORY_NAME));
}
@@ -408,14 +410,14 @@ public IVResource getResource(String path) {
return getLibFile(path);
}
- private Library getLibrary(ILibInfo li) {
+ protected Library getLibrary(ILibInfo li) {
String id = li.getId();
String version = li.getVersion();
return ServerManager.getServerManger().getLibraryManager().getLibrary(id, version);
}
- private IVResource getLibFile(String p1) {
+ protected IVResource getLibFile(String p1) {
IPath path = new Path(p1);
IVResource root = this.workspace;
for (int i = 0; i < path.segmentCount() && root != null; i++) {
@@ -426,7 +428,7 @@ private IVResource getLibFile(String p1) {
return root;
}
- private IVResource getLinkedResource(String path){
+ protected IVResource getLinkedResource(String path){
String path1 = path;
if (path1.startsWith("./")) {
path1 = path.substring(2);
@@ -605,7 +607,7 @@ synchronized public ILinks getLinks() {
}
}
if(f1!=null){
- Collection c = this.userDirectory.listFiles(f1, filter, TrueFileFilter.INSTANCE);
+ Collection c = this.userDirectory.findFiles(f1, pathStr,ignoreCase);
File[] found = (File[]) c.toArray(new File[c.size()]);
for (int i = 0; i < found.length; i++) {
IStorage workspaceFile = null;
@@ -18,7 +18,7 @@
public class PersonManagerImpl implements IPersonManager {
- HashMap persons = new HashMap();
+ protected HashMap persons = new HashMap();
static final String USERS_TAG = "users";
static final String USER_TAG = "user";
@@ -20,13 +20,13 @@
public class UserManagerImpl implements IUserManager {
- static UserManagerImpl theUserManager;
- HashMap users = new HashMap();
- public IStorage baseDirectory;
+ protected static UserManagerImpl theUserManager;
+ protected HashMap users = new HashMap();
+ protected IStorage baseDirectory;
- IPersonManager personManager;
- int maxUsers = 0;
- private int usersCount;
+ protected IPersonManager personManager;
+ protected int maxUsers = 0;
+ protected int usersCount;
public UserManagerImpl() {
@@ -85,6 +85,7 @@ public IUser getUser(String userName) {
if (user == null && this.checkUserExists(userName)) {
IPerson person = this.personManager.getPerson(userName);
user = newUser(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
+ users.put(userName, user);
}
return user;
@@ -108,7 +109,7 @@ public IUser addUser(String userName, String password, String email) throws User
IPerson person = this.personManager.addPerson(userName, password, email);
if (person != null) {
- IUser user = new User(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
+ IUser user = newUser(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
users.put(userName, user);
//File userDir = user.getUserDirectory();
//userDir.mkdir();
@@ -155,7 +156,7 @@ public IUser login(String userName, String password) {
}
IPerson person = this.personManager.login(userName, password);
if (person != null) {
- return new User(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
+ return newUser(person, this.baseDirectory.newInstance(this.baseDirectory, userName));
}
return null;
}
@@ -1,8 +1,6 @@
package maqetta.core.server.util;
import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -14,7 +12,6 @@
import org.maqetta.server.IStorage;
import org.maqetta.server.IVResource;
-import org.maqetta.server.StorageFileSystem;
import org.osgi.framework.Bundle;
public class VResourceUtils {
@@ -80,9 +77,9 @@ public static void copyDirectory(IStorage userDir, String bundleDirName, Bundle
URLConnection connection = source.openConnection();
String path = source.getPath();
String tail = path.substring(bundleDirName.length() + 1);
- File path1 = new File("/tmp");
+
// File destination = new File("/Users/childsb/dev/workspaces/maqetta-workspace/childsb@us.ibm.com/project1/WebContent/app.css");
- IStorage destination = new StorageFileSystem(userDir, tail);
+ IStorage destination = userDir.newInstance(userDir, tail);
if (tail.indexOf(".svn") > -1) {
continue;
@@ -2,9 +2,7 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -51,8 +51,7 @@
public IStorage newInstance(URI uri);
- public Collection listFiles(IStorage f1, IOFileFilter filter,
- IOFileFilter instance);
+ public Collection findFiles(IStorage parentFolder, String pathStr, boolean ignoreCase) ;
public boolean isFile();
public String[] list();
@@ -10,8 +10,16 @@
import java.net.URI;
import java.util.Collection;
+
+
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOCase;
import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.NameFileFilter;
+import org.apache.commons.io.filefilter.SuffixFileFilter;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
public class StorageFileSystem implements IStorage {
@@ -94,9 +102,22 @@ public void renameTo(IStorage file) {
public IStorage newInstance(URI uri) {
return new StorageFileSystem(new File(uri));
}
- public Collection listFiles(IStorage f1, IOFileFilter filter, IOFileFilter instance) {
-
- return FileUtils.listFiles(((StorageFileSystem)f1).file, filter, instance);
+ public Collection findFiles(IStorage f1, String pathStr, boolean ignoreCase) {
+ IOFileFilter filter;
+ IPath path = new Path(pathStr);
+ if (path.segment(0).equals("*")) {
+ IOCase ioCase = ignoreCase ? IOCase.INSENSITIVE : IOCase.SENSITIVE;
+ filter = new NameFileFilter(path.lastSegment(), ioCase);
+ } else {
+ String lastSegment = path.lastSegment();
+ if (lastSegment.startsWith("*")) {
+ filter = new SuffixFileFilter(lastSegment.substring(1));
+ } else {
+ filter = null;
+ }
+ }
+
+ return FileUtils.listFiles(((StorageFileSystem)f1).file, filter, TrueFileFilter.INSTANCE);
}
public boolean isFile() {
@@ -21,11 +21,11 @@
public class VFile implements IVResource {
// abstracted file/resource class
- IStorage file = null;
- private boolean isWorkingCopy;
- private String virtualPath;
- private IStorage workingCopy;
- private IVResource parent;
+ protected IStorage file = null;
+ protected boolean isWorkingCopy;
+ protected String virtualPath;
+ protected IStorage workingCopy;
+ protected IVResource parent;
public VFile(IStorage file, IVResource parent, String virtualPath) {
@@ -65,10 +65,14 @@ public IStorage getFile() {
}
- private IStorage getWorkingCopy(IStorage original) {
+ protected IStorage getWorkingCopy(IStorage original) {
IStorage parent = original.getParentFile();
- IStorage workingCopy = original.newInstance(parent, original.getName() + IDavinciServerConstants.WORKING_COPY_EXTENSION);
- return workingCopy;
+ IStorage workingCopy;
+ if(parent!=null)
+ workingCopy = original.newInstance(parent, original.getName() + IDavinciServerConstants.WORKING_COPY_EXTENSION);
+ else
+ workingCopy = original.newInstance(original.getName() + IDavinciServerConstants.WORKING_COPY_EXTENSION);
+ return workingCopy;
}
/*
@@ -7,13 +7,15 @@ Bundle-Activator: maqetta.server.orion.internal.Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.servlet;version="[2.1.0,3.0.0]",
javax.servlet.http;version="[2.1.0,3.0.0)",
+ org.json,
org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: maqetta.core.server;bundle-version="1.0.0",
org.eclipse.core.filesystem;bundle-version="1.3.200",
org.eclipse.orion.server.configurator;bundle-version="0.4.0",
org.eclipse.orion.server.core;bundle-version="0.3.0",
- org.eclipse.core.runtime;bundle-version="3.8.0"
+ org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.orion.server.servlets;bundle-version="0.3.0"
Export-Package: maqetta.server.orion;
uses:="org.davinci.server.util,
org.davinci.server.user,
@@ -15,8 +15,93 @@
</extension>
<extension point="maqetta.core.server.userManager">
- <userManager class="maqetta.core.server.user.manager.UserManagerImpl"/>
+ <userManager class="maqetta.server.orion.user.OrionUserManager"/>
</extension>
+ <extension point="org.eclipse.core.runtime.products">
+ <product
+ application="maqetta.orion.product"
+ description="Maqetta Orion Server"
+ name="MaqMuffin">
+ </product>
+ </extension>
+ <extension
+ point="maqetta.core.server.command">
+ <command path="login" noLogin="true"
+ class="maqetta.core.server.command.Login" />
+ <command path="register" noLogin="true"
+ class="maqetta.core.server.command.Register" />
+ <command path="listFiles"
+ class="maqetta.core.server.command.ListFiles" />
+ <command path="addFiles"
+ class="maqetta.core.server.command.AddFiles" />
+ <command path="deleteResource"
+ class="maqetta.core.server.command.DeleteResource" />
+ <command path="createResource"
+ class="maqetta.core.server.command.CreateResource" />
+ <command path="getPreferences"
+ class="maqetta.core.server.command.GetPreferences" />
+ <command path="setPreferences" isPut="true"
+ class="maqetta.core.server.command.SetPreferences" />
+ <command path="getWorkbenchState"
+ class="maqetta.server.orion.command.GetWorkbenchState" />
+ <command path="setWorkbenchState" isPut="true"
+ class="maqetta.server.orion.command.SetWorkbenchState" />
+ <command path="removeWorkingCopy"
+ class="maqetta.core.server.command.RemoveWorkingCopy" />
+ <command path="logoff"
+ class="maqetta.core.server.command.LogOff" />
+ <command path="download"
+ class="maqetta.core.server.command.Download" />
+ <command path="findResource"
+ class="maqetta.core.server.command.FindResource" />
+ <command path="getPlugins"
+ class="maqetta.core.server.command.GetPlugins" />
+ <command path="getLibRoots"
+ class="maqetta.core.server.command.GetLibRoots" />
+ <command path="listLibs"
+ class="maqetta.core.server.command.ListLibs" />
+ <command path="getUserLibs"
+ class="maqetta.core.server.command.GetUserLibs" />
+ <command path="getLibMetadata"
+ class="maqetta.core.server.command.GetLibMetadata" />
+ <command path="modifyLib"
+ class="maqetta.core.server.command.ModifyLib" />
+ <command path="getMetaRoot"
+ class="maqetta.core.server.command.GetMetaRoot" />
+ <command path="copy"
+ class="maqetta.core.server.command.Copy" />
+ <command path="createProject"
+ class="maqetta.core.server.command.CreateProject" />
+ <command path="rename"
+ class="maqetta.core.server.command.Rename" />
+ <command path="tryIt" noLogin="true"
+ class="maqetta.core.server.command.TryIt" />
+ <command path="removeUser" noLogin="true"
+ class="maqetta.core.server.command.RemoveUser" />
+
+ <!-- Review and Commenting Commands -->
+ <command path="listVersions"
+ class="maqetta.core.server.command.ListVersions" />
+ <command path="addComment"
+ class="maqetta.core.server.command.AddComment" />
+ <command path="updateComment"
+ class="maqetta.core.server.command.UpdateComment" />
+ <command path="getComments"
+ class="maqetta.core.server.command.GetComments" />
+ <command path="publish"
+ class="maqetta.core.server.command.Publish" />
+ <command path="getBluePageInfo"
+ class="maqetta.core.server.command.GetBluePageInfo" />
+ <command path="listReviewFiles"
+ class="maqetta.core.server.command.ListReviewFiles" />
+ <command path="getLatestVersionId"
+ class="maqetta.core.server.command.GetLatestVersionId" />
+ <command path="managerVersion"
+ class="maqetta.core.server.command.ManagerVersion" />
+ <command path="getReviewUserInfo"
+ class="maqetta.core.server.command.GetReviewUserInfo" />
+
+ </extension>
</plugin>
Oops, something went wrong.

0 comments on commit 652c612

Please sign in to comment.