-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guido Grune <g.grune@datainmotion.com>
- Loading branch information
Showing
4 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...gecko.emf.mongo/src/org/gecko/emf/mongo/resource/MongoPersistenceResourceFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) 2012 - 2024 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.emf.mongo.resource; | ||
|
||
import org.eclipse.emf.common.util.URI; | ||
import org.eclipse.emf.ecore.resource.Resource; | ||
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; | ||
import org.gecko.emf.osgi.constants.EMFNamespaces; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Deactivate; | ||
|
||
/** | ||
* | ||
* @author grune | ||
* @since Jan 23, 2024 | ||
* | ||
* enabled = false da es eine weiter Implementierung im codec mongo_generator branch gibt | ||
*/ | ||
@Component(enabled = false , service = Resource.Factory.class, property = { EMFNamespaces.EMF_CONFIGURATOR_NAME + "=myMongo", | ||
EMFNamespaces.EMF_MODEL_PROTOCOL + "=mongodb" }) | ||
public class MongoPersistenceResourceFactoryImpl extends ResourceFactoryImpl { | ||
|
||
@Activate | ||
public void activate() { | ||
} | ||
|
||
@Deactivate | ||
public void deactivate() { | ||
} | ||
|
||
@Override | ||
public Resource createResource(URI uri) { | ||
return new MongoPersistenceResourceImpl(uri); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
org.gecko.emf.mongo/src/org/gecko/emf/mongo/resource/MongoPersistenceResourceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2012 - 2024 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.emf.mongo.resource; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.util.Map; | ||
|
||
import org.eclipse.emf.common.util.URI; | ||
import org.eclipse.emf.ecore.resource.impl.ResourceImpl; | ||
import org.gecko.emf.mongo.streams.MongoInputStream; | ||
import org.gecko.emf.mongo.streams.MongoOutputStream; | ||
|
||
/** | ||
* | ||
* @author grune | ||
* @since Jan 23, 2024 | ||
*/ | ||
final class MongoPersistenceResourceImpl extends ResourceImpl { | ||
/** | ||
* Creates a new instance. | ||
* @param uri | ||
*/ | ||
MongoPersistenceResourceImpl(URI uri) { | ||
super(uri); | ||
} | ||
|
||
@Override | ||
protected void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException { | ||
((MongoOutputStream) outputStream).saveResource(this); | ||
} | ||
|
||
@Override | ||
protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException { | ||
((MongoInputStream) inputStream).loadResource(this); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
org.gecko.emf.mongo/src/org/gecko/emf/mongo/resource/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@org.osgi.annotation.versioning.Version("1.0.0") | ||
package org.gecko.emf.mongo.resource; |