Skip to Content.
Sympa Menu

perfsonar-dev - [GEANT/SA2/ps-java-services] r5599 - in trunk/perfsonar-java-xml-ls: packaging/deb src/main/java/org/perfsonar/service/lookupservice/components src/main/java/org/perfsonar/service/lookupservice/servlets src/main/resources/perfsonar/conf

Subject: perfsonar development work

List archive

[GEANT/SA2/ps-java-services] r5599 - in trunk/perfsonar-java-xml-ls: packaging/deb src/main/java/org/perfsonar/service/lookupservice/components src/main/java/org/perfsonar/service/lookupservice/servlets src/main/resources/perfsonar/conf


Chronological Thread 
  • From:
  • To:
  • Subject: [GEANT/SA2/ps-java-services] r5599 - in trunk/perfsonar-java-xml-ls: packaging/deb src/main/java/org/perfsonar/service/lookupservice/components src/main/java/org/perfsonar/service/lookupservice/servlets src/main/resources/perfsonar/conf
  • Date: Tue, 27 Apr 2010 10:05:39 +0100

Author: psnc.trzaszczka
Date: 2010-04-27 10:05:39 +0100 (Tue, 27 Apr 2010)
New Revision: 5599

Modified:
trunk/perfsonar-java-xml-ls/packaging/deb/changelog
trunk/perfsonar-java-xml-ls/packaging/deb/control

trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java

trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java

trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/servlets/ExistDbInitializerServlet.java

trunk/perfsonar-java-xml-ls/src/main/resources/perfsonar/conf/configuration.xml
Log:
database access improved

Modified: trunk/perfsonar-java-xml-ls/packaging/deb/changelog
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/deb/changelog 2010-04-26 16:10:22
UTC (rev 5598)
+++ trunk/perfsonar-java-xml-ls/packaging/deb/changelog 2010-04-27 09:05:39
UTC (rev 5599)
@@ -1,3 +1,8 @@
+perfsonar-java-xml-ls (1.5-0RC3) stable; urgency=low
+
+ * Fixes: bugs fixes
+ -- Slawomir Trzaszczka
<>
Thu, 08 Apr 2010 10:00:00 +0200
+
perfsonar-java-xml-ls (1.5-0RC2) stable; urgency=low

* Fixes: bugs fixes

Modified: trunk/perfsonar-java-xml-ls/packaging/deb/control
===================================================================
--- trunk/perfsonar-java-xml-ls/packaging/deb/control 2010-04-26 16:10:22
UTC (rev 5598)
+++ trunk/perfsonar-java-xml-ls/packaging/deb/control 2010-04-27 09:05:39
UTC (rev 5599)
@@ -2,11 +2,11 @@
Section: web
Priority: extra
Maintainer: Slawomir Trzaszczka
<>
-Build-Depends: debhelper (>= 5), maven2
+Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2

Package: perfsonar-java-xml-ls
Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, tomcat5.5-exist
+Depends: ${shlibs:Depends}, ${misc:Depends}, exist
Description: perfSONAR Lookup Service


Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
2010-04-26 16:10:22 UTC (rev 5598)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/DataSourceComponent.java
2010-04-27 09:05:39 UTC (rev 5599)
@@ -4,9 +4,10 @@
import org.perfsonar.base2.service.exceptions.PerfSONARException;

/**
- *
- * contains username,password nad url to databse, optionally contains
read-only user
*
+ * contains username,password nad url to databse, optionally contains
read-only
+ * user
+ *
* @author Slawomir Trzaszczka
*/
public class DataSourceComponent extends Component {
@@ -15,22 +16,30 @@
private String password;
private String usernameRO;
private String passwordRO;
- private boolean hasReadOnlyUser=false;
+ private boolean hasReadOnlyUser = false;
private String url;
+ private String mainCollection;

@Override
public void init() throws PerfSONARException {
username = getOption("username").getValue();
password = getOption("password").getValue();
- url = getOption("url").getValue();
+ String[] splitedAddress =
splitURL(getOption("url").getValue());
+ if(splitedAddress==null || splitedAddress.length!=2){
+ throw new PerfSONARException("Cannot split exist
url");
+ }

-
if(!getOptions().containsKey("usernameRO")||!getOptions().containsKey("passwordRO")){
- usernameRO=username;
- passwordRO=password;
- }else{
+ url=splitedAddress[0];
+ mainCollection=splitedAddress[1];
+
+ if (!getOptions().containsKey("usernameRO")
+ || !getOptions().containsKey("passwordRO")) {
+ usernameRO = username;
+ passwordRO = password;
+ } else {
usernameRO = getOption("usernameRO").getValue();
passwordRO = getOption("passwordRO").getValue();
- hasReadOnlyUser=true;
+ hasReadOnlyUser = true;
}
}

@@ -45,7 +54,8 @@
password = null;
usernameRO = null;
passwordRO = null;
- url = null;
+ url=null;
+ mainCollection=null;
}

public String getUsername() {
@@ -56,10 +66,6 @@
return password;
}

- public String getUrl() {
- return url;
- }
-
public String getUsernameRO() {
return usernameRO;
}
@@ -76,5 +82,30 @@
public boolean hasReadOnlyUser() {
return hasReadOnlyUser;
}
+
+ /**
+ * splits existDbURL to 2 parts: first is direct address to Exist and
second
+ * is main collection name
+ *
+ * @param url
+ * @return
+ */
+ private String[] splitURL(String url) {
+ url.indexOf("exist/xmlrpc/db");
+ final String pattern = "exist/xmlrpc/db/";
+ final int index = url.indexOf("exist/xmlrpc/db/") +
pattern.length();
+ String[] result = new String[2];
+ result[0] = url.substring(0, index - 1);
+ result[1] = url.substring(index);
+ return result;
+ }

+ public String getUrl() {
+ return url;
+ }
+
+ public String getMainCollection() {
+ return mainCollection;
+ }
+
}

Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
2010-04-26 16:10:22 UTC (rev 5598)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/components/XMLDBComponent.java
2010-04-27 09:05:39 UTC (rev 5599)
@@ -37,6 +37,7 @@

private Logger logger = Logger.getLogger(XMLDBComponent.class);
private String url;
+ private String mainCollection;
private String username;
private String password;
public final static String DATASOURCE_KEY = "dataSource-ref";
@@ -55,7 +56,8 @@
dataSourceRefValue);

