Skip to content

Commit

Permalink
Cleaned up structure a little bit, cashdesk now working
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoeppke committed Aug 8, 2016
1 parent e8fa63f commit f5c2263
Show file tree
Hide file tree
Showing 53 changed files with 1,034 additions and 637 deletions.
Original file line number Diff line number Diff line change
@@ -1,93 +1,96 @@
/***************************************************************************
* Copyright 2013 DFG SPP 1593 (http://dfg-spp1593.de)
*
* 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.cocome.cloud.registry.service;

/**
* Utility class for deriving RMI and JNDI names from component names.
*
* @author Lubomir Bulej
*/
public final class Names {
public static String getCashDeskName(final int cashDeskIndex) {
return String.format("CashDesk%d", cashDeskIndex);
}

private static String getStoreName(final long storeIndex) {
return String.format("Store%d", storeIndex);
}

private static String getEnterpriseManagerName(final long enterpriseIndex) {
return String.format("EnterpriseManager%d", enterpriseIndex);
}

private static String getEnterpriseReportingName(final long enterpriseIndex) {
return String.format("EnterpriseReporting%d", enterpriseIndex);
}

private static String getLoginManagerName(final long enterpriseIndex) {
return String.format("LoginManager%d", enterpriseIndex);
}

public static String getBankRemoteName(final String bankName) {
return String.format("Bank.%s", bankName);
}

private static String getEnterpriseRemoteName(final String enterpriseName) {
return String.format("EnterpriseApplication.%s", enterpriseName);
}

private static String getStoreRemoteName(final String storeName) {
return String.format("StoreApplication.%s", storeName);
}

private static String getReportingRemoteName(final String reportingName) {
return String.format("ReportingApplication.%s", reportingName);
}

public static String getProductDispatcherRemoteName(final String dispatcherName) {
return String.format("ProductDispatcher.%s", dispatcherName);
}

public static String getCashDeskRemoteName(final String storeName, final String cashDeskName) {
return String.format("%s/%s", storeName, cashDeskName);
}

public static String getEnterpriseManagerRegistryName(final long enterpriseIndex) {
return getEnterpriseRemoteName(getEnterpriseManagerName(enterpriseIndex));
}

public static String getEnterpriseManagerRegistryName(final String enterpriseName) {
return getEnterpriseRemoteName(String.format("EnterpriseManager.%s", enterpriseName));
}

public static String getEnterpriseReportingRegistryName(final long enterpriseIndex) {
return getReportingRemoteName(getEnterpriseReportingName(enterpriseIndex));
}

public static String getStoreManagerRegistryName(final long storeIndex) {
return getStoreRemoteName(getStoreName(storeIndex));
}

public static String getLoginManagerRegistryName(final long enterpriseIndex) {
return getEnterpriseRemoteName(getLoginManagerName(enterpriseIndex));
}

public static String getCashDeskRegistryName(final long storeIndex, final int cashDeskIndex) {
return getCashDeskRemoteName(getStoreName(storeIndex), getCashDeskName(cashDeskIndex));
}

}
/***************************************************************************
* Copyright 2013 DFG SPP 1593 (http://dfg-spp1593.de)
*
* 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.cocome.cloud.registry.service;

/**
* Utility class for deriving RMI and JNDI names from component names.
*
* @author Lubomir Bulej
*/
public final class Names {
public static String getCashDeskName(final int cashDeskIndex) {
return String.format("CashDesk%d", cashDeskIndex);
}

private static String getStoreName(final long storeIndex) {
return String.format("Store%d", storeIndex);
}

private static String getEnterpriseManagerName(final long enterpriseIndex) {
return String.format("EnterpriseManager%d", enterpriseIndex);
}

private static String getEnterpriseReportingName(final long enterpriseIndex) {
return String.format("EnterpriseReporting%d", enterpriseIndex);
}

private static String getLoginManagerName(final long enterpriseIndex) {
return String.format("LoginManager%d", enterpriseIndex);
}

public static String getBankRemoteName(final String bankName) {
return String.format("Bank.%s", bankName);
}

private static String getEnterpriseRemoteName(final String enterpriseName) {
return String.format("EnterpriseApplication.%s", enterpriseName);
}

private static String getStoreRemoteName(final String storeName) {
return String.format("StoreApplication.%s", storeName);
}

private static String getReportingRemoteName(final String reportingName) {
return String.format("ReportingApplication.%s", reportingName);
}

public static String getProductDispatcherRemoteName(final String dispatcherName) {
return String.format("ProductDispatcher.%s", dispatcherName);
}

public static String getCashDeskRemoteName(final String storeName, final String cashDeskName) {
return String.format("%s/%s", storeName, cashDeskName);
}

public static String getCashDeskComponentRegistryName(final String cashDeskRemoteName, final String componentName) {
return String.format("%s-%s", cashDeskRemoteName, componentName);
}

public static String getEnterpriseManagerRegistryName(final long enterpriseIndex) {
return getEnterpriseRemoteName(getEnterpriseManagerName(enterpriseIndex));
}

public static String getEnterpriseManagerRegistryName(final String enterpriseName) {
return getEnterpriseRemoteName(String.format("EnterpriseManager.%s", enterpriseName));
}

public static String getEnterpriseReportingRegistryName(final long enterpriseIndex) {
return getReportingRemoteName(getEnterpriseReportingName(enterpriseIndex));
}

public static String getStoreManagerRegistryName(final long storeIndex) {
return getStoreRemoteName(getStoreName(storeIndex));
}

public static String getLoginManagerRegistryName(final long enterpriseIndex) {
return getEnterpriseRemoteName(getLoginManagerName(enterpriseIndex));
}

public static String getCashDeskRegistryName(final long storeIndex, final int cashDeskIndex) {
return getCashDeskRemoteName(getStoreName(storeIndex), getCashDeskName(cashDeskIndex));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
org.cocome.tradingsystem.remote.access.connection.backendHost=${serviceadapter.host}
defaultCashDeskIndex=-1
defaultStoreIndex=-1
defaultEnterpriseIndex=-1
org.cocome.tradingsystem.remote.access.connection.backendPort=${serviceadapter.httpPort}
org.cocome.tradingsystem.remote.access.connection.backendGetDataURL=${serviceadapter.baseDir}/Database/GetData
org.cocome.tradingsystem.remote.access.connection.backendSetDataURL=${serviceadapter.baseDir}/Database/SetData
org.cocome.cloud.webservice.enterprise.enterpriseServiceWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.enterpriseService}/IEnterpriseManager?wsdl
org.cocome.cloud.webservice.enterprise.enterpriseReportingWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.enterpriseService}/IEnterpriseReport?wsdl
org.cocome.cloud.webservice.enterprise.loginManagerWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.loginService}/ILoginManager?wsdl
org.cocome.cloud.logic.webservice.store.storeManagerWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.storeService}/IStoreManager?wsdl
org.cocome.tradingsystem.remote.access.connection.backendHost=${serviceadapter.host}
defaultCashDeskIndex=-1
defaultStoreIndex=-1
defaultEnterpriseIndex=-1
org.cocome.tradingsystem.remote.access.connection.backendPort=${serviceadapter.httpPort}
org.cocome.tradingsystem.remote.access.connection.backendGetDataURL=${serviceadapter.baseDir}/Database/GetData
org.cocome.tradingsystem.remote.access.connection.backendSetDataURL=${serviceadapter.baseDir}/Database/SetData
org.cocome.cloud.webservice.enterprise.enterpriseServiceWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.enterpriseService}/IEnterpriseManager?wsdl
org.cocome.cloud.webservice.enterprise.enterpriseReportingWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.enterpriseService}/IEnterpriseReport?wsdl
org.cocome.cloud.webservice.enterprise.loginManagerWSDL=${logic.enterprise.protocol}\://${logic.enterprise.host}\:${logic.enterprise.httpPort}${logic.enterprise.baseDir}${logic.loginService}/ILoginManager?wsdl
org.cocome.cloud.logic.webservice.store.storeManagerWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.storeService}/IStoreManager?wsdl
org.cocome.cloud.logic.webservice.store.cashDeskWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/ICashDesk?wsdl
org.cocome.cloud.logic.webservice.store.cashBoxWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/ICashBox?wsdl
org.cocome.cloud.logic.webservice.store.barcodeScannerWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/IBarcodeScanner?wsdl
org.cocome.cloud.logic.webservice.store.cardReaderWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/ICardReader?wsdl
org.cocome.cloud.logic.webservice.store.expressLightWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/IExpressLight?wsdl
org.cocome.cloud.logic.webservice.store.printerWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/IPrinter?wsdl
org.cocome.cloud.logic.webservice.store.userDisplayWSDL=${logic.store.protocol}\://${logic.store.host}\:${logic.store.httpPort}${logic.store.baseDir}${logic.cashDeskService}/IUserDisplay?wsdl
Original file line number Diff line number Diff line change
@@ -1,40 +1,68 @@
package org.cocome.cloud.logic.webservice.store;

