Skip to content

Commit

Permalink
fix: renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Dec 25, 2024
1 parent 07c17fa commit e962ac9
Show file tree
Hide file tree
Showing 57 changed files with 742 additions and 735 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions projects/aas-server/src/app/aas-provider/aas-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ScanEndpointData } from './worker-data.js';
import { SocketClient } from '../live/socket-client.js';
import { EmptySubscription } from '../live/empty-subscription.js';
import { SocketSubscription } from '../live/socket-subscription.js';
import { AASResourceFactory } from '../packages/aas-resource-factory.js';
import { AASClientFactory } from '../package/aas-client-factory.js';
import { Variable } from '../variable.js';
import { WSServer } from '../ws-server.js';
import { ERRORS } from '../errors.js';
Expand All @@ -53,7 +53,7 @@ export class AASProvider {
@inject(Variable) private readonly variable: Variable,
@inject('Logger') private readonly logger: Logger,
@inject(Parallel) private readonly parallel: Parallel,
@inject(AASResourceFactory) private readonly resourceFactory: AASResourceFactory,
@inject(AASClientFactory) private readonly resourceFactory: AASClientFactory,
@inject('AASIndex') private readonly index: AASIndex,
@inject(TaskHandler) private readonly taskHandler: TaskHandler,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import { Logger } from '../logging/logger.js';
import { DirectoryScan } from './directory-scan.js';
import { AASServerScan } from './aas-server-scan.js';
import { OpcuaServerScan } from './opcua-server-scan.js';
import { OpcuaClient } from '../packages/opcua/opcua-client.js';
import { AasxDirectory } from '../packages/file-system/aasx-directory.js';
import { AASApiClient } from '../packages/aas-server/aas-api-client.js';
import { AASApiClientV3 } from '../packages/aas-server/aas-api-client-v3.js';
import { AASApiClientV1 } from '../packages/aas-server/aas-api-client-v1.js';
import { AASApiClientV0 } from '../packages/aas-server/aas-api-client-v0.js';
import { OpcuaClient } from '../package/opcua/opcua-client.js';
import { AasxDirectory } from '../package/file-system/aasx-directory.js';
import { AASApiClient } from '../package/aas-api/aas-api-client.js';
import { AASApiClientV3 } from '../package/aas-api/aas-api-client-v3.js';
import { AASApiClientV1 } from '../package/aas-api/aas-api-client-v1.js';
import { AASApiClientV0 } from '../package/aas-api/aas-api-client-v0.js';
import { FileStorageProvider } from '../file-storage/file-storage-provider.js';
import { HttpClient } from '../http-client.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import EventEmitter from 'events';
import { AASDocument, AASEndpoint } from 'aas-core';
import { AASIndex } from '../aas-index/aas-index.js';
import { PagedResult } from '../types/paged-result.js';
import { AASLabel } from '../packages/aas-server/aas-api-client.js';
import { AASLabel } from '../package/aas-api/aas-api-client.js';

/** Defines an automate to scan an AAS resource for Asset Administration Shells. */
export abstract class AASResourceScan extends EventEmitter {
Expand Down
6 changes: 3 additions & 3 deletions projects/aas-server/src/app/aas-provider/aas-server-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import { AASDocument } from 'aas-core';
import { Logger } from '../logging/logger.js';
import { AASApiClient, AASLabel } from '../packages/aas-server/aas-api-client.js';
import { AASServerPackage } from '../packages/aas-server/aas-server-package.js';
import { AASApiClient, AASLabel } from '../package/aas-api/aas-api-client.js';
import { AASApiPackage } from '../package/aas-api/aas-api-package.js';
import { AASResourceScan } from './aas-resource-scan.js';
import { PagedResult } from '../types/paged-result.js';

Expand All @@ -32,7 +32,7 @@ export class AASServerScan extends AASResourceScan {
}

protected override createDocument(id: AASLabel): Promise<AASDocument> {
const aasPackage = new AASServerPackage(this.logger, this.client, id.id, id.idShort);
const aasPackage = new AASApiPackage(this.logger, this.client, id.id, id.idShort);
return aasPackage.createDocumentAsync();
}

Expand Down
6 changes: 3 additions & 3 deletions projects/aas-server/src/app/aas-provider/directory-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import { AASDocument } from 'aas-core';
import { Logger } from '../logging/logger.js';
import { AasxPackage } from '../packages/file-system/aasx-package.js';
import { AasxDirectory } from '../packages/file-system/aasx-directory.js';
import { AasxPackage } from '../package/file-system/aasx-package.js';
import { AasxDirectory } from '../package/file-system/aasx-directory.js';
import { AASResourceScan } from './aas-resource-scan.js';
import { PagedResult } from '../types/paged-result.js';
import { AASLabel } from '../packages/aas-server/aas-api-client.js';
import { AASLabel } from '../package/aas-api/aas-api-client.js';

export class DirectoryScan extends AASResourceScan {
private readonly map = new Map<string, AASDocument>();
Expand Down
8 changes: 4 additions & 4 deletions projects/aas-server/src/app/aas-provider/opcua-server-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import { AttributeIds, BrowseDescriptionLike, QualifiedName, ReferenceDescription } from 'node-opcua';
import { AASDocument, noop } from 'aas-core';
import { Logger } from '../logging/logger.js';
import { OpcuaDataTypeDictionary } from '../packages/opcua/opcua-data-type-dictionary.js';
import { OpcuaClient } from '../packages/opcua/opcua-client.js';
import { OpcuaPackage } from '../packages/opcua/opcua-package.js';
import { OpcuaDataTypeDictionary } from '../package/opcua/opcua-data-type-dictionary.js';
import { OpcuaClient } from '../package/opcua/opcua-client.js';
import { OpcuaPackage } from '../package/opcua/opcua-package.js';
import { AASResourceScan } from './aas-resource-scan.js';
import { PagedResult } from '../types/paged-result.js';
import { AASLabel } from '../packages/aas-server/aas-api-client.js';
import { AASLabel } from '../package/aas-api/aas-api-client.js';

export class OpcuaServerScan extends AASResourceScan {
private readonly logger: Logger;
Expand Down
2 changes: 1 addition & 1 deletion projects/aas-server/src/app/live/http/http-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { aas, changeType, LiveNode, LiveRequest, noop } from 'aas-core';
import { HttpSocketItem } from './http-socket-item.js';
import { Logger } from '../../logging/logger.js';
import { SocketClient } from '../socket-client.js';
import { AASApiClient } from '../../packages/aas-server/aas-api-client.js';
import { AASApiClient } from '../../package/aas-api/aas-api-client.js';
import { SocketSubscription } from '../socket-subscription.js';

export class HttpSubscription extends SocketSubscription {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { LiveNode } from 'aas-core';
import { OpcuaSocketItem } from './opcua-socket-item.js';
import { OpcuaClient } from '../../packages/opcua/opcua-client.js';
import { OpcuaClient } from '../../package/opcua/opcua-client.js';
import { Logger } from '../../logging/logger.js';
import { SocketClient } from '../socket-client.js';
import { SocketSubscription } from '../socket-subscription.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Logger } from '../../logging/logger.js';
import { HttpSubscription } from '../../live/http/http-subscription.js';
import { SocketClient } from '../../live/socket-client.js';
import { AASPackage } from '../aas-package.js';
import { AASResource } from '../aas-resource.js';
import { AASServerPackage } from './aas-server-package.js';
import { AASClient } from '../aas-client.js';
import { AASApiPackage } from './aas-api-package.js';
import { SocketSubscription } from '../../live/socket-subscription.js';
import { PagedResult } from '../../types/paged-result.js';

Expand All @@ -25,7 +25,7 @@ interface PropertyValue {
export type AASLabel = { id: string; idShort: string };

/** Provides access to an AASX-Server. */
export abstract class AASApiClient extends AASResource {
export abstract class AASApiClient extends AASClient {
private reentry = 0;

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ export abstract class AASApiClient extends AASResource {
* @returns A new `AASServerPackage` instance.
**/
public override createPackage(...args: string[]): AASPackage {
return new AASServerPackage(this.logger, this, args[0], args[1]);
return new AASApiPackage(this.logger, this, args[0], args[1]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

import { AASDocument, diffAsync, aas } from 'aas-core';
import { AASPackage } from '../aas-package.js';
import { AASResource } from '../aas-resource.js';
import { AASClient } from '../aas-client.js';
import { Logger } from '../../logging/logger.js';
import { AASApiClient } from './aas-api-client.js';
import { ImageProcessing } from '../../image-processing.js';

export class AASServerPackage extends AASPackage {
export class AASApiPackage extends AASPackage {
private readonly server: AASApiClient;
private readonly id: string;
private readonly idShort: string;
Expand All @@ -24,7 +24,7 @@ export class AASServerPackage extends AASPackage {
* @param resource The handle.
* @param id The identifier of the AAS.
*/
public constructor(logger: Logger, resource: AASResource, id: string, idShort: string) {
public constructor(logger: Logger, resource: AASClient, id: string, idShort: string) {
super(logger);

this.server = resource as AASApiClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
import { inject, singleton } from 'tsyringe';
import { AASEndpoint, ApplicationError } from 'aas-core';
import { Logger } from '../logging/logger.js';
import { AASResource } from './aas-resource.js';
import { AASClient } from './aas-client.js';
import { AasxDirectory } from './file-system/aasx-directory.js';
import { AASApiClientV0 } from './aas-server/aas-api-client-v0.js';
import { AASApiClientV3 } from './aas-server/aas-api-client-v3.js';
import { AASApiClientV0 } from './aas-api/aas-api-client-v0.js';
import { AASApiClientV3 } from './aas-api/aas-api-client-v3.js';
import { OpcuaClient } from './opcua/opcua-client.js';
import { ERRORS } from '../errors.js';
import { FileStorageProvider } from '../file-storage/file-storage-provider.js';
import { AASApiClientV1 } from './aas-server/aas-api-client-v1.js';
import { AASApiClientV1 } from './aas-api/aas-api-client-v1.js';
import { HttpClient } from '../http-client.js';

@singleton()
export class AASResourceFactory {
export class AASClientFactory {
public constructor(
@inject('Logger') private readonly logger: Logger,
@inject(FileStorageProvider) private readonly fileStorageProvider: FileStorageProvider,
Expand All @@ -32,7 +32,7 @@ export class AASResourceFactory {
* @param url The URL of the container.
* @returns A new instance of .
*/
public create(endpoint: AASEndpoint): AASResource {
public create(endpoint: AASEndpoint): AASClient {
switch (endpoint.type) {
case 'AAS_API':
switch (endpoint.version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { SocketClient } from '../live/socket-client.js';
import { AASPackage } from './aas-package.js';
import { SocketSubscription } from '../live/socket-subscription.js';

/** Represents a resource of Asset Administration Shells. */
export abstract class AASResource {
/** Represents a client of a server that provides Asset Administration Shells. */
export abstract class AASClient {
protected constructor(
protected readonly logger: Logger,
public readonly endpoint: AASEndpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { aas } from 'aas-core';

/** Represents a reader of an Asset Administration Shell. */
export abstract class AASReader {
public abstract readEnvironment(): aas.Environment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { aas } from 'aas-core';

/** */
/** Represents a writer of an Asset Administration Shell. */
export abstract class AASWriter {
public abstract write(env: aas.Environment): string;
}
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
/******************************************************************************
*
* Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo,
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
* zur Foerderung der angewandten Forschung e.V.
*
*****************************************************************************/

import { aas } from 'aas-core';
import { AASReader } from './aas-reader.js';
import { JsonReaderV2 } from './json-reader-v2.js';
import { JsonReaderV3 } from './json-reader-v3.js';
import * as aasV2 from '../types/aas-v2.js';

export function createJsonReader(data: object): AASReader {
if (isAssetAdministrationShellEnvironment(data)) {
return new JsonReaderV2(data);
}

if (isEnvironment(data)) {
return new JsonReaderV3(data);
}

if (isSubmodelElement(data)) {
return new JsonReaderV3();
}

if (isSubmodelElementV2(data)) {
return new JsonReaderV2();
}

throw new Error('Not implemented.');

function isAssetAdministrationShellEnvironment(value: unknown): value is aasV2.AssetAdministrationShellEnvironment {
const env = value as aasV2.AssetAdministrationShellEnvironment;
return Array.isArray(env.assets);
}

function isEnvironment(value: unknown): value is aas.Environment {
const env = value as aas.Environment;
return (
Array.isArray(env.assetAdministrationShells) &&
Array.isArray(env.submodels) &&
Array.isArray(env.conceptDescriptions)
);
}

function isSubmodelElement(value: unknown): value is aas.Referable {
return typeof (value as aas.Referable).modelType === 'string';
}

function isSubmodelElementV2(value: unknown): value is aasV2.Referable {
return typeof (value as aasV2.Referable).modelType?.name === 'string';
}
}
/******************************************************************************
*
* Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo,
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft
* zur Foerderung der angewandten Forschung e.V.
*
*****************************************************************************/

import { aas } from 'aas-core';
import { AASReader } from './aas-reader.js';
import { JsonReaderV2 } from './json-reader-v2.js';
import { JsonReaderV3 } from './json-reader-v3.js';
import * as aasV2 from '../types/aas-v2.js';

export function createJsonReader(data: object): AASReader {
if (isAssetAdministrationShellEnvironment(data)) {
return new JsonReaderV2(data);
}

if (isEnvironment(data)) {
return new JsonReaderV3(data);
}

if (isSubmodelElement(data)) {
return new JsonReaderV3();
}

if (isSubmodelElementV2(data)) {
return new JsonReaderV2();
}

throw new Error('Not implemented.');

function isAssetAdministrationShellEnvironment(value: unknown): value is aasV2.AssetAdministrationShellEnvironment {
const env = value as aasV2.AssetAdministrationShellEnvironment;
return Array.isArray(env.assets);
}

function isEnvironment(value: unknown): value is aas.Environment {
const env = value as aas.Environment;
return (
Array.isArray(env.assetAdministrationShells) &&
Array.isArray(env.submodels) &&
Array.isArray(env.conceptDescriptions)
);
}

function isSubmodelElement(value: unknown): value is aas.Referable {
return typeof (value as aas.Referable).modelType === 'string';
}

function isSubmodelElementV2(value: unknown): value is aasV2.Referable {
return typeof (value as aasV2.Referable).modelType?.name === 'string';
}
}
Loading

0 comments on commit e962ac9

Please sign in to comment.