diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..20fcaa8
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..dcd9f38
--- /dev/null
+++ b/.project
@@ -0,0 +1,23 @@
+
+
+ portal-manager
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..f9fe345
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding/=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..60105c1
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/distro/INSTALL b/distro/INSTALL
new file mode 100644
index 0000000..dfeae98
--- /dev/null
+++ b/distro/INSTALL
@@ -0,0 +1 @@
+Used as a Web service in the gCube Framework
\ No newline at end of file
diff --git a/distro/LICENSE b/distro/LICENSE
new file mode 100644
index 0000000..bd0c2b4
--- /dev/null
+++ b/distro/LICENSE
@@ -0,0 +1,8 @@
+gCube System - License
+------------------------------------------------------------
+
+The gCube/gCore software is licensed as Free Open Source software conveying to
+the EUPL (http://ec.europa.eu/idabc/eupl).
+The software and documentation is provided by its authors/distributors "as is"
+and no expressed or implied warranty is given for its use, quality or fitness
+for a particular case.
diff --git a/distro/MAINTAINERS b/distro/MAINTAINERS
new file mode 100644
index 0000000..1c0d747
--- /dev/null
+++ b/distro/MAINTAINERS
@@ -0,0 +1,5 @@
+* Daniele Strollo (daniele.strollo@isti.cnr.it), CNR Pisa,
+ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
+
+* Valentina Marioli (valentina.marioli@isti.cnr.it), CNR Pisa,
+ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
\ No newline at end of file
diff --git a/distro/README b/distro/README
new file mode 100644
index 0000000..9f02f32
--- /dev/null
+++ b/distro/README
@@ -0,0 +1,49 @@
+The gCube System
+------------------------------------------------------------
+
+This work is partially funded by the European Commission in the
+context of the D4Science project (www.d4science.eu), under the 1st
+call of FP7 IST priority.
+
+
+Authors
+-------
+
+* Valentina Marioli (valentina.marioli@isti.cnr.it), CNR Pisa,
+ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
+
+* Daniele Strollo (daniele.strollo@isti.cnr.it), CNR Pisa,
+ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
+
+Version and Release Date
+------------------------
+
+version 1.0.0 (20-05-2010)
+version 1.2.0 (19-04-2013)
+
+Description
+--------------------
+
+Consists of a gcube service able to properly manage the scheduling and
+the deployment planning of services in a gcube infrastructure.
+
+
+Download information
+--------------------
+
+Source code is available from SVN:
+http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/ResourceBroker/org.gcube.vremanagement.resourcebroker/
+
+Binaries can be downloaded from:
+http://software.d4science.research-infrastructures.eu/
+
+Documentation
+-------------
+VREManager documentation is available on-line from the Projects Documentation Wiki:
+https://gcube.wiki.gcube-system.org/gcube/index.php/Resource_Broker
+
+Licensing
+---------
+
+This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
+
diff --git a/distro/changelog.xml b/distro/changelog.xml
new file mode 100644
index 0000000..f0bc8ca
--- /dev/null
+++ b/distro/changelog.xml
@@ -0,0 +1,7 @@
+
+
+ First Release
+
+
\ No newline at end of file
diff --git a/distro/descriptor.xml b/distro/descriptor.xml
new file mode 100644
index 0000000..c468f13
--- /dev/null
+++ b/distro/descriptor.xml
@@ -0,0 +1,48 @@
+
+ servicearchive
+
+ tar.gz
+
+ /
+
+
+ ${distroDirectory}
+ /
+ true
+
+ README
+ LICENSE
+ INSTALL
+ MAINTAINERS
+ changelog.xml
+
+ 755
+ true
+
+
+ target/apidocs
+ /${artifactId}/doc/api
+ true
+ 755
+
+
+
+
+
+ ./
+ true
+
+
+
+ /${artifactId}
+
+
+
+ /${artifactId}
+ true
+
+
+
\ No newline at end of file
diff --git a/distro/profile.xml b/distro/profile.xml
new file mode 100644
index 0000000..1f95c6b
--- /dev/null
+++ b/distro/profile.xml
@@ -0,0 +1,25 @@
+
+
+
+ Library
+
+ ${description}
+ PortletsAdmin
+ ${artifactId}
+ 1.0.0
+
+
+ ${artifactId}
+ ${version}
+
+ ${groupId}
+ ${artifactId}
+ ${version}
+
+
+ ${build.finalName}.jar
+
+
+
+
+
diff --git a/distro/svnpath.txt b/distro/svnpath.txt
new file mode 100644
index 0000000..edacb04
--- /dev/null
+++ b/distro/svnpath.txt
@@ -0,0 +1 @@
+${scm.url}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a60e430
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,139 @@
+
+ 4.0.0
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+
+
+ org.gcube.common.portal
+ portal-manager
+ 0.1.0-SNAPSHOT
+ jar
+ gCube Portal Manager
+
+ gCube Portal Manager is a component that all portlets need to use to get the context where they are running.
+
+
+ scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/${project.artifactId}
+ scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/${project.artifactId}
+ http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlal/${project.artifactId}
+
+
+ distro
+ 1.6
+ 1.6
+
+ UTF-8
+ UTF-8
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.6.4
+
+
+ org.slf4j
+ slf4j-api
+ 1.6.4
+
+
+
+
+
+ src/main/java
+
+ **/*.*
+
+
+
+
+
+ maven-compiler-plugin
+ 3.0
+
+
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.2
+
+
+
+ test-jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 2.5
+
+
+ copy-profile
+ install
+
+ copy-resources
+
+
+ target
+
+
+ ${distroDirectory}
+ true
+
+ profile.xml
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 2.2
+
+
+ ${distroDirectory}/descriptor.xml
+
+
+
+ fully.qualified.MainClass
+
+
+
+
+
+ servicearchive
+ install
+
+ single
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/org/gcube/common/portal/Portal.java b/src/main/java/org/gcube/common/portal/Portal.java
new file mode 100644
index 0000000..5a0586b
--- /dev/null
+++ b/src/main/java/org/gcube/common/portal/Portal.java
@@ -0,0 +1,85 @@
+package org.gcube.common.portal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+
+/**
+ * Clients can obtain the single instance of the {@link Portal} by invoking its static method {@link #getConfiguration()}.
+ * The first invocation of the method triggers the initialisation of the instance.
+ *
+ * @author Massimiliano Assante (ISTI-CNR)
+ *
+ */
+public class Portal {
+ private static final Logger _log = LoggerFactory.getLogger(Portal.class);
+
+ public static final String INFRASTRUCTURE_NAME = "infrastructure";
+ public static final String SCOPES = "scopes";
+
+ protected static Portal singleton = new Portal();
+
+ private String infra;
+ private String vos;
+
+ private Portal() {
+ initialize();
+ }
+ /**
+ *
+ * @return the instance
+ */
+ public synchronized static Portal getConfiguration() {
+ return singleton == null ? new Portal() : singleton;
+ }
+
+
+ private void initialize() {
+ Properties props = new Properties();
+ try {
+ String propertyfile = getGCoreFolder() + File.separator + "infrastructure.properties";
+ File propsFile = new File(propertyfile);
+ FileInputStream fis = new FileInputStream(propsFile);
+ props.load( fis);
+ infra = props.getProperty(INFRASTRUCTURE_NAME);
+ vos = props.getProperty(SCOPES);
+ }
+ catch(IOException e) {
+ infra = "gcube";
+ vos = "";
+ _log.error("infrastructure.properties file not found under $CATALINA_HOME/ dir, setting default infrastructure Name and no Scopes" + infra);
+ }
+ _log.info("Portal configurator correctly initialized on " + infra);
+ }
+
+ public String getInfrastructureName() {
+ return this.infra;
+ }
+
+ public List getVOs() {
+ List toReturn = new ArrayList();
+ if (vos == null || vos.equals(""))
+ return toReturn;
+ String[] split = vos.split(",");
+ for (int i = 0; i < split.length; i++) {
+ toReturn.add(split[i].trim());
+ }
+ return toReturn;
+ }
+ /**
+ *
+ * @return $CATALINA_HOME
+ */
+ private static String getGCoreFolder() {
+ return (System.getenv("GLOBUS_LOCATION").endsWith("/") ? System.getenv("GLOBUS_LOCATION") : System.getenv("GLOBUS_LOCATION")+"/");
+ }
+}