url = dataSource.getUrl();
-
+ mainCollection=dataSource.getMainCollection();
+
if (getOption(READ_ONLY_KEY) != null
&&
getOption(READ_ONLY_KEY).getValue().equals("true")) {
logger.debug("readOnly compoenent");
@@ -95,8 +97,7 @@
logger.debug("Iniialize XMLDBCompoenent");
try {
// get the collection
- Collection col = DatabaseManager.getCollection(url +
"/ls",
- username, password);
+ Collection col = DatabaseManager.getCollection(url +
"/"+mainCollection,username, password);
if (col == null) {
return false;
}
@@ -166,7 +167,7 @@
*/
public synchronized void uploadStoreFile(String name, String content)
{
try {
- Collection col = getDbCollection(url + "/ls/store");
+ Collection col = getDbCollection(url +
"/"+mainCollection+"/store");
Resource res = col.createResource(name,
"XMLResource");
res.setContent(content);
col.storeResource(res);
@@ -183,7 +184,7 @@
*/
public synchronized void removeFile(String name) {
try {
- Collection col = getDbCollection(url + "/ls/store");
+ Collection col = getDbCollection(url +
"/"+mainCollection+"/store");
Resource res = col.getResource(name);
if (res != null) {
col.removeResource(res);

Modified:
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/servlets/ExistDbInitializerServlet.java
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/servlets/ExistDbInitializerServlet.java
2010-04-26 16:10:22 UTC (rev 5598)
+++
trunk/perfsonar-java-xml-ls/src/main/java/org/perfsonar/service/lookupservice/servlets/ExistDbInitializerServlet.java
2010-04-27 09:05:39 UTC (rev 5599)
@@ -27,6 +27,7 @@
@SuppressWarnings("serial")
public class ExistDbInitializerServlet extends ExistDBInitServlet {

+
/**
*
* main function which initializes database
@@ -48,21 +49,21 @@

.getAuxiliaryComponent("existDataSource");

String dbUrl = existDbComponent.getUrl();
+ String
mainCollection=existDbComponent.getMainCollection();

-
Collection collection = getMainCollection(dbUrl);

UserManagementService usrMngmtService =
getUserManagmentService(collection);
CollectionManagementService colMngmtService =
getCollectionManagmentService(collection);

- Collection lsCollection =
colMngmtService.createCollection("ls");
+ Collection lsCollection =
colMngmtService.createCollection(mainCollection);
Collection copyCollection = colMngmtService
.createCollection("copy");

// removes all existing resources from store
collection (remove old
// registered service stored in collection)
Collection storeCollection = colMngmtService
- .createCollection("ls/store");
+
.createCollection(mainCollection+"/store");

for (String resourceName :
storeCollection.listResources()) {
storeCollection.removeResource(storeCollection
@@ -71,7 +72,7 @@

User user=createUser(existDbComponent.getUsername(),
existDbComponent.getPassword(),
"dba");
- user.setHome(XmldbURI.xmldbUriFor("ls"));
+ user.setHome(XmldbURI.xmldbUriFor(mainCollection));

if (existDbComponent.hasReadOnlyUser()) {
User
userRO=createUser(existDbComponent.getUsernameRO(),

Modified:
trunk/perfsonar-java-xml-ls/src/main/resources/perfsonar/conf/configuration.xml
===================================================================
---
trunk/perfsonar-java-xml-ls/src/main/resources/perfsonar/conf/configuration.xml
2010-04-26 16:10:22 UTC (rev 5598)
+++
trunk/perfsonar-java-xml-ls/src/main/resources/perfsonar/conf/configuration.xml
2010-04-27 09:05:39 UTC (rev 5599)
@@ -75,7 +75,7 @@
<!-- exist datasource contains optionally read-only credentials -->
<component name="existDataSource"

className="org.perfsonar.service.lookupservice.components.DataSourceComponent">
- <option name="url"
value="xmldb:exist://localhost:%PORT%/exist/xmlrpc/db"/>
+ <option name="url"
value="xmldb:exist://localhost:%PORT%/exist/xmlrpc/db/ls"/>
<option name="username" value="lookupservice"/>
<option name="password" value="sonar"/>
<option name="usernameRO" value="guest"/>
@@ -118,6 +118,8 @@
<option name="comp_id" value="urn:compId"/>
</component>

+ <!-- MIGRATION COMPONENT -->
+ <component name="migrator"
className="org.perfsonar.base2.service.configuration.migration.MigratorComponent"
/>

<!-- Scheduler -->
<component name="scheduling"



  • [GEANT/SA2/ps-java-services] r5599 - in trunk/perfsonar-java-xml-ls: packaging/deb src/main/java/org/perfsonar/service/lookupservice/components src/main/java/org/perfsonar/service/lookupservice/servlets src/main/resources/perfsonar/conf, svn-noreply, 04/27/2010

Archive powered by MHonArc 2.6.16.

Top of Page