import java.net.URISyntaxException;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;

import org.apache.log4j.Logger;
import org.cocome.cloud.logic.registry.client.IApplicationHelper;
import org.cocome.cloud.registry.service.Names;

@Singleton
@Startup
public class StoreManagerStartup {
private static final Logger LOG = Logger.getLogger(StoreManagerStartup.class);

@Inject
String storeManagerWSDL;

@Inject
long defaultStoreIndex;

@Inject
int defaultCashDeskIndex;

@Inject
IApplicationHelper applicationHelper;

@PostConstruct
private void registerStoreManager() {
try {
applicationHelper.registerComponent(Names.getStoreManagerRegistryName(defaultStoreIndex), storeManagerWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskRegistryName(defaultStoreIndex, defaultCashDeskIndex), storeManagerWSDL, false);
} catch (URISyntaxException e) {
LOG.error("Error registering component: " + e.getMessage());
}
}
}
package org.cocome.cloud.logic.webservice.store;

import java.net.URISyntaxException;

import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;

import org.apache.log4j.Logger;
import org.cocome.cloud.logic.registry.client.IApplicationHelper;
import org.cocome.cloud.registry.service.Names;

@Singleton
@Startup
public class StoreManagerStartup {
private static final Logger LOG = Logger.getLogger(StoreManagerStartup.class);

@Inject
String storeManagerWSDL;

@Inject
String cashDeskWSDL;

@Inject
String barcodeScannerWSDL;

@Inject
String cardReaderWSDL;

@Inject
String cashBoxWSDL;

@Inject
String expressLightWSDL;

@Inject
String printerWSDL;

@Inject
String userDisplayWSDL;

@Inject
long defaultStoreIndex;

@Inject
int defaultCashDeskIndex;

@Inject
IApplicationHelper applicationHelper;

@PostConstruct
private void registerStoreManager() {
try {
applicationHelper.registerComponent(Names.getStoreManagerRegistryName(defaultStoreIndex), storeManagerWSDL, false);
String cashDeskName = Names.getCashDeskRegistryName(defaultStoreIndex, defaultCashDeskIndex);
applicationHelper.registerComponent(cashDeskName, cashDeskWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "barcodeScanner"), barcodeScannerWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "cardReader"), cardReaderWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "cashBox"), cashBoxWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "expressLight"), expressLightWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "printer"), printerWSDL, false);
applicationHelper.registerComponent(Names.getCashDeskComponentRegistryName(cashDeskName, "userDisplay"), userDisplayWSDL, false);
} catch (URISyntaxException e) {
LOG.error("Error registering component: " + e.getMessage());
}
}
}
Loading

0 comments on commit f5c2263

Please sign in to comment.