Skip to content
Snippets Groups Projects
Commit 78edefc7 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

added emfstore and unicase client storage location providers

parent f9c5b5e2
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,18 @@
uri="http://www.fortiss.org/tooling/kernel">
</package>
</extension>
<extension
point="org.unicase.emfstore.locationprovider">
<LocationProvider
providerClass="org.fortiss.tooling.kernel.internal.emfstore.EclipseWorkspaceEMFStoreLocationProvider">
</LocationProvider>
</extension>
<extension
point="org.unicase.workspace.workspaceLocationProvider">
<LocationProvider
providerClass="org.fortiss.tooling.kernel.internal.emfstore.EclipseWorkspaceUnicaseClientLocationProvider">
</LocationProvider>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.emfstore;
import org.unicase.emfstore.LocationProvider;
/**
* A {@link LocationProvider} which uses the Eclipse workspace location as base
* location. This provider is intended to be used with the
* <code>org.unicase.emfstore.locationprovider</code> extension point.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public final class EclipseWorkspaceEMFStoreLocationProvider extends
EclipseWorkspaceLocationProviderBase {
/** {@inheritDoc} */
@Override
protected String getWorkspaceProjectName() {
return ".unicase_client";
}
/** {@inheritDoc} */
@Override
protected String getBackupProjectName() {
return ".unicase_client_backup";
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.emfstore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.unicase.emfstore.LocationProvider;
/**
* Base implementation of a {@link LocationProvider} which uses the Eclipse
* workspace location as base location.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public abstract class EclipseWorkspaceLocationProviderBase implements
LocationProvider {
/** Store the workspace location. */
private final IProject workspaceProject;
/** Stores the backup location. */
private final IProject backupProject;
/** Constructor. */
public EclipseWorkspaceLocationProviderBase() {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
this.workspaceProject = workspaceRoot
.getProject(getWorkspaceProjectName());
if (!workspaceProject.exists()) {
try {
workspaceProject.create(null);
} catch (CoreException e) {
printCreationError(getWorkspaceProjectName(), e);
}
}
this.backupProject = workspaceRoot.getProject(getBackupProjectName());
if (!backupProject.exists()) {
try {
backupProject.create(null);
} catch (CoreException e) {
printCreationError(getBackupProjectName(), e);
}
}
}
/** Prints error message to standard error. */
private final void printCreationError(String projectName, Exception ex) {
System.err.println("Could not create project " + projectName);
ex.printStackTrace(System.err);
}
/** Returns the name of the workspace project. */
protected abstract String getWorkspaceProjectName();
/** Returns the name of the backup project. */
protected abstract String getBackupProjectName();
/** {@inheritDoc} */
@Override
public final String getWorkspaceDirectory() {
return workspaceProject.getFullPath().toString();
}
/** {@inheritDoc} */
@Override
public final String getBackupDirectory() {
return backupProject.getFullPath().toString();
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.emfstore;
import org.unicase.emfstore.LocationProvider;
/**
* A {@link LocationProvider} which uses the Eclipse workspace location as base
* location. This provider is intended to be used with the
* <code>org.unicase.workspace.workspaceLocationProvider</code> extension point.
*
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @levd.rating RED Rev:
*/
public final class EclipseWorkspaceUnicaseClientLocationProvider extends
EclipseWorkspaceLocationProviderBase {
/** {@inheritDoc} */
@Override
protected String getWorkspaceProjectName() {
return "emfStoreServerWorkspaceProject";
}
/** {@inheritDoc} */
@Override
protected String getBackupProjectName() {
return "emfStoreServerBackupProject";